diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-09 17:44:32 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-09 17:44:32 -0800 |
commit | 6724890e36c5c3c6a6b79f1b5322b9c2932de9e1 (patch) | |
tree | 6076f4eaf1463ff94e07b8bcf161367f80ac528a /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | cc9402b0d639dd5d9ac0b468b49a3ef7c2d80d39 (diff) | |
parent | 10ca1783d45dc9c87ea0c09f4ea046ac539f1749 (diff) | |
download | scala-6724890e36c5c3c6a6b79f1b5322b9c2932de9e1.tar.gz scala-6724890e36c5c3c6a6b79f1b5322b9c2932de9e1.tar.bz2 scala-6724890e36c5c3c6a6b79f1b5322b9c2932de9e1.zip |
Merge pull request #3476 from retronym/ticket/8207
SI-8207 Allow import qualified by self reference
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 632e25aa2e..886dbed6d6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1408,8 +1408,14 @@ trait Namers extends MethodSynthesis { if (expr1.isErrorTyped) ErrorType else { - if (!treeInfo.isStableIdentifierPattern(expr1)) - typer.TyperErrorGen.UnstableTreeError(expr1) + expr1 match { + case This(_) => + // SI-8207 okay, typedIdent expands Ident(self) to C.this which doesn't satisfy the next case + // TODO should we change `typedIdent` not to expand to the `Ident` to a `This`? + case _ if treeInfo.isStableIdentifierPattern(expr1) => + case _ => + typer.TyperErrorGen.UnstableTreeError(expr1) + } val newImport = treeCopy.Import(imp, expr1, selectors).asInstanceOf[Import] checkSelectors(newImport) |