From c9c66ff122cdfaa071bee8cc045b001be292339a Mon Sep 17 00:00:00 2001 From: Solal Pirelli Date: Mon, 9 Mar 2026 09:29:09 +0100 Subject: [PATCH 1/3] Regression test --- tests/neg/24782.scala | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/neg/24782.scala diff --git a/tests/neg/24782.scala b/tests/neg/24782.scala new file mode 100644 index 000000000000..28f2df112f7b --- /dev/null +++ b/tests/neg/24782.scala @@ -0,0 +1,5 @@ +object S { + trait F[A] + type Pure = [a] => a => F[a] + def f(using pure: Pure) = S(s => pure(s)) // error (but no compiler crash / stack overflow) +} From 4b7b8f601eebf81c08e6e6b58a517dc6fa733610 Mon Sep 17 00:00:00 2001 From: Solal Pirelli Date: Mon, 9 Mar 2026 13:12:14 +0100 Subject: [PATCH 2/3] Fix --- compiler/src/dotty/tools/dotc/typer/Typer.scala | 2 +- tests/pos/i14907.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 8ead9b64f9a7..26c2faff0a72 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -118,7 +118,7 @@ object Typer { * apply of a function class? */ private[typer] def isSyntheticApply(tree: tpd.Tree): Boolean = tree match { - case tree: tpd.Select => tree.hasAttachment(InsertedApply) + case _: (tpd.Select | tpd.Apply) => tree.hasAttachment(InsertedApply) case TypeApply(fn, targs) => isSyntheticApply(fn) && targs.forall(_.isInstanceOf[tpd.InferredTypeTree]) case _ => false } diff --git a/tests/pos/i14907.scala b/tests/pos/i14907.scala index 4a60362d0f73..ae19e5231a66 100644 --- a/tests/pos/i14907.scala +++ b/tests/pos/i14907.scala @@ -5,7 +5,7 @@ object Module { case 1 => Any *: Fill[0] } extension[N <: Int] (f: Fun[N]) - def apply: Fill[N] => Any = ??? + def apply(): Fill[N] => Any = ??? - Fun[1]()(???) + Fun[1]()()(???) } From 338092aa776441a5517197240203333c3cf697df Mon Sep 17 00:00:00 2001 From: Solal Pirelli Date: Wed, 11 Mar 2026 16:35:19 +0100 Subject: [PATCH 3/3] add checkfile --- tests/neg/24782.check | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/neg/24782.check diff --git a/tests/neg/24782.check b/tests/neg/24782.check new file mode 100644 index 000000000000..5c6e55f5599d --- /dev/null +++ b/tests/neg/24782.check @@ -0,0 +1,6 @@ +-- [E050] Type Error: tests/neg/24782.scala:4:28 ----------------------------------------------------------------------- +4 | def f(using pure: Pure) = S(s => pure(s)) // error (but no compiler crash / stack overflow) + | ^ + | expression does not take more parameters + | + | longer explanation available when compiling with `-explain`