Compiler: avoid two error message when trying to call a non-existing function

This commit is contained in:
Olivier Goffart 2024-01-24 18:02:02 +01:00
parent 93142bf417
commit 2564eede9f
2 changed files with 15 additions and 0 deletions

View file

@ -891,6 +891,10 @@ impl Expression {
.collect()
}
}
Type::Invalid => {
debug_assert!(ctx.diag.has_error());
arguments.into_iter().map(|x| x.0).collect()
}
_ => {
ctx.diag.push_error("The expression is not a function".into(), &node);
arguments.into_iter().map(|x| x.0).collect()

View file

@ -45,6 +45,17 @@ export Xxx := Rectangle {
comp.f3();
// ^error{The function 'f3' is protected}
notexist();
// ^error{Unknown unqualified identifier 'notexist'}
comp.notexist(56, foo("fff"));
// ^error{Element 'Comp' does not have a property 'notexist'}
// ^^error{Cannot convert string to int}
45()()();
// ^error{The expression is not a function}
(foo)(1);
// ^error{'foo' must be called. Did you forgot the '\(\)'}
}
callback xx <=> foo;