File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,21 @@ import dotty.tools.dotc.core.Flags._
12
12
*/
13
13
object UnusedUtil {
14
14
15
+ /** Transforms the tree into a its default tree.
16
+ * Performed to shrink the tree that is known to be erased later.
17
+ */
15
18
def normalizeUnusedExpr (tree : Tree , msg : String )(implicit ctx : Context ): Tree = {
16
19
if (! isPureExpr(tree))
17
20
ctx.warning(msg + " This expression will not be evaluated." , tree.pos)
18
21
defaultValue(tree.tpe)
19
22
}
20
23
21
- def normalizeUnusedRhs (tree : Tree , sym : Symbol )(implicit ctx : Context ) = {
22
- if (sym.is(Unused ) && tree.tpe.exists) normalizeUnusedExpr(tree, " Expression is on the RHS of an `unused` " + sym.showKind + " . " )
23
- else tree
24
+ /** Transforms the rhs tree into a its default tree if it is in an `unused` val/def.
25
+ * Performed to shrink the tree that is known to be erased later.
26
+ */
27
+ def normalizeUnusedRhs (rhs : Tree , sym : Symbol )(implicit ctx : Context ) = {
28
+ if (sym.is(Unused ) && rhs.tpe.exists) normalizeUnusedExpr(rhs, " Expression is on the RHS of an `unused` " + sym.showKind + " . " )
29
+ else rhs
24
30
}
25
31
26
32
}
You can’t perform that action at this time.
0 commit comments