Skip to content

Commit 3ac72d2

Browse files
committed
fix SAM types when pt is a flexible type
1 parent 504a8cf commit 3ac72d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4192,10 +4192,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
41924192
}
41934193

41944194
// convert function literal to SAM closure
4195+
val pt1 = pt.stripFlexible
41954196
tree match {
41964197
case closure(Nil, id @ Ident(nme.ANON_FUN), _)
4197-
if defn.isFunctionNType(wtp) && !defn.isFunctionNType(pt) =>
4198-
pt match {
4198+
if defn.isFunctionNType(wtp) && !defn.isFunctionNType(pt1) =>
4199+
pt1 match {
41994200
case SAMType(samMeth, samParent)
42004201
if wtp <:< samMeth.toFunctionType(isJava = samParent.classSymbol.is(JavaDefined)) =>
42014202
// was ... && isFullyDefined(pt, ForceDegree.flipBottom)

0 commit comments

Comments
 (0)