Commit b41f9f0
committed
Fix compiler crash in PatternMatcher
My understanding is that the test case in i24504 is expected to take
this branch:
https://github.com/scala/scala3/blob/0470ec1ff46a822ca58e204587fb67d56004623a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala#L420
where we the info is comming from
https://github.com/scala/scala3/blob/0470ec1ff46a822ca58e204587fb67d56004623a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala#L118-L124
that has called `dropNamedTuple`
https://github.com/scala/scala3/blob/0470ec1ff46a822ca58e204587fb67d56004623a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala#L113-L115
the problem is that under this case the type will be `NamedTuple.From`
for which `isNamedTupleType` returns false. Which means that the
returned type will not be a `NonEmptyTupleType`.
The fix in this mr adds a `normalized.dealias` call in
`isNormalizedTupleType` which brings it inline with
`stripNormalizedTupleType`. But seems feasible that a better fix could
be that `NamedTuple.From` should have already been removed earlier. But
it not clear to me if that possible.
fixes: i245041 parent 5066dca commit b41f9f0
File tree
2 files changed
+13
-1
lines changed- compiler/src/dotty/tools/dotc/core
- tests/pos
2 files changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments