Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,9 @@ trait Applications extends Compatibility {
def isAsGood(alt1: TermRef, tp1: Type, alt2: TermRef, tp2: Type): Boolean = trace(i"isAsGood $tp1 $tp2", overload) {
tp1 match
case tp1: MethodType => // (1)
tp1.paramInfos.isEmpty && tp2.isInstanceOf[LambdaType]
tp1.paramInfos.isEmpty
&& tp2.isInstanceOf[LambdaType]
&& !tp2.isVarArgsMethod
|| {
if tp1.isVarArgsMethod then
tp2.isVarArgsMethod
Expand Down
12 changes: 12 additions & 0 deletions tests/pos/i24871.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class C[T]

object X:
def apply(xs: Int*)(d: Double) = Nil
def apply[T](xs: Int*)(t: C[T])(d: Double) = Nil
def apply()(d: Double) = List(List(d))
def apply[T]()(t: C[T])(d: Double) = List(List(d))

for
List(x) <- X()(.0)
yield
x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file is an ordinary compilation unit, so a top-level expression isn't supported.

Loading