aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala3
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala4
-rw-r--r--tests/new/t2660.scala25
-rw-r--r--tests/pending/pos/tuplePatDef.scala4
4 files changed, 33 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index f1e6f5a52..eb6b151b4 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -3,7 +3,7 @@ package printing
import core._
import Texts._, Types._, Flags._, Names._, Symbols._, NameOps._, Constants._
-import Contexts.Context, Scopes.Scope, Denotations._, Annotations.Annotation
+import Contexts.Context, Scopes.Scope, Denotations._, SymDenotations._, Annotations.Annotation
import StdNames.nme
import ast.{Trees, untpd}
import typer.Namer
@@ -481,6 +481,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
override def toText(denot: Denotation): Text = denot match {
case denot: MultiDenotation => denot.toString
+ case NoDenotation => "NoDenotation"
case _ =>
if (denot.symbol.exists) toText(denot.symbol)
else "some " ~ toText(denot.info)
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index e3683d2cf..32680e34b 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -328,7 +328,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
val tpt1 = typedType(tree.tpt)
val expr1 =
if (isWildcard) tree.expr withType tpt1.tpe
- else typedExpr(tree.expr, tpt1.tpe)
+ else typed(tree.expr, tpt1.tpe)
assignType(cpy.Typed(tree, expr1, tpt1), tpt1)
}
tree.expr match {
@@ -957,7 +957,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
}
- def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = /*>|>*/ ctx.traceIndented (i"typing $tree", typr, show = true) /*<|<*/ {
+ def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = /*>|>*/ ctx.traceIndented (i"typing $tree, patternMode = ${ctx.mode is Mode.Pattern}", typr, show = true) /*<|<*/ {
assertPositioned(tree)
try adapt(typedUnadapted(tree, pt), pt, tree)
catch {
diff --git a/tests/new/t2660.scala b/tests/new/t2660.scala
new file mode 100644
index 000000000..94a40f740
--- /dev/null
+++ b/tests/new/t2660.scala
@@ -0,0 +1,25 @@
+package hoho
+
+class G
+
+class H extends G
+
+class A[T](x: T) {
+
+ def this(y: G, z: T) = {
+ this(z)
+ print(1)
+ }
+
+ def this(z: H, h: T) = {
+ this(h)
+ print(2)
+ }
+}
+
+object T {
+ def main(args: Array[String]): Unit = {
+ implicit def g2h(g: G): H = new H
+ new A[Int](new H, 23)
+ }
+}
diff --git a/tests/pending/pos/tuplePatDef.scala b/tests/pending/pos/tuplePatDef.scala
new file mode 100644
index 000000000..978052991
--- /dev/null
+++ b/tests/pending/pos/tuplePatDef.scala
@@ -0,0 +1,4 @@
+
+object Test {
+ val (x,y): (String, M) = null
+}