Skip to content

fix(jsii): single-valued enums are not processed correctly#1406

Merged
mergify[bot] merged 2 commits intomasterfrom
rmuller/fix-1-valued-enums
Mar 27, 2020
Merged

fix(jsii): single-valued enums are not processed correctly#1406
mergify[bot] merged 2 commits intomasterfrom
rmuller/fix-1-valued-enums

Conversation

@RomainMuller
Copy link
Copy Markdown
Contributor

Commit Message

TypeScript represents enums similar to union types, and single-valued
enums are "simplified" to the sole member (the TypeChecker fiercely
refuses to give a handle to the actual enum type). This resulted in
jsii incorrectly tagging the type at usage sites.

This commit adds the necessary infrastructure to detect single-valued
enums and tweak the FQN generation to obtain the correct result.

A new test was added to validate this whole endeavor works correctly
even when the single-valued enum is within a submodule (which adds even
more complexity to the mix).

References: aws/aws-cdk#6712 aws/aws-cdk#6948

End Commit Message


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

TypeScript represents enums similar to union types, and single-valued
enums are "simplified" to the sole member (the TypeChecker fiercely
refuses to give a handle to the actual `enum` type). This resulted in
`jsii` incorrectly tagging the type at usage sites.

This commit adds the necessary infrastructure to detect single-valued
enums and tweak the FQN generation to obtain the correct result.

A new test was added to validate this whole endeavor works correctly
even when the single-valued enum is within a submodule (which adds even
more complexity to the mix).

References: aws/aws-cdk#6712 aws/aws-cdk#6948
@RomainMuller RomainMuller requested review from a team and MrArnoldPalmer as code owners March 26, 2020 16:09
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 26, 2020
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: 79dcd9f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: c9ce59d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@RomainMuller RomainMuller removed the request for review from MrArnoldPalmer March 27, 2020 09:50
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 27, 2020

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Mar 27, 2020
@mergify mergify bot merged commit 39425a4 into master Mar 27, 2020
@mergify mergify bot deleted the rmuller/fix-1-valued-enums branch March 27, 2020 09:57
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 27, 2020

Merging (with squash)...

@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Mar 27, 2020
@aws aws deleted a comment from mergify bot Mar 27, 2020
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants