Skip to content

Conversation

aschwaighofer
Copy link
Contributor

…stitution map in the context of the current generic enviroment

We used a substitution map derived from a thunk that might have been
created in a different function if that other function used the same
thunk type.
Instead use a substitution map that was derived from the
current functions generic environment.

rdar://41331672
SR-8064

…stitution map in the context of the current generic enviroment

We used a substitution map derived from a thunk that might have been
created in a different function if that other function used the same
thunk type.
Instead use a substitution map that was derived from the
current functions generic environment.

rdar://41331672
SR-8064
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dbdea27

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - dbdea27

// thunk->getForwardingSubstitutionMap() / thunk might have been created in a
// different function's generic enviroment.
if (auto genericSig = thunkType->getGenericSignature()) {
substFnTy = thunkType->substGenericArgs(F.getModule(), interfaceSubs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, nice catch. I wonder if thunks should always get a new generic environment instead of inheriting one from their parent. We might have the same issue with any other kind of thunk we emit lazily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On quick review, all the other places that call 'buildThunkType' perform this substitution.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dbdea27

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - dbdea27

@aschwaighofer aschwaighofer merged commit 4ada917 into swiftlang:swift-4.2-branch Jun 25, 2018
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.

3 participants