@@ -122,7 +122,6 @@ def validate_class_module_definition
122122 entry . each_decl do |decl |
123123 if super_class = decl . super_class
124124 super_class . args . each do |arg |
125- void_type_context_validator ( arg , true )
126125 no_self_type_validator ( arg )
127126 no_classish_type_validator ( arg )
128127 @validator . validate_type ( arg , context : nil )
@@ -133,7 +132,6 @@ def validate_class_module_definition
133132 entry . each_decl do |decl |
134133 decl . self_types . each do |self_type |
135134 self_type . args . each do |arg |
136- void_type_context_validator ( arg , true )
137135 no_self_type_validator ( arg )
138136 no_classish_type_validator ( arg )
139137 @validator . validate_type ( arg , context : nil )
@@ -163,21 +161,18 @@ def validate_class_module_definition
163161
164162 d . type_params . each do |param |
165163 if ub = param . upper_bound_type
166- void_type_context_validator ( ub )
167164 no_self_type_validator ( ub )
168165 no_classish_type_validator ( ub )
169166 @validator . validate_type ( ub , context : nil )
170167 end
171168
172169 if lb = param . lower_bound_type
173- void_type_context_validator ( lb )
174170 no_self_type_validator ( lb )
175171 no_classish_type_validator ( lb )
176172 @validator . validate_type ( lb , context : nil )
177173 end
178174
179175 if dt = param . default_type
180- void_type_context_validator ( dt , true )
181176 no_self_type_validator ( dt )
182177 no_classish_type_validator ( dt )
183178 @validator . validate_type ( dt , context : nil )
@@ -193,17 +188,9 @@ def validate_class_module_definition
193188 case member
194189 when AST ::Members ::MethodDefinition
195190 @validator . validate_method_definition ( member , type_name : name )
196- member . overloads . each do |ov |
197- void_type_context_validator ( ov . method_type )
198- end
199- when AST ::Members ::Attribute
200- void_type_context_validator ( member . type )
201191 when AST ::Members ::Mixin
202192 member . args . each do |arg |
203193 no_self_type_validator ( arg )
204- unless arg . is_a? ( Types ::Bases ::Void )
205- void_type_context_validator ( arg , true )
206- end
207194 end
208195 params =
209196 if member . name . class?
@@ -216,7 +203,6 @@ def validate_class_module_definition
216203 InvalidTypeApplicationError . check! ( type_name : member . name , params : params , args : member . args , location : member . location )
217204 when AST ::Members ::Var
218205 @validator . validate_variable ( member )
219- void_type_context_validator ( member . type )
220206 if member . is_a? ( AST ::Members ::ClassVariable )
221207 no_self_type_validator ( member . type )
222208 end
@@ -255,21 +241,18 @@ def validate_interface
255241
256242 decl . decl . type_params . each do |param |
257243 if ub = param . upper_bound_type
258- void_type_context_validator ( ub )
259244 no_self_type_validator ( ub )
260245 no_classish_type_validator ( ub )
261246 @validator . validate_type ( ub , context : nil )
262247 end
263248
264249 if lb = param . lower_bound_type
265- void_type_context_validator ( lb )
266250 no_self_type_validator ( lb )
267251 no_classish_type_validator ( lb )
268252 @validator . validate_type ( lb , context : nil )
269253 end
270254
271255 if dt = param . default_type
272- void_type_context_validator ( dt , true )
273256 no_self_type_validator ( dt )
274257 no_classish_type_validator ( dt )
275258 @validator . validate_type ( dt , context : nil )
@@ -283,7 +266,6 @@ def validate_interface
283266 when AST ::Members ::MethodDefinition
284267 @validator . validate_method_definition ( member , type_name : name )
285268 member . overloads . each do |ov |
286- void_type_context_validator ( ov . method_type )
287269 no_classish_type_validator ( ov . method_type )
288270 end
289271 end
@@ -300,7 +282,6 @@ def validate_constant
300282 @builder . ensure_namespace! ( name . namespace , location : const . decl . location )
301283 no_self_type_validator ( const . decl . type )
302284 no_classish_type_validator ( const . decl . type )
303- void_type_context_validator ( const . decl . type )
304285 rescue BaseError => error
305286 @errors . add ( error )
306287 end
@@ -312,7 +293,6 @@ def validate_global
312293 @validator . validate_type global . decl . type , context : nil
313294 no_self_type_validator ( global . decl . type )
314295 no_classish_type_validator ( global . decl . type )
315- void_type_context_validator ( global . decl . type )
316296 rescue BaseError => error
317297 @errors . add ( error )
318298 end
@@ -335,21 +315,18 @@ def validate_type_alias
335315
336316 decl . decl . type_params . each do |param |
337317 if ub = param . upper_bound_type
338- void_type_context_validator ( ub )
339318 no_self_type_validator ( ub )
340319 no_classish_type_validator ( ub )
341320 @validator . validate_type ( ub , context : nil )
342321 end
343322
344323 if lb = param . lower_bound_type
345- void_type_context_validator ( lb )
346324 no_self_type_validator ( lb )
347325 no_classish_type_validator ( lb )
348326 @validator . validate_type ( lb , context : nil )
349327 end
350328
351329 if dt = param . default_type
352- void_type_context_validator ( dt , true )
353330 no_self_type_validator ( dt )
354331 no_classish_type_validator ( dt )
355332 @validator . validate_type ( dt , context : nil )
@@ -360,7 +337,6 @@ def validate_type_alias
360337
361338 no_self_type_validator ( decl . decl . type )
362339 no_classish_type_validator ( decl . decl . type )
363- void_type_context_validator ( decl . decl . type )
364340 rescue BaseError => error
365341 @errors . add ( error )
366342 end
@@ -384,7 +360,7 @@ def void_type_context_validator(type, allowed_here = false)
384360 if allowed_here
385361 return if type . is_a? ( Types ::Bases ::Void )
386362 end
387- if type . with_nonreturn_void?
363+ if type . with_nonreturn_void? # steep:ignore DeprecatedReference
388364 @errors . add WillSyntaxError . new ( "`void` type is only allowed in return type or generics parameter" , location : type . location )
389365 end
390366 end
0 commit comments