Skip to content

Commit

Permalink
fixup! Merge pull request #226 from soutaro/target
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Oct 2, 2020
1 parent afeb844 commit 70b65ff
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions lib/steep/ast/types/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 70b65ff

Please sign in to comment.