Skip to content

Commit

Permalink
function_call: Error out if call contains generics despite declaratio…
Browse files Browse the repository at this point in the history
…n not having any
  • Loading branch information
CohenArthur committed Jan 16, 2022
1 parent 22db7ce commit 19f5f0b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/instruction/function_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,15 @@ impl Generic for FunctionCall {
None => return,
};

if !self.generics.is_empty() && dec.generics().is_empty() {
// FIXME: Format generic list in error too
ctx.error(Error::new(ErrKind::Generics).with_msg(format!(
"calling non-generic function with generic arguments: `{}`",
self.name()
)));
return;
}

let type_map =
match GenericMap::create(dec.generics(), &self.generics, &mut ctx.typechecker) {
Err(e) => {
Expand Down

0 comments on commit 19f5f0b

Please sign in to comment.