Method: RBS::MethodType#sub

Defined in:
lib/rbs/method_type.rb

#sub(s) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rbs/method_type.rb', line 33

def sub(s)
  sub = s.without(*type_param_names)

  return self if sub.empty?

  self.class.new(
    type_params: type_params.map do |param|
      param.map_type do |bound|
        bound.map_type {|ty| ty.sub(sub) }
      end
    end,
    type: type.sub(sub),
    block: block&.sub(sub),
    location: location
  )
end