1use crate::records::clone_state::CloneState;
18use crate::records::type_arena::TypeArena;
19use crate::records::type_fun::TypeFun;
20use crate::type_aliases::type_error_data::TypeErrorData;
21use crate::type_aliases::type_id::TypeId;
22use crate::type_aliases::type_pack_id::TypePackId;
23
24fn clone_type(ty: TypeId, dest_arena: &mut TypeArena, clone_state: &mut CloneState) -> TypeId {
26 crate::functions::clone_clone_alt_b::clone(ty, dest_arena, clone_state)
27}
28
29fn clone_pack(
31 tp: TypePackId,
32 dest_arena: &mut TypeArena,
33 clone_state: &mut CloneState,
34) -> TypePackId {
35 crate::functions::clone_clone::clone(tp, dest_arena, clone_state)
36}
37
38fn clone_type_fun(
40 tf: &TypeFun,
41 dest_arena: &mut TypeArena,
42 clone_state: &mut CloneState,
43) -> TypeFun {
44 crate::functions::clone_clone_alt_c::clone(tf, dest_arena, clone_state)
45}
46
47pub trait CopyError {
52 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState);
53}
54
55pub fn copy_error<T: CopyError>(
57 e: &mut T,
58 dest_arena: &mut TypeArena,
59 clone_state: &mut CloneState,
60) {
61 e.copy_error_impl(dest_arena, clone_state);
62}
63
64fn visit_error_data(
68 data: &mut TypeErrorData,
69 dest_arena: &mut TypeArena,
70 clone_state: &mut CloneState,
71) {
72 match data {
73 TypeErrorData::TypeMismatch(e) => copy_error(e, dest_arena, clone_state),
74 TypeErrorData::UnknownSymbol(e) => copy_error(e, dest_arena, clone_state),
75 TypeErrorData::UnknownProperty(e) => copy_error(e, dest_arena, clone_state),
76 TypeErrorData::NotATable(e) => copy_error(e, dest_arena, clone_state),
77 TypeErrorData::CannotExtendTable(e) => copy_error(e, dest_arena, clone_state),
78 TypeErrorData::CannotCompareUnrelatedTypes(e) => copy_error(e, dest_arena, clone_state),
79 TypeErrorData::OnlyTablesCanHaveMethods(e) => copy_error(e, dest_arena, clone_state),
80 TypeErrorData::DuplicateTypeDefinition(e) => copy_error(e, dest_arena, clone_state),
81 TypeErrorData::CountMismatch(e) => copy_error(e, dest_arena, clone_state),
82 TypeErrorData::FunctionDoesNotTakeSelf(e) => copy_error(e, dest_arena, clone_state),
83 TypeErrorData::FunctionRequiresSelf(e) => copy_error(e, dest_arena, clone_state),
84 TypeErrorData::OccursCheckFailed(e) => copy_error(e, dest_arena, clone_state),
85 TypeErrorData::UnknownRequire(e) => copy_error(e, dest_arena, clone_state),
86 TypeErrorData::IncorrectGenericParameterCount(e) => copy_error(e, dest_arena, clone_state),
87 TypeErrorData::SyntaxError(e) => copy_error(e, dest_arena, clone_state),
88 TypeErrorData::CodeTooComplex(e) => copy_error(e, dest_arena, clone_state),
89 TypeErrorData::UnificationTooComplex(e) => copy_error(e, dest_arena, clone_state),
90 TypeErrorData::UnknownPropButFoundLikeProp(e) => copy_error(e, dest_arena, clone_state),
91 TypeErrorData::GenericError(e) => copy_error(e, dest_arena, clone_state),
92 TypeErrorData::InternalError(e) => copy_error(e, dest_arena, clone_state),
93 TypeErrorData::ConstraintSolvingIncompleteError(e) => {
94 copy_error(e, dest_arena, clone_state)
95 }
96 TypeErrorData::CannotCallNonFunction(e) => copy_error(e, dest_arena, clone_state),
97 TypeErrorData::ExtraInformation(e) => copy_error(e, dest_arena, clone_state),
98 TypeErrorData::DeprecatedApiUsed(e) => copy_error(e, dest_arena, clone_state),
99 TypeErrorData::ModuleHasCyclicDependency(e) => copy_error(e, dest_arena, clone_state),
100 TypeErrorData::IllegalRequire(e) => copy_error(e, dest_arena, clone_state),
101 TypeErrorData::FunctionExitsWithoutReturning(e) => copy_error(e, dest_arena, clone_state),
102 TypeErrorData::DuplicateGenericParameter(e) => copy_error(e, dest_arena, clone_state),
103 TypeErrorData::CannotAssignToNever(e) => copy_error(e, dest_arena, clone_state),
104 TypeErrorData::CannotInferBinaryOperation(e) => copy_error(e, dest_arena, clone_state),
105 TypeErrorData::MissingProperties(e) => copy_error(e, dest_arena, clone_state),
106 TypeErrorData::SwappedGenericTypeParameter(e) => copy_error(e, dest_arena, clone_state),
107 TypeErrorData::OptionalValueAccess(e) => copy_error(e, dest_arena, clone_state),
108 TypeErrorData::MissingUnionProperty(e) => copy_error(e, dest_arena, clone_state),
109 TypeErrorData::TypesAreUnrelated(e) => copy_error(e, dest_arena, clone_state),
110 TypeErrorData::NormalizationTooComplex(e) => copy_error(e, dest_arena, clone_state),
111 TypeErrorData::TypePackMismatch(e) => copy_error(e, dest_arena, clone_state),
112 TypeErrorData::DynamicPropertyLookupOnExternTypesUnsafe(e) => {
113 copy_error(e, dest_arena, clone_state)
114 }
115 TypeErrorData::UninhabitedTypeFunction(e) => copy_error(e, dest_arena, clone_state),
116 TypeErrorData::UninhabitedTypePackFunction(e) => copy_error(e, dest_arena, clone_state),
117 TypeErrorData::WhereClauseNeeded(e) => copy_error(e, dest_arena, clone_state),
118 TypeErrorData::PackWhereClauseNeeded(e) => copy_error(e, dest_arena, clone_state),
119 TypeErrorData::CheckedFunctionCallError(e) => copy_error(e, dest_arena, clone_state),
120 TypeErrorData::NonStrictFunctionDefinitionError(e) => {
121 copy_error(e, dest_arena, clone_state)
122 }
123 TypeErrorData::PropertyAccessViolation(e) => copy_error(e, dest_arena, clone_state),
124 TypeErrorData::CheckedFunctionIncorrectArgs(e) => copy_error(e, dest_arena, clone_state),
125 TypeErrorData::UnexpectedTypeInSubtyping(e) => copy_error(e, dest_arena, clone_state),
126 TypeErrorData::UnexpectedTypePackInSubtyping(e) => copy_error(e, dest_arena, clone_state),
127 TypeErrorData::ExplicitFunctionAnnotationRecommended(e) => {
128 copy_error(e, dest_arena, clone_state)
129 }
130 TypeErrorData::UserDefinedTypeFunctionError(e) => copy_error(e, dest_arena, clone_state),
131 TypeErrorData::BuiltInTypeFunctionError(e) => copy_error(e, dest_arena, clone_state),
132 TypeErrorData::ReservedIdentifier(e) => copy_error(e, dest_arena, clone_state),
133 TypeErrorData::UnexpectedArrayLikeTableItem(e) => copy_error(e, dest_arena, clone_state),
134 TypeErrorData::CannotCheckDynamicStringFormatCalls(e) => {
135 copy_error(e, dest_arena, clone_state)
136 }
137 TypeErrorData::GenericTypeCountMismatch(e) => copy_error(e, dest_arena, clone_state),
138 TypeErrorData::GenericTypePackCountMismatch(e) => copy_error(e, dest_arena, clone_state),
139 TypeErrorData::MultipleNonviableOverloads(e) => copy_error(e, dest_arena, clone_state),
140 TypeErrorData::RecursiveRestraintViolation(e) => copy_error(e, dest_arena, clone_state),
141 TypeErrorData::GenericBoundsMismatch(e) => copy_error(e, dest_arena, clone_state),
142 TypeErrorData::UnappliedTypeFunction(e) => copy_error(e, dest_arena, clone_state),
143 TypeErrorData::InstantiateGenericsOnNonFunction(e) => {
144 copy_error(e, dest_arena, clone_state)
145 }
146 TypeErrorData::TypeInstantiationCountMismatch(e) => copy_error(e, dest_arena, clone_state),
147 TypeErrorData::AmbiguousFunctionCall(e) => copy_error(e, dest_arena, clone_state),
148 }
149}
150
151impl CopyError for crate::records::type_mismatch::TypeMismatch {
156 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
157 self.wanted_type = clone_type(self.wanted_type, dest_arena, clone_state);
158 self.given_type = clone_type(self.given_type, dest_arena, clone_state);
159
160 if let Some(error) = self.error.as_mut() {
161 visit_error_data(
162 &mut alloc::sync::Arc::make_mut(error).data,
163 dest_arena,
164 clone_state,
165 );
166 }
167 }
168}
169
170impl CopyError for crate::records::unknown_symbol::UnknownSymbol {
171 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
172}
173
174impl CopyError for crate::records::unknown_property::UnknownProperty {
175 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
176 self.table = clone_type(self.table, dest_arena, clone_state);
177 }
178}
179
180impl CopyError for crate::records::not_a_table::NotATable {
181 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
182 self.ty = clone_type(self.ty, dest_arena, clone_state);
183 }
184}
185
186impl CopyError for crate::records::cannot_extend_table::CannotExtendTable {
187 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
188 self.table_type = clone_type(self.table_type, dest_arena, clone_state);
189 }
190}
191
192impl CopyError for crate::records::cannot_compare_unrelated_types::CannotCompareUnrelatedTypes {
193 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
194 self.left = clone_type(self.left, dest_arena, clone_state);
195 self.right = clone_type(self.right, dest_arena, clone_state);
196 }
197}
198
199impl CopyError for crate::records::only_tables_can_have_methods::OnlyTablesCanHaveMethods {
200 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
201 self.table_type = clone_type(self.table_type, dest_arena, clone_state);
202 }
203}
204
205impl CopyError for crate::records::duplicate_type_definition::DuplicateTypeDefinition {
206 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
207}
208
209impl CopyError for crate::records::count_mismatch::CountMismatch {
210 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
211}
212
213impl CopyError for crate::records::function_does_not_take_self::FunctionDoesNotTakeSelf {
214 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
215}
216
217impl CopyError for crate::records::function_requires_self::FunctionRequiresSelf {
218 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
219}
220
221impl CopyError for crate::records::occurs_check_failed::OccursCheckFailed {
222 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
223}
224
225impl CopyError for crate::records::unknown_require::UnknownRequire {
226 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
227}
228
229impl CopyError
230 for crate::records::incorrect_generic_parameter_count::IncorrectGenericParameterCount
231{
232 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
233 self.type_fun = clone_type_fun(&self.type_fun, dest_arena, clone_state);
234 }
235}
236
237impl CopyError for crate::records::syntax_error::SyntaxError {
238 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
239}
240
241impl CopyError for crate::records::code_too_complex::CodeTooComplex {
242 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
243}
244
245impl CopyError for crate::records::unification_too_complex::UnificationTooComplex {
246 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
247}
248
249impl CopyError for crate::records::unknown_prop_but_found_like_prop::UnknownPropButFoundLikeProp {
250 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
251 self.table = clone_type(self.table, dest_arena, clone_state);
252 }
253}
254
255impl CopyError for crate::records::generic_error::GenericError {
256 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
257}
258
259impl CopyError for crate::records::internal_error::InternalError {
260 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
261}
262
263impl CopyError
264 for crate::records::constraint_solving_incomplete_error::ConstraintSolvingIncompleteError
265{
266 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
267}
268
269impl CopyError for crate::records::cannot_call_non_function::CannotCallNonFunction {
270 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
271 self.ty = clone_type(self.ty, dest_arena, clone_state);
272 }
273}
274
275impl CopyError for crate::records::extra_information::ExtraInformation {
276 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
277}
278
279impl CopyError for crate::records::deprecated_api_used::DeprecatedApiUsed {
280 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
281}
282
283impl CopyError for crate::records::module_has_cyclic_dependency::ModuleHasCyclicDependency {
284 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
285}
286
287impl CopyError for crate::records::illegal_require::IllegalRequire {
288 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
289}
290
291impl CopyError for crate::records::function_exits_without_returning::FunctionExitsWithoutReturning {
292 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
293 self.expected_return_type = clone_pack(self.expected_return_type, dest_arena, clone_state);
294 }
295}
296
297impl CopyError for crate::records::duplicate_generic_parameter::DuplicateGenericParameter {
298 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
299}
300
301impl CopyError for crate::records::cannot_infer_binary_operation::CannotInferBinaryOperation {
302 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
303}
304
305impl CopyError for crate::records::missing_properties::MissingProperties {
306 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
307 self.super_type = clone_type(self.super_type, dest_arena, clone_state);
308 self.sub_type = clone_type(self.sub_type, dest_arena, clone_state);
309 }
310}
311
312impl CopyError for crate::records::swapped_generic_type_parameter::SwappedGenericTypeParameter {
313 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
314}
315
316impl CopyError for crate::records::optional_value_access::OptionalValueAccess {
317 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
318 self.optional = clone_type(self.optional, dest_arena, clone_state);
319 }
320}
321
322impl CopyError for crate::records::missing_union_property::MissingUnionProperty {
323 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
324 self.r#type = clone_type(self.r#type, dest_arena, clone_state);
325
326 for ty in self.missing.iter_mut() {
327 *ty = clone_type(*ty, dest_arena, clone_state);
328 }
329 }
330}
331
332impl CopyError for crate::records::types_are_unrelated::TypesAreUnrelated {
333 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
334 self.left = clone_type(self.left, dest_arena, clone_state);
335 self.right = clone_type(self.right, dest_arena, clone_state);
336 }
337}
338
339impl CopyError for crate::records::normalization_too_complex::NormalizationTooComplex {
340 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
341}
342
343impl CopyError for crate::records::type_pack_mismatch::TypePackMismatch {
344 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
345 self.wanted_tp = clone_pack(self.wanted_tp, dest_arena, clone_state);
346 self.given_tp = clone_pack(self.given_tp, dest_arena, clone_state);
347 }
348}
349
350impl CopyError for crate::records::dynamic_property_lookup_on_extern_types_unsafe::DynamicPropertyLookupOnExternTypesUnsafe {
351 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
352 self.ty = clone_type(self.ty, dest_arena, clone_state);
353 }
354}
355
356impl CopyError for crate::records::uninhabited_type_function::UninhabitedTypeFunction {
357 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
358 self.ty = clone_type(self.ty, dest_arena, clone_state);
359 }
360}
361
362impl CopyError for crate::records::explicit_function_annotation_recommended::ExplicitFunctionAnnotationRecommended {
363 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
364 self.recommended_return = clone_type(self.recommended_return, dest_arena, clone_state);
365 for (_, t) in self.recommended_args.iter_mut() {
366 *t = clone_type(*t, dest_arena, clone_state);
367 }
368 }
369}
370
371impl CopyError for crate::records::uninhabited_type_pack_function::UninhabitedTypePackFunction {
372 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
373 self.tp = clone_pack(self.tp, dest_arena, clone_state);
374 }
375}
376
377impl CopyError for crate::records::where_clause_needed::WhereClauseNeeded {
378 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
379 self.ty = clone_type(self.ty, dest_arena, clone_state);
380 }
381}
382
383impl CopyError for crate::records::pack_where_clause_needed::PackWhereClauseNeeded {
384 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
385 self.tp = clone_pack(self.tp, dest_arena, clone_state);
386 }
387}
388
389impl CopyError for crate::records::checked_function_call_error::CheckedFunctionCallError {
390 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
391 self.expected = clone_type(self.expected, dest_arena, clone_state);
392 self.passed = clone_type(self.passed, dest_arena, clone_state);
393 }
394}
395
396impl CopyError
397 for crate::records::non_strict_function_definition_error::NonStrictFunctionDefinitionError
398{
399 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
400 self.argument_type = clone_type(self.argument_type, dest_arena, clone_state);
401 }
402}
403
404impl CopyError for crate::records::property_access_violation::PropertyAccessViolation {
405 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
406 self.table = clone_type(self.table, dest_arena, clone_state);
407 }
408}
409
410impl CopyError for crate::records::checked_function_incorrect_args::CheckedFunctionIncorrectArgs {
411 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
412}
413
414impl CopyError for crate::records::unexpected_type_in_subtyping::UnexpectedTypeInSubtyping {
415 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
416 self.ty = clone_type(self.ty, dest_arena, clone_state);
417 }
418}
419
420impl CopyError
421 for crate::records::unexpected_type_pack_in_subtyping::UnexpectedTypePackInSubtyping
422{
423 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
424 self.tp = clone_pack(self.tp, dest_arena, clone_state);
425 }
426}
427
428impl CopyError for crate::records::user_defined_type_function_error::UserDefinedTypeFunctionError {
429 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
430}
431
432impl CopyError for crate::records::built_in_type_function_error::BuiltInTypeFunctionError {
433 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
434}
435
436impl CopyError for crate::records::cannot_assign_to_never::CannotAssignToNever {
437 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
438 self.rhsType = clone_type(self.rhsType, dest_arena, clone_state);
439
440 for ty in self.cause.iter_mut() {
441 *ty = clone_type(*ty, dest_arena, clone_state);
442 }
443 }
444}
445
446impl CopyError for crate::records::unexpected_array_like_table_item::UnexpectedArrayLikeTableItem {
447 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
448}
449
450impl CopyError for crate::records::reserved_identifier::ReservedIdentifier {
451 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
452}
453
454impl CopyError for crate::records::cannot_check_dynamic_string_format_calls::CannotCheckDynamicStringFormatCalls {
455 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
456}
457
458impl CopyError for crate::records::generic_type_count_mismatch::GenericTypeCountMismatch {
459 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
460}
461
462impl CopyError for crate::records::generic_type_pack_count_mismatch::GenericTypePackCountMismatch {
463 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
464}
465
466impl CopyError for crate::records::multiple_nonviable_overloads::MultipleNonviableOverloads {
467 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
468}
469
470impl CopyError for crate::records::recursive_restraint_violation::RecursiveRestraintViolation {
471 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
472}
473
474impl CopyError for crate::records::generic_bounds_mismatch::GenericBoundsMismatch {
475 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
476 for lower_bound in self.lower_bounds.iter_mut() {
477 *lower_bound = clone_type(*lower_bound, dest_arena, clone_state);
478 }
479 for upper_bound in self.upper_bounds.iter_mut() {
480 *upper_bound = clone_type(*upper_bound, dest_arena, clone_state);
481 }
482 }
483}
484
485impl CopyError
486 for crate::records::instantiate_generics_on_non_function::InstantiateGenericsOnNonFunction
487{
488 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
489}
490
491impl CopyError
492 for crate::records::type_instantiation_count_mismatch::TypeInstantiationCountMismatch
493{
494 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
495 self.functionType = clone_type(self.functionType, dest_arena, clone_state);
496 }
497}
498
499impl CopyError for crate::records::unapplied_type_function::UnappliedTypeFunction {
500 fn copy_error_impl(&mut self, _dest_arena: &mut TypeArena, _clone_state: &mut CloneState) {}
501}
502
503impl CopyError for crate::records::ambiguous_function_call::AmbiguousFunctionCall {
504 fn copy_error_impl(&mut self, dest_arena: &mut TypeArena, clone_state: &mut CloneState) {
505 self.function = clone_type(self.function, dest_arena, clone_state);
506 self.arguments = clone_pack(self.arguments, dest_arena, clone_state);
507 }
508}