Commit 08c4012
authored
sempass2: fix crash with tuple-in-array edge case (#1696)
## Summary
Fix the compiler crashing in an edge case where a tuple type used as
the element type of an array is not used anywhere.
## Details
Synthesizing the hooks for a type embedding a tuple type doesn't, by
itself, synthesize the hooks for the tuple type. For array construction
expressions, `sempass2` didn't separately pass the the array's element
type to `createTypeBoundOps`, leaving the tuple type without hooks
(unless synthesized elsewhere), causing the compiler to crash when
the hooks were needed (happens when the result of a sub-expression is
materialized).
Passing the array's element type to `createTypeBoundOps` fixes the
issue.
Fixes #1695 .
<!--
Pull Request(PR) Help
Before Merge Ensure:
* title reads like a short changelog line entry
* code includes tests and is documented
* leave the source better than before, but split out big reformats
See contributor
(guide)[https://nim-works.github.io/nimskull/contributing.html]
for details, especially if you're new to this project.
Tips that make PRs easier:
* for big/impactful changes, start with chat/discussions to refine
ideas
* refine the pull request message over time; don't have to nail it in
one go1 parent a208966 commit 08c4012
2 files changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1407 | 1407 | | |
1408 | 1408 | | |
1409 | 1409 | | |
1410 | | - | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
1411 | 1414 | | |
1412 | 1415 | | |
1413 | 1416 | | |
| |||
Lines changed: 19 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 | + | |
0 commit comments