Skip to content

Improve multiline T.must autocorrection - #40

Merged
Morriar merged 3 commits into
mainfrom
fix/prefer-not-nil-multiline-receiver
Sep 9, 2026
Merged

Improve multiline T.must autocorrection#40
Morriar merged 3 commits into
mainfrom
fix/prefer-not-nil-multiline-receiver

Conversation

@Morriar

@Morriar Morriar commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

TypeToolkit/PreferNotNil preserves the T.must parentheses whenever the call spans multiple lines, even when only the argument itself is multiline. This causes:

T.must(foo
  .bar)

to autocorrect to:

(foo
  .bar).not_nil!

instead of:

foo
  .bar.not_nil!

Multiline command-style calls can also crash because they do not have parenthesis locations:

T.must foo
  .bar

This change distinguishes multiline arguments from multiline wrappers and handles calls without parentheses.

@Morriar
Morriar force-pushed the fix/prefer-not-nil-multiline-receiver branch from 574716e to 753a4a0 Compare August 20, 2026 20:08
Base automatically changed from fix/prefer-not-nil-index-parentheses to main August 25, 2026 17:30

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a case like:

T.must(
  foo.
    bar
)

@Morriar
Morriar force-pushed the fix/prefer-not-nil-multiline-receiver branch from 4a89554 to 55210f9 Compare September 9, 2026 17:59
@Morriar
Morriar merged commit ecf0528 into main Sep 9, 2026
1 check passed
@Morriar
Morriar deleted the fix/prefer-not-nil-multiline-receiver branch September 9, 2026 18:00
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