Skip to content

Commit dff19c5

Browse files
committed
Fix assertion failed: lhs_lookup.is_local_to_component
Fixes #6632
1 parent 89bc023 commit dff19c5

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

internal/compiler/passes/resolving.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,10 +1591,12 @@ fn resolve_two_way_bindings(
15911591
.or_default()
15921592
.is_linked = true;
15931593

1594-
if lhs_lookup.property_visibility == PropertyVisibility::Private
1595-
&& !lhs_lookup.is_local_to_component
1594+
if matches!(
1595+
lhs_lookup.property_visibility,
1596+
PropertyVisibility::Private | PropertyVisibility::Output
1597+
) && !lhs_lookup.is_local_to_component
15961598
{
1597-
// Assignment to private property should have been reported earlier
1599+
// invalid property assignment should have been reported earlier
15981600
assert!(diag.has_errors());
15991601
continue;
16001602
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright © SixtyFPS GmbH <[email protected]>
2+
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3+
4+
export component S{
5+
t:=TextInput{
6+
has-focus<=>t.has-focus;
7+
// ^error{Cannot assign to output property 'has-focus'}
8+
}
9+
}

internal/compiler/tests/syntax/new_syntax/two_way_input_output.slint

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,31 @@ export component C13 {
336336
// ^error{Cannot assign to private property 'internal'}
337337
Button { internal <=> self.checked; }
338338
// ^error{Cannot assign to private property 'internal'}
339+
340+
Button { pressed <=> self.pressed; }
341+
// ^error{Cannot assign to output property 'pressed'}
342+
Button { pressed <=> self.checked; }
343+
// ^error{Cannot assign to output property 'pressed'}
344+
Button { pressed <=> self.enabled; }
345+
// ^error{Cannot assign to output property 'pressed'}
346+
Button { pressed <=> self.accessible-checked; }
347+
// ^error{Cannot assign to output property 'pressed'}
348+
Button { pressed <=> self.internal; }
349+
// ^error{Cannot assign to output property 'pressed'}
350+
// ^^error{The property 'internal' is private. Annotate it with}
351+
Button { pressed <=> out; }
352+
// ^error{Cannot assign to output property 'pressed'}
353+
Button { pressed <=> in; }
354+
// ^error{Cannot assign to output property 'pressed'}
355+
Button { pressed <=> inout; }
356+
// ^error{Cannot assign to output property 'pressed'}
357+
Button { pressed <=> priv; }
358+
// ^error{Cannot assign to output property 'pressed'}
359+
339360
}
340361

341362
export Legacy1 := Rectangle {
363+
// ^warning{':=' to declare a component is deprecated}
342364
b1:= Button {}
343365
in property in1 <=> b1.pressed;
344366
// ^warning{Link to a output property is deprecated}

0 commit comments

Comments
 (0)