-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(go,python/java): bad code for members with same name with differe…
…nt casing (#2699) In TypeScript, it is possible to give two members (methods/properties) the same name but with different capitalization. This results in duplicate members in Go and Python. In Go, where the member is expected to be PascalCase, use the same conversion used in .NET, in which we only capitalize the first letter (assuming TypeScript uses camelCase). This offers more tolerance. In Python, where members use snake_case, we implemented a different heuristic in which we only render the non-deprecated member and fail if there is more than one deprecated member. In Java, this issue existed only for property names. Fixes #2508 BREAKING CHANGE: if multiple members have the same name with different capitalization, only one is allowed to be non-deprecated. This will currently only manifest when producing python bindings, but will be added as a jsii compiler error in the future.
- Loading branch information
Elad Ben-Israel
authored
Mar 16, 2021
1 parent
6b2bbe8
commit 25528fb
Showing
19 changed files
with
2,156 additions
and
182 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
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,17 @@ | ||
export interface IFoo { | ||
bar(): string; | ||
readonly baz: number; | ||
} | ||
|
||
export class Base implements IFoo { | ||
public readonly baz = 120; | ||
public bar() { | ||
return 'bar'; | ||
} | ||
} | ||
|
||
export class Derived extends Base implements IFoo { | ||
public zoo() { | ||
return 'zoo'; | ||
} | ||
} |
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,13 @@ | ||
/** | ||
* Converts a jsii method/property names to pascal-case. | ||
* | ||
* This is different from `toPascalCase()` since it only capitalizes the first | ||
* letter. This handles avoids duplicates of things like `toIsoString()` and `toISOString()`. | ||
* The assumption is that the jsii name is camelCased. | ||
* | ||
* @param camelCase The original jsii method name | ||
* @returns A pascal-cased method name. | ||
*/ | ||
export function jsiiToPascalCase(camelCase: string) { | ||
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1); | ||
} |
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.