File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,11 +112,14 @@ def coerce(value, state:)
112112 #
113113 # @return [Object]
114114 def to_sorbet_type
115- case values
115+ types = values . map { Lithic ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
116+ case types
116117 in [ ]
117118 T . noreturn
118- in [ value , *_ ]
119- T . all ( Lithic ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( value ) , self )
119+ in [ type ]
120+ type
121+ else
122+ T . any ( *types )
120123 end
121124 end
122125
Original file line number Diff line number Diff line change @@ -206,11 +206,14 @@ def dump(value, state:)
206206 #
207207 # @return [Object]
208208 def to_sorbet_type
209- case ( v = variants )
209+ types = variants . map { Lithic ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
210+ case types
210211 in [ ]
211212 T . noreturn
213+ in [ type ]
214+ type
212215 else
213- T . any ( *v . map { Lithic :: Internal :: Util :: SorbetRuntimeSupport . to_sorbet_type ( _1 ) } )
216+ T . any ( *types )
214217 end
215218 end
216219
Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ module Lithic
1111 mod . constants . each do |name |
1212 case mod . const_get ( name )
1313 in true | false
14- mod . define_sorbet_constant! ( :TaggedBoolean ) { T . type_alias { T . all ( T ::Boolean , mod ) } }
14+ mod . define_sorbet_constant! ( :TaggedBoolean ) { T . type_alias { T ::Boolean } }
1515 mod . define_sorbet_constant! ( :OrBoolean ) { T . type_alias { T ::Boolean } }
1616 in Integer
17- mod . define_sorbet_constant! ( :TaggedInteger ) { T . type_alias { T . all ( Integer , mod ) } }
17+ mod . define_sorbet_constant! ( :TaggedInteger ) { T . type_alias { Integer } }
1818 mod . define_sorbet_constant! ( :OrInteger ) { T . type_alias { Integer } }
1919 in Float
20- mod . define_sorbet_constant! ( :TaggedFloat ) { T . type_alias { T . all ( Float , mod ) } }
20+ mod . define_sorbet_constant! ( :TaggedFloat ) { T . type_alias { Float } }
2121 mod . define_sorbet_constant! ( :OrFloat ) { T . type_alias { Float } }
2222 in Symbol
23- mod . define_sorbet_constant! ( :TaggedSymbol ) { T . type_alias { T . all ( Symbol , mod ) } }
23+ mod . define_sorbet_constant! ( :TaggedSymbol ) { T . type_alias { Symbol } }
2424 mod . define_sorbet_constant! ( :OrSymbol ) { T . type_alias { T . any ( Symbol , String ) } }
2525 else
2626 end
You can’t perform that action at this time.
0 commit comments