Skip to content

Commit 8e79d45

Browse files
authoredMar 12, 2025
Align gutter width with old compiler (microsoft#517)
1 parent fc5909a commit 8e79d45

13 files changed

+260
-281
lines changed
 

‎internal/diagnosticwriter/diagnosticwriter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func writeCodeSnippet(writer io.Writer, sourceFile *ast.SourceFile, start int, l
9090
lastLineOfFile, _ := scanner.GetLineAndCharacterOfPosition(sourceFile, len(sourceFile.Text))
9191

9292
hasMoreThanFiveLines := lastLine-firstLine >= 4
93-
gutterWidth := len(strconv.Itoa(lastLineOfFile + 1 + len("")))
93+
gutterWidth := len(strconv.Itoa(lastLine + 1))
9494
if hasMoreThanFiveLines {
9595
gutterWidth = max(len(ellipsis), gutterWidth)
9696
}

‎testdata/baselines/reference/submodule/compiler/deeplyNestedAssignabilityIssue.errors.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
   ~~~~~
55

66
deeplyNestedAssignabilityIssue.ts:2:5 - 'a' is declared here.
7-
 2 a: number;
8-
   ~
7+
2 a: number;
8+
   ~
99

1010
deeplyNestedAssignabilityIssue.ts:9:17 - The expected type comes from property 'thing' which is declared here on type '{ thing: A; }'
11-
 9 thing: A;
12-
   ~~~~~
11+
9 thing: A;
12+
   ~~~~~
1313

1414
deeplyNestedAssignabilityIssue.ts:25:17 - error TS2741: Property 'a' is missing in type '{}' but required in type 'A'.
1515

1616
25 another: {}
1717
   ~~~~~~~
1818

1919
deeplyNestedAssignabilityIssue.ts:2:5 - 'a' is declared here.
20-
 2 a: number;
21-
   ~
20+
2 a: number;
21+
   ~
2222

2323
deeplyNestedAssignabilityIssue.ts:12:17 - The expected type comes from property 'another' which is declared here on type '{ another: A; }'
2424
12 another: A;

‎testdata/baselines/reference/submodule/compiler/deeplyNestedAssignabilityIssue.errors.txt.diff

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,28 @@
55
   ~~~~~
66

77
- deeplyNestedAssignabilityIssue.ts:2:5
8-
- 2 a: number;
9-
-    ~
8+
+ deeplyNestedAssignabilityIssue.ts:2:5 - 'a' is declared here.
9+
2 a: number;
10+
   ~
1011
- 'a' is declared here.
1112
- deeplyNestedAssignabilityIssue.ts:9:17
12-
- 9 thing: A;
13-
-    ~~~~~
14-
- The expected type comes from property 'thing' which is declared here on type '{ thing: A; }'
15-
+ deeplyNestedAssignabilityIssue.ts:2:5 - 'a' is declared here.
16-
+  2 a: number;
17-
+    ~
1813
+
1914
+ deeplyNestedAssignabilityIssue.ts:9:17 - The expected type comes from property 'thing' which is declared here on type '{ thing: A; }'
20-
+  9 thing: A;
21-
+    ~~~~~
15+
9 thing: A;
16+
   ~~~~~
17+
- The expected type comes from property 'thing' which is declared here on type '{ thing: A; }'
2218
+
2319
deeplyNestedAssignabilityIssue.ts:25:17 - error TS2741: Property 'a' is missing in type '{}' but required in type 'A'.
2420

2521
25 another: {}
2622
   ~~~~~~~
2723

2824
- deeplyNestedAssignabilityIssue.ts:2:5
29-
- 2 a: number;
30-
-    ~
25+
+ deeplyNestedAssignabilityIssue.ts:2:5 - 'a' is declared here.
26+
2 a: number;
27+
   ~
3128
- 'a' is declared here.
3229
- deeplyNestedAssignabilityIssue.ts:12:17
33-
+ deeplyNestedAssignabilityIssue.ts:2:5 - 'a' is declared here.
34-
+  2 a: number;
35-
+    ~
3630
+
3731
+ deeplyNestedAssignabilityIssue.ts:12:17 - The expected type comes from property 'another' which is declared here on type '{ another: A; }'
3832
12 another: A;

‎testdata/baselines/reference/submodule/compiler/duplicateIdentifierRelatedSpans2.errors.txt

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,157 +4,157 @@
44
   ~
55

66
file2.ts:1:7 - 'A' was also declared here.
7-
 1 class A { }
8-
   ~
7+
1 class A { }
8+
   ~
99

1010
file1.ts:2:7 - error TS2300: Duplicate identifier 'B'.
1111

1212
2 class B { }
1313
   ~
1414

1515
file2.ts:2:7 - 'B' was also declared here.
16-
 2 class B { }
17-
   ~
16+
2 class B { }
17+
   ~
1818

1919
file1.ts:3:7 - error TS2300: Duplicate identifier 'C'.
2020

2121
3 class C { }
2222
   ~
2323

2424
file2.ts:3:7 - 'C' was also declared here.
25-
 3 class C { }
26-
   ~
25+
3 class C { }
26+
   ~
2727

2828
file1.ts:4:7 - error TS2300: Duplicate identifier 'D'.
2929

3030
4 class D { }
3131
   ~
3232

3333
file2.ts:4:7 - 'D' was also declared here.
34-
 4 class D { }
35-
   ~
34+
4 class D { }
35+
   ~
3636

3737
file1.ts:5:7 - error TS2300: Duplicate identifier 'E'.
3838

3939
5 class E { }
4040
   ~
4141

4242
file2.ts:5:7 - 'E' was also declared here.
43-
 5 class E { }
44-
   ~
43+
5 class E { }
44+
   ~
4545

4646
file1.ts:6:7 - error TS2300: Duplicate identifier 'F'.
4747

4848
6 class F { }
4949
   ~
5050

5151
file2.ts:6:7 - 'F' was also declared here.
52-
 6 class F { }
53-
   ~
52+
6 class F { }
53+
   ~
5454

5555
file1.ts:7:7 - error TS2300: Duplicate identifier 'G'.
5656

5757
7 class G { }
5858
   ~
5959

6060
file2.ts:7:7 - 'G' was also declared here.
61-
 7 class G { }
62-
   ~
61+
7 class G { }
62+
   ~
6363

6464
file1.ts:8:7 - error TS2300: Duplicate identifier 'H'.
6565

6666
8 class H { }
6767
   ~
6868

6969
file2.ts:8:7 - 'H' was also declared here.
70-
 8 class H { }
71-
   ~
70+
8 class H { }
71+
   ~
7272

7373
file1.ts:9:7 - error TS2300: Duplicate identifier 'I'.
7474

7575
9 class I { }
7676
   ~
7777

7878
file2.ts:9:7 - 'I' was also declared here.
79-
 9 class I { }
80-
   ~
79+
9 class I { }
80+
   ~
8181

8282
file2.ts:1:7 - error TS2300: Duplicate identifier 'A'.
8383

84-
 1 class A { }
85-
   ~
84+
1 class A { }
85+
   ~
8686

8787
file1.ts:1:7 - 'A' was also declared here.
8888
1 class A { }
8989
   ~
9090

9191
file2.ts:2:7 - error TS2300: Duplicate identifier 'B'.
9292

93-
 2 class B { }
94-
   ~
93+
2 class B { }
94+
   ~
9595

9696
file1.ts:2:7 - 'B' was also declared here.
9797
2 class B { }
9898
   ~
9999

100100
file2.ts:3:7 - error TS2300: Duplicate identifier 'C'.
101101

102-
 3 class C { }
103-
   ~
102+
3 class C { }
103+
   ~
104104

105105
file1.ts:3:7 - 'C' was also declared here.
106106
3 class C { }
107107
   ~
108108

109109
file2.ts:4:7 - error TS2300: Duplicate identifier 'D'.
110110

111-
 4 class D { }
112-
   ~
111+
4 class D { }
112+
   ~
113113

114114
file1.ts:4:7 - 'D' was also declared here.
115115
4 class D { }
116116
   ~
117117

118118
file2.ts:5:7 - error TS2300: Duplicate identifier 'E'.
119119

120-
 5 class E { }
121-
   ~
120+
5 class E { }
121+
   ~
122122

123123
file1.ts:5:7 - 'E' was also declared here.
124124
5 class E { }
125125
   ~
126126

127127
file2.ts:6:7 - error TS2300: Duplicate identifier 'F'.
128128

129-
 6 class F { }
130-
   ~
129+
6 class F { }
130+
   ~
131131

132132
file1.ts:6:7 - 'F' was also declared here.
133133
6 class F { }
134134
   ~
135135

136136
file2.ts:7:7 - error TS2300: Duplicate identifier 'G'.
137137

138-
 7 class G { }
139-
   ~
138+
7 class G { }
139+
   ~
140140

141141
file1.ts:7:7 - 'G' was also declared here.
142142
7 class G { }
143143
   ~
144144

145145
file2.ts:8:7 - error TS2300: Duplicate identifier 'H'.
146146

147-
 8 class H { }
148-
   ~
147+
8 class H { }
148+
   ~
149149

150150
file1.ts:8:7 - 'H' was also declared here.
151151
8 class H { }
152152
   ~
153153

154154
file2.ts:9:7 - error TS2300: Duplicate identifier 'I'.
155155

156-
 9 class I { }
157-
   ~
156+
9 class I { }
157+
   ~
158158

159159
file1.ts:9:7 - 'I' was also declared here.
160160
9 class I { }

0 commit comments

Comments
 (0)