Skip to content

[4.2] [SILGen] Ensure type params in witness method conformances match the witness method signatures. #16514

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
merged 1 commit into from
May 11, 2018

Conversation

huonw
Copy link
Contributor

@huonw huonw commented May 10, 2018

A witness method of a class can have its generic parameters rephrased: a
parameters of the class, like τ_0_0, get pushed to the next depth, like τ_1_0,
to make way for a τ_0_0 parameter with a τ_0_0: Class<...> subclass
constraint. When this wasn't accounted for, IRGen would find that it couldn't
satisfy conditional requirements on the rewritten type parameters, and they'd
incorrectly be passed as additional arguments of a witness method thunk rather
than pulled out of the Self witness table's private area inside the thunk.

Fixes rdar://problem/40078863.

@huonw huonw changed the base branch from master to swift-4.2-branch May 10, 2018 22:55
@huonw huonw force-pushed the conditional-class-crash-4.2 branch from 820bc69 to ed362a6 Compare May 10, 2018 23:00
@huonw
Copy link
Contributor Author

huonw commented May 10, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ed362a68f17f44d3a2c4f0b18bea291c00c364d2

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ed362a68f17f44d3a2c4f0b18bea291c00c364d2

…witness method signatures.

A witness method of a class can have its generic parameters rephrased: a
parameters of the class, like τ_0_0, get pushed to the next depth, like τ_1_0,
to make way for a τ_0_0 parameter with a τ_0_0: Class<...> subclass
constraint. When this wasn't accounted for, IRGen would find that it couldn't
satisfy conditional requirements on the rewritten type parameters, and they'd
incorrectly be passed as additional arguments of a witness method thunk rather
than pulled out of the Self witness table's private area inside the thunk.

Fixes rdar://problem/40078863.
@huonw huonw force-pushed the conditional-class-crash-4.2 branch from ed362a6 to a8ef08c Compare May 11, 2018 00:16
@huonw
Copy link
Contributor Author

huonw commented May 11, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ed362a68f17f44d3a2c4f0b18bea291c00c364d2

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ed362a68f17f44d3a2c4f0b18bea291c00c364d2

@huonw
Copy link
Contributor Author

huonw commented May 11, 2018

@swift-ci please test

@huonw huonw changed the title [SILGen] Ensure type params in witness method conformances match the witness method signatures. [4.2] [SILGen] Ensure type params in witness method conformances match the witness method signatures. May 11, 2018
@huonw huonw merged commit 2949940 into swiftlang:swift-4.2-branch May 11, 2018
@huonw huonw deleted the conditional-class-crash-4.2 branch May 11, 2018 04:13
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