-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No errors/warnings are thrown when using wrong attributes. #965
Comments
This is likely linked to our qobject tagged type item, we likely aren't passing through attributes like we do for other places like methods ? But we should also check that the same is working for methods too etc. |
@ahayzen-kdab This is a problem I've not yet found a very clean way to handle in our parser/generator. For most of the types we parse, there's a predefined list of attributes that we allow, like Maybe we should just list all allowed properties every time we parse and check that no other exist? |
@LeonMatthesKDAB right sounds like something for the checks phase. However for other things i thought was pass through unknown attributes? eg cxx-qt/crates/cxx-qt-gen/test_inputs/passthrough_and_naming.rs Lines 140 to 143 in 309190a
As we can see in the test outputs cxx-qt/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs Lines 264 to 268 in 309190a
I assume we are doing this for all methods ? (invokables, signals, overrrides etc). But we should also do it for attributes on the unsafe extern "C++Qt" {
#[my_attribute]
#[qobject]
type QPushButton;
}
extern "RustQt" {
#[my_attribute]
#[qobject]
type MyObject = super::MyObjectRust;
} should probably generate the following? unsafe extern "C++" {
#[my_attribute]
type QPushButton;
}
unsafe extern "C++" {
#[my_attribute]
type MyObject;
}
extern "Rust" {
type MyObjectRust;
} If they did this then at least any unknown attributes would fail to compile in Rust rather than silently failing ? As part of your refactoring we should have a map available of the original attributes for a token so then we should be able to tag the original attributes with some filters of known attributes? |
Well that's really the question, whether we want to pass anything unknown through to CXX, or whether we throw an error... Not so sure about that, but either way we need to figure out which attributes we've computed ourselves and which remain to be passed through/errored on. |
@BenFordTytherington That should be done as of #1063 , right? Can you confirm? |
When using a wrong attribute macro inside an extern block, there are no errors or warning. It would help a lot to have some sort of compile time sanitation to avoid user error.
Context: I spent a while to figure out why my properties were not exposed to QML when the error was using
#[qml_property]
instead of#[qproperty]
The text was updated successfully, but these errors were encountered: