From e615794a5f7120cc8dcccdd033d2c87b9fde5942 Mon Sep 17 00:00:00 2001 From: CohenArthur Date: Sun, 16 Jan 2022 20:33:59 +0100 Subject: [PATCH] function_call: Error out if call contains generics despite declaration not having any --- src/instruction/function_call.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/instruction/function_call.rs b/src/instruction/function_call.rs index d5e38e04..eb79cc20 100644 --- a/src/instruction/function_call.rs +++ b/src/instruction/function_call.rs @@ -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) => {