Skip to content

Conversation

@rudkx
Copy link
Contributor

@rudkx rudkx commented Jul 29, 2016

What's in this pull request?

Fix an issue where an associated type inferred to be Any is allowed to satisfy all same-type constraints on types.

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

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is built incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

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.

For associated types inferred to be Any, we were allowing the type to
satisfy more specific same-type constraints, e.g. Element ==
Character (where Element is the associated type). This is clearly wrong.

The fix here is very specific to empty protocol compositions, and
removes some code in matchTypes() that doesn't make a lot of
sense. Looking back at the history, this was added in a commit that made
a handful of other changes, and it's not clear this particular change
was important for the issues that commit claimed to fix (and in fact
removing this regresses no tests).

Fixes rdar://problem/27515965.

For associated types inferred to be Any, we were allowing the type to
satisfy more specific same-type constraints, e.g. Element ==
Character (where Element is the associated type). This is clearly wrong.

The fix here is very specific to empty protocol compositions, and
removes some code in matchTypes() that doesn't make a lot of
sense. Looking back at the history, this was added in a commit that made
a handful of other changes, and it's not clear this particular change
was important for the issues that commit claimed to fix (and in fact
removing this regresses no tests).

Fixes rdar://problem/27515965.
@rudkx
Copy link
Contributor Author

rudkx commented Jul 29, 2016

@swift-ci Test.

@rudkx
Copy link
Contributor Author

rudkx commented Jul 29, 2016

@DougGregor Doug - can you take a look? I'm not 100% confident that deleting this code is the best fix (e.g. there might be something else going on that means we shouldn't even reach here), but we don't have any tests that expect the current behavior, and the current code doesn't make a lot of sense in context.

@DougGregor
Copy link
Member

This looks like the right fix. I don't know what that code was trying to accomplish, but after you change the SelfObjectOfProtocol constraint kind appears to be dead!

@rudkx
Copy link
Contributor Author

rudkx commented Jul 29, 2016

Thanks!

@rudkx
Copy link
Contributor Author

rudkx commented Jul 29, 2016

I cannot seem to merge this.

@tkremenek Ted, it seems like something is going on with PR testing where it appears to start the tests when you create the PR, but the tests never run, and then in some cases (like this one) it's blocking the merge. Perhaps because I did the full test run rather than smoke tests?

@gottesmm
Copy link
Contributor

@rudkx That is what is happening. This is a known issue. @shahmishal is working on fixing the issue by having the test/merge and the normal test API to set the smoke test values to true. I just think that he needs to finish testing it.

@tkremenek tkremenek merged commit d470fc2 into swiftlang:master Jul 29, 2016
@jckarter
Copy link
Contributor

@rudkx Thanks!

@rudkx rudkx deleted the fix-27515965 branch July 29, 2016 21:16
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.

5 participants