primary()
click to toggle source
# File rbs-2.1.0/lib/rbs/environment.rb, line 69
def primary
raise "Not implemented"
end
Object
# File rbs-2.1.0/lib/rbs/environment.rb, line 59
def compatible_params?(ps1, ps2)
if ps1.size == ps2.size
ps1 == AST::TypeParam.rename(ps2, new_names: ps1.map(&:name))
end
end
# File rbs-2.1.0/lib/rbs/environment.rb, line 35
def insert(decl,, outer))
decls << D.new(decl: decl, outer: outer)
@primary = nil
end
# File rbs-2.1.0/lib/rbs/environment.rb, line 69
def primary
raise "Not implemented"
end
# File rbs-2.1.0/lib/rbs/environment.rb, line 65
def type_params
primary.decl.type_params
end
# File rbs-2.1.0/lib/rbs/environment.rb, line 40
def validate_type_params
unless decls.empty?
# @type var hd_decl: MultiEntry::D[module_decl]
# @type var tl_decls: Array[MultiEntry::D[module_decl]]
hd_decl, *tl_decls = decls
raise unless hd_decl
hd_params = hd_decl.decl.type_params
tl_decls.each do |tl_decl|
tl_params = tl_decl.decl.type_params
unless compatible_params?(hd_params, tl_params)
raise GenericParameterMismatchError.new(name: name, decl: tl_decl.decl)
end
end
end
end