Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions _packages/native-preview/src/enums/symbolFlags.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export enum SymbolFlags {
FunctionScopedVariableExcludes = Value & ~FunctionScopedVariable,
BlockScopedVariableExcludes = Value,
ParameterExcludes = Value,
PropertyExcludes = Value & ~Property,
PropertyExcludes = Value & ~(Property | Accessor),
EnumMemberExcludes = Value | Type,
FunctionExcludes = Value & ~(Function | ValueModule | Class),
ClassExcludes = (Value | Type) & ~(ValueModule | Interface | Function),
Expand All @@ -54,9 +54,9 @@ export enum SymbolFlags {
ValueModuleExcludes = Value & ~(Function | Class | RegularEnum | ValueModule),
NamespaceModuleExcludes = None,
MethodExcludes = Value & ~Method,
GetAccessorExcludes = Value & ~SetAccessor,
SetAccessorExcludes = Value & ~GetAccessor,
AccessorExcludes = Value,
GetAccessorExcludes = Value & ~(SetAccessor | Property),
SetAccessorExcludes = Value & ~(GetAccessor | Property),
AccessorExcludes = Value & ~Property,
TypeParameterExcludes = Type & ~TypeParameter,
TypeAliasExcludes = Type,
AliasExcludes = Alias,
Expand Down
8 changes: 4 additions & 4 deletions _packages/native-preview/src/enums/symbolFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export var SymbolFlags: any;
SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes";
SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes";
SymbolFlags[SymbolFlags["ParameterExcludes"] = 111551] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 111547] = "PropertyExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 13243] = "PropertyExcludes";
SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
SymbolFlags[SymbolFlags["FunctionExcludes"] = 110991] = "FunctionExcludes";
SymbolFlags[SymbolFlags["ClassExcludes"] = 899503] = "ClassExcludes";
Expand All @@ -54,9 +54,9 @@ export var SymbolFlags: any;
SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes";
SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes";
SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes";
SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes";
SymbolFlags[SymbolFlags["AccessorExcludes"] = 111551] = "AccessorExcludes";
SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46011] = "GetAccessorExcludes";
SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78779] = "SetAccessorExcludes";
SymbolFlags[SymbolFlags["AccessorExcludes"] = 111547] = "AccessorExcludes";
SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes";
SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes";
SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes";
Expand Down
8 changes: 4 additions & 4 deletions internal/ast/symbolflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
SymbolFlagsBlockScopedVariableExcludes = SymbolFlagsValue

SymbolFlagsParameterExcludes = SymbolFlagsValue
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exclusion-mask changes are subtle and directly impact binding/merging semantics (especially around property/accessor merging being allowed in the binder and rejected later in the checker). Please add a short comment near these constants explaining the rationale and the intended invariants (e.g., “binder allows property+accessor merge; checker reports duplicates within the same declaration”), so future modifications don’t inadvertently revert the intended behavior.

Suggested change
SymbolFlagsParameterExcludes = SymbolFlagsValue
SymbolFlagsParameterExcludes = SymbolFlagsValue
// Binder intentionally allows property+accessor merges by not excluding Property/Accessor
// here; duplicate/conflicting declarations within the same declaration are reported later
// by the checker. Keep these masks aligned so future changes do not tighten binder merging.

