From 4d3d2d3177157c5b02f5ebc536de1b80aa37ddbb Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 19 Jan 2014 12:09:43 +0100 Subject: Dropping isFullyRefined requirement when adapting to SAM type. --- src/dotty/tools/dotc/typer/Typer.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 31964ce98..3f3899752 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1242,7 +1242,11 @@ class Typer extends Namer with Applications with Implicits { if defn.isFunctionType(wtp) && !defn.isFunctionType(pt) => pt match { case SAMType(meth) - if wtp <:< meth.info.toFunctionType && isFullyDefined(pt, ForceDegree.noBottom) => + if wtp <:< meth.info.toFunctionType => + // was ... && isFullyDefined(pt, ForceDegree.noBottom) + // but this prevents case blocks from implementing polymorphic partial functions, + // since we do not know the result parameter a priori. Have to wait until the + // body is typechecked. return cpy.Closure(tree, Nil, id, TypeTree(pt)).withType(pt) case _ => } -- cgit v1.2.3