aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2016-04-29 15:28:30 +0200
committerDmitry Petrashko <dark@d-d.me>2016-04-29 15:28:30 +0200
commitf9858a402db9a38ac0beae8bb30a36e7656386aa (patch)
tree7c8a161309af2d8b12dfa011d532b4aa59d55094 /src
parent96fcdd9da51e1febe9e320f774424b5ac3f8ff3d (diff)
parent1c7c738a148390ffb2072fc97a81646031fb49b2 (diff)
downloaddotty-f9858a402db9a38ac0beae8bb30a36e7656386aa.tar.gz
dotty-f9858a402db9a38ac0beae8bb30a36e7656386aa.tar.bz2
dotty-f9858a402db9a38ac0beae8bb30a36e7656386aa.zip
Merge pull request #1241 from dotty-staging/fix-#1222
Transform annotations only if defined in current run
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala6
-rw-r--r--src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala2
-rw-r--r--src/dotty/tools/dotc/transform/TreeTransform.scala15
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala4
4 files changed, 20 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index b6a4dc5e7..12c1e65a6 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -46,7 +46,11 @@ object desugar {
*/
override def ensureCompletions(implicit ctx: Context) =
if (!(ctx.owner is Package))
- if (ctx.owner is ModuleClass) ctx.owner.linkedClass.ensureCompleted()
+ if (ctx.owner.isClass) {
+ ctx.owner.ensureCompleted()
+ if (ctx.owner is ModuleClass)
+ ctx.owner.linkedClass.ensureCompleted()
+ }
else ensureCompletions(ctx.outer)
/** Return info of original symbol, where all references to siblings of the
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index 83d427a8f..cceaed53d 100644
--- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -179,7 +179,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
val ex = new BadSignature(
sm"""error reading Scala signature of $classRoot from $source:
|error occurred at position $readIndex: $msg""")
- if (ctx.debug || true) original.getOrElse(ex).printStackTrace() // temporarilly enable printing of original failure signature to debug failing builds
+ if (ctx.debug || true) original.getOrElse(ex).printStackTrace() // temporarily enable printing of original failure signature to debug failing builds
throw ex
}
diff --git a/src/dotty/tools/dotc/transform/TreeTransform.scala b/src/dotty/tools/dotc/transform/TreeTransform.scala
index 67bd2f160..abada9ab4 100644
--- a/src/dotty/tools/dotc/transform/TreeTransform.scala
+++ b/src/dotty/tools/dotc/transform/TreeTransform.scala
@@ -185,12 +185,19 @@ object TreeTransforms {
ref match {
case ref: SymDenotation =>
- val annotTrees = ref.annotations.map(_.tree)
- val annotTrees1 = annotTrees.mapConserve(annotationTransformer.macroTransform)
- val annots1 = if (annotTrees eq annotTrees1) ref.annotations else annotTrees1.map(new ConcreteAnnotation(_))
+ val annots1 =
+ if (!ref.symbol.isDefinedInCurrentRun) ref.annotations // leave annotations read from class files alone
+ else {
+ val annotTrees = ref.annotations.map(_.tree)
+ val annotTrees1 = annotTrees.mapConserve(annotationTransformer.macroTransform)
+ if (annotTrees eq annotTrees1) ref.annotations
+ else annotTrees1.map(new ConcreteAnnotation(_))
+ }
if ((info1 eq ref.info) && (annots1 eq ref.annotations)) ref
else ref.copySymDenotation(info = info1, annotations = annots1)
- case _ => if (info1 eq ref.info) ref else ref.derivedSingleDenotation(ref.symbol, info1)
+ case _ =>
+ if (info1 eq ref.info) ref
+ else ref.derivedSingleDenotation(ref.symbol, info1)
}
}
}
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index d70546f9d..390ecaee9 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -925,7 +925,9 @@ trait Applications extends Compatibility { self: Typer =>
/** Drop any implicit parameter section */
def stripImplicit(tp: Type): Type = tp match {
case mt: ImplicitMethodType if !mt.isDependent =>
- mt.resultType // todo: make sure implicit method types are not dependent
+ mt.resultType
+ // todo: make sure implicit method types are not dependent?
+ // but check test case in /tests/pos/depmet_implicit_chaining_zw.scala
case pt: PolyType =>
pt.derivedPolyType(pt.paramNames, pt.paramBounds, stripImplicit(pt.resultType))
case _ =>