228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/rbs/definition.rb', line 228
def apply(args, location:)
InvalidTypeApplicationError.check!(
type_name: type_name,
args: args,
params: params,
location: location
)
subst = Substitution.build(params, args)
ancestors.map do |ancestor|
case ancestor
when Ancestor::Instance
if ancestor.args.empty?
ancestor
else
Ancestor::Instance.new(
name: ancestor.name,
args: ancestor.args.map {|type| type.sub(subst) },
source: ancestor.source
)
end
when Ancestor::Singleton
ancestor
end
end
end
|