Skip to content

TSLANG_ISSUES 14: a literal union casts through its literals' type - #568

Merged
ASDAlexander77 merged 1 commit into
mainfrom
fix-literal-union-cast
Oct 13, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
fix-literal-union-cast

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG_ISSUES.md 14: a literal-union ternary stored as an integer tuple field failed in codegen.

c ? 1 : 0 is the union 0 | 1, stored untagged as s32. Cast straight to another type (an index variable, a parameter, a tuple field) it reached the lowering as a union, and llvm.sext of the union failed with <unknown>:0. castFromSourceSpecialCases now casts such a union to its literals' type first, as #560 did for binary operators.

Test: 00literal_union_cast.ts (variable, parameter, number, s64, and the tuple-field repro from the issue).

Full Release suite with all six TSLANG_ISSUES fixes together: 4074/4074.

🤖 Generated with Claude Code

`c ? 1 : 0` is the union `0 | 1`, stored untagged as s32. Cast straight
to another type (an `index` variable, a parameter, a tuple field) it
reached the lowering as a union, and `llvm.sext` of the union failed
with no source location. castFromSourceSpecialCases now casts such a
union to its literals' type first, as #560 did for binary operators.

Found writing native_ts_graphics' graphics pipeline (TSLANG_ISSUES.md 14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 703a38a into main Oct 13, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-literal-union-cast branch October 13, 2026 17:07
ASDAlexander77 added a commit that referenced this pull request Oct 13, 2026
13, 14, 15 and 18 are fixed by #572, #568, #570 and #569. For 16, `%` is
fixed by #571 and `/` stays a number. 17 is answered (`Deref(p[i]) = v`
stores) and its error names that form since #573. 5 and 6 stay open:
they are design questions, not bugs.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant