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

fix(go): generate concrete structs for behavioral interfaces #2257

Merged
merged 6 commits into from
Nov 18, 2020

Conversation

MrArnoldPalmer
Copy link
Contributor

Adds generation of empty structs for behavioral interfaces. These are to
be used by the runtime so that methods that return behavioral interfaces
have some known type that is able to be constructed and returned. These
may be able to be made private (non-exported) though they may be
referenced by other JSII modules that depend on them as necessitated by
the runtime.

Additionally, changes type signatures in places to always refer to the
interface type of JSII classes, interfaces, and structs. This is
required since JSII methods always return the interface implementation
of complex types in order to resolve runtime reference values. In order
for the returned values to be passed into other methods, the methods
themselves must accept the interface type and not the concrete type.

Added runtime code gen for calls to jsii get/set apis. Changed order of
args in runtime Get/Set functions to better match method invoke.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Valine added 4 commits November 17, 2020 08:22
Added runtime code gen for calls to jsii get/set apis. Changed order of
args in runtime Get/Set functions to better match method invoke.

Moved all property access to codegen to separate file.
Adds generation of empty structs for behavioral interfaces. These are to
be used by the runtime so that methods that return behavioral interfaces
have some known type that is able to be constructed and returned. These
may be able to be made private (non-exported) though they may be
referenced by other JSII modules that depend on them as necessitated by
the runtime.

Additionally, changes type signatures in places to always refer to the
interface type of JSII classes, interfaces, and structs. This is
required since JSII methods always return the interface implementation
of complex types in order to resolve runtime reference values. In order
for the returned values to be passed into other methods, the methods
themselves must accept the interface type and not the concrete type.
Update runtime to properly handle Get/StaticGet calls from generated
code. Updates jsii-calc-test to be runnable using `go test`.
Fixes bug in primitive type resolution for go type references.
@MrArnoldPalmer MrArnoldPalmer added the language/go Regarding GoLang bindings label Nov 17, 2020
@MrArnoldPalmer MrArnoldPalmer added this to the GoLang Alpha milestone Nov 17, 2020
@MrArnoldPalmer MrArnoldPalmer changed the title Fix/go interface code gen fix(go): interface code gen Nov 17, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 17, 2020
@SoManyHs SoManyHs changed the title fix(go): interface code gen fix(go): generate concrete structs for behavioral interfaces Nov 18, 2020
@RomainMuller RomainMuller added the pr/do-not-merge This PR should not be merged at this time. label Nov 18, 2020
@MrArnoldPalmer MrArnoldPalmer removed the pr/do-not-merge This PR should not be merged at this time. label Nov 18, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-5lHf64IXfvmr
  • Commit ID: 76b91fc
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@MrArnoldPalmer MrArnoldPalmer merged commit 6da0870 into main Nov 18, 2020
@MrArnoldPalmer MrArnoldPalmer deleted the fix/go-interface-code-gen branch November 18, 2020 21:06
Copy link
Contributor

@SoManyHs SoManyHs left a comment

Choose a reason for hiding this comment

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

I see this already got merged, but had a few questions.

Also, moving forward, this was a pretty large PR that did multiple things -- the Get/Set code generation could have been submitted separately, for example. Just thoughts moving forward.

MrArnoldPalmer added a commit that referenced this pull request Nov 21, 2020
Renaming some args in go runtime as suggested in #2257.
MrArnoldPalmer added a commit that referenced this pull request Nov 24, 2020
Renaming some args in go runtime as suggested in #2257.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. language/go Regarding GoLang bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants