File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed
Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -116,11 +116,14 @@ def coerce(value, state:)
116116 #
117117 # @return [Object]
118118 def to_sorbet_type
119- case values
119+ types = values . map { FinchAPI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
120+ case types
120121 in [ ]
121122 T . noreturn
122- in [ value , *_ ]
123- T . all ( FinchAPI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( value ) , self )
123+ in [ type ]
124+ type
125+ else
126+ T . any ( *types )
124127 end
125128 end
126129
Original file line number Diff line number Diff line change @@ -216,11 +216,14 @@ def dump(value, state:)
216216 #
217217 # @return [Object]
218218 def to_sorbet_type
219- case ( v = variants )
219+ types = variants . map { FinchAPI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
220+ case types
220221 in [ ]
221222 T . noreturn
223+ in [ type ]
224+ type
222225 else
223- T . any ( *v . map { FinchAPI :: Internal :: Util :: SorbetRuntimeSupport . to_sorbet_type ( _1 ) } )
226+ T . any ( *types )
224227 end
225228 end
226229
Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ module FinchAPI
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