diff --git a/internal/compiler/passes/resolving.rs b/internal/compiler/passes/resolving.rs index c96ce3e75..d5edb8a1d 100644 --- a/internal/compiler/passes/resolving.rs +++ b/internal/compiler/passes/resolving.rs @@ -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() diff --git a/internal/compiler/tests/syntax/functions/functions_call.slint b/internal/compiler/tests/syntax/functions/functions_call.slint index 730412c3f..831506ba2 100644 --- a/internal/compiler/tests/syntax/functions/functions_call.slint +++ b/internal/compiler/tests/syntax/functions/functions_call.slint @@ -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;