File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -3543,3 +3543,37 @@ end
3543
3543
# issue #14339
3544
3544
f14339 {T<:Union{}} (x:: T , y:: T ) = 0
3545
3545
@test_throws MethodError f14339 (1 , 2 )
3546
+
3547
+ # Make sure jlcall objects are rooted
3548
+ # PR #14301
3549
+ module JLCall14301
3550
+
3551
+ # Define f
3552
+ f () = 1
3553
+
3554
+ let i = Any[[1.23 ], [2.34 ]]
3555
+ # f() with capture variables
3556
+ # Intentionally type unstable so that the dynamic dispatch will
3557
+ # read the corrupted tag if the object is incorrectly GC'd.
3558
+ global f () = i[1 ][1 ] * i[2 ][1 ]
3559
+ end
3560
+
3561
+ # Another function that use f()
3562
+ g () = f () * 100
3563
+ # Compile it
3564
+ g ()
3565
+
3566
+ let i = 9.0
3567
+ # Override f()
3568
+ global f () = i + 1
3569
+ end
3570
+
3571
+ # Make sure the old f() method is GC'd if it was not rooted properly
3572
+ gc ()
3573
+ gc ()
3574
+ gc ()
3575
+
3576
+ # Run again.
3577
+ g ()
3578
+
3579
+ end
You can’t perform that action at this time.
0 commit comments