diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index c4e54961585c..af6424266485 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -1824,7 +1824,7 @@ trait Applications extends Compatibility { skip(alt.widen) def resultIsMethod(tp: Type): Boolean = tp.widen.stripPoly match - case tp: MethodType => tp.resultType.isInstanceOf[MethodType] + case tp: MethodType => stripImplicit(tp.resultType).isInstanceOf[MethodType] case _ => false val found = narrowMostSpecific(candidates) diff --git a/tests/pos/i2378.scala b/tests/neg/i2378.scala similarity index 76% rename from tests/pos/i2378.scala rename to tests/neg/i2378.scala index 0dba1b951b3f..529eba1e6e57 100644 --- a/tests/pos/i2378.scala +++ b/tests/neg/i2378.scala @@ -21,10 +21,10 @@ class Test(val tb: Toolbox) { implicit val cap: Cap = null def foo(tree: Tree): Int = (tree: Any) match { - case tb.Apply(fun, args) => 3 + case tb.Apply(fun, args) => 3 // error: ambiguous overload of unapply } def bar(tree: tpd.Tree): Int = (tree: Any) match { - case Apply(fun, args) => 3 + case Apply(fun, args) => 3 // error: ambiguous overload of unapply } } diff --git a/tests/pos/i8188a.scala b/tests/pos/i8188a.scala new file mode 100644 index 000000000000..3e9582e4ce9f --- /dev/null +++ b/tests/pos/i8188a.scala @@ -0,0 +1,11 @@ +object Test { + extension StrDeco on (tree: String) { + def show(using DummyImplicit): String = ??? + def show(color: Boolean)(using DummyImplicit): String = ??? + } + + val a: String = "foo".show + val b: String = "foo".show(true) + val c: Any = "foo".show + val d: Any = "foo".show(true) +} diff --git a/tests/pos/i8188b.scala b/tests/pos/i8188b.scala new file mode 100644 index 000000000000..28e1a410bbab --- /dev/null +++ b/tests/pos/i8188b.scala @@ -0,0 +1,6 @@ +class Foo { + def f(x: String)(using DummyImplicit): String = x * 2 + def f(x: String)(color: Boolean)(using DummyImplicit): String = x * 3 +} + +@main def Test = println(new Foo().f("foo")) diff --git a/tests/pos/i8188c.scala b/tests/pos/i8188c.scala new file mode 100644 index 000000000000..4b6ba90da162 --- /dev/null +++ b/tests/pos/i8188c.scala @@ -0,0 +1,6 @@ +class Foo { + def f(x: String)(using DummyImplicit): String = x * 2 + def f(x: String)(using DummyImplicit)(color: Boolean): String = x * 3 +} + +@main def Test = println(new Foo().f("foo"))