summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorYour Name <entcrd@gmail.com>2012-11-22 20:45:50 +0100
committerEugene Burmako <xeno.by@gmail.com>2012-11-23 08:17:29 +0100
commit548a54d708d8aaceea6abe0931aabaa70b2cd925 (patch)
treeb19851d1264adea4a6cff3dbfd117cd89383d1a8 /src/compiler
parenta0e642b7fe608b869071b690e7907b934b10db5a (diff)
downloadscala-548a54d708d8aaceea6abe0931aabaa70b2cd925.tar.gz
scala-548a54d708d8aaceea6abe0931aabaa70b2cd925.tar.bz2
scala-548a54d708d8aaceea6abe0931aabaa70b2cd925.zip
SI-6023 reify abstract vals
Type trees created by MethodSynthesis for abstract val getters carry symless originals, which are unusable for reification purposes (or the result of reification will be unhygienic). To combat this, type trees for such getters are now created empty, i.e. without any `tpe` set, just having an original assigned. Subsequent `typedTypeTree` invocations fill in the `tpe` and update the original to be symful.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
2 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index e8a2c9f43c..acc4f7ff67 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -426,6 +426,7 @@ trait MethodSynthesis {
// spot that brand of them. In other words it's an artifact of the implementation.
val tpt = derivedSym.tpe.finalResultType match {
case ExistentialType(_, _) => TypeTree()
+ case _ if mods.isDeferred => TypeTree()
case tp => TypeTree(tp)
}
tpt setPos derivedSym.pos.focus
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 222c9ff8c3..a2aca45e8f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -5368,8 +5368,14 @@ trait Typers extends Modes with Adaptations with Tags {
}
def typedTypeTree(tree: TypeTree) = {
- if (tree.original != null)
- tree setType typedType(tree.original, mode).tpe
+ if (tree.original != null) {
+ val newTpt = typedType(tree.original, mode)
+ tree setType newTpt.tpe
+ newTpt match {
+ case tt @ TypeTree() => tree setOriginal tt.original
+ case _ => tree
+ }
+ }
else
// we should get here only when something before failed
// and we try again (@see tryTypedApply). In that case we can assign