Skip to content

Improve reuse of nodes in signatures with type mapping #58546

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

Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
125 changes: 90 additions & 35 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/services/symbolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type
typeChecker,
resolvedSymbol,
getSourceFileOfNode(resolvedNode),
resolvedNode,
enclosingDeclaration,
declarationName,
type,
semanticMeaning,
Expand Down
50 changes: 25 additions & 25 deletions tests/baselines/reference/1.0lib-noErrors.types

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/baselines/reference/2dArrays.types
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Board {
>this.ships.every(function (val) { return val.isSunk; }) : boolean
> : ^^^^^^^
>this.ships.every : { <S extends Ship>(predicate: (value: Ship, index: number, array: Ship[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Ship, index: number, array: Ship[]) => unknown, thisArg?: any): boolean; }
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ ^ ^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^ ^^^ ^^^ ^^^
>this.ships : Ship[]
> : ^^^^^^
>this : this
> : ^^^^
>ships : Ship[]
> : ^^^^^^
>every : { <S extends Ship>(predicate: (value: Ship, index: number, array: Ship[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Ship, index: number, array: Ship[]) => unknown, thisArg?: any): boolean; }
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ ^ ^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^ ^^^ ^^^ ^^^
>function (val) { return val.isSunk; } : (val: Ship) => boolean
> : ^ ^^^^^^^^^^^^^^^^^^
>val : Ship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ var cl: { x: number; y: number; }

var cl = Point();
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point() : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point : typeof Point
> : ^^^^^^^^^^^^

var cl = Point.Origin;
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point : typeof Point
> : ^^^^^^^^^^^^
>Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^

Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ var p: { x: number; y: number; }

var p = A.Point.Origin;
>p : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>A.Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>A.Point : typeof A.Point
> : ^^^^^^^^^^^^^^
>A : typeof A
> : ^^^^^^^^
>Point : typeof A.Point
> : ^^^^^^^^^^^^^^
>Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^

var p = new A.Point(0, 0); // unexpected error here, bug 840000
>p : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>new A.Point(0, 0) : A.Point
> : ^^^^^^^
>A.Point : typeof A.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ var p: { x: number; y: number; }

var p = A.Point.Origin;
>p : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>A.Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>A.Point : typeof A.Point
> : ^^^^^^^^^^^^^^
>A : typeof A
> : ^^^^^^^^
>Point : typeof A.Point
> : ^^^^^^^^^^^^^^
>Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^

var p = new A.Point(0, 0); // unexpected error here, bug 840000
>p : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>new A.Point(0, 0) : A.Point
> : ^^^^^^^
>A.Point : typeof A.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ var cl: { x: number; y: number; }

var cl = Point();
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point() : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>Point : typeof Point
> : ^^^^^^^^^^^^

var cl = Point.Origin;
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>Point : typeof Point
> : ^^^^^^^^^^^^
>Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^

4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of1.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ for (var v of ['a', 'b', 'c']) {
>console.log(v) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>v : string
> : ^^^^^^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of22.types
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ for (var x of [1, 2, 3]) {
>console.log(x) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>x : number
> : ^^^^^^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of23.types
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ for (var x of [1, 2, 3]) {
>console.log(x) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>x : number
> : ^^^^^^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of33.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ for (var v of ['a', 'b', 'c']) {
>console.log(v) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>v : string
> : ^^^^^^
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of37.types
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ for (const i of [0, 1, 2, 3, 4]) {
>console.log(i) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>i : number
> : ^^^^^^

Expand All @@ -69,11 +69,11 @@ for (const i of [0, 1, 2, 3, 4]) {
>console.log('E %s %s', i, err) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^ ^^^^^^^^^
> : ^^^^ ^^ ^^^^^
>'E %s %s' : "E %s %s"
> : ^^^^^^^^^
>i : number
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5SymbolProperty4.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class C {
>Symbol.iterator : string
> : ^^^^^^
>Symbol : { iterator: string; }
> : ^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^ ^^^
>iterator : string
> : ^^^^^^
}
Expand All @@ -33,7 +33,7 @@ class C {
>Symbol.iterator : string
> : ^^^^^^
>Symbol : { iterator: string; }
> : ^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^ ^^^
>iterator : string
> : ^^^^^^

4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5SymbolProperty5.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class C {
>Symbol.iterator : symbol
> : ^^^^^^
>Symbol : { iterator: symbol; }
> : ^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^ ^^^
>iterator : symbol
> : ^^^^^^
}
Expand All @@ -34,7 +34,7 @@ class C {
>Symbol.iterator : symbol
> : ^^^^^^
>Symbol : { iterator: symbol; }
> : ^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^ ^^^
>iterator : symbol
> : ^^^^^^
>0 : 0
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5SymbolProperty7.types
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class C {
> : ^^^^^^^^^^
>Symbol.iterator : any
>Symbol : { iterator: any; }
> : ^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^ ^^^
>iterator : any
> : ^^^
}
Expand All @@ -30,7 +30,7 @@ class C {
> : ^^^^^^^^
>Symbol.iterator : any
>Symbol : { iterator: any; }
> : ^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^ ^^^
>iterator : any
> : ^^^

4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5SymbolType1.types
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ s.toString();
>s.toString() : string
> : ^^^^^^
>s.toString : () => string
> : ^^^^^^^^^^^^
> : ^^^^^^
>s : symbol
> : ^^^^^^
>toString : () => string
> : ^^^^^^^^^^^^
> : ^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var y: { x: number; y: number };

var y = new enumdule.Point(0, 0);
>y : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>new enumdule.Point(0, 0) : enumdule.Point
> : ^^^^^^^^^^^^^^
>enumdule.Point : typeof enumdule.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var fn: () => { x: number; y: number };

var fn = A.Point;
>fn : () => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^
>A.Point : typeof A.Point
> : ^^^^^^^^^^^^^^
>A : typeof A
Expand All @@ -77,7 +77,7 @@ var cl: { x: number; y: number; }

var cl = A.Point();
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>A.Point() : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>A.Point : typeof A.Point
Expand All @@ -89,7 +89,7 @@ var cl = A.Point();

var cl = A.Point.Origin; // not expected to be an error.
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>A.Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>A.Point : typeof A.Point
Expand Down Expand Up @@ -146,15 +146,15 @@ module B {

var fn: () => { x: number; y: number };
>fn : () => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^
>x : number
> : ^^^^^^
>y : number
> : ^^^^^^

var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
>fn : () => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^
>B.Point : typeof B.Point
> : ^^^^^^^^^^^^^^
>B : typeof B
Expand All @@ -164,15 +164,15 @@ var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Functi

var cl: { x: number; y: number; }
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>x : number
> : ^^^^^^
>y : number
> : ^^^^^^

var cl = B.Point();
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>B.Point() : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>B.Point : typeof B.Point
Expand All @@ -184,7 +184,7 @@ var cl = B.Point();

var cl = B.Point.Origin;
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>B.Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>B.Point : typeof B.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var fn: () => { x: number; y: number };

var fn = A.Point;
>fn : () => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^
>A.Point : () => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>A : typeof A
Expand All @@ -77,7 +77,7 @@ var cl: { x: number; y: number; }

var cl = B.Point.Origin;
>cl : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>B.Point.Origin : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>B.Point : typeof B.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var y: { x: number; y: number };

var y = new enumdule.Point(0, 0);
>y : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^^^^ ^^^
>new enumdule.Point(0, 0) : enumdule.Point
> : ^^^^^^^^^^^^^^
>enumdule.Point : typeof enumdule.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var a: { id: number; name: string };

var a = new A.A();
>a : { id: number; name: string; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^ ^^^^^^^^ ^^^
>new A.A() : A.A
> : ^^^
>A.A : typeof A.A
Expand Down
Loading