slint/internal/compiler/tests/syntax/basic/arithmetic_op.slint
Simon Hausmann 24dcef5fed
First stage of cleaning up the export handling of the slint root component (#2095)
We implicitly export the last component of a .slint file to the generator.
Issue a warning when that happens and suggest to export it explicitly.
2023-01-23 15:19:49 +01:00

34 lines
1.4 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
export SuperSimple := Rectangle {
property<duration> p1: 3s + 1ms;
property<int> p2: 3s + 1;
// ^error{Cannot convert float to duration}
property<int> p3: 3s - 1;
// ^error{Cannot convert float to duration}
property<int> p4: 3 / 1ms;
// ^error{Cannot convert \(ms⁻¹\) to int}
property<duration> p5: 3ms * 1;
property<duration> p6: 3ms * 1s;
// ^error{Cannot convert \(ms²\) to duration}
property<int> p7: "hello" * 1;
// ^error{Cannot convert string to float}
property<int> p8: 1 - "hello" - 1;
// ^error{Cannot convert string to float}
property<string> p9: 1 + "hello" + 1;
property<int> p10: "hello" + 1ms;
// ^error{Cannot convert duration to string}
property<length> p11: 1ms * 1px *3px / 1deg * 3 / (30px * 1s - 3px * 1ms) * 2deg;
property<int> p12: 1ms * 3s / 3px / (2deg * 5turn) * 2s / 3phx;
// ^error{Cannot convert \(ms³×phx⁻¹×px⁻¹×deg⁻²\) to int}
property <brush> bru: background + background;
// ^error{Cannot convert brush to float}
// ^^error{Cannot convert brush to float}
}