-
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid duplicate static class and/or namespace members
This isn't fully TS compatible, but refactors targeting internal names, scoping, merging, etc. are needed to become more compatible. For instance, if namespace members had unique separators in internal names, then a non-exported namespace member would override a static class member, assuming the names are the same. Note that this change doesn't prevent the compiler from attempting to compile the duplicate global, and hence the previous commit is needed for this to work fully.
- Loading branch information
1 parent
89b49f0
commit 8a76750
Showing
3 changed files
with
43 additions
and
2 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,13 @@ | ||
{ | ||
"stderr": [ | ||
"Duplicate identifier 'bar'.", | ||
"in issues/2793.ts(8,14)", | ||
"in issues/2793.ts(2,10)", | ||
"Duplicate identifier 'baz'.", | ||
"in issues/2793.ts(9,7)", | ||
"in issues/2793.ts(3,10)", | ||
"Duplicate identifier 'qux'.", | ||
"in issues/2793.ts(10,14)", | ||
"in issues/2793.ts(4,18)" | ||
] | ||
} |
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,12 @@ | ||
class Foo { | ||
static bar: i32 = 2; // errors in TS | ||
static baz: i32 = 2; // does not error in TS | ||
private static qux: i32 = 2; // errors in TS | ||
} | ||
|
||
namespace Foo { | ||
export let bar: i32 = 1; | ||
let baz: string = "baz"; | ||
export let qux: i32 = 1; | ||
let hi: i32 = 1; | ||
} |