Repository navigation
An optional union with no value is false in a condition (path.ts on wasm) - #815
Merged
Merged
Conversation
…)` over `null | undefined | {...}` ends
A cast of an optional union to boolean took the optional's default, a zeroed union whose type is
"undefined", and tested it against null: not null, so true. With the default library, path.ts's
Readonly<Path> is such a tuple and its loop never ended (natively too; ctest runs it without the
default library). A boolean target now tests HasValue first.
path.ts is taken off the wasm skips; 00optional_union_truthiness reproduces it without the library.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
added a commit
that referenced
this pull request
Nov 12, 2026
…'s tests PR #829's run booted the emulator and passed everything but two tester tests, 00class_override_arity and 00optional_union_truthiness, under every model: both came after v0.0-pre-alpha124 with the compiler fixes they check (#811, #815). When the job takes a published release's package, it now takes that release's tslang/test/tester/tests and CMakeLists.txt too; the runner and its skips stay the commit's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
added a commit
that referenced
this pull request
Nov 12, 2026
…829) * Android emulator tests: make the AVD where the emulator looks for it Release run 43251862764's emulator exited at once: "Unknown AVD name [tslang_api29_x86_64] ... no file tslang_api29_x86_64.ini in $HOME/.android/avd". The runner's avdmanager had made it elsewhere. The run job sets ANDROID_USER_HOME and ANDROID_AVD_HOME for both, and the install step checks that `emulator -list-avds` names the AVD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Android emulator tests: a published package runs with its own release's tests PR #829's run booted the emulator and passed everything but two tester tests, 00class_override_arity and 00optional_union_truthiness, under every model: both came after v0.0-pre-alpha124 with the compiler fixes they check (#811, #815). When the job takes a published release's package, it now takes that release's tslang/test/tester/tests and CMakeLists.txt too; the runner and its skips stay the commit's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes path.ts hanging on wasm. The bug isn't wasm-specific: it shows whenever the program is compiled with the default library, natively too.
What went wrong
Readonly<Path>expands to an object type, soMaybe<Readonly<Path>>isoptional<null | {key, prev, typename}>.while (curr)casts that to boolean. The cast took the optional's default when it has no value: a zeroed union whose type is "undefined". It then tested that against null, which it isn't, so the result was true.curr.prevwas undefined the loop kept going, pushing garbage, until memory ran out (wasm64) or a read went out of bounds (wasm32).The fix (
MLIRGenCast.cpp)HasValuefirst; with no value it isfalse.Tests
00optional_union_truthinessreproduces it without the default library (while,if,!,?:overnull | undefined | {...}). The old compiler hangs on it.wasm_skips.txt.Under own, both tests are refused natively too (
addPathreturns a borrowed field), so the runner counts them as NATIVE.🤖 Generated with Claude Code