lib/rbs/definition_builder/ancestor_builder.rb in rbs-3.6.0.pre.2 vs lib/rbs/definition_builder/ancestor_builder.rb in rbs-3.6.0.pre.3
- old
+ new
@@ -211,11 +211,11 @@
super_name = BuiltinNames::Object.name
super_args = []
end
super_name = env.normalize_module_name(super_name)
-
+
NoSuperclassFoundError.check!(super_name, env: env, location: primary.decl.location)
if super_class
InheritModuleError.check!(super_class, env: env)
end
@@ -456,11 +456,13 @@
if super_class = one_ancestors.super_class
# @type var super_class: Definition::Ancestor::Instance
super_name = super_class.name
super_args = super_class.args
- super_ancestors = instance_ancestors(super_name, building_ancestors: building_ancestors).apply(super_args, location: entry.primary.decl.location)
+ super_ancestors =
+ instance_ancestors(super_name, building_ancestors: building_ancestors)
+ .apply(super_args, env: env, location: entry.primary.decl.super_class&.location)
super_ancestors.map! {|ancestor| fill_ancestor_source(ancestor, name: super_name, source: :super) }
ancestors.unshift(*super_ancestors)
end
end
@@ -475,11 +477,14 @@
if included_modules = one_ancestors.included_modules
included_modules.each do |mod|
name = mod.name
arg_types = mod.args
- mod_ancestors = instance_ancestors(name, building_ancestors: building_ancestors).apply(arg_types, location: entry.primary.decl.location)
+ mod.source.is_a?(AST::Members::Include) or raise
+ mod_ancestors =
+ instance_ancestors(name, building_ancestors: building_ancestors)
+ .apply(arg_types, env: env, location: mod.source.location)
mod_ancestors.map! {|ancestor| fill_ancestor_source(ancestor, name: name, source: mod.source) }
ancestors.unshift(*mod_ancestors)
end
end
@@ -487,11 +492,14 @@
if prepended_modules = one_ancestors.prepended_modules
prepended_modules.each do |mod|
name = mod.name
arg_types = mod.args
- mod_ancestors = instance_ancestors(name, building_ancestors: building_ancestors).apply(arg_types, location: entry.primary.decl.location)
+ mod.source.is_a?(AST::Members::Prepend) or raise
+ mod_ancestors =
+ instance_ancestors(name, building_ancestors: building_ancestors)
+ .apply(arg_types, env: env, location: mod.source.location)
mod_ancestors.map! {|ancestor| fill_ancestor_source(ancestor, name: name, source: mod.source) }
ancestors.unshift(*mod_ancestors)
end
end
@@ -522,11 +530,13 @@
case super_class = one_ancestors.super_class
when Definition::Ancestor::Instance
super_name = super_class.name
super_args = super_class.args
- super_ancestors = instance_ancestors(super_name, building_ancestors: building_ancestors).apply(super_args, location: entry.primary.decl.location)
+ super_ancestors =
+ instance_ancestors(super_name, building_ancestors: building_ancestors)
+ .apply(super_args, env: env, location: nil)
super_ancestors.map! {|ancestor| fill_ancestor_source(ancestor, name: super_name, source: :super) }
ancestors.unshift(*super_ancestors)
when Definition::Ancestor::Singleton
super_name = super_class.name
@@ -537,11 +547,14 @@
extended_modules = one_ancestors.extended_modules or raise
extended_modules.each do |mod|
name = mod.name
args = mod.args
- mod_ancestors = instance_ancestors(name, building_ancestors: building_ancestors).apply(args, location: entry.primary.decl.location)
+ mod.source.is_a?(AST::Members::Extend) or raise
+ mod_ancestors =
+ instance_ancestors(name, building_ancestors: building_ancestors)
+ .apply(args, env: env, location: mod.source.location)
mod_ancestors.map! {|ancestor| fill_ancestor_source(ancestor, name: name, source: mod.source) }
ancestors.unshift(*mod_ancestors)
end
ancestors.unshift(self_ancestor)
@@ -570,10 +583,13 @@
one_ancestors = one_interface_ancestors(type_name)
ancestors = []
included_interfaces = one_ancestors.included_interfaces or raise
included_interfaces.each do |a|
- included_ancestors = interface_ancestors(a.name, building_ancestors: building_ancestors).apply(a.args, location: entry.decl.location)
+ a.source.is_a?(AST::Members::Include) or raise
+ included_ancestors =
+ interface_ancestors(a.name, building_ancestors: building_ancestors)
+ .apply(a.args, env: env, location: a.source.location)
included_ancestors.map! {|ancestor| fill_ancestor_source(ancestor, name: a.name, source: a.source) }
ancestors.unshift(*included_ancestors)
end
ancestors.unshift(self_ancestor)