Commit 0cd94fc
authored
Fixes #18855
The code in #18855 used to crash the compiler with an out-of-bound
access exception. It was because, previously, `ContextState.reset`
clears the `comparers`, the cached pool of `TypeComparer`s, while
keeping the variable `comparersInUse` intact. However, the `comparer`
method of a context assumes `comparers` has a size greater than or equal
to `comparersInUse`. So the invariant is clearly violated here and thus
triggers the crash.
This PR proposes a straightforward fix. Yet, the reason why only under
both macros and cc this code path will be triggered remains to be
investigated.
File tree
3 files changed
+11
-0
lines changed- compiler/src/dotty/tools/dotc/core
- tests/pos-macros/i18855
3 files changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| 1066 | + | |
1066 | 1067 | | |
1067 | 1068 | | |
1068 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments