Skip to content

Remove NilClass parameters from AR fixture methods#2660

Merged
amomchilov merged 1 commit into
mainfrom
Alex/fix-fixture-nil-params
Jul 3, 2026
Merged

Remove NilClass parameters from AR fixture methods#2660
amomchilov merged 1 commit into
mainfrom
Alex/fix-fixture-nil-params

Conversation

@amomchilov

@amomchilov amomchilov commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Motivation

Fixture methods have 3 overloads to describe the different ways they can be called. Their current shape incorrectly allows to nils to be passed, like:

users(nil)
users(:alice, nil)
users(:alice, nil, nil)

This PR fixes these annotations to not allow such nils, which has the pleasant side-effect of making them much simpler.

See also #1871, #1895

Implementation

Uses the same approach I used to describe Module#private (sorbet/sorbet#10239).

Tests

Updated.

Validated against Shopify Core. Type-checking fails, but for a great reason: there's a few of new errors like:

T.cast is useless because Foo is already a subtype of Foo

@amomchilov amomchilov requested a review from a team as a code owner July 3, 2026 16:13
@amomchilov amomchilov force-pushed the Alex/fix-fixture-nil-params branch from b9bc5a7 to b3088e5 Compare July 3, 2026 16:19
@amomchilov amomchilov marked this pull request as draft July 3, 2026 16:24
@amomchilov amomchilov marked this pull request as ready for review July 3, 2026 18:13
@amomchilov amomchilov self-assigned this Jul 3, 2026
@amomchilov amomchilov merged commit a8794c0 into main Jul 3, 2026
19 of 20 checks passed
@amomchilov amomchilov deleted the Alex/fix-fixture-nil-params branch July 3, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants