aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-28 18:23:40 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-28 18:24:31 +0200
commit215f73f1f6b8b03b49bdab80fbbfcf4574203d2b (patch)
treeb092d9eb0512476bce78659c84e1794edc1f84ba
parente195a2e31320edc796a6ef84d1ad13dc5b5b3732 (diff)
downloaddotty-215f73f1f6b8b03b49bdab80fbbfcf4574203d2b.tar.gz
dotty-215f73f1f6b8b03b49bdab80fbbfcf4574203d2b.tar.bz2
dotty-215f73f1f6b8b03b49bdab80fbbfcf4574203d2b.zip
Disable enclding in retyping.
We would like to be able to define unencoded symbolic names in trees computed by the compiler. The patch avoids their accidental encoding.
-rw-r--r--src/dotty/tools/dotc/typer/ReTyper.scala4
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/ReTyper.scala b/src/dotty/tools/dotc/typer/ReTyper.scala
index b36c8eafe..230788cc1 100644
--- a/src/dotty/tools/dotc/typer/ReTyper.scala
+++ b/src/dotty/tools/dotc/typer/ReTyper.scala
@@ -30,7 +30,7 @@ class ReTyper extends Typer {
promote(tree)
override def typedSelect(tree: untpd.Select, pt: Type)(implicit ctx: Context): Tree = {
- assert(tree.hasType)
+ assert(tree.hasType, tree)
val qual1 = typed(tree.qualifier, AnySelectionProto)
untpd.cpy.Select(tree)(qual1, tree.name).withType(tree.typeOpt)
}
@@ -68,5 +68,7 @@ class ReTyper extends Typer {
override def addTypedModifiersAnnotations(mods: untpd.Modifiers, sym: Symbol)(implicit ctx: Context): Modifiers =
typedModifiers(mods, sym)
+ override def encodeName(tree: untpd.NameTree)(implicit ctx: Context) = tree
+
override def checkVariance(tree: Tree)(implicit ctx: Context) = ()
} \ No newline at end of file
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 9bf4d8a66..89cf0b055 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -996,13 +996,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
xtree match {
- case xtree: untpd.NameTree => typedNamed(xtree withName xtree.name.encode, pt)
+ case xtree: untpd.NameTree => typedNamed(encodeName(xtree), pt)
case xtree: untpd.Import => typedImport(xtree, retrieveSym(xtree))
case xtree => typedUnnamed(xtree)
}
}
}
+ protected def encodeName(tree: untpd.NameTree)(implicit ctx: Context) = tree withName tree.name.encode
+
def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = /*>|>*/ ctx.traceIndented (i"typing $tree", typr, show = true) /*<|<*/ {
assertPositioned(tree)
try adapt(typedUnadapted(tree, pt), pt, tree)