Is your feature request related to a problem? Please describe.
I am trying to use sord-4.0.0 to parse a very thoroughly YARD documented library of mine, but noticed that it does not recognize Type Unions within the key or value part of a Hash{K => V} signature.
Describe the solution you'd like
sord should be able to parse the following Hash{...} type signatures:
Hash{KeyType1,KeyType2 => ValueType}
Hash{KeyType => ValueType1,ValueType2}
Describe alternatives you've considered
The obvious workaround is to change the YARD Hash{...} type signature to Hash{KeyType1 => Value}, Hash{KeyType2 => Value}, however this implies that all of the Hash'es keys are either of KeyType or of KeyType2, but never a mixture of the two key types. I could change the Hash{...} signature to Hash{Object => ValueType} but that makes the Hash type signature less descriptive. In my library KeyType1 and KeyType2 do not have a common base class, so that is also not an option.
Is your feature request related to a problem? Please describe.
I am trying to use
sord-4.0.0
to parse a very thoroughly YARD documented library of mine, but noticed that it does not recognize Type Unions within the key or value part of aHash{K => V}
signature.Describe the solution you'd like
sord
should be able to parse the followingHash{...}
type signatures:Hash{KeyType1,KeyType2 => ValueType}
Hash{KeyType => ValueType1,ValueType2}
Describe alternatives you've considered
The obvious workaround is to change the YARD
Hash{...}
type signature toHash{KeyType1 => Value}, Hash{KeyType2 => Value}
, however this implies that all of the Hash'es keys are either ofKeyType
or ofKeyType2
, but never a mixture of the two key types. I could change theHash{...}
signature toHash{Object => ValueType}
but that makes theHash
type signature less descriptive. In my libraryKeyType1
andKeyType2
do not have a common base class, so that is also not an option.Additional context
real world code