You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A lot of the remaining errors returned by rake examples:typecheck are to do with classes descending from Array or Struct, and thus needing to have the Elem constant redeclared.
sord_examples/yard.rbi:4248: Type Elem declared by parent Array must be re-declared in YARD::Parser::Ruby::Legacy::TokenList https://srb.help/5036
4248 | class TokenList < Array
^^^^^^^^^^^^^^^^^^^^^^^
https://github.com/sorbet/sorbet/tree/7afa6f30e4d5f6e6e49815ff130d6c98563df809/rbi/core/array.rbi#L7: Elem declared in parent here
7 | Elem = type_member(:out)
^^^^^^^^^^^^^^^^^^^^^^^^
sord_examples/yard.rbi:4296: Type Elem declared by parent Array must be re-declared in YARD::Parser::Ruby::Legacy::StatementList https://srb.help/5036
4296 | class StatementList < Array
^^^^^^^^^^^^^^^^^^^^^^^^^^^
https://github.com/sorbet/sorbet/tree/7afa6f30e4d5f6e6e49815ff130d6c98563df809/rbi/core/array.rbi#L7: Elem declared in parent here
7 | Elem = type_member(:out)
^^^^^^^^^^^^^^^^^^^^^^^^
sord_examples/yard.rbi:4361: Type Elem declared by parent Array must be re-declared in YARD::Parser::Ruby::AstNode https://srb.help/5036
4361 | class AstNode < Array
^^^^^^^^^^^^^^^^^^^^^
https://github.com/sorbet/sorbet/tree/7afa6f30e4d5f6e6e49815ff130d6c98563df809/rbi/core/array.rbi#L7: Elem declared in parent here
7 | Elem = type_member(:out)
^^^^^^^^^^^^^^^^^^^^^^^^
sord_examples/yard.rbi:4501: Type Elem declared by parent YARD::Parser::Ruby::AstNode must be re-declared in YARD::Parser::Ruby::ReferenceNode https://srb.help/5036
4501 | class ReferenceNode < AstNode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sord_examples/yard.rbi:4361: Elem declared in parent here
4361 | class AstNode < Array
^^^^^^^^^^^^^^^^^^^^^
Describe the solution you'd like
The simplest solution would be to just define the necessary constants for each parent class that needs this (Array, Struct, etc.), but that's somewhat fragile. I'm not sure if there's a way for us to determine what Sorbet wants us to add when generating the rbi file?
I suppose these constants wouldn't change very often for core classes like this, so it may be fine to just handle it on a case-by-case basis in Sord.
Describe alternatives you've considered
I'd prefer if Sorbet magically fixed this itself, but I don't think it can :(
The text was updated successfully, but these errors were encountered:
This is certainly a tricky one. I'm not too familiar with how type_member works, but my understanding is that, for an array, Elem should be set to the type of each element in the array. Is there any way this could be determined through YARD, or would we just use T.untyped?
Is your feature request related to a problem? Please describe.
A lot of the remaining errors returned by
rake examples:typecheck
are to do with classes descending from Array or Struct, and thus needing to have theElem
constant redeclared.Describe the solution you'd like
The simplest solution would be to just define the necessary constants for each parent class that needs this (Array, Struct, etc.), but that's somewhat fragile. I'm not sure if there's a way for us to determine what Sorbet wants us to add when generating the rbi file?
I suppose these constants wouldn't change very often for core classes like this, so it may be fine to just handle it on a case-by-case basis in Sord.
Describe alternatives you've considered
I'd prefer if Sorbet magically fixed this itself, but I don't think it can :(
The text was updated successfully, but these errors were encountered: