diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t2801.check | 6 | ||||
-rw-r--r-- | test/files/neg/t2801.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t2794.scala | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/test/files/neg/t2801.check b/test/files/neg/t2801.check new file mode 100644 index 0000000000..25320de5bc --- /dev/null +++ b/test/files/neg/t2801.check @@ -0,0 +1,6 @@ +t2801.scala:2: error: type mismatch; + found : Null(null) + required: A + def f[A <: AnyRef] = { val a: A = null ; a } + ^ +one error found diff --git a/test/files/neg/t2801.scala b/test/files/neg/t2801.scala new file mode 100644 index 0000000000..d425f58b56 --- /dev/null +++ b/test/files/neg/t2801.scala @@ -0,0 +1,3 @@ +object Test { + def f[A <: AnyRef] = { val a: A = null ; a } +} diff --git a/test/files/pos/t2794.scala b/test/files/pos/t2794.scala index caefea4fbb..a17edf8cb3 100644 --- a/test/files/pos/t2794.scala +++ b/test/files/pos/t2794.scala @@ -4,6 +4,6 @@ class Entry[T](val k: Key[T], val v: T) object Entry { - def makeDefault[T <: AnyRef] = new Entry[T](new Key[T], null: T) + def makeDefault[T >: Null <: AnyRef] = new Entry[T](new Key[T], null: T) } |