diff --git a/lib/steep/ast/types/factory.rb b/lib/steep/ast/types/factory.rb index 4911e615a..fff8fa9cd 100644 --- a/lib/steep/ast/types/factory.rb +++ b/lib/steep/ast/types/factory.rb @@ -344,43 +344,43 @@ def setup_primitives(method_name, method_type) defined_in = method_def.defined_in member = method_def.member - return unless member.is_a?(RBS::AST::Members::MethodDefinition) - - case - when defined_in == RBS::BuiltinNames::Object.name && member.instance? - case method_name - when :is_a?, :kind_of?, :instance_of? - return method_type.with( - return_type: AST::Types::Logic::ReceiverIsArg.new(location: method_type.return_type.location) - ) - when :nil? - return method_type.with( - return_type: AST::Types::Logic::ReceiverIsNil.new(location: method_type.return_type.location) - ) - end + if member.is_a?(RBS::AST::Members::MethodDefinition) + case + when defined_in == RBS::BuiltinNames::Object.name && member.instance? + case method_name + when :is_a?, :kind_of?, :instance_of? + return method_type.with( + return_type: AST::Types::Logic::ReceiverIsArg.new(location: method_type.return_type.location) + ) + when :nil? + return method_type.with( + return_type: AST::Types::Logic::ReceiverIsNil.new(location: method_type.return_type.location) + ) + end - when defined_in == AST::Builtin::NilClass.module_name && member.instance? - case method_name - when :nil? - return method_type.with( - return_type: AST::Types::Logic::ReceiverIsNil.new(location: method_type.return_type.location) - ) - end + when defined_in == AST::Builtin::NilClass.module_name && member.instance? + case method_name + when :nil? + return method_type.with( + return_type: AST::Types::Logic::ReceiverIsNil.new(location: method_type.return_type.location) + ) + end - when defined_in == RBS::BuiltinNames::BasicObject.name && member.instance? - case method_name - when :! - return method_type.with( - return_type: AST::Types::Logic::Not.new(location: method_type.return_type.location) - ) - end + when defined_in == RBS::BuiltinNames::BasicObject.name && member.instance? + case method_name + when :! + return method_type.with( + return_type: AST::Types::Logic::Not.new(location: method_type.return_type.location) + ) + end - when defined_in == RBS::BuiltinNames::Module.name && member.instance? - case method_name - when :=== - return method_type.with( - return_type: AST::Types::Logic::ArgIsReceiver.new(location: method_type.return_type.location) - ) + when defined_in == RBS::BuiltinNames::Module.name && member.instance? + case method_name + when :=== + return method_type.with( + return_type: AST::Types::Logic::ArgIsReceiver.new(location: method_type.return_type.location) + ) + end end end end