Skip to content

Commit c717bfe

Browse files
committed
fix SAM types when pt is a flexible type
1 parent 4e78493 commit c717bfe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -4198,10 +4198,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
41984198
}
41994199

42004200
// convert function literal to SAM closure
4201+
val pt1 = pt.stripFlexible
42014202
tree match {
42024203
case closure(Nil, id @ Ident(nme.ANON_FUN), _)
4203-
if defn.isFunctionNType(wtp) && !defn.isFunctionNType(pt) =>
4204-
pt match {
4204+
if defn.isFunctionNType(wtp) && !defn.isFunctionNType(pt1) =>
4205+
pt1 match {
42054206
case SAMType(sam)
42064207
if wtp <:< sam.toFunctionType(isJava = pt.classSymbol.is(JavaDefined)) =>
42074208
// was ... && isFullyDefined(pt, ForceDegree.flipBottom)

0 commit comments

Comments
 (0)