summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 70acb03584..531bc622f9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -850,13 +850,13 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
def adaptType(): Tree = {
// @M When not typing a type constructor (!context.inTypeConstructorAllowed)
- // or raw type (tree.symbol.isJavaDefined && context.unit.isJava), types must be of kind *,
+ // or raw type, types must be of kind *,
// and thus parameterized types must be applied to their type arguments
// @M TODO: why do kind-* tree's have symbols, while higher-kinded ones don't?
def properTypeRequired = (
tree.hasSymbolField
&& !context.inTypeConstructorAllowed
- && !(tree.symbol.isJavaDefined && context.unit.isJava)
+ && !context.unit.isJava
)
// @M: don't check tree.tpe.symbol.typeParams. check tree.tpe.typeParams!!!
// (e.g., m[Int] --> tree.tpe.symbol.typeParams.length == 1, tree.tpe.typeParams.length == 0!)