aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-10-08 10:41:09 +0200
committerGuillaume Martres <smarter@ubuntu.com>2016-10-12 03:36:57 +0200
commit695afc5651da0fae0ff2cf0467820b6503dd0f6d (patch)
tree2fa684544814c58451cfb1b7aa448bcab84b9ce7 /src
parentd64bab55aeaf9c182e0150e9a37cca3ed6ad635e (diff)
downloaddotty-695afc5651da0fae0ff2cf0467820b6503dd0f6d.tar.gz
dotty-695afc5651da0fae0ff2cf0467820b6503dd0f6d.tar.bz2
dotty-695afc5651da0fae0ff2cf0467820b6503dd0f6d.zip
Don't let import symbols go stale
Otherwise we can run into problems when checking imports for e.g. scala2Mode in later runs.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala5
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 5a5eacd18..05501011a 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -41,7 +41,7 @@ trait SymDenotations { this: Context =>
}
def stillValid(denot: SymDenotation): Boolean =
- if (denot.is(ValidForever) || denot.isRefinementClass) true
+ if (denot.is(ValidForever) || denot.isRefinementClass || denot.isImport) true
else {
val initial = denot.initial
val firstPhaseId = initial.validFor.firstPhaseId.max(ctx.typerPhase.id)
@@ -590,6 +590,9 @@ object SymDenotations {
originalName.isSetterName &&
(!isCompleted || info.firstParamTypes.nonEmpty) // to avoid being fooled by var x_= : Unit = ...
+ /** is this a symbol representing an import? */
+ final def isImport = name == nme.IMPORT
+
/** is this the constructor of a class? */
final def isClassConstructor = name == nme.CONSTRUCTOR
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 4f3a8d272..b6deca52b 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -553,7 +553,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
(sym.allOverriddenSymbols exists (_ is TypeParam))
override def toText(sym: Symbol): Text = {
- if (sym.name == nme.IMPORT) {
+ if (sym.isImport) {
def importString(tree: untpd.Tree) = s"import ${tree.show}"
sym.infoOrCompleter match {
case info: Namer#Completer => return importString(info.original)