-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve diagnostics deduplication 2 #58318
Changes from all commits
49a65b1
165869c
3257850
35ed28c
ef2eb5c
4adb671
e1698ad
e66e80d
f270cff
83fa274
c5b5e65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
duplicateErrorAssignability.ts(10,11): error TS2741: Property 'x' is missing in type 'B' but required in type 'A'. | ||
duplicateErrorAssignability.ts(12,5): error TS2538: Type 'B' cannot be used as an index type. | ||
|
||
|
||
==== duplicateErrorAssignability.ts (2 errors) ==== | ||
interface A { | ||
x: number; | ||
} | ||
interface B { | ||
y: string; | ||
} | ||
|
||
declare let b: B; | ||
declare let a: A; | ||
const x = a = b; | ||
~ | ||
!!! error TS2741: Property 'x' is missing in type 'B' but required in type 'A'. | ||
!!! related TS2728 duplicateErrorAssignability.ts:2:5: 'x' is declared here. | ||
let obj: { 3: string } = { 3: "three" }; | ||
obj[x]; | ||
~ | ||
!!! error TS2538: Type 'B' cannot be used as an index type. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// [tests/cases/compiler/duplicateErrorAssignability.ts] //// | ||
|
||
//// [duplicateErrorAssignability.ts] | ||
interface A { | ||
x: number; | ||
} | ||
interface B { | ||
y: string; | ||
} | ||
|
||
declare let b: B; | ||
declare let a: A; | ||
const x = a = b; | ||
let obj: { 3: string } = { 3: "three" }; | ||
obj[x]; | ||
|
||
//// [duplicateErrorAssignability.js] | ||
"use strict"; | ||
var x = a = b; | ||
var obj = { 3: "three" }; | ||
obj[x]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//// [tests/cases/compiler/duplicateErrorAssignability.ts] //// | ||
|
||
=== duplicateErrorAssignability.ts === | ||
interface A { | ||
>A : Symbol(A, Decl(duplicateErrorAssignability.ts, 0, 0)) | ||
|
||
x: number; | ||
>x : Symbol(A.x, Decl(duplicateErrorAssignability.ts, 0, 13)) | ||
} | ||
interface B { | ||
>B : Symbol(B, Decl(duplicateErrorAssignability.ts, 2, 1)) | ||
|
||
y: string; | ||
>y : Symbol(B.y, Decl(duplicateErrorAssignability.ts, 3, 13)) | ||
} | ||
|
||
declare let b: B; | ||
>b : Symbol(b, Decl(duplicateErrorAssignability.ts, 7, 11)) | ||
>B : Symbol(B, Decl(duplicateErrorAssignability.ts, 2, 1)) | ||
|
||
declare let a: A; | ||
>a : Symbol(a, Decl(duplicateErrorAssignability.ts, 8, 11)) | ||
>A : Symbol(A, Decl(duplicateErrorAssignability.ts, 0, 0)) | ||
|
||
const x = a = b; | ||
>x : Symbol(x, Decl(duplicateErrorAssignability.ts, 9, 5)) | ||
>a : Symbol(a, Decl(duplicateErrorAssignability.ts, 8, 11)) | ||
>b : Symbol(b, Decl(duplicateErrorAssignability.ts, 7, 11)) | ||
|
||
let obj: { 3: string } = { 3: "three" }; | ||
>obj : Symbol(obj, Decl(duplicateErrorAssignability.ts, 10, 3)) | ||
>3 : Symbol(3, Decl(duplicateErrorAssignability.ts, 10, 10)) | ||
>3 : Symbol(3, Decl(duplicateErrorAssignability.ts, 10, 26)) | ||
|
||
obj[x]; | ||
>obj : Symbol(obj, Decl(duplicateErrorAssignability.ts, 10, 3)) | ||
>x : Symbol(x, Decl(duplicateErrorAssignability.ts, 9, 5)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//// [tests/cases/compiler/duplicateErrorAssignability.ts] //// | ||
|
||
=== duplicateErrorAssignability.ts === | ||
interface A { | ||
x: number; | ||
>x : number | ||
> : ^^^^^^ | ||
} | ||
interface B { | ||
y: string; | ||
>y : string | ||
> : ^^^^^^ | ||
} | ||
|
||
declare let b: B; | ||
>b : B | ||
> : ^ | ||
|
||
declare let a: A; | ||
>a : A | ||
> : ^ | ||
|
||
const x = a = b; | ||
>x : B | ||
> : ^ | ||
>a = b : B | ||
> : ^ | ||
>a : A | ||
> : ^ | ||
>b : B | ||
> : ^ | ||
|
||
let obj: { 3: string } = { 3: "three" }; | ||
>obj : { 3: string; } | ||
> : ^^^^^ ^^^ | ||
>3 : string | ||
> : ^^^^^^ | ||
>{ 3: "three" } : { 3: string; } | ||
> : ^^^^^^^^^^^^^^ | ||
>3 : string | ||
> : ^^^^^^ | ||
>"three" : "three" | ||
> : ^^^^^^^ | ||
|
||
obj[x]; | ||
>obj[x] : any | ||
> : ^^^ | ||
>obj : { 3: string; } | ||
> : ^^^^^^^^^^^^^^ | ||
>x : B | ||
> : ^ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
duplicateErrorNameNotFound.ts(4,5): error TS2552: Cannot find name 'RoomInterface'. Did you mean 'RoomInterfae'? | ||
|
||
|
||
==== duplicateErrorNameNotFound.ts (1 errors) ==== | ||
type RoomInterfae = {}; | ||
|
||
export type { | ||
RoomInterface | ||
~~~~~~~~~~~~~ | ||
!!! error TS2552: Cannot find name 'RoomInterface'. Did you mean 'RoomInterfae'? | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//// [tests/cases/compiler/duplicateErrorNameNotFound.ts] //// | ||
|
||
//// [duplicateErrorNameNotFound.ts] | ||
type RoomInterfae = {}; | ||
|
||
export type { | ||
RoomInterface | ||
} | ||
|
||
//// [duplicateErrorNameNotFound.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//// [tests/cases/compiler/duplicateErrorNameNotFound.ts] //// | ||
|
||
=== duplicateErrorNameNotFound.ts === | ||
type RoomInterfae = {}; | ||
>RoomInterfae : Symbol(RoomInterfae, Decl(duplicateErrorNameNotFound.ts, 0, 0)) | ||
|
||
export type { | ||
RoomInterface | ||
>RoomInterface : Symbol(RoomInterface, Decl(duplicateErrorNameNotFound.ts, 2, 13)) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//// [tests/cases/compiler/duplicateErrorNameNotFound.ts] //// | ||
|
||
=== duplicateErrorNameNotFound.ts === | ||
type RoomInterfae = {}; | ||
>RoomInterfae : RoomInterfae | ||
> : ^^^^^^^^^^^^ | ||
|
||
export type { | ||
RoomInterface | ||
>RoomInterface : any | ||
> : ^^^ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
Assignability cache: 5,000 | ||
Type Count: 10,000 | ||
Instantiation count: 250,000 | ||
Symbol count: 100,000 | ||
Symbol count: 250,000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...That's a big bump. Is this just caused by the extra There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't necessarily something that aughta get fixed in this PR, but understanding where so many symbols popped in from could be useful. It might indicate that we're not caching something we aughta be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I believe so. Since this test has an infinitely recurring type, it didn't seem like a great reason for concern to me, but I could be wrong. |
||
|
||
=== mappedTypeRecursiveInference.ts === | ||
interface A { a: A } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be serialized in buildInfo when serializing diagnostic. Will we need this to deduplicate across multiple files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, this should only be relevant for deduplicating diagnostics of a single file.
What's the criterion for needing to serialize this in
buildInfo
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you would need this info to deduplicate with errors from other files or errors emitted for same file in other phase (which obviously isn't true - like say same error is reported by declaration emit and semantic diagnostic just giving hypothetical example here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this doesnt get used beyond file boundaries this should be ok to be not serialized.
That is checking files in any order will result in same error in that file (which we were anyways assuming till now) this is good.