mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Fix compiler panic binding to property with syntax error (#6572)
Fixes #6519
This commit is contained in:
parent
40faf0e1c4
commit
13d44130d9
3 changed files with 28 additions and 0 deletions
|
@ -1562,6 +1562,11 @@ fn resolve_two_way_bindings(
|
|||
|
||||
// Check the compatibility.
|
||||
let mut rhs_lookup = nr.element().borrow().lookup_property(nr.name());
|
||||
if rhs_lookup.property_type == Type::Invalid {
|
||||
// An attempt to resolve this already failed when trying to resolve the property type
|
||||
assert!(diag.has_errors());
|
||||
continue;
|
||||
}
|
||||
rhs_lookup.is_local_to_component &=
|
||||
lookup_ctx.is_local_element(&nr.element());
|
||||
|
||||
|
|
19
internal/compiler/tests/syntax/fuzzing/6519.slint
Normal file
19
internal/compiler/tests/syntax/fuzzing/6519.slint
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
component Button{
|
||||
property<bool>checked
|
||||
}
|
||||
// ^error{Syntax error: expected ';'}
|
||||
export component C{
|
||||
in property<b in
|
||||
// ^error{Syntax error: expected '>'}
|
||||
Button {
|
||||
// ^error{Syntax error: expected ';'}
|
||||
checked<=>in obal
|
||||
// ^error{Syntax error: expected ';'}
|
||||
// ^^error{Parse error}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ export component Button {
|
|||
in property<bool> enabled : true;
|
||||
out property <bool> pressed;
|
||||
in-out property <bool> checked;
|
||||
property <bool> internal;
|
||||
callback clicked();
|
||||
}
|
||||
|
||||
|
@ -304,6 +305,9 @@ export component C12 {
|
|||
in property <bool> in5 <=> inout1;
|
||||
// ^error{Cannot link input property}
|
||||
|
||||
in property <bool> boggus1 <=> btn.internal;
|
||||
// ^error{The property 'internal' is private. Annotate it with}
|
||||
|
||||
in-out property <bool> inout1;
|
||||
|
||||
btn := Button {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue