File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -403,8 +403,13 @@ object Erasure extends TypeTestsCasts{
403403 override def typedTry (tree : untpd.Try , pt : Type )(implicit ctx : Context ) =
404404 super .typedTry(tree, adaptProto(tree, pt))
405405
406- private def adaptProto (tree : untpd.Tree , pt : Type )(implicit ctx : Context ) =
407- if (pt.isValueType) pt else erasure(tree.typeOpt)
406+ private def adaptProto (tree : untpd.Tree , pt : Type )(implicit ctx : Context ) = {
407+ if (pt.isValueType) pt else {
408+ if (tree.typeOpt.derivesFrom(ctx.definitions.UnitClass ))
409+ tree.typeOpt
410+ else erasure(tree.typeOpt)
411+ }
412+ }
408413
409414 override def typedValDef (vdef : untpd.ValDef , sym : Symbol )(implicit ctx : Context ): ValDef =
410415 super .typedValDef(untpd.cpy.ValDef (vdef)(
You can’t perform that action at this time.
0 commit comments