diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/predef-masking.check | 4 | ||||
-rw-r--r-- | test/files/neg/predef-masking.scala | 21 | ||||
-rw-r--r-- | test/files/neg/type-diagnostics.check | 6 | ||||
-rw-r--r-- | test/files/neg/type-diagnostics.scala | 4 |
4 files changed, 34 insertions, 1 deletions
diff --git a/test/files/neg/predef-masking.check b/test/files/neg/predef-masking.check new file mode 100644 index 0000000000..79e4dece8a --- /dev/null +++ b/test/files/neg/predef-masking.check @@ -0,0 +1,4 @@ +predef-masking.scala:7: error: value + is not a member of type parameter T + def f[T](x: T) = x + 5 + ^ +one error found diff --git a/test/files/neg/predef-masking.scala b/test/files/neg/predef-masking.scala new file mode 100644 index 0000000000..67b69aa169 --- /dev/null +++ b/test/files/neg/predef-masking.scala @@ -0,0 +1,21 @@ +// Testing predef masking +import Predef.{ any2stringadd => _, _ } + +object StringPlusConfusion { + // Would love to do something about this error message, but by the + // time we get our hands on it the context is lost. + def f[T](x: T) = x + 5 + + // After we block out any2stringadd, the error is: + // + // work/a.scala:7: error: value + is not a member of type parameter T + // def f[T](x: T) = x + 5 + // ^ + // Normally, it is: + // + // work/a.scala:7: error: type mismatch; + // found : Int(5) + // required: String + // def f[T](x: T) = x + 5 + // ^ +} diff --git a/test/files/neg/type-diagnostics.check b/test/files/neg/type-diagnostics.check index 33e07f3816..62d580a788 100644 --- a/test/files/neg/type-diagnostics.check +++ b/test/files/neg/type-diagnostics.check @@ -13,4 +13,8 @@ type-diagnostics.scala:17: error: type mismatch; required: java.lang.String def f2[String](s: String) = strings(List(s)) ^ -three errors found +type-diagnostics.scala:21: error: missing parameter type for expanded function +(see SLS 8.5, "Pattern Matching Anonymous Functions") + val f = { case 5 => 10 } + ^ +four errors found diff --git a/test/files/neg/type-diagnostics.scala b/test/files/neg/type-diagnostics.scala index fdc0978138..fcc49812f4 100644 --- a/test/files/neg/type-diagnostics.scala +++ b/test/files/neg/type-diagnostics.scala @@ -16,3 +16,7 @@ object TParamConfusion { def f2[String](s: String) = strings(List(s)) } + +object PartialInfer { + val f = { case 5 => 10 } +}
\ No newline at end of file |