lib/rbs/cli/validate.rb in rbs-3.6.0.dev.1 vs lib/rbs/cli/validate.rb in rbs-3.6.0.pre.1

- old
+ new

@@ -162,11 +162,11 @@ no_classish_type_validator(ub) @validator.validate_type(ub, context: nil) end if dt = param.default_type - void_type_context_validator(dt) + void_type_context_validator(dt, true) no_self_type_validator(dt) no_classish_type_validator(dt) @validator.validate_type(dt, context: nil) end end @@ -230,10 +230,26 @@ decl.decl.type_params, type_name: name, location: decl.decl.location&.aref(:type_params) ) + decl.decl.type_params.each do |param| + if ub = param.upper_bound_type + void_type_context_validator(ub) + no_self_type_validator(ub) + no_classish_type_validator(ub) + @validator.validate_type(ub, context: nil) + end + + if dt = param.default_type + void_type_context_validator(dt, true) + no_self_type_validator(dt) + no_classish_type_validator(dt) + @validator.validate_type(dt, context: nil) + end + end + decl.decl.members.each do |member| case member when AST::Members::MethodDefinition @validator.validate_method_definition(member, type_name: name) member.overloads.each do |ov| @@ -276,10 +292,34 @@ @env.type_alias_decls.each do |name, decl| RBS.logger.info "Validating alias: `#{name}`..." @builder.expand_alias1(name).tap do |type| @validator.validate_type type, context: nil end + @validator.validate_type_alias(entry: decl) + + @validator.validate_type_params( + decl.decl.type_params, + type_name: name, + location: decl.decl.location&.aref(:type_params) + ) + + decl.decl.type_params.each do |param| + if ub = param.upper_bound_type + void_type_context_validator(ub) + no_self_type_validator(ub) + no_classish_type_validator(ub) + @validator.validate_type(ub, context: nil) + end + + if dt = param.default_type + void_type_context_validator(dt, true) + no_self_type_validator(dt) + no_classish_type_validator(dt) + @validator.validate_type(dt, context: nil) + end + end + no_self_type_validator(decl.decl.type) no_classish_type_validator(decl.decl.type) void_type_context_validator(decl.decl.type) rescue BaseError => error @errors.add(error)