Skip to content

Commit

Permalink
when checking the arity of monomorphization arguments, only check the…
Browse files Browse the repository at this point in the history
… number of non parent arguments
  • Loading branch information
xunilrj committed Sep 16, 2024
1 parent 0fa1b9a commit f80bd13
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sway-core/src/semantic_analysis/type_check_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1711,16 +1711,23 @@ impl<'a> TypeCheckContext<'a> {
// reported the number of arguments including the implicit self, hence
// we adjust it below
let adjust_for_trait_decl = value.has_self_type_param() as usize;
let num_type_params = num_type_params - adjust_for_trait_decl;
let non_parent_type_params = value
.type_parameters()
.iter()
.filter(|x| !x.is_from_parent)
.count()
- adjust_for_trait_decl;

let num_type_args = num_type_args - adjust_for_trait_decl;
if num_type_params != num_type_args {
if non_parent_type_params != num_type_args {
return Err(handler.emit_err(make_type_arity_mismatch_error(
value.name().clone(),
type_arguments_span,
num_type_args,
num_type_params,
non_parent_type_params,
)));
}

for type_argument in type_arguments.iter_mut() {
type_argument.type_id = self
.resolve(
Expand Down

0 comments on commit f80bd13

Please sign in to comment.