Skip to content

Avoid unnecessary parentheses when autocorrecting bracket access - #39

Merged
Morriar merged 2 commits into
mainfrom
fix/prefer-not-nil-index-parentheses
Aug 25, 2026
Merged

Avoid unnecessary parentheses when autocorrecting bracket access#39
Morriar merged 2 commits into
mainfrom
fix/prefer-not-nil-index-parentheses

Conversation

@Morriar

@Morriar Morriar commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

TypeToolkit/PreferNotNil (introduced in #37) treats [] as an operator when deciding whether an expression needs parentheses. This causes:

T.must(foo[bar]).foo

to autocorrect to:

(foo[bar]).not_nil!.foo

The expected correction is:

foo[bar].not_nil!.foo

@Morriar
Morriar merged commit 92b9c7a into main Aug 25, 2026
1 check passed
@Morriar
Morriar deleted the fix/prefer-not-nil-index-parentheses branch August 25, 2026 17:30
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