aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-22 18:12:43 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-23 11:49:06 +0200
commit890b8a45cc9d83a6ef67fee3ee05084313f34688 (patch)
tree71304e74ba8b4ef83749c57bd4f63f313db76a50
parent0fba8757b444d96c748df1e034d39f7626a39d1e (diff)
downloaddotty-890b8a45cc9d83a6ef67fee3ee05084313f34688.tar.gz
dotty-890b8a45cc9d83a6ef67fee3ee05084313f34688.tar.bz2
dotty-890b8a45cc9d83a6ef67fee3ee05084313f34688.zip
Avoid follow-on errors after implicit argument errors.
Previously, we could die with a <notype> when an implicit argument was not found.
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
-rw-r--r--test/dotc/tests.scala2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index a3ddca5d9..8a92eb726 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -450,7 +450,7 @@ trait Implicits { self: Typer =>
// Not clear whether we need to drop the `.widen` here. All tests pass with it in place, though.
assert(argument.isEmpty || argument.tpe.isValueType || argument.tpe.isInstanceOf[ExprType],
- d"found: ${argument.tpe}, expected: $pt")
+ d"found: $argument: ${argument.tpe}, expected: $pt")
/** The expected type for the searched implicit */
lazy val fullProto = implicitProto(pt, identity)
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 97bd0f514..3f8785090 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1299,7 +1299,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
implicitArgError(d"no implicit argument of type $formal found for $where" + failure.postscript)
}
}
- adapt(tpd.Apply(tree, args), pt)
+ if (args.exists(_.isEmpty)) tree
+ else adapt(tpd.Apply(tree, args), pt)
}
if ((pt eq WildcardType) || original.isEmpty) addImplicitArgs
else
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 1aa35e3ee..f96e77f00 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -121,7 +121,7 @@ class tests extends CompilerTest {
@Test def neg_t1843_variances = compileFile(negDir, "t1843-variances", xerrors = 1)
@Test def neg_t2660_ambi = compileFile(negDir, "t2660", xerrors = 2)
@Test def neg_t2994 = compileFile(negDir, "t2994", xerrors = 2)
- @Test def neg_subtyping = compileFile(negDir, "subtyping", xerrors = 4)
+ @Test def neg_subtyping = compileFile(negDir, "subtyping", xerrors = 5)
@Test def neg_variances = compileFile(negDir, "variances", xerrors = 2)
@Test def neg_badAuxConstr = compileFile(negDir, "badAuxConstr", xerrors = 2)
@Test def neg_typetest = compileFile(negDir, "typetest", xerrors = 1)