Compiler version
main
Minimized code
import language.experimental.safe
def assertPure(op: () -> Unit): Unit = ()
def testQueue(): Unit =
val q = new java.util.concurrent.ConcurrentLinkedQueue[String]()
assertPure: () =>
q.add("secret") // should be error, but ok
def testArrayList(): Unit =
val xs = new java.util.ArrayList[String]()
assertPure: () =>
xs.add("secret") // should be error, but ok
def testHashMap(): Unit =
val m = new java.util.HashMap[String, String]()
assertPure: () =>
m.put("leak", "secret") // should be error, but ok
def testArrayDeque(): Unit =
val dq = new java.util.ArrayDeque[String]()
assertPure: () =>
dq.addLast("secret") // should be error, but ok
Output
It compiles.
Expectation
Should be tons of errors.
Compiler version
mainMinimized code
Output
It compiles.
Expectation
Should be tons of errors.