diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/bug846.check | 6 | ||||
-rwxr-xr-x | test/files/neg/bug846.scala | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/files/neg/bug846.check b/test/files/neg/bug846.check new file mode 100644 index 0000000000..b60b4c7125 --- /dev/null +++ b/test/files/neg/bug846.check @@ -0,0 +1,6 @@ +bug846.scala:9 error: type mismatch; + found : scala.Null(null) + required: B + if (a != null) f(a) else null + ^ +one error found diff --git a/test/files/neg/bug846.scala b/test/files/neg/bug846.scala new file mode 100755 index 0000000000..be105a71aa --- /dev/null +++ b/test/files/neg/bug846.scala @@ -0,0 +1,13 @@ +package test; +trait Test { + type Bar; + trait FooImpl; + trait Bob { + def bar : Bar with FooImpl; + } + def ifn[A,B](a : A)(f : A => B): B = + if (a != null) f(a) else null + val bob : Bob = null; + val bar = ifn(bob)(.bar); + assert(bar == null); +} |