Skip to content

Also guard against arrays falling into object branch in untagged vari…#8255

Merged
cristianoc merged 1 commit intomasterfrom
fix-array-typeof-object-8251
Feb 25, 2026
Merged

Also guard against arrays falling into object branch in untagged vari…#8255
cristianoc merged 1 commit intomasterfrom
fix-array-typeof-object-8251

Conversation

@cristianoc
Copy link
Collaborator

…ant switch (#8251)

Arrays also have typeof "object", so when there's an ObjectType typeof case but no Array instanceof case, arrays would incorrectly match the object branch. Add an Array.isArray guard alongside the null guard.

Also clean up the guard logic to use direct pattern matching instead of intermediate list building.

…ant switch (#8251)

Arrays also have typeof "object", so when there's an ObjectType typeof
case but no Array instanceof case, arrays would incorrectly match the
object branch. Add an Array.isArray guard alongside the null guard.

Also clean up the guard logic to use direct pattern matching instead of
intermediate list building.

Signed-Off-By: Cristiano Calcagno <cristiano.calcagno@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test output looks good!
Code as well, but not really familiar with that part of the compiler.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@8255

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@8255

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@8255

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@8255

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@8255

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@8255

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@8255

commit: 516bd06

@cristianoc cristianoc merged commit fbe7a73 into master Feb 25, 2026
25 of 26 checks passed
@cristianoc cristianoc deleted the fix-array-typeof-object-8251 branch February 25, 2026 13:39
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.

2 participants