-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(go): embedded bases may conflict with member names (#2703)
When we generate proxy structs in Go (for classes or interfaces), we embed the base types (base class or interfaces) in the struct. If the base type has a name that is the same as a member of the hosting type, there will be a conflict. To solve this, we create a unique type alias for each base interface we want to embed. Fixes #2702
- Loading branch information
Elad Ben-Israel
committed
Mar 17, 2021
1 parent
e6ca054
commit 3594ad7
Showing
16 changed files
with
1,374 additions
and
119 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// member has the same name as a base class | ||
// @see https://github.com/aws/jsii/issues/2702 | ||
|
||
import { Base, IBaseInterface } from '@scope/jsii-calc-base'; | ||
|
||
export class Class1 extends Base { | ||
public base() { | ||
return; | ||
} | ||
} | ||
|
||
export class Class2 extends Base { | ||
public readonly base = 'hello'; | ||
} | ||
|
||
export class Class3 implements IBaseInterface { | ||
public bar(): void { | ||
return; | ||
} | ||
|
||
public foo(): void { | ||
return; | ||
} | ||
|
||
public iBaseInterface() { | ||
return; | ||
} | ||
} | ||
|
||
export interface IFoo extends IBaseInterface { | ||
readonly iBaseInterface: string; | ||
} |
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.