summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/javac
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-10-16 14:44:56 +0000
committerMartin Odersky <odersky@gmail.com>2010-10-16 14:44:56 +0000
commit9adc6d22c960c1b20c7cff88091c9aaecaaf9053 (patch)
tree1844dd1150cb80b5248f40c9646f0e4d9392cee1 /src/compiler/scala/tools/nsc/javac
parentde2fb8466ebf0fa221e56a1a5db8537676cd7d97 (diff)
downloadscala-9adc6d22c960c1b20c7cff88091c9aaecaaf9053.tar.gz
scala-9adc6d22c960c1b20c7cff88091c9aaecaaf9053.tar.bz2
scala-9adc6d22c960c1b20c7cff88091c9aaecaaf9053.zip
Closes #3567. Review by milessabin.
Diffstat (limited to 'src/compiler/scala/tools/nsc/javac')
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaParsers.scala13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
index 8c0e5585be..1f071e2288 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
@@ -226,7 +226,7 @@ trait JavaParsers extends JavaScanners {
Ident(name.toTypeName).setPos(tree.pos)
case Select(qual, name) =>
Select(qual, name.toTypeName).setPos(tree.pos)
- case AppliedTypeTree(_, _) | ExistentialTypeTree(_, _) =>
+ case AppliedTypeTree(_, _) | ExistentialTypeTree(_, _) | SelectFromTypeTree(_, _) =>
tree
case _ =>
syntaxError(tree.pos, "identifier expected", false)
@@ -272,9 +272,18 @@ trait JavaParsers extends JavaScanners {
if (in.token == FINAL) in.nextToken
if (in.token == IDENTIFIER) {
var t = typeArgs(atPos(in.currentPos)(Ident(ident())))
+ // typeSelect generates Select nodes is the lhs is an Ident or Select,
+ // SelectFromTypeTree otherwise. See #3567.
+ // Select nodes can be later
+ // converted in the typechecker to SelectFromTypeTree if the class
+ // turns out to be an instance ionner class instead of a static inner class.
+ def typeSelect(t: Tree, name: Name) = t match {
+ case Ident(_) | Select(_, _) => Select(t, name)
+ case _ => SelectFromTypeTree(t, name)
+ }
while (in.token == DOT) {
in.nextToken
- t = typeArgs(atPos(in.currentPos)(Select(t, ident())))
+ t = typeArgs(atPos(in.currentPos)(typeSelect(t, ident())))
}
convertToTypeId(t)
} else {