Skip to content

Commit ed5eeaf

Browse files
authored
Preserve range on copied identifiers (#57965)
1 parent c87b5bc commit ed5eeaf

File tree

2,554 files changed

+15038
-15038
lines changed

Some content is hidden

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

2,554 files changed

+15038
-15038
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8611,7 +8611,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
86118611
const type = getDeclaredTypeOfSymbol(sym);
86128612
const name = sym.flags & SymbolFlags.TypeParameter ? typeParameterToName(type, context) : factory.cloneNode(node);
86138613
name.symbol = sym; // for quickinfo, which uses identifier symbol information
8614-
return { introducesError, node: setEmitFlags(setOriginalNode(name, node), EmitFlags.NoAsciiEscaping) };
8614+
return { introducesError, node: setTextRange(setEmitFlags(setOriginalNode(name, node), EmitFlags.NoAsciiEscaping), node) };
86158615
}
86168616
}
86178617

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

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

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Point {
1313

1414
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
1515
>Origin : () => Point
16-
> : ^^^^^^^^^^^
16+
> : ^^^^^^
1717
>{ x: 0, y: 0 } : { x: number; y: number; }
1818
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
1919
>x : number
@@ -52,7 +52,7 @@ module A {
5252

5353
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
5454
>Origin : () => Point
55-
> : ^^^^^^^^^^^
55+
> : ^^^^^^
5656
>{ x: 0, y: 0 } : { x: number; y: number; }
5757
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
5858
>x : number

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Point {
1313

1414
static Origin(): Point { return { x: 0, y: 0 }; }
1515
>Origin : () => Point
16-
> : ^^^^^^^^^^^
16+
> : ^^^^^^
1717
>{ x: 0, y: 0 } : { x: number; y: number; }
1818
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
1919
>x : number
@@ -54,7 +54,7 @@ module A {
5454

5555
static Origin(): Point { return { x: 0, y: 0 }; }
5656
>Origin : () => Point
57-
> : ^^^^^^^^^^^
57+
> : ^^^^^^
5858
>{ x: 0, y: 0 } : { x: number; y: number; }
5959
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
6060
>x : number

tests/baselines/reference/ClassDeclaration25.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
interface IList<T> {
55
data(): T;
66
>data : () => T
7-
> : ^^^^^^^
7+
> : ^^^^^^
88

99
next(): string;
1010
>next : () => string
@@ -16,7 +16,7 @@ class List<U> implements IList<U> {
1616

1717
data(): U;
1818
>data : () => U
19-
> : ^^^^^^^
19+
> : ^^^^^^
2020

2121
next(): string;
2222
>next : () => string

tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module A {
1616

1717
fromOrigin(p: Point): number;
1818
>fromOrigin : (p: Point) => number
19-
> : ^^^^^^^^^^^^^^
19+
> : ^^^^ ^^^^^
2020
>p : Point
2121
> : ^^^^^
2222
}
@@ -33,7 +33,7 @@ module A {
3333

3434
fromOrigin(p: Point) {
3535
>fromOrigin : (p: Point) => number
36-
> : ^^^^^^^^^^^^^^^^^^^^
36+
> : ^^^^ ^^^^^^^^^^^
3737
>p : Point
3838
> : ^^^^^
3939

tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module A {
7373

7474
static fromorigin2d(p: Point): Line<Point>{
7575
>fromorigin2d : (p: Point) => Line<Point>
76-
> : ^^^^^^^^^^^^^^^^^^ ^^^^^
76+
> : ^^^^ ^^^^^
7777
>p : Point
7878
> : ^^^^^
7979

0 commit comments

Comments
 (0)