Repository: slint-ui/slint (language: rust)

Issue:
"Cannot override property 'background'"
<!-- Thanks for opening an issue! 🤗 -->
<!-- IMPORTANT: This issue tracker is for tracking bugs and features request. For questions or help on how to use Slint, please go to the "Discussions" tab -->
<!-- Please mention your platform and the programming language you are using Slint with -->
<!-- For bugs, please give steps on how to reproduce. What is the expected behavior and what do you see instead. -->
<!-- If possible, please include relevant code snippets, in code blocks (```  ```)-->

Consider [this SlintPad demo](https://slintpad.com/?snippet=export+component+Demo+%7B%0A++++Rectangle+%7B%0A++++++++property+%3Ccolor%3E+color%3A+black%3B%0A++++%7D%0A%7D%0A&style=native):

```slint
export component Demo {
    Rectangle {
        property <color> color: black;
    }
}
```

It generates the error message:

> Cannot override property 'background'

I didn't name the property `background`, but `color`!


Discussion / hints:
Hi,

it is meant the `property <brush> background` property that is present on the `Rectangle`. The color property is a remnants of old days and it's a reference to the background property.


Fix patch:
diff --git a/internal/compiler/object_tree.rs b/internal/compiler/object_tree.rs
index 9ba268b4aa7..ade453f45b4 100644
--- a/internal/compiler/object_tree.rs
+++ b/internal/compiler/object_tree.rs
@@ -1013,7 +1013,7 @@ impl Element {
                 Type::Invalid => {} // Ok to proceed with a new declaration
                 _ => {
                     diag.push_error(
-                        format!("Cannot override property '{}'", prop_name),
+                        format!("Cannot override property '{}'", unresolved_prop_name),
                         &prop_decl
                             .DeclaredIdentifier()
                             .child_token(SyntaxKind::Identifier)


Test patch:
diff --git a/internal/compiler/tests/syntax/basic/property_declaration.slint b/internal/compiler/tests/syntax/basic/property_declaration.slint
index 312681c0135..5d04d20b049 100644
--- a/internal/compiler/tests/syntax/basic/property_declaration.slint
+++ b/internal/compiler/tests/syntax/basic/property_declaration.slint
@@ -25,4 +25,7 @@ export Test := Comp {
 
     property<bool> pressed;
 //                 ^error{Cannot declare property 'pressed' when a callback with the same name exists}
+
+    property<color> color;
+//                  ^error{Cannot override property 'color'}
 }