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] Add helper methods to compute ArgumentSource::getSubst{RValue,}Type() as SILTypes. #8297

Merged

Conversation

gottesmm
Copy link
Contributor

[silgen] Add helper methods to compute ArgumentSource::getSubst{RValue,}Type() as SILTypes.

rdar://31145255

@gottesmm
Copy link
Contributor Author

@jckarter How does this look? I just want to make sure I am doing this right,

@gottesmm
Copy link
Contributor Author

@swift-ci Please smoke test

SILType ArgumentSource::getSILSubstRValueType(SILGenFunction &SGF) const & {
CanSILFunctionType funcType = SGF.F.getLoweredFunctionType();
CanType substType = getSubstType();
AbstractionPattern origType(funcType->getGenericSignature(), substType);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the argument value always emitted at the most substituted abstraction level?

I don't think you need the abstraction pattern at all then. substType should not contain any interface type parameters, so just calling getLoweredType(substType) should work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure. So I was trying to make this the most general correct manner of performing the operation, so if I was incorrect it would just be a no-op. That is why I wanted to ask you guys. ; ).

Copy link
Contributor

Choose a reason for hiding this comment

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

You could add an assert that when the argument source is eventually evaluated down to a single managed value, the type of that matches the expected SIL type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would rather just be careful for now.

@gottesmm gottesmm merged commit 73bc62c into swiftlang:master Mar 24, 2017
@gottesmm gottesmm deleted the add_getsubst_methods_to_argumentsource branch March 24, 2017 00:46
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