Skip to content
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

SILGen: Open-code materializeForSet in more situations. #15890

Merged

Conversation

jckarter
Copy link
Member

Since this code was first written, we've added more language features that introduce the opportunity for a materializeForSet protocol witness to have an incompatible polymorphic convention with its concrete implementation:

  • In a conditional conformance, if a witness comes from a constrained extension with additional protocol requirements, then the witness will require those conformances as additional polymorphic arguments, making its materializeForSet uncallable from code using the protocol witness.
  • Given a subscript requirement, the witness may be a generic subscript with a more general signature than the witness, making the generic arguments to the concrete materializeForSet callback incompatible with those expected for the witness.

Longer term, representing materializeForSet patterns using accessor coroutines should obviate the need for this hack. For now, it's necessary for correctness, addressing rdar://problem/35760754.

@jckarter
Copy link
Member Author

@swift-ci Please test

@jckarter
Copy link
Member Author

@rjmccall Even if we don't manage to achieve accessor coroutines, do you think it'd make sense to pass the generic context to the materializeForSet callback through its context buffer?

Copy link
Member

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but can you add an execution test for the conditional conformance case (either stand-alone, or using the stdlib Slice type), as well as the generic subscript test case from my JIRA?

Since this code was first written, we've added more language features that introduce the opportunity for a materializeForSet protocol witness to have an incompatible polymorphic convention with its concrete implementation:

- In a conditional conformance, if a witness comes from a constrained extension with additional protocol requirements, then the witness will require those conformances as additional polymorphic arguments, making its materializeForSet uncallable from code using the protocol witness.
- Given a subscript requirement, the witness may be a generic subscript with a more general signature than the witness, making the generic arguments to the concrete materializeForSet callback incompatible with those expected for the witness.

Longer term, representing materializeForSet patterns using accessor coroutines should obviate the need for this hack. For now, it's necessary for correctness, addressing rdar://problem/35760754.
@jckarter jckarter force-pushed the materializeForSet-conditional-conformance branch from b95cb18 to abdc703 Compare April 12, 2018 17:51
@jckarter
Copy link
Member Author

@swift-ci Please test

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - b95cb1887ba6af145ff14ef485751b278f0a60ab

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - b95cb1887ba6af145ff14ef485751b278f0a60ab

@jckarter
Copy link
Member Author

@slavapestov Added execution tests, thanks!

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.

None yet

3 participants