Fix null falling into object branch in untagged variant switch#8253
Fix null falling into object branch in untagged variant switch#8253cristianoc merged 1 commit intomasterfrom
Conversation
When pattern matching on untagged variants with both an Object case and a null/wildcard case, null (typeof "object") would incorrectly match the object branch. Emit a null check before the typeof switch when both conditions are present. Fixes #8251 Signed-Off-By: Cristiano Calcagno <cristiano.calcagno@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9f29f3a to
61b6f10
Compare
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
how can i use this @nojaf via the Also can u confirm it this handles these cases as well, sometimes the array was also falling into the object case @cristianoc |
I'm not sure what your expectations are this does. then I would expect yarn to pick it up. Maybe |
|
yeah i want to point to this version only @nojaf Also do u know when we can expect this fix in upcoming release ? |
|
i can't use it actually as it's using the rescript "version": "13.0.0-alpha.2", which can cause other issue, are we planning to release thsi as path in rescript 12 only |
Summary
null(which hastypeof "object") incorrectly falling into theObjectbranch instead of the wildcard when pattern matching on untagged variants that have both anObjectcase and anull/wildcard case.typeofswitch when both conditions are present.Fixes #8251
Test plan
js_json_test.resthat exercisesArray,Object, and wildcard matching withnullinputmake testpasses🤖 Generated with Claude Code