Skip to content

Support .nil? narrowing for local and instance variables#427

Merged
mame merged 1 commit intomasterfrom
nil-check-narrowing
Apr 7, 2026
Merged

Support .nil? narrowing for local and instance variables#427
mame merged 1 commit intomasterfrom
nil-check-narrowing

Conversation

@mame
Copy link
Copy Markdown
Member

@mame mame commented Apr 7, 2026

x.nil? in conditions now narrows the variable type: the then branch treats x as nil, and the else branch excludes nil. Works with both local variables and instance variables.

`x.nil?` in conditions now narrows the variable type: the then
branch treats x as nil, and the else branch excludes nil. Works
with both local variables and instance variables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mame mame enabled auto-merge (rebase) April 7, 2026 09:54
@mame mame merged commit 890fc08 into master Apr 7, 2026
12 checks passed
@mame mame deleted the nil-check-narrowing branch April 7, 2026 09:55
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