We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5119a0 commit e795437Copy full SHA for e795437
src/dotty/tools/dotc/typer/Typer.scala
@@ -1859,7 +1859,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1859
if (folded ne tree) return adaptConstant(folded, folded.tpe.asInstanceOf[ConstantType])
1860
// drop type if prototype is Unit
1861
if (pt isRef defn.UnitClass)
1862
- return adapt(tpd.Block(tree :: Nil, Literal(Constant(()))), pt)
+ // 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(())))
1865
// convert function literal to SAM closure
1866
tree match {
1867
case Closure(Nil, id @ Ident(nme.ANON_FUN), _)
0 commit comments