diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 0bcf2f5cce69..f9b40f6deb1f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -1581,7 +1581,7 @@ trait Applications extends Compatibility { val newAcc = params match case param :: _ if param.isType => true - case param :: _ if param.isTerm && !param.isOneOf(GivenOrImplicit) => false + case param :: _ if param.isTerm && !param.is(Given) => false case _ => acc hasTrailingTypeParams(paramss.tail, newAcc) diff --git a/tests/pos/i23499.scala b/tests/pos/i23499.scala new file mode 100644 index 000000000000..36e236d09fcb --- /dev/null +++ b/tests/pos/i23499.scala @@ -0,0 +1,18 @@ +def summonsTest = + given Type[String] = ??? + val opt1: Option[Wrapper[String]] = Wrapper.unapply[String] // ok + val opt2 = Wrapper.unapply[String] + opt2.map(_.getValue) + +def patternMatchTest = + Type[String] match + case Wrapper(v) => v.getValue // was an error + +type Type[A] = Class[A] // any rhs would work here +object Type: + def apply[A]: Type[A] = ??? + +trait Wrapper[T]: + def getValue: T = ??? +object Wrapper: + def unapply[T](implicit ev: Type[T]): Option[Wrapper[T]] = None