-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7688 from Microsoft/Fix7629
Fix #7629: Check if errors are needed before reporting them in enumRelatedTo
- Loading branch information
Showing
5 changed files
with
201 additions
and
5 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,51 @@ | ||
//// [enumAssignmentCompat4.ts] | ||
namespace M { | ||
export enum MyEnum { | ||
BAR | ||
} | ||
export var object2 = { | ||
foo: MyEnum.BAR | ||
}; | ||
} | ||
|
||
namespace N { | ||
export enum MyEnum { | ||
FOO | ||
}; | ||
export var object1 = { | ||
foo: MyEnum.FOO | ||
}; | ||
} | ||
|
||
let broken = [ | ||
N.object1, | ||
M.object2 | ||
]; | ||
|
||
|
||
//// [enumAssignmentCompat4.js] | ||
var M; | ||
(function (M) { | ||
(function (MyEnum) { | ||
MyEnum[MyEnum["BAR"] = 0] = "BAR"; | ||
})(M.MyEnum || (M.MyEnum = {})); | ||
var MyEnum = M.MyEnum; | ||
M.object2 = { | ||
foo: MyEnum.BAR | ||
}; | ||
})(M || (M = {})); | ||
var N; | ||
(function (N) { | ||
(function (MyEnum) { | ||
MyEnum[MyEnum["FOO"] = 0] = "FOO"; | ||
})(N.MyEnum || (N.MyEnum = {})); | ||
var MyEnum = N.MyEnum; | ||
; | ||
N.object1 = { | ||
foo: MyEnum.FOO | ||
}; | ||
})(N || (N = {})); | ||
var broken = [ | ||
N.object1, | ||
M.object2 | ||
]; |
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,59 @@ | ||
=== tests/cases/compiler/enumAssignmentCompat4.ts === | ||
namespace M { | ||
>M : Symbol(M, Decl(enumAssignmentCompat4.ts, 0, 0)) | ||
|
||
export enum MyEnum { | ||
>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 0, 13)) | ||
|
||
BAR | ||
>BAR : Symbol(MyEnum.BAR, Decl(enumAssignmentCompat4.ts, 1, 24)) | ||
} | ||
export var object2 = { | ||
>object2 : Symbol(object2, Decl(enumAssignmentCompat4.ts, 4, 14)) | ||
|
||
foo: MyEnum.BAR | ||
>foo : Symbol(foo, Decl(enumAssignmentCompat4.ts, 4, 26)) | ||
>MyEnum.BAR : Symbol(MyEnum.BAR, Decl(enumAssignmentCompat4.ts, 1, 24)) | ||
>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 0, 13)) | ||
>BAR : Symbol(MyEnum.BAR, Decl(enumAssignmentCompat4.ts, 1, 24)) | ||
|
||
}; | ||
} | ||
|
||
namespace N { | ||
>N : Symbol(N, Decl(enumAssignmentCompat4.ts, 7, 1)) | ||
|
||
export enum MyEnum { | ||
>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 9, 13)) | ||
|
||
FOO | ||
>FOO : Symbol(MyEnum.FOO, Decl(enumAssignmentCompat4.ts, 10, 24)) | ||
|
||
}; | ||
export var object1 = { | ||
>object1 : Symbol(object1, Decl(enumAssignmentCompat4.ts, 13, 14)) | ||
|
||
foo: MyEnum.FOO | ||
>foo : Symbol(foo, Decl(enumAssignmentCompat4.ts, 13, 26)) | ||
>MyEnum.FOO : Symbol(MyEnum.FOO, Decl(enumAssignmentCompat4.ts, 10, 24)) | ||
>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 9, 13)) | ||
>FOO : Symbol(MyEnum.FOO, Decl(enumAssignmentCompat4.ts, 10, 24)) | ||
|
||
}; | ||
} | ||
|
||
let broken = [ | ||
>broken : Symbol(broken, Decl(enumAssignmentCompat4.ts, 18, 3)) | ||
|
||
N.object1, | ||
>N.object1 : Symbol(N.object1, Decl(enumAssignmentCompat4.ts, 13, 14)) | ||
>N : Symbol(N, Decl(enumAssignmentCompat4.ts, 7, 1)) | ||
>object1 : Symbol(N.object1, Decl(enumAssignmentCompat4.ts, 13, 14)) | ||
|
||
M.object2 | ||
>M.object2 : Symbol(M.object2, Decl(enumAssignmentCompat4.ts, 4, 14)) | ||
>M : Symbol(M, Decl(enumAssignmentCompat4.ts, 0, 0)) | ||
>object2 : Symbol(M.object2, Decl(enumAssignmentCompat4.ts, 4, 14)) | ||
|
||
]; | ||
|
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,62 @@ | ||
=== tests/cases/compiler/enumAssignmentCompat4.ts === | ||
namespace M { | ||
>M : typeof M | ||
|
||
export enum MyEnum { | ||
>MyEnum : MyEnum | ||
|
||
BAR | ||
>BAR : MyEnum | ||
} | ||
export var object2 = { | ||
>object2 : { foo: MyEnum; } | ||
>{ foo: MyEnum.BAR } : { foo: MyEnum; } | ||
|
||
foo: MyEnum.BAR | ||
>foo : MyEnum | ||
>MyEnum.BAR : MyEnum | ||
>MyEnum : typeof MyEnum | ||
>BAR : MyEnum | ||
|
||
}; | ||
} | ||
|
||
namespace N { | ||
>N : typeof N | ||
|
||
export enum MyEnum { | ||
>MyEnum : MyEnum | ||
|
||
FOO | ||
>FOO : MyEnum | ||
|
||
}; | ||
export var object1 = { | ||
>object1 : { foo: MyEnum; } | ||
>{ foo: MyEnum.FOO } : { foo: MyEnum; } | ||
|
||
foo: MyEnum.FOO | ||
>foo : MyEnum | ||
>MyEnum.FOO : MyEnum | ||
>MyEnum : typeof MyEnum | ||
>FOO : MyEnum | ||
|
||
}; | ||
} | ||
|
||
let broken = [ | ||
>broken : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[] | ||
>[ N.object1, M.object2] : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[] | ||
|
||
N.object1, | ||
>N.object1 : { foo: N.MyEnum; } | ||
>N : typeof N | ||
>object1 : { foo: N.MyEnum; } | ||
|
||
M.object2 | ||
>M.object2 : { foo: M.MyEnum; } | ||
>M : typeof M | ||
>object2 : { foo: M.MyEnum; } | ||
|
||
]; | ||
|
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,22 @@ | ||
namespace M { | ||
export enum MyEnum { | ||
BAR | ||
} | ||
export var object2 = { | ||
foo: MyEnum.BAR | ||
}; | ||
} | ||
|
||
namespace N { | ||
export enum MyEnum { | ||
FOO | ||
}; | ||
export var object1 = { | ||
foo: MyEnum.FOO | ||
}; | ||
} | ||
|
||
let broken = [ | ||
N.object1, | ||
M.object2 | ||
]; |