You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This underlines the source positions in the safe-init stack traces similarly to how the MessageRendering will underline its stack positions.
Before, a safe-init error might look like this:
```
[error] -- Error: /******/dotty/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala:1032:22
[error] 1032 | "inlineVars" -> inlineVars
[error] | ^^^^^^^^^^
[error] |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments
[error] |
[error] |The unsafe promotion may cause the following problem:
[error] |Calling the external method method apply may cause initialization errors. Calling trace:
[error] | -> "inlineVars" -> inlineVars [ PatternMatcher.scala:1032 ]
[error] | -> Inliner(plan) [ PatternMatcher.scala:700 ]
[error] | -> case plan: TestPlan => apply(plan) [ PatternMatcher.scala:492 ]
[error] | -> plan.scrutinee = apply(plan.scrutinee) [ PatternMatcher.scala:472 ]
[error] | -> def apply(tree: Tree): Tree = treeMap.transform(tree) [ PatternMatcher.scala:470 ]
[error] | -> if (toDrop(sym)) transform(initializer(sym)) [ PatternMatcher.scala:675 ]
```
Now, the same error looks like this:
```
[error] -- Error: /******/dotty/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala:1032:22
[error] 1032 | "inlineVars" -> inlineVars
[error] | ^^^^^^^^^^
[error] |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments
[error] |
[error] |The unsafe promotion may cause the following problem:
[error] |Calling the external method method apply may cause initialization errors. Calling trace:
[error] | -> "inlineVars" -> inlineVars [ PatternMatcher.scala:1032 ]
[error] | ^^^^^^^^^^
[error] | -> Inliner(plan) [ PatternMatcher.scala:700 ]
[error] | ^^^^^^^^^^^^^
[error] | -> case plan: TestPlan => apply(plan) [ PatternMatcher.scala:492 ]
[error] | ^^^^^^^^^^^
[error] | -> plan.scrutinee = apply(plan.scrutinee) [ PatternMatcher.scala:472 ]
[error] | ^^^^^^^^^^^^^^^^^^^^^
[error] | -> def apply(tree: Tree): Tree = treeMap.transform(tree) [ PatternMatcher.scala:470 ]
[error] | ^^^^^^^^^^^^^^^^^^^^^^^
[error] | -> if (toDrop(sym)) transform(initializer(sym)) [ PatternMatcher.scala:675 ]
```
This should improve the readability of the safe-init error messages.
Review by @liufengyun
0 commit comments