-
Notifications
You must be signed in to change notification settings - Fork 246
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
C# Runtime check fails on compilation #3759
Comments
Thanks for reporting. I can confirm that, contrary to the unwritten assumption, types in a union aren't necessarily unrelated... and this may cause us to emit unnecessary checks. Should not be all too hard to either remove checks that are implied by others, or to re-order the clauses so that the implied clauses come first (I lean towards removing redundant clauses but am wondering if there'd be any associated risk/tradeoff) |
If a type union includes several candidates that are related to each other (A extends B or A implements B), `jsii-pacmak` may generate type checking clauses in a pattern matching `switch` statement in an order such that the compiler identifies dead clauses, which is an error in C#. This adds a provision to NOT emit such a clause so as to not cause the error. It is worth mentioning that the error cannot be "opted out" of via a `#pragma` directive like a warning would be, which is unfortunate. Fixes #3759
If a type union includes several candidates that are related to each other (A extends B or A implements B), `jsii-pacmak` may generate type checking clauses in a pattern matching `switch` statement in an order such that the compiler identifies dead clauses, which is an error in C#. This adds a provision to NOT emit such a clause so as to not cause the error. It is worth mentioning that the error cannot be "opted out" of via a `#pragma` directive like a warning would be, which is unfortunate. Fixes #3759 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
|
Describe the bug
The CDKTF library does not build with 1.67.0 after upgrading from 1.65.0 in C#. There is an error thrown when running
dotnet build --force --configuration Release
as part ofjsii-pacmak
as part ofjsii-srcmak
.Expected Behavior
The unchanged code should still build.
Current Behavior
The code in question looks like this in C#:
The errors are thrown from
case HashiCorp.Cdktf.ComplexList cast_a33039:
tocase HashiCorp.Cdktf.AnyMapList cast_a33039:
.Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.57.0
Environment details (OS name and version, etc.)
OSX 12.6
The text was updated successfully, but these errors were encountered: