Skip to content

Commit

Permalink
fix SAM types when pt is a flexible type
Browse files Browse the repository at this point in the history
  • Loading branch information
olhotak committed Jul 14, 2023
1 parent 4e78493 commit c717bfe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4198,10 +4198,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
}

// convert function literal to SAM closure
val pt1 = pt.stripFlexible
tree match {
case closure(Nil, id @ Ident(nme.ANON_FUN), _)
if defn.isFunctionNType(wtp) && !defn.isFunctionNType(pt) =>
pt match {
if defn.isFunctionNType(wtp) && !defn.isFunctionNType(pt1) =>
pt1 match {
case SAMType(sam)
if wtp <:< sam.toFunctionType(isJava = pt.classSymbol.is(JavaDefined)) =>
// was ... && isFullyDefined(pt, ForceDegree.flipBottom)
Expand Down

0 comments on commit c717bfe

Please sign in to comment.