Skip to content

Commit 9eaa220

Browse files
committed
Add safe-init test to prevent adding cold elements to hot arrays
This adds a negative test to ensure that the initialization checker does nt allow cold values to be inserted into hot arrays through a method call.
1 parent f3cca47 commit 9eaa220

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object A:
2+
def foo[T](x: T, array: Array[T]): Unit = array(0) = x
3+
var a = Array.apply(1, 2, 3)
4+
foo(i, a)
5+
val i = 99

0 commit comments

Comments
 (0)