Commit 65bbf78
committed
Expr#show: Don't crash when the expression contains an unsupported type (like a SkolemType)
When the SkolemType appears as the prefix of a TypeRef, we avoid it by going
using `qualifier` which is defined in QuotesImpl to widen skolem, but skolems
can appear in any position, and so before this change we would get a compiler
crash in the added test case where the skolem appears as the prefix of a
TermRef.
We fix this by adding fallback cases in the quotes pretty-printer, now for the
test case we get:
Test.f.ho(((arg: <<SkolemType(693709097) does not have a corresponding extractor> does not have a source representation>.x.type) => arg))
Which isn't great, but better than a crash.
Maybe we should run `Type#deskolemized` on a type before trying to print it in
SourceCode/Extractors, but currently these files are intentionally defined to
not depend on compiler internals and do not have a `Context` so we cannot even
call `deskolemized` on them.
Alternatively, maybe SkolemType should be a tasty-reflect constructor but that
would also be a pretty big change.
[Cherry-picked 0ee8762][modified]1 parent a4141dd commit 65bbf78
File tree
5 files changed
+30
-5
lines changed- compiler/src/scala/quoted/runtime/impl/printers
- tests
- pos-macros/skolem
- run-macros
5 files changed
+30
-5
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| |||
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| 244 | + | |
| 245 | + | |
242 | 246 | | |
243 | 247 | | |
244 | 248 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1287 | 1287 | | |
1288 | 1288 | | |
1289 | 1289 | | |
1290 | | - | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
1291 | 1293 | | |
1292 | 1294 | | |
1293 | 1295 | | |
| |||
1462 | 1464 | | |
1463 | 1465 | | |
1464 | 1466 | | |
1465 | | - | |
1466 | | - | |
| 1467 | + | |
| 1468 | + | |
1467 | 1469 | | |
1468 | 1470 | | |
1469 | 1471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
0 commit comments