1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4Abc := Rectangle {
5 function par() {}
6}
7
8export Xxx := Rectangle {
9 function fooo(a: int, a: int) -> int { return a; }
10// ^error{Duplicated argument name 'a'}
11
12 function plop2() -> int {
13// ^error{Cannot convert string to int}
14 return 45;
15 "xxx"
16 }
17
18 function plop3() { return 45; "xxx" }
19
20 function plop4(string: int) -> int { return "45"; }
21// ^error{Cannot convert string to int}
22
23 function plop5() { plop4("456") }
24// ^error{Cannot convert string to int}
25
26
27 function background() {}
28// ^error{Cannot declare function 'background' when a property with the same name exists}
29
30
31 Abc {
32 property <int> par;
33// ^error{Cannot declare property 'par' when a function with the same name exists}
34 callback par();
35// ^error{Cannot declare callback 'par' when a function with the same name exists}
36 }
37
38 TouchArea {
39 function clicked() {}
40// ^error{Cannot override 'clicked'}
41 }
42
43 Abc { par => {} }
44// ^error{'par' is not a callback in Abc}
45 aa := Abc { par: 42; }
46// ^error{Cannot assign to par in Abc because it does not have a valid property type}
47 Abc { par <=> aa.par; }
48// ^error{Cannot assign to par in Abc because it does not have a valid property type}
49// ^^error{Cannot bind to a function}
50// ^^^error{The function 'par' is private. Annotate it with 'public' to make it accessible from other components}
51 fooo => {}
52// ^error{'fooo' is not a callback in Rectangle}
53
54}
55