slint/internal/compiler/tests/syntax/analysis/binding_loop_function.slint
2023-07-10 10:12:11 +02:00

32 lines
924 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
Compo1 := Rectangle {
property <int> a : aa();
// ^error{The binding for the property 'a' is part of a binding loop}
pure callback aa() -> int;
function factorial(n: int) -> int {
// ^error{The binding for the property 'factorial' is part of a binding loop}
return n == 0 ? 1 : factorial(n - 1) * n;
}
property <int> b;
public pure function bb() -> int { return b; }
// ^error{The binding for the property 'bb' is part of a binding loop}
}
export App := Rectangle {
cc := Compo1 {
aa() => { return self.a; }
// ^error{The binding for the property 'aa' is part of a binding loop}
b: self.bb();
// ^error{The binding for the property 'b' is part of a binding loop}
}
}