-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.3][Property Wrappers] For now, don't allow wrappedValue and projectedValue to have dynamic Self type. #31427
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
[5.3][Property Wrappers] For now, don't allow wrappedValue and projectedValue to have dynamic Self type. #31427
Conversation
to have dynamic Self type.
@swift-ci please test |
@@ -2862,7 +2862,7 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) { | |||
|
|||
// If the nominal type is a property wrapper type, we can be delegating | |||
// through a property. | |||
if (nominal->getPropertyWrapperTypeInfo()) { | |||
if (nominal->getAttrs().hasAttribute<PropertyWrapperAttr>()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this change do? I’m not objecting, just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change only suppresses the cannot be used as attribute
diagnostic in the case where the nominal type for the custom attribute type is declared as @propertyWrapper
but there's some other error, such as the type not having a non-static wrappedValue
property
wrappedValue/projectedValue to also cover optional.
@swift-ci please test |
Build failed |
Build failed |
Cherry-picked from #31344 and it's follow-up #31443
Currently, when wrappedValue or projectedValue have dynamic Self type, the synthesized properties when using the wrapper will also get a dynamic Self type, but in a new context. This bug could manifest as really misleading diagnostics, or a crash. For now, we will disallow this, but we can re-visit implementing correct support for this in the future.
Resolves: rdar://problem/53258469