@@ -68,6 +68,8 @@ private[async] trait AnfTransform {
68
68
69
69
def _transformToList (tree : Tree ): List [Tree ] = trace(tree) {
70
70
val stats :+ expr = anf.transformToList(tree)
71
+ def statsExprUnit =
72
+ stats :+ expr :+ localTyper.typedPos(expr.pos)(Literal (Constant (())))
71
73
expr match {
72
74
case Apply (fun, args) if isAwait(fun) =>
73
75
val valDef = defineVal(name.await, expr, tree.pos)
@@ -77,7 +79,7 @@ private[async] trait AnfTransform {
77
79
// if type of if-else is Unit don't introduce assignment,
78
80
// but add Unit value to bring it into form expected by async transform
79
81
if (expr.tpe =:= definitions.UnitTpe ) {
80
- stats :+ expr :+ localTyper.typedPos(expr.pos)( Literal ( Constant (())))
82
+ statsExprUnit
81
83
} else {
82
84
val varDef = defineVar(name.ifRes, expr.tpe, tree.pos)
83
85
def branchWithAssign (orig : Tree ) = localTyper.typedPos(orig.pos) {
@@ -90,12 +92,14 @@ private[async] trait AnfTransform {
90
92
val ifWithAssign = treeCopy.If (tree, cond, branchWithAssign(thenp), branchWithAssign(elsep)).setType(definitions.UnitTpe )
91
93
stats :+ varDef :+ ifWithAssign :+ gen.mkAttributedStableRef(varDef.symbol).setType(tree.tpe).setPos(tree.pos)
92
94
}
95
+ case LabelDef (name, params, rhs) =>
96
+ statsExprUnit
93
97
94
98
case Match (scrut, cases) =>
95
99
// if type of match is Unit don't introduce assignment,
96
100
// but add Unit value to bring it into form expected by async transform
97
101
if (expr.tpe =:= definitions.UnitTpe ) {
98
- stats :+ expr :+ localTyper.typedPos(expr.pos)( Literal ( Constant (())))
102
+ statsExprUnit
99
103
}
100
104
else {
101
105
val varDef = defineVar(name.matchRes, expr.tpe, tree.pos)
0 commit comments