summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-11-09 11:49:05 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-11-09 11:55:35 +1000
commit3a4d4dbd366490b5bcbbd6091eb5947a23655600 (patch)
tree87c7b1fe7935938c58f7a98b5991d9fde41fa001 /test/files
parentb431a4bd83d3bfb2b95d0426d2905b34ce1265ad (diff)
downloadscala-3a4d4dbd366490b5bcbbd6091eb5947a23655600.tar.gz
scala-3a4d4dbd366490b5bcbbd6091eb5947a23655600.tar.bz2
scala-3a4d4dbd366490b5bcbbd6091eb5947a23655600.zip
SI-8449 Fix spurious error with Java raw type over a Scala class
When the Scala typechecker typechecks signatures in Java sources, it must enable use of a type constructor without applied type arguments (a raw type). However, the check in `adaptType::properTypeRequired` was too restricive: it only allows raw types given a) we are typechecking a Java source file and b) the type constructor itself is Java defined. The second check does not make sense; it is perfectly legal to define a Java raw type for over a Scala defined type constructor. This commit removes it. The bug was noticed in the Scaladoc context, as it explores the signatures of all Java sources so it can document them. But the enclosed test demonstrates the underlying bug under normal compilation.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/t8449/Client.scala3
-rw-r--r--test/files/t8449/Test.java10
2 files changed, 13 insertions, 0 deletions
diff --git a/test/files/t8449/Client.scala b/test/files/t8449/Client.scala
new file mode 100644
index 0000000000..5d273f06b2
--- /dev/null
+++ b/test/files/t8449/Client.scala
@@ -0,0 +1,3 @@
+object Client {
+ def foo: Any = new Test().foo
+}
diff --git a/test/files/t8449/Test.java b/test/files/t8449/Test.java
new file mode 100644
index 0000000000..ecb1711b24
--- /dev/null
+++ b/test/files/t8449/Test.java
@@ -0,0 +1,10 @@
+public class Test {
+ // Raw type over a Scala type constructor
+ public scala.Function1 foo() { return null; }
+ // scalac reported:
+ // % scalac-hash v2.11.2 -d /tmp sandbox/{Test.java,Client.scala}
+ // sandbox/Test.java:2: error: trait Function1 takes type parameters
+ // public scala.Function1 foo() { return null; }
+ // ^
+ // one error found
+}