Unexpected behaviour with @warn_unqualified_access and Swift 6
Originator: | jcparis | ||
Number: | rdar://FB16272848 | Date Originated: | 2025-01-09 |
Status: | Open | Resolved: | |
Product: | Swift | Product Version: | 6 |
Classification: | Incorrect/Unexpected Behavior | Reproducible: | Yes |
Given a function `foo` defined in an extension of `View`, when marking it with `@warn_unqualified_access` like this: ``` struct ContentView: View { var body: some View { Text("Hello, world!") .foo() } } extension View { @warn_unqualified_access func foo() -> some View { self.padding() } } ``` When compiling with Swift 6, the following warning triggers: ``` warning: use of 'foo' treated as a reference to instance method in protocol 'View' .foo() ^ ``` It doesn't trigger (as expected) on Swift 5. It is also trigger on Swift 5 with StrictConcurrency upcoming feature flag enabled (unexpected).
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at feedbackassistant.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!