Skip to content

Provide fix-its when implementing a protocol method with bridged types. #2799

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

Merged

Conversation

jrose-apple
Copy link
Contributor

This is the protocol version of 7bfdd4a: if a protocol requirement has a newly-bridged type (say, 'URL' instead of NSURL), then any conforming types will need to update their implementations of the requirement. Reuse the override-checking mechanism to do so when we're reasonably confident about it.

This slots the checking into the existing protocol diagnostics, which
doesn't result in the best user experience.

note: protocol requires property 'prop' with type 'Refrigerator?'
  var prop: Refrigerator? { get }
      ^
note: candidate has non-matching type 'APPRefrigerator?'
  var prop: APPRefrigerator? {
      ^     ~~~~~~~~~~~~~~~~
            Refrigerator?

But we can come back and improve that later; right now this is better
than nothing.

rdar://problem/26237030


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

This is the protocol version of 7bfdd4a: if a protocol requirement
has a newly-bridged type (say, 'URL' instead of 'NSURL'), then any
conforming types will need to update their implementations of the
requirement. Reuse the override-checking mechanism to do so when
we're reasonably confident about it.

This slots the checking into the existing protocol diagnostics, which
doesn't result in the best user experience.

    note: protocol requires property 'prop' with type 'Refrigerator?'
      var prop: Refrigerator? { get }
          ^
    note: candidate has non-matching type 'APPRefrigerator?'
      var prop: APPRefrigerator? {
          ^     ~~~~~~~~~~~~~~~~
                Refrigerator?

But we can come back and improve that later; right now this is better
than nothing.

rdar://problem/26237030
@jrose-apple
Copy link
Contributor Author

@DougGregor It's starting to get late to pull this into the preview 1 branch, but can you look over it anyway? It's mostly the same as the WIP. I'd also appreciate comments on any important test cases I might have missed, since the space of possible test cases is very large.

@swift-ci Please test

@DougGregor
Copy link
Member

Yeah, this looks good. Protocol conformance failure diagnostics need a mega-overhaul at some point, but this is a step forward for now.

@jrose-apple jrose-apple merged commit 258e2bb into swiftlang:master Jun 1, 2016
@jrose-apple jrose-apple deleted the fix-it-value-type-witnesses branch June 1, 2016 21:03
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Jun 1, 2016
…s. (swiftlang#2799)

This is the protocol version of 7bfdd4a: if a protocol requirement
has a newly-bridged type (say, 'URL' instead of 'NSURL'), then any
conforming types will need to update their implementations of the
requirement. Reuse the override-checking mechanism to do so when
we're reasonably confident about it.

This slots the checking into the existing protocol diagnostics, which
doesn't result in the best user experience.

    note: protocol requires property 'prop' with type 'Refrigerator?'
      var prop: Refrigerator? { get }
          ^
    note: candidate has non-matching type 'APPRefrigerator?'
      var prop: APPRefrigerator? {
          ^     ~~~~~~~~~~~~~~~~
                Refrigerator?

But we can come back and improve that later; right now this is better
than nothing.

rdar://problem/26237030
(cherry picked from commit 258e2bb)
tkremenek pushed a commit that referenced this pull request Jun 1, 2016
…s. (#2799) (#2823)

This is the protocol version of 7bfdd4a: if a protocol requirement
has a newly-bridged type (say, 'URL' instead of 'NSURL'), then any
conforming types will need to update their implementations of the
requirement. Reuse the override-checking mechanism to do so when
we're reasonably confident about it.

This slots the checking into the existing protocol diagnostics, which
doesn't result in the best user experience.

    note: protocol requires property 'prop' with type 'Refrigerator?'
      var prop: Refrigerator? { get }
          ^
    note: candidate has non-matching type 'APPRefrigerator?'
      var prop: APPRefrigerator? {
          ^     ~~~~~~~~~~~~~~~~
                Refrigerator?

But we can come back and improve that later; right now this is better
than nothing.

rdar://problem/26237030
(cherry picked from commit 258e2bb)
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.

2 participants