Commit 4489e7e
Fix inline reduction for CaseDef guards with asInstanceOf (scala#22305)
In Inliner.scala
we add asInstanceOf to references to private inline methods to make sure
we later are able to know which method is referenced (if e.g. we inline
out of the scope where that method would be visible). This added
asInstanceOf caused issue when inlining CaseDef guards, as instead of a
simple constant literal we get an Inlined node with an added binding,
like this:
```scala
{
val A_this: A = A_this.asInstanceOf[A]
true:Boolean
}
```
We fix that by just unpacking that Inlined node (and we do not need that
binding for constant literals, so we can just ignore it).
[Cherry-picked 1448123]1 parent d8fb35e commit 4489e7e
File tree
2 files changed
+17
-1
lines changed- compiler/src/dotty/tools/dotc/inlines
- tests/pos
2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
| 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 | + | |
0 commit comments