Skip to content

Use explicit type annotations for CurrentAttributes methods#2511

Merged
amomchilov merged 1 commit intoShopify:mainfrom
tavianator:tb/current-attributes-copy-types
Feb 17, 2026
Merged

Use explicit type annotations for CurrentAttributes methods#2511
amomchilov merged 1 commit intoShopify:mainfrom
tavianator:tb/current-attributes-copy-types

Conversation

@tavianator
Copy link
Contributor

@tavianator tavianator commented Feb 17, 2026

Motivation

When an explicit type is given for an attributes, e.g. by

attribute :user_id

#: -> Integer?
def user_id = super

we should use that type in the class methods rather than untyped.

Implementation

Rather than grab the method from the class, use instance_method() for
both the class and the GeneratedAttributesMethod signatures.

Tests

Yes.

When an explicit type is given for an attributes, e.g. by

    attribute :user_id

    #: -> Integer?
    def user_id = super

we should use that type in the class methods rather than untyped.
@tavianator tavianator requested a review from a team as a code owner February 17, 2026 21:01
@amomchilov amomchilov added the enhancement New feature or request label Feb 17, 2026
@amomchilov amomchilov merged commit df731f1 into Shopify:main Feb 17, 2026
16 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants