aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala2
-rw-r--r--tests/neg/implicitDefs.scala11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 2bd1731da..68ec9273a 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -429,7 +429,7 @@ trait Implicits { self: Typer =>
private def nestedContext = ctx.fresh.withNewMode(ctx.mode &~ Mode.ImplicitsEnabled)
private def implicitProto(resultType: Type, f: Type => Type) =
- if (argument.isEmpty) f(resultType) else ViewProto(f(argument.tpe), f(resultType))
+ if (argument.isEmpty) f(resultType) else ViewProto(f(argument.tpe.widen), f(resultType))
assert(argument.isEmpty || argument.tpe.isValueType || argument.tpe.isInstanceOf[ExprType],
i"found: ${argument.tpe}, expected: $pt")
diff --git a/tests/neg/implicitDefs.scala b/tests/neg/implicitDefs.scala
new file mode 100644
index 000000000..28ac32656
--- /dev/null
+++ b/tests/neg/implicitDefs.scala
@@ -0,0 +1,11 @@
+package test
+
+import dotty._
+import Predef.{any2stringadd => _, StringAdd => _, _}
+
+object implicitDefs {
+
+ implicit val x = 2
+ implicit def y(x: Int) = 3
+ implicit def z(a: x.type): String = ""
+}