Skip to content

Conversation

@Morriar
Copy link
Contributor

@Morriar Morriar commented Jan 8, 2026

Also enable Sorbet/ForbidTStruct cop after that.

@Morriar Morriar self-assigned this Jan 8, 2026
@Morriar Morriar requested a review from a team as a code owner January 8, 2026 16:27
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar force-pushed the at-remove-t-struct branch from e91064c to 90bd8f6 Compare January 8, 2026 16:27
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar force-pushed the at-remove-t-struct branch from 90bd8f6 to 80a1d36 Compare January 8, 2026 16:30
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Copy link
Contributor

@amomchilov amomchilov left a comment

Choose a reason for hiding this comment

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

I guess if you migrated to Data.define instead, you'd need a whole bunch of RBI files just to specify the sigs, right?

@amomchilov amomchilov changed the title Migrate all T::Struct usages to bare Ruby classes Migrate all T::Struct usages to bare Ruby classes Jan 8, 2026
@Morriar
Copy link
Contributor Author

Morriar commented Jan 8, 2026

I guess if you migrated to Data.define instead, you'd need a whole bunch of RBI files just to specify the sigs, right?

Indeed, Sorbet doesn't have a way to associate types to data fields yet.

Copy link
Member

@paracycle paracycle left a comment

Choose a reason for hiding this comment

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

I have a few minor comments, but looks good to me

#: String
attr_reader :uri

#: Range
Copy link
Member

Choose a reason for hiding this comment

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

This is quite confusing. Even though it probably resolves to LSP::Range, I still find it confusing to see a bare Range reference, and I assume it would be a reference to ::Range and not something else. Should we keep the namespace here?

const :code, Integer
const :message, String
const :information, Object
#: Range
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above

#: Location?
attr_reader :location

#: Range?
Copy link
Member

Choose a reason for hiding this comment

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

Same comment here, but I think the old code was similarly confusing.

#: (SymbolPrinter printer) -> void
def accept_printer(printer)
h = serialize.hash
h = hash
Copy link
Member

Choose a reason for hiding this comment

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

Interesting! I am noticing this code now and I am not sure if this will always work the way you intend it to. The return value of hash isn't necessarily unique, so you can't rely on it (solely) for Set inclusion.

a.eql?(b) implies a.hash == b.hash

from https://docs.ruby-lang.org/en/3.4/Object.html#method-i-hash

but the converse isn't necessarily true, i.e. a.hash == b.hash does not necessarily imply a.eql?(b).

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.

3 participants