compiler: Warn user when immediately converting gradient macro to color (#6956)

Fixes #6819
This commit is contained in:
crai0 2024-12-02 12:05:38 +00:00 committed by GitHub
parent 35e094e723
commit e4b70efe6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 0 deletions

View file

@ -29,4 +29,6 @@ export X := Rectangle {
// ^error{Unknown unqualified identifier 'r'}
property <brush> g15: @linear-gradient(90deg, brown o, green); // #3241
// ^error{Unknown unqualified identifier 'o'}
property<color> g16: @linear-gradient(0deg, red, green, blue); // #6819
// ^warning{Narrowing conversion from brush to color. This can lead to unexpected behavior because the brush is a gradient}
}

View file

@ -25,4 +25,7 @@ export X := Rectangle {
property<brush> g11: @radial-gradient(circle,);
property<brush> g12: @radial-gradient(circle);
property<color> g13: @radial-gradient(circle, red, green, blue); // #6819
// ^warning{Narrowing conversion from brush to color. This can lead to unexpected behavior because the brush is a gradient}
}