File tree Expand file tree Collapse file tree 1 file changed +1
-12
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change @@ -4182,18 +4182,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4182
4182
// convert function literal to SAM closure
4183
4183
tree match {
4184
4184
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) =>
4197
4186
// was ... && isFullyDefined(pt, ForceDegree.flipBottom)
4198
4187
// but this prevents case blocks from implementing polymorphic partial functions,
4199
4188
// since we do not know the result parameter a priori. Have to wait until the
You can’t perform that action at this time.
0 commit comments