mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Parser: Hint for the mod function when parsing %
Was reported several times: - https://github.com/slint-ui/slint/discussions/4190 - https://github.com/slint-ui/slint/issues/3980
This commit is contained in:
parent
2404cce0bc
commit
2ce161ced8
2 changed files with 18 additions and 0 deletions
12
internal/compiler/tests/syntax/expressions/percent2.slint
Normal file
12
internal/compiler/tests/syntax/expressions/percent2.slint
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
||||
|
||||
component Foo {
|
||||
|
||||
property <int> abc: 45 %;
|
||||
// ^error{Unexpected '%'. For the unit, it should be attached to the number. If you're looking for the modulo operator, use the 'Math.mod\(x, y\)' function}
|
||||
|
||||
property <int> def: abc % 8;
|
||||
// ^error{Unexpected '%'. For the unit, it should be attached to the number. If you're looking for the modulo operator, use the 'Math.mod\(x, y\)' function}
|
||||
// ^^error{Parse error}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue