Commit 7480582
authored
Improve
The intention of this change is to make it simpler to read the error
message.
List the expected type and actual type before the expression. This is
usually the most important information and simpler to parse as the
expression can get quite long. For the expected type, the actual type
and the expression, we print the value in the same line if its String
representation has only one line. Otherwise we print it in the next line
with an indentation and extra new line at the end.
Before:
```
java.lang.Exception: Expr cast exception: ((a: scala.Int) => ({
val v: scala.Int = a
Binding.apply[scala.Unit](())
}: Binding[scala.Unit]))
of type: scala.Function1[scala.Int, scala.Unit]
did not conform to type: scala.Function1[scala.Int, Binding[scala.Unit]]
at scala.quoted.runtime.impl.QuotesImpl.asExprOf(QuotesImpl.scala:76)
...
```
Example from #19191
After:
```
scala.quoted.runtime.impl.ExprCastException:
Expected type: scala.Function1[scala.Int, scala.Unit]
Actual type: scala.Function1[scala.Int, Binding[scala.Unit]]
Expression:
((a: scala.Int) => ({
val v: scala.Int = a
Binding.apply[scala.Unit](())
}: Binding[scala.Unit]))
at scala.quoted.runtime.impl.QuotesImpl.asExprOf(QuotesImpl.scala:...)
...
```asExprOf cast error formatting (#19195)1 parent a3854cb commit 7480582
File tree
2 files changed
+25
-5
lines changed- compiler/src/scala/quoted/runtime/impl
2 files changed
+25
-5
lines changedLines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
0 commit comments