Copilot uses AI. Check for mistakes.
SymbolFlagsPropertyExcludes = SymbolFlagsValue & ^SymbolFlagsProperty
SymbolFlagsPropertyExcludes = SymbolFlagsValue & ^(SymbolFlagsProperty | SymbolFlagsAccessor)
SymbolFlagsEnumMemberExcludes = SymbolFlagsValue | SymbolFlagsType
SymbolFlagsFunctionExcludes = SymbolFlagsValue & ^(SymbolFlagsFunction | SymbolFlagsValueModule | SymbolFlagsClass)
SymbolFlagsClassExcludes = (SymbolFlagsValue | SymbolFlagsType) & ^(SymbolFlagsValueModule | SymbolFlagsInterface | SymbolFlagsFunction) // class-interface mergability done in checker.ts
Expand All @@ -66,9 +66,9 @@ const (
SymbolFlagsValueModuleExcludes = SymbolFlagsValue & ^(SymbolFlagsFunction | SymbolFlagsClass | SymbolFlagsRegularEnum | SymbolFlagsValueModule)
SymbolFlagsNamespaceModuleExcludes = SymbolFlagsNone
SymbolFlagsMethodExcludes = SymbolFlagsValue & ^SymbolFlagsMethod
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exclusion-mask changes are subtle and directly impact binding/merging semantics (especially around property/accessor merging being allowed in the binder and rejected later in the checker). Please add a short comment near these constants explaining the rationale and the intended invariants (e.g., “binder allows property+accessor merge; checker reports duplicates within the same declaration”), so future modifications don’t inadvertently revert the intended behavior.

Suggested change
SymbolFlagsMethodExcludes = SymbolFlagsValue & ^SymbolFlagsMethod
SymbolFlagsMethodExcludes = SymbolFlagsValue & ^SymbolFlagsMethod
// Binder intentionally allows property+accessor merges by excluding accessors from
// other value declarations but not from properties. The checker later reports duplicate
// or otherwise invalid combinations within the same declaration.

Copilot uses AI. Check for mistakes.
SymbolFlagsGetAccessorExcludes = SymbolFlagsValue & ^SymbolFlagsSetAccessor
SymbolFlagsSetAccessorExcludes = SymbolFlagsValue & ^SymbolFlagsGetAccessor
SymbolFlagsAccessorExcludes = SymbolFlagsValue
SymbolFlagsGetAccessorExcludes = SymbolFlagsValue & ^(SymbolFlagsSetAccessor | SymbolFlagsProperty)
SymbolFlagsSetAccessorExcludes = SymbolFlagsValue & ^(SymbolFlagsGetAccessor | SymbolFlagsProperty)
SymbolFlagsAccessorExcludes = SymbolFlagsValue & ^SymbolFlagsProperty
SymbolFlagsTypeParameterExcludes = SymbolFlagsType & ^SymbolFlagsTypeParameter
SymbolFlagsTypeAliasExcludes = SymbolFlagsType
SymbolFlagsAliasExcludes = SymbolFlagsAlias
Expand Down
2 changes: 1 addition & 1 deletion internal/binder/binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func (b *Binder) bind(node *ast.Node) bool {
case ast.KindCallSignature, ast.KindConstructSignature, ast.KindIndexSignature:
b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsSignature, ast.SymbolFlagsNone)
case ast.KindMethodDeclaration, ast.KindMethodSignature:
b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsMethod|getOptionalSymbolFlagForNode(node), core.IfElse(ast.IsObjectLiteralMethod(node), ast.SymbolFlagsPropertyExcludes, ast.SymbolFlagsMethodExcludes))
b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsMethod|getOptionalSymbolFlagForNode(node), core.IfElse(ast.IsObjectLiteralMethod(node), ast.SymbolFlagsValue, ast.SymbolFlagsMethodExcludes))
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching object-literal methods to use ast.SymbolFlagsValue as the exclude mask is a behavioral change that can affect merging between object-literal methods and same-named properties/accessors (and therefore inferred object literal types and diagnostics). Please add/extend a baseline test that covers at least { a() {}, get a() { ... } } and { a() {}, a: 1 } to ensure the binder+checker combination still produces the intended error codes and inferred member type.

Suggested change
b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsMethod|getOptionalSymbolFlagForNode(node), core.IfElse(ast.IsObjectLiteralMethod(node), ast.SymbolFlagsValue, ast.SymbolFlagsMethodExcludes))
b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsMethod|getOptionalSymbolFlagForNode(node), ast.SymbolFlagsMethodExcludes)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests already show the effects of this change (i.e. method names must be unique in object literals).

case ast.KindFunctionDeclaration:
b.bindFunctionDeclaration(node)
case ast.KindConstructor:
Expand Down
33 changes: 20 additions & 13 deletions internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3081,7 +3081,7 @@ func (c *Checker) checkObjectTypeForDuplicateDeclarations(node *ast.Node, checkP
var staticNames map[string]int
var privateNames map[string]int
nodeInAmbientContext := node.Flags&ast.NodeFlagsAmbient != 0
checkProperty := func(symbol *ast.Symbol, isStatic bool) {
checkPropertyOrAccessor := func(symbol *ast.Symbol, kind int, isStatic bool) {
if len(symbol.Declarations) > 1 {
var names map[string]int
if isStatic {
Expand All @@ -3095,19 +3095,24 @@ func (c *Checker) checkObjectTypeForDuplicateDeclarations(node *ast.Node, checkP
}
names = instanceNames
}
if state := names[symbol.Name]; state != 2 {
if state == 1 {
c.reportDuplicateMemberErrors(node, symbol.Name, true, isStatic, diagnostics.Duplicate_identifier_0)
}
names[symbol.Name] = state + 1
state := names[symbol.Name]
switch {
case state == 0:
// On first occurrence just record the kind
names[symbol.Name] = kind
case state == 1 || state == 2 && kind != 2:
// Error on second property or combination of property and accessor
c.reportDuplicateMemberErrors(node, symbol.Name, true, isStatic, diagnostics.Duplicate_identifier_0)
// Record that errors have been reported
names[symbol.Name] = 3
}
}
}
for _, member := range node.Members() {
if ast.IsConstructorDeclaration(member) {
for _, param := range member.Parameters() {
if ast.IsParameterPropertyDeclaration(param, member) && !ast.IsBindingPattern(param.Name()) {
checkProperty(c.getSymbolOfDeclaration(param), false /*isStatic*/)
checkPropertyOrAccessor(c.getSymbolOfDeclaration(param), 1, false /*isStatic*/)
}
}
} else {
Expand All @@ -3117,10 +3122,12 @@ func (c *Checker) checkObjectTypeForDuplicateDeclarations(node *ast.Node, checkP
if !nodeInAmbientContext && isStatic && symbol != nil && symbol.Name == "prototype" {
c.error(member.Name(), diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1, symbol.Name, c.symbolToString(c.getSymbolOfDeclaration(node)))
}
// When a property has multiple declarations, check that only one of those declarations is in this object
// type declaration (multiple merged object types are permitted to each declare the same property).
// Check that this object type declaration doesn't contain multiple declarations of the same property,
// or accessor and property declarations with the same name.
if ast.IsPropertyDeclaration(member) && !ast.HasAccessorModifier(member) || ast.IsPropertySignatureDeclaration(member) {
checkProperty(symbol, isStatic)
checkPropertyOrAccessor(symbol, 1, isStatic)
} else if ast.IsAccessor(member) || ast.IsPropertyDeclaration(member) && ast.HasAccessorModifier(member) {
checkPropertyOrAccessor(symbol, 2, isStatic)
}
// Check that each private identifier is used only for instance members or only for static members. It is an
// error for an instance and a static member to have the same private identifier.
Expand Down Expand Up @@ -16118,6 +16125,9 @@ func (c *Checker) getTypeOfSymbol(symbol *ast.Symbol) *Type {
if symbol.CheckFlags&ast.CheckFlagsReverseMapped != 0 {
return c.getTypeOfReverseMappedSymbol(symbol)
}
if symbol.Flags&ast.SymbolFlagsAccessor != 0 {
return c.getTypeOfAccessors(symbol)
}
if symbol.Flags&(ast.SymbolFlagsVariable|ast.SymbolFlagsProperty) != 0 {
return c.getTypeOfVariableOrParameterOrProperty(symbol)
}
Expand All @@ -16127,9 +16137,6 @@ func (c *Checker) getTypeOfSymbol(symbol *ast.Symbol) *Type {
if symbol.Flags&ast.SymbolFlagsEnumMember != 0 {
return c.getTypeOfEnumMember(symbol)
}
if symbol.Flags&ast.SymbolFlagsAccessor != 0 {
return c.getTypeOfAccessors(symbol)
}
if symbol.Flags&ast.SymbolFlagsAlias != 0 {
return c.getTypeOfAlias(symbol)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,8 @@ duplicateIdentifierChecks.ts(114,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(115,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(116,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name.
duplicateIdentifierChecks.ts(116,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(120,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(121,5): error TS1119: An object literal cannot have property and accessor with the same name.
duplicateIdentifierChecks.ts(121,5): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(122,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(126,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(127,5): error TS1119: An object literal cannot have property and accessor with the same name.
duplicateIdentifierChecks.ts(127,5): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(128,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(132,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(133,5): error TS1119: An object literal cannot have property and accessor with the same name.
duplicateIdentifierChecks.ts(133,5): error TS2300: Duplicate identifier 'x'.
Expand All @@ -74,12 +68,12 @@ duplicateIdentifierChecks.ts(138,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(139,5): error TS1119: An object literal cannot have property and accessor with the same name.
duplicateIdentifierChecks.ts(139,5): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(140,9): error TS2300: Duplicate identifier 'x'.
duplicateIdentifierChecks.ts(146,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(147,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(148,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(152,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(153,5): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(154,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(146,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(147,5): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(148,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(152,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(153,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(154,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(158,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(159,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(160,9): error TS2300: Duplicate identifier '[foo]'.
Expand All @@ -91,15 +85,15 @@ duplicateIdentifierChecks.ts(171,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(175,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(176,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(177,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(181,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(182,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(183,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(187,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(188,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(189,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(193,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(194,9): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(195,5): error TS2300: Duplicate identifier 'foo'.
duplicateIdentifierChecks.ts(181,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(182,5): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(183,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(187,5): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(188,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(189,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(193,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(194,9): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(195,5): error TS2300: Duplicate identifier '[foo]'.
duplicateIdentifierChecks.ts(201,9): error TS2300: Duplicate identifier '[sym]'.
duplicateIdentifierChecks.ts(202,5): error TS2300: Duplicate identifier '[sym]'.
duplicateIdentifierChecks.ts(203,9): error TS2300: Duplicate identifier '[sym]'.
Expand All @@ -108,7 +102,7 @@ duplicateIdentifierChecks.ts(208,5): error TS2300: Duplicate identifier '[sym]'.
duplicateIdentifierChecks.ts(209,9): error TS2300: Duplicate identifier '[sym]'.


==== duplicateIdentifierChecks.ts (108 errors) ====
==== duplicateIdentifierChecks.ts (102 errors) ====
// Every member declaration in the following should produce a duplicate identifier error.

interface I1 {
Expand Down Expand Up @@ -349,30 +343,18 @@ duplicateIdentifierChecks.ts(209,9): error TS2300: Duplicate identifier '[sym]'.

const o5 = {
get x() { return 0 },
~
!!! error TS2300: Duplicate identifier 'x'.
x: 0,
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'x'.
set x(value: number) { }
~
!!! error TS2300: Duplicate identifier 'x'.
}

const o6 = {
set x(value: number) { },
~
!!! error TS2300: Duplicate identifier 'x'.
x: 0,
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'x'.
get x() { return 0 }
~
!!! error TS2300: Duplicate identifier 'x'.
}

const o7 = {
Expand Down Expand Up @@ -408,29 +390,25 @@ duplicateIdentifierChecks.ts(209,9): error TS2300: Duplicate identifier '[sym]'.
interface I10 {
get [foo](): number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
[foo]: number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
set [foo](value: number);
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
}

interface I11 {
get [foo](): number;
~~~~~
!!! error TS2300: Duplicate identifier '[foo]'.
!!! related TS6203 duplicateIdentifierChecks.ts:153:5: '[foo]' was also declared here.
!!! error TS2300: Duplicate identifier 'foo'.
foo: number;
~~~
!!! error TS2300: Duplicate identifier '[foo]'.
!!! related TS6203 duplicateIdentifierChecks.ts:152:9: '[foo]' was also declared here.
!!! related TS6204 duplicateIdentifierChecks.ts:154:9: and here.
!!! error TS2300: Duplicate identifier 'foo'.
set [foo](value: number);
~~~~~
!!! error TS2300: Duplicate identifier '[foo]'.
!!! related TS6203 duplicateIdentifierChecks.ts:153:5: '[foo]' was also declared here.
!!! error TS2300: Duplicate identifier 'foo'.
}

interface I12 {
Expand Down Expand Up @@ -485,37 +463,37 @@ duplicateIdentifierChecks.ts(209,9): error TS2300: Duplicate identifier '[sym]'.
declare class C10 {
get [foo](): number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
[foo]: number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
set [foo](value: number);
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
}

declare class C11 {
[foo]: number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
get [foo](): number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
set [foo](value: number);
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
}

declare class C12 {
get [foo](): number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
set [foo](value: number);
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
[foo]: number;
~~~~~
!!! error TS2300: Duplicate identifier 'foo'.
!!! error TS2300: Duplicate identifier '[foo]'.
}

const sym = Symbol();
Expand Down
Loading
Loading