diff options
author | Martin Odersky <odersky@gmail.com> | 2016-10-02 20:03:27 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-02 20:03:27 +0200 |
commit | e7954376c245d42e0e70df501c73c3d5971db41e (patch) | |
tree | ffc6a43f11e4ed6b079771d212eb065c1653fd0a /src/dotty/tools/dotc/typer/Typer.scala | |
parent | e5119a058ff11cc0cca565c22c29f090401d794b (diff) | |
download | dotty-e7954376c245d42e0e70df501c73c3d5971db41e.tar.gz dotty-e7954376c245d42e0e70df501c73c3d5971db41e.tar.bz2 dotty-e7954376c245d42e0e70df501c73c3d5971db41e.zip |
Fix inline failure in the presence of unit conversion
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index e32805e0f..3aff69bdb 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1859,7 +1859,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (folded ne tree) return adaptConstant(folded, folded.tpe.asInstanceOf[ConstantType]) // drop type if prototype is Unit if (pt isRef defn.UnitClass) - return adapt(tpd.Block(tree :: Nil, Literal(Constant(()))), pt) + // local adaptation makes sure every adapted tree conforms to its pt + // so will take the code path that decides on inlining + return tpd.Block(adapt(tree, WildcardType) :: Nil, Literal(Constant(()))) // convert function literal to SAM closure tree match { case Closure(Nil, id @ Ident(nme.ANON_FUN), _) |