@@ -77,6 +77,7 @@ def yard_to_parlour_default(type)
7777
7878 context 'with literals' do
7979 it 'converts literals to their types' do
80+ expect ( yard_to_parlour_default ( 'nil' ) ) . to eq Types ::Raw . new ( 'NilClass' )
8081 expect ( yard_to_parlour_default ( [ ':up' , ':down' ] ) ) . to eq Types ::Raw . new ( 'Symbol' )
8182 expect ( yard_to_parlour_default ( [ 'String' , ':up' , ':down' ] ) ) . to eq \
8283 Types ::Union . new ( [ 'String' , 'Symbol' ] )
@@ -132,6 +133,11 @@ def self.path
132133 Types ::Array . new ( Types ::Union . new ( [ 'String' , 'Integer' ] ) )
133134 end
134135
136+ it 'handles nil is one of multiple arguments in a one-argument type parameter' do
137+ expect ( yard_to_parlour_default ( 'Array<String, nil>' ) ) . to eq \
138+ Types ::Array . new ( Types ::Nilable . new ( 'String' ) )
139+ end
140+
135141 it 'handles whitespace' do
136142 expect ( yard_to_parlour_default ( 'Array < String >' ) ) . to eq Types ::Array . new ( 'String' )
137143 end
@@ -148,6 +154,7 @@ def self.path
148154 it 'handles correctly-formed two-argument type parameters with hash rockets' do
149155 expect ( yard_to_parlour_default ( 'Hash<String=>Symbol>' ) ) . to eq Types ::Hash . new ( 'String' , 'Symbol' )
150156 expect ( yard_to_parlour_default ( 'Hash{String=>Symbol}' ) ) . to eq Types ::Hash . new ( 'String' , 'Symbol' )
157+ expect ( yard_to_parlour_default ( 'Hash{String=>String}' ) ) . to eq Types ::Hash . new ( 'String' , 'String' )
151158 expect ( yard_to_parlour_default ( 'Hash{String => Symbol}' ) ) . to eq Types ::Hash . new ( 'String' , 'Symbol' )
152159 expect ( yard_to_parlour_default ( 'Hash{String, Integer => Symbol, Float}' ) ) . to eq \
153160 Types ::Hash . new (
@@ -339,7 +346,7 @@ def self.path
339346 Sord ::TypeConverter ::Configuration . new (
340347 output_language : :rbs ,
341348 replace_errors_with_untyped : false ,
342- replace_unresolved_with_untyped : false ,
349+ replace_unresolved_with_untyped : false ,
343350 )
344351 end
345352
0 commit comments