mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 05:14:48 +00:00
Compiler: avoid two error message when trying to call a non-existing function
This commit is contained in:
parent
93142bf417
commit
2564eede9f
2 changed files with 15 additions and 0 deletions
|
@ -891,6 +891,10 @@ impl Expression {
|
||||||
.collect()
|
.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);
|
ctx.diag.push_error("The expression is not a function".into(), &node);
|
||||||
arguments.into_iter().map(|x| x.0).collect()
|
arguments.into_iter().map(|x| x.0).collect()
|
||||||
|
|
|
@ -45,6 +45,17 @@ export Xxx := Rectangle {
|
||||||
|
|
||||||
comp.f3();
|
comp.f3();
|
||||||
// ^error{The function 'f3' is protected}
|
// ^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;
|
callback xx <=> foo;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue