-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pacmak): .NET bindings fail to compile with error CS8120 (#3760)
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
- Loading branch information
1 parent
a4d39c6
commit 783ec7f
Showing
14 changed files
with
1,596 additions
and
715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { IFriendly } from '@scope/jsii-calc-lib'; | ||
|
||
export interface IResolvable { | ||
resolve(): any; | ||
} | ||
|
||
export class Resolvable implements IResolvable { | ||
private constructor() {} | ||
|
||
public resolve(): any { | ||
return false; | ||
} | ||
} | ||
|
||
export class ConsumesUnion { | ||
public static unionType(param: IResolvable | Resolvable | IFriendly) { | ||
void param; | ||
} | ||
|
||
private constructor() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.