Skip to content

Commit e795437

Browse files
committed
Fix inline failure in the presence of unit conversion
1 parent e5119a0 commit e795437

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
18591859
if (folded ne tree) return adaptConstant(folded, folded.tpe.asInstanceOf[ConstantType])
18601860
// drop type if prototype is Unit
18611861
if (pt isRef defn.UnitClass)
1862-
return adapt(tpd.Block(tree :: Nil, Literal(Constant(()))), pt)
1862+
// local adaptation makes sure every adapted tree conforms to its pt
1863+
// so will take the code path that decides on inlining
1864+
return tpd.Block(adapt(tree, WildcardType) :: Nil, Literal(Constant(())))
18631865
// convert function literal to SAM closure
18641866
tree match {
18651867
case Closure(Nil, id @ Ident(nme.ANON_FUN), _)

0 commit comments

Comments
 (0)