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._
1212 */
1313object UnusedUtil {
1414
15+ /** Transforms the tree into a its default tree.
16+ * Performed to shrink the tree that is known to be erased later.
17+ */
1518 def normalizeUnusedExpr (tree : Tree , msg : String )(implicit ctx : Context ): Tree = {
1619 if (! isPureExpr(tree))
1720 ctx.warning(msg + " This expression will not be evaluated." , tree.pos)
1821 defaultValue(tree.tpe)
1922 }
2023
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
2430 }
2531
2632}
You can’t perform that action at this time.
0 commit comments