-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect dingind loops that applies to the Window itself
The Window geometry depends on its constraints, so its constraints cannot depends on its geometry This fixes Infinitely growing layout, and other panics Fixes #3989 Fixes #2902
- Loading branch information
Showing
5 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
internal/compiler/tests/syntax/analysis/binding_loop_window.slint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright © SixtyFPS GmbH <info@slint.dev> | ||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial | ||
|
||
// Issue #2902 | ||
|
||
import { HorizontalBox, VerticalBox } from "std-widgets.slint"; | ||
|
||
export component MainWindow inherits Window { | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
|
||
HorizontalBox { | ||
// ^error{The binding for the property 'width' is part of a binding loop} | ||
// ^^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
|
||
VerticalBox { | ||
|
||
width: parent.width; | ||
// ^error{The binding for the property 'width' is part of a binding loop} | ||
//height: parent.height; | ||
Text { | ||
text: "Test"; | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/compiler/tests/syntax/analysis/binding_loop_window2.slint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright © SixtyFPS GmbH <info@slint.dev> | ||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial | ||
|
||
// Issue #3898 | ||
export component LspCrash inherits Rectangle { | ||
// ^error{The binding for the property 'width' is part of a binding loop} | ||
// ^^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
// ^^^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
|
||
HorizontalLayout { | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
padding-left: parent.width * 0.015; | ||
// ^error{The binding for the property 'padding-left' is part of a binding loop} | ||
Rectangle {} | ||
} | ||
} |