aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/i0281-null-primitive-conforms.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-12-13 19:15:47 +0100
committerMartin Odersky <odersky@gmail.com>2014-12-13 19:15:58 +0100
commit9f87127c40a2b8ac0c8f97d039053e4d2f7577e4 (patch)
treeacf8cc3575bcc625aaf7e1715ba60a0c71b89b1b /tests/neg/i0281-null-primitive-conforms.scala
parentf3d887f079efbe7dbb53abd22bd212eee8e1c67a (diff)
downloaddotty-9f87127c40a2b8ac0c8f97d039053e4d2f7577e4.tar.gz
dotty-9f87127c40a2b8ac0c8f97d039053e4d2f7577e4.tar.bz2
dotty-9f87127c40a2b8ac0c8f97d039053e4d2f7577e4.zip
Disable implicit conversions between from `Null` and `Nothing`.
This is necessary to reject code like val x: Boolean = null Without the restriction, this code would typecheck and expand to val x: Boolean = Predef.Boolean2boolean(null) since `null` counts as a value of type `java.kang.Boolean`.
Diffstat (limited to 'tests/neg/i0281-null-primitive-conforms.scala')
-rw-r--r--tests/neg/i0281-null-primitive-conforms.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/neg/i0281-null-primitive-conforms.scala b/tests/neg/i0281-null-primitive-conforms.scala
new file mode 100644
index 000000000..469e72324
--- /dev/null
+++ b/tests/neg/i0281-null-primitive-conforms.scala
@@ -0,0 +1,6 @@
+object test {
+ val b: scala.Boolean = null
+ val c: Unit = null
+ val d: Float = null
+ val e: AnyVal = null
+}