slint/internal/compiler/tests/syntax/focus/focus_wrong_args.slint
Olivier Goffart c553eb4398
compiler: Don't panic when using foo.focus(something)
Just ignore the case where focus has more argument that planed as it has
been reported as an error earlier.

Also fix the error message for calling member function with the wrong
number of argument to not include the base in the count.

Fix #4883
2024-03-19 11:06:08 +01:00

22 lines
No EOL
595 B
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
export component WrongFocus {
fs := FocusScope {}
ta := TouchArea {
clicked => {
fs.focus(0);
// ^error{The callback or function expects 0 arguments, but 1 are provided}
ta.focus();
// ^error{focus\(\) can only be called on focusable elements}
ta.focus(0);
// ^error{The callback or function expects 0 arguments, but 1 are provided}
}
}
}