Skip to content

Commit a2d37a5

Browse files
authored
Underlines in baselines should not consider nodes with .original set synthetic (#58086)
1 parent 4bfb4e6 commit a2d37a5

File tree

4,915 files changed

+55620
-55616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,915 files changed

+55620
-55616
lines changed

src/harness/typeWriter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ function* forEachASTNode(node: ts.Node) {
4444
}
4545
}
4646

47+
function nodeIsFullySynthetic(node: ts.Node) {
48+
return ts.nodeIsSynthesized(node) && !node.original;
49+
}
50+
4751
const createSyntheticNodeUnderliningPrinter = memoize((): { printer: ts.Printer; writer: ts.EmitTextWriter; underliner: ts.EmitTextWriter; reset(): void; } => {
4852
let underlining = false;
4953
const printer = createPrinter({ removeComments: true }, {
5054
onEmitNode: (hint, node, cb) => {
51-
if (ts.nodeIsSynthesized(node) !== underlining) {
55+
if (nodeIsFullySynthetic(node) !== underlining) {
5256
// either node is synthetic and underlining needs to be enabled, or node is not synthetic and
5357
// underlining needs to be disabled
5458
underlining = !underlining;

tests/baselines/reference/1.0lib-noErrors.types

Lines changed: 172 additions & 172 deletions
Large diffs are not rendered by default.

tests/baselines/reference/2dArrays.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ class Board {
3535
>this.ships.every(function (val) { return val.isSunk; }) : boolean
3636
> : ^^^^^^^
3737
>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; }
38-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
3939
>this.ships : Ship[]
4040
> : ^^^^^^
4141
>this : this
4242
> : ^^^^
4343
>ships : Ship[]
4444
> : ^^^^^^
4545
>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; }
46-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
4747
>function (val) { return val.isSunk; } : (val: Ship) => boolean
48-
> : ^^^^^^^^^^^^^^^^^^^^^^
48+
> : ^ ^^^^^^^^^^^^^^^^^^
4949
>val : Ship
5050
> : ^^^^
5151
>val.isSunk : boolean

tests/baselines/reference/ArrowFunction1.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
=== ArrowFunction1.ts ===
44
var v = (a: ) => {
55
>v : (a: any) => void
6-
> : ^^^^^^^^^^^^^^^^
6+
> : ^ ^^^^^^^^^^^^^^
77
>(a: ) => { } : (a: any) => void
8-
> : ^^^^^^^^^^^^^^^^
8+
> :
99
>a : any
1010
> : ^^^
1111

tests/baselines/reference/ArrowFunction4.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
=== ArrowFunction4.ts ===
44
var v = (a, b) => {
55
>v : (a: any, b: any) => void
6-
> : ^^^^^^^^^^^^^^^^^^^^^^^^
6+
> : ^ ^^^^^^^ ^^^^^^^^^^^^^^
77
>(a, b) => { } : (a: any, b: any) => void
8-
> : ^^^^^^^^^^^^^^^^^^^^^^^^
8+
> :
99
>a : any
1010
>b : any
1111

tests/baselines/reference/ArrowFunctionExpression1.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
=== ArrowFunctionExpression1.ts ===
44
var v = (public x: string) => { };
55
>v : (x: string) => void
6-
> : ^^^^ ^^^^^^^^^
6+
> : ^ ^^ ^^^^^^^^^
77
>(public x: string) => { } : (x: string) => void
8-
> : ^^^^ ^^^^^^^^^
8+
> :
99
>x : string
1010
> : ^^^^^^
1111

tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module clodule1 {
2222

2323
function f(x: T) { }
2424
>f : (x: T) => void
25-
> : ^^^^^^^^^^^^^^
25+
> : ^ ^^^^^^^^^^^^
2626
>x : T
2727
> : ^
2828
}

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class clodule<T> {
1515

1616
static fn<U>(id: U) { }
1717
>fn : <U>(id: U) => void
18-
> : ^ ^^^^^^ ^^^^^^^^^
18+
> : ^ ^^ ^^ ^^^^^^^^^
1919
>id : U
2020
> : ^
2121
}
@@ -27,7 +27,7 @@ module clodule {
2727
// error: duplicate identifier expected
2828
export function fn<T>(x: T, y: T): T {
2929
>fn : <T>(x: T, y: T) => T
30-
> : ^ ^^^^^ ^^^^^ ^^^^^
30+
> : ^ ^^ ^^ ^^ ^^ ^^^^^
3131
>x : T
3232
> : ^
3333
>y : T

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class clodule<T> {
1515

1616
static fn(id: string) { }
1717
>fn : (id: string) => void
18-
> : ^^^^^ ^^^^^^^^^
18+
> : ^ ^^ ^^^^^^^^^
1919
>id : string
2020
> : ^^^^^^
2121
}
@@ -27,7 +27,7 @@ module clodule {
2727
// error: duplicate identifier expected
2828
export function fn<T>(x: T, y: T): T {
2929
>fn : <T>(x: T, y: T) => T
30-
> : ^ ^^^^^ ^^^^^ ^^^^^
30+
> : ^ ^^ ^^ ^^ ^^ ^^^^^
3131
>x : T
3232
> : ^
3333
>y : T

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class clodule<T> {
1515

1616
private static sfn(id: string) { return 42; }
1717
>sfn : (id: string) => number
18-
> : ^^^^^ ^^^^^^^^^^^
18+
> : ^ ^^ ^^^^^^^^^^^
1919
>id : string
2020
> : ^^^^^^
2121
>42 : 42
@@ -29,7 +29,7 @@ module clodule {
2929
// error: duplicate identifier expected
3030
export function fn<T>(x: T, y: T): number {
3131
>fn : <T>(x: T, y: T) => number
32-
> : ^ ^^^^^ ^^^^^ ^^^^^
32+
> : ^ ^^ ^^ ^^ ^^ ^^^^^
3333
>x : T
3434
> : ^
3535
>y : T
@@ -39,11 +39,11 @@ module clodule {
3939
>clodule.sfn('a') : number
4040
> : ^^^^^^
4141
>clodule.sfn : (id: string) => number
42-
> : ^^^^^^^^^^^^^^^^^^^^^^
42+
> : ^ ^^^^^^^^^^^^^^^^^^^
4343
>clodule : typeof clodule
4444
> : ^^^^^^^^^^^^^^
4545
>sfn : (id: string) => number
46-
> : ^^^^^^^^^^^^^^^^^^^^^^
46+
> : ^ ^^^^^^^^^^^^^^^^^^^
4747
>'a' : "a"
4848
> : ^^^
4949
}

0 commit comments

Comments
 (0)