Skip to content

Conversation

@CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Nov 10, 2020

We don't expect swiftinterface files to have anything meaningful to
report from these checks anyhow - they will have been run at module
generation time anyways.

In fact, the linked radar demonstrates how this kind of checking can be
detrimental to the usability of the compiler. The test committed here
declares the CoreFeatures framework, an Objective-C (root) class and a
set of Objective-C protocols. Now for the fun part: The Objective-C
class is made to conform to the Objective-C protocols in a Swift
extension. This extension is then printed into the generated
CoreFeatures-Swift header and made available to clients of the module.

Now, because we have an Objective-C protocol and a base class that is
imported from Objective-C, we mirror-in the members of RootProtocol.
The sum total of the monster we have built is that we now have a Swift
class that implements some requirements, and an Objective-C protocol
that has requirements mirrored into that same class. The result is
a raft of spurious selector conflict diagnostics that the user cannot
work around unless they own both the class and the protocol.

Exempt swiftinterface files from this checking.

rdar://69550935

We don't expect swiftinterface files to have anything meaningful to
report from these checks anyhow - they will have been run at module
generation time anyways.

In fact, the linked radar demonstrates how this kind of checking can be
detrimental to the usability of the compiler. The test committed here
declares the CoreFeatures framework, an Objective-c (root) class and a
set of Objective-C protocols. Now for the fun part: The Objective-C
class is made to conform to the Objective-C protocols in a Swift
extension. This extension is then printed into the generated
CoreFeatures-Swift header and made available to clients of the module.

Now, because we have an Objective-C protocol and a base class that is
imported from Objective-C, we mirror-in the members of RootProtocol.
The sum total of the monster we have built is that we now have a Swift
class that implements some requirements, and an Objective-C protocol
that has requirements mirrored into that same class. The result is
a raft of spurious selector conflict diagnostics that the user cannot
work around unless they own both the class and the protocol.

Exempt swiftinterface files from this checking.

rdar://69550935
@CodaFi CodaFi requested a review from DougGregor November 10, 2020 01:06
@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 10, 2020

@swift-ci test

@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 10, 2020

@swift-ci test source compatibility

1 similar comment
@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 10, 2020

@swift-ci test source compatibility

@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 10, 2020

@CodaFi CodaFi merged commit 58f7ac6 into swiftlang:main Nov 10, 2020
@CodaFi CodaFi deleted the a-mirror-into-the-soul-of-the-compiler branch November 10, 2020 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant