Factor out AbstractFunctionDecl's interface type computation#18145
Merged
slavapestov merged 4 commits intoswiftlang:masterfrom Jul 23, 2018
Merged
Factor out AbstractFunctionDecl's interface type computation#18145slavapestov merged 4 commits intoswiftlang:masterfrom
slavapestov merged 4 commits intoswiftlang:masterfrom
Conversation
…ript}Decl::computeType() It doesn't actually depend on the type checker, and using it on synthesized declarations will eliminate a lot of boilerplate.
b573151 to
2b53da2
Compare
2b53da2 to
7265617
Compare
Contributor
Author
|
@swift-ci Please test |
Contributor
Author
|
@swift-ci Please test source compatibility |
CodaFi
reviewed
Jul 23, 2018
| auto &ctx = getASTContext(); | ||
|
|
||
| auto elementTy = getElementTypeLoc().getType(); | ||
| auto indicesTy = getIndices()->getInterfaceType(ctx); |
Contributor
There was a problem hiding this comment.
In future, what's the right way to convert these kinds of things to speak in terms of params?
Contributor
Author
There was a problem hiding this comment.
Add a way to go from a ParamDecl to an AnyFunctionType::Param. Then we can remove ParameterList::getInterfaceType().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The type of a function declaration is entirely determined by the type of its parameters and the type of its result. Sema already knows how to calculate the function type from the parameters and result for parsed definitions. Factor this out into a method on AbstractFunctionDecl, and use it for synthesized and imported declarations.