Skip to content

Commit c82d199

Browse files
committed
rebase on current main branch
1 parent 8b1773f commit c82d199

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,18 +4182,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
41824182
// convert function literal to SAM closure
41834183
tree match {
41844184
case closure(Nil, id @ Ident(nme.ANON_FUN), _)
4185-
if defn.isFunctionType(wtp) && !defn.isFunctionType(pt) && SAMType.isSamCompatible(wtp, pt) =>
4186-
case FlexibleType(tp) => tp match {
4187-
// recurse once inside
4188-
case SAMType(sam)
4189-
if wtp <:< sam.toFunctionType(isJava = pt.classSymbol.is(JavaDefined)) =>
4190-
// was ... && isFullyDefined(pt, ForceDegree.flipBottom)
4191-
// but this prevents case blocks from implementing polymorphic partial functions,
4192-
// since we do not know the result parameter a priori. Have to wait until the
4193-
// body is typechecked.
4194-
return toSAM(tree)
4195-
case _ =>
4196-
}
4185+
if defn.isFunctionType(wtp) && !defn.isFunctionType(pt) && SAMType.isSamCompatible(wtp, pt.stripFlexible) =>
41974186
// was ... && isFullyDefined(pt, ForceDegree.flipBottom)
41984187
// but this prevents case blocks from implementing polymorphic partial functions,
41994188
// since we do not know the result parameter a priori. Have to wait until the

0 commit comments

Comments
 (0)