Skip to content

[SILGen] Handled foreign funcs with async, error, and more args. #39957

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
Oct 29, 2021

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Oct 28, 2021

In 1ae317d, all the machinery was added to enable calling ObjC functions that have both async and error conventions. The handling that was added for matching up arguments and parameters, however, failed to handle functions that had both foreign async and foreign error and other arguments. Here, that handling is fixed.

The fix is in four parts:

  • Reverting to a single call to CallSite::emit to emit the formal params. At this point, the foreign async and/or error params will be claimed as well.
  • Separately counting the async and error parameters in ParamLowering::claimParams to ensure we get the right parameter slices.
  • Letting ArgEmitter::maybeEmitForeignArgument look for an error parameter even if it already found an async parameter.
  • Letting ArgEmitter::maybeEmitForeignArgument keep looking for foreign arguments after it finds one.

rdar://80704984

@nate-chandler nate-chandler changed the title [SILGen] Handled foreign funcs with async, error, and more. [SILGen] Handled foreign funcs with async, error, and more args. Oct 28, 2021
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

In 1ae317d, all the machinery was added
to enable calling ObjC functions that have both async and error
conventions.  The handling that was added for matching up arguments and
parameters, however, failed to handle functions that had both foreign
async and foreign error and other arguments.  Here, that handling is
fixed.

The fix is in four parts:
- Reverting to a single call to CallSite::emit to emit the formal
  params.  At this point, the foreign async and/or error params will be
  claimed as well.
- Separately counting the async and error parameters in
  ParamLowering::claimParams to ensure we get the right parameter
  slices.
- Letting ArgEmitter::maybeEmitForeignArgument look for an error
  parameter even if it already found an async parameter.
- Letting ArgEmitter::maybeEmitForeignArgument keep looking for foreign
  arguments after it finds one.

rdar://80704984
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

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