Skip to content

Commit 4d3d2d3

Browse files
committed
Dropping isFullyRefined requirement when adapting to SAM type.
1 parent d420473 commit 4d3d2d3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,11 @@ class Typer extends Namer with Applications with Implicits {
12421242
if defn.isFunctionType(wtp) && !defn.isFunctionType(pt) =>
12431243
pt match {
12441244
case SAMType(meth)
1245-
if wtp <:< meth.info.toFunctionType && isFullyDefined(pt, ForceDegree.noBottom) =>
1245+
if wtp <:< meth.info.toFunctionType =>
1246+
// was ... && isFullyDefined(pt, ForceDegree.noBottom)
1247+
// but this prevents case blocks from implementing polymorphic partial functions,
1248+
// since we do not know the result parameter a priori. Have to wait until the
1249+
// body is typechecked.
12461250
return cpy.Closure(tree, Nil, id, TypeTree(pt)).withType(pt)
12471251
case _ =>
12481252
}

0 commit comments

Comments
 (0)