aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-31 18:01:20 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-31 18:05:55 +0200
commit8f321f2afd0cd363492665b410a70476c8a4b751 (patch)
tree3b1e17627c8f5a5f6e9ca152d6a3308100456904
parent2bfff5e5457223114e24e112aa6715f6a9d0c3f3 (diff)
downloaddotty-8f321f2afd0cd363492665b410a70476c8a4b751.tar.gz
dotty-8f321f2afd0cd363492665b410a70476c8a4b751.tar.bz2
dotty-8f321f2afd0cd363492665b410a70476c8a4b751.zip
Types of This trees are promoted during retyping.
Failing to do this leads to problems when retyping the This of nested classes with the same name (e.g. nested anonymous classes as they appear in t0453.scala). RefinedPrinter was changed to avoid sugaring of anonymous classes when uniqid is set (that was essential to track down the problem).
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala2
-rw-r--r--src/dotty/tools/dotc/typer/ReTyper.scala3
3 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 0da9b6d54..eba27dfef 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -116,7 +116,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case _ => if (tp.prefix.isInstanceOf[ThisType]) return nameString(tp.symbol)
}
}
- else if (tp.symbol.isAnonymousClass)
+ else if (tp.symbol.isAnonymousClass && !ctx.settings.uniqid.value)
return toText(tp.info)
case ExprType(result) =>
return "=> " ~ toText(result)
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index cf2f3f286..90d1ceefb 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -422,7 +422,7 @@ trait Implicits { self: Typer =>
def inferImplicit(pt: Type, argument: Tree, pos: Position)(implicit ctx: Context): SearchResult = track("inferImplicit") {
assert(!ctx.isAfterTyper,
if (argument.isEmpty) i"missing implicit parameter of type $pt after typer"
- else i"type error: ${argument.tpe} does not conform to $pt")
+ else i"type error: ${argument.tpe} does not conform to $pt${err.whyNoMatchStr(argument.tpe, pt)}")
ctx.traceIndented(s"search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}", implicits, show = true) {
assert(!pt.isInstanceOf[ExprType])
val isearch =
diff --git a/src/dotty/tools/dotc/typer/ReTyper.scala b/src/dotty/tools/dotc/typer/ReTyper.scala
index 3826531cb..b18a7dd13 100644
--- a/src/dotty/tools/dotc/typer/ReTyper.scala
+++ b/src/dotty/tools/dotc/typer/ReTyper.scala
@@ -44,6 +44,9 @@ class ReTyper extends Typer {
override def typedLiteral(tree: untpd.Literal)(implicit ctc: Context): Literal =
promote(tree)
+ override def typedThis(tree: untpd.This)(implicit ctc: Context): This =
+ promote(tree)
+
override def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): TypeTree =
promote(tree)