Skip to content

Commit 5c12fc5

Browse files
committed
Change the error message
1 parent 3bd2226 commit 5c12fc5

21 files changed

+48
-48
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16504,7 +16504,7 @@ namespace ts {
1650416504
if (!hasParseDiagnostics(sourceFile)) {
1650516505
const start = getSpanOfTokenAtPosition(sourceFile, node.pos).start;
1650616506
const end = node.statement.pos;
16507-
grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Unsupported_with_statement_all_symbols_within_a_with_block_will_be_resolved_to_any);
16507+
grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any);
1650816508
}
1650916509
}
1651016510

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@
12791279
"category": "Error",
12801280
"code": 2409
12811281
},
1282-
"Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.": {
1282+
"The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.": {
12831283
"category": "Error",
12841284
"code": 2410
12851285
},

tests/baselines/reference/ambientWithStatements.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ tests/cases/compiler/ambientWithStatements.ts(2,5): error TS1036: Statements are
22
tests/cases/compiler/ambientWithStatements.ts(3,5): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement.
33
tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.
44
tests/cases/compiler/ambientWithStatements.ts(11,5): error TS1108: A 'return' statement can only be used within a function body.
5-
tests/cases/compiler/ambientWithStatements.ts(25,5): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
5+
tests/cases/compiler/ambientWithStatements.ts(25,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
66

77

88
==== tests/cases/compiler/ambientWithStatements.ts (5 errors) ====
@@ -40,6 +40,6 @@ tests/cases/compiler/ambientWithStatements.ts(25,5): error TS2410: Unsupported '
4040
}
4141
with (x) {
4242
~~~~~~~~
43-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
43+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
4444
}
4545
}

tests/baselines/reference/arrowFunctionContexts.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(3,1): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
1+
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(3,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
22
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(3,7): error TS2304: Cannot find name 'window'.
33
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(19,1): error TS2304: Cannot find name 'window'.
44
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(31,9): error TS2322: Type '() => number' is not assignable to type 'E'.
55
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(32,16): error TS2332: 'this' cannot be referenced in current location.
6-
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(44,5): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
6+
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(44,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
77
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(44,11): error TS2304: Cannot find name 'window'.
88
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(60,5): error TS2304: Cannot find name 'window'.
99
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(72,13): error TS2322: Type '() => number' is not assignable to type 'E'.
@@ -15,7 +15,7 @@ tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(73,20): e
1515
// Arrow function used in with statement
1616
with (window) {
1717
~~~~~~~~~~~~~
18-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
18+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
1919
~~~~~~
2020
!!! error TS2304: Cannot find name 'window'.
2121
var p = () => this;
@@ -66,7 +66,7 @@ tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(73,20): e
6666
// Arrow function used in with statement
6767
with (window) {
6868
~~~~~~~~~~~~~
69-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
69+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
7070
~~~~~~
7171
!!! error TS2304: Cannot find name 'window'.
7272
var p = () => this;

tests/baselines/reference/constDeclarations-invalidContexts.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(4,5): error TS1156: 'c
22
tests/cases/compiler/constDeclarations-invalidContexts.ts(6,5): error TS1156: 'const' declarations can only be declared inside a block.
33
tests/cases/compiler/constDeclarations-invalidContexts.ts(9,5): error TS1156: 'const' declarations can only be declared inside a block.
44
tests/cases/compiler/constDeclarations-invalidContexts.ts(12,5): error TS1156: 'const' declarations can only be declared inside a block.
5-
tests/cases/compiler/constDeclarations-invalidContexts.ts(16,1): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
5+
tests/cases/compiler/constDeclarations-invalidContexts.ts(16,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
66
tests/cases/compiler/constDeclarations-invalidContexts.ts(20,5): error TS1156: 'const' declarations can only be declared inside a block.
77
tests/cases/compiler/constDeclarations-invalidContexts.ts(23,5): error TS1156: 'const' declarations can only be declared inside a block.
88
tests/cases/compiler/constDeclarations-invalidContexts.ts(26,12): error TS1156: 'const' declarations can only be declared inside a block.
@@ -35,7 +35,7 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(29,29): error TS1156:
3535
var obj;
3636
with (obj)
3737
~~~~~~~~~~
38-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
38+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
3939
const c5 = 0; // No Error will be reported here since we turn off all type checking
4040

4141
for (var i = 0; i < 10; i++)

tests/baselines/reference/constDeclarations-scopes.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
tests/cases/compiler/constDeclarations-scopes.ts(13,5): error TS7027: Unreachable code detected.
22
tests/cases/compiler/constDeclarations-scopes.ts(22,1): error TS7027: Unreachable code detected.
3-
tests/cases/compiler/constDeclarations-scopes.ts(28,1): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
3+
tests/cases/compiler/constDeclarations-scopes.ts(28,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
44

55

66
==== tests/cases/compiler/constDeclarations-scopes.ts (3 errors) ====
@@ -37,7 +37,7 @@ tests/cases/compiler/constDeclarations-scopes.ts(28,1): error TS2410: Unsupporte
3737
var obj;
3838
with (obj) {
3939
~~~~~~~~~~
40-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
40+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
4141
const c = 0;
4242
n = c;
4343
}

tests/baselines/reference/constDeclarations-validContexts.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/compiler/constDeclarations-validContexts.ts(20,1): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
1+
tests/cases/compiler/constDeclarations-validContexts.ts(20,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
22

33

44
==== tests/cases/compiler/constDeclarations-validContexts.ts (1 errors) ====
@@ -23,7 +23,7 @@ tests/cases/compiler/constDeclarations-validContexts.ts(20,1): error TS2410: Uns
2323
var obj;
2424
with (obj) {
2525
~~~~~~~~~~
26-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
26+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
2727
const c5 = 0;
2828
}
2929

tests/baselines/reference/es5-asyncFunctionWithStatements.errors.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(4,5): error TS1300: 'with' statements are not allowed in an async function block.
2-
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(4,5): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
2+
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(4,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
33
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(10,5): error TS1300: 'with' statements are not allowed in an async function block.
4-
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(10,5): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
4+
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(10,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
55
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(16,5): error TS1300: 'with' statements are not allowed in an async function block.
6-
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(16,5): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
6+
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(16,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
77
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS1300: 'with' statements are not allowed in an async function block.
8-
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
8+
tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
99

1010

1111
==== tests/cases/compiler/es5-asyncFunctionWithStatements.ts (8 errors) ====
@@ -16,7 +16,7 @@ tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS2410: Uns
1616
~~~~
1717
!!! error TS1300: 'with' statements are not allowed in an async function block.
1818
~~~~~~~~
19-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
19+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
2020
y;
2121
}
2222
}
@@ -26,7 +26,7 @@ tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS2410: Uns
2626
~~~~
2727
!!! error TS1300: 'with' statements are not allowed in an async function block.
2828
~~~~~~~~~~~~~~
29-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
29+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
3030
y;
3131
}
3232
}
@@ -36,7 +36,7 @@ tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS2410: Uns
3636
~~~~
3737
!!! error TS1300: 'with' statements are not allowed in an async function block.
3838
~~~~~~~~
39-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
39+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
4040
a;
4141
await y;
4242
b;
@@ -48,7 +48,7 @@ tests/cases/compiler/es5-asyncFunctionWithStatements.ts(24,5): error TS2410: Uns
4848
~~~~
4949
!!! error TS1300: 'with' statements are not allowed in an async function block.
5050
~~~~~~~~
51-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
51+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
5252
with (z) {
5353
a;
5454
await y;

tests/baselines/reference/functionExpressionInWithBlock.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
tests/cases/compiler/functionExpressionInWithBlock.ts(2,2): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
1+
tests/cases/compiler/functionExpressionInWithBlock.ts(2,2): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
22

33

44
==== tests/cases/compiler/functionExpressionInWithBlock.ts (1 errors) ====
55
function x() {
66
with({}) {
77
~~~~~~~~
8-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
8+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
99
function f() {
1010
() => this;
1111
}

tests/baselines/reference/letDeclarations-invalidContexts.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ tests/cases/compiler/letDeclarations-invalidContexts.ts(5,5): error TS1157: 'let
22
tests/cases/compiler/letDeclarations-invalidContexts.ts(7,5): error TS1157: 'let' declarations can only be declared inside a block.
33
tests/cases/compiler/letDeclarations-invalidContexts.ts(10,5): error TS1157: 'let' declarations can only be declared inside a block.
44
tests/cases/compiler/letDeclarations-invalidContexts.ts(13,5): error TS1157: 'let' declarations can only be declared inside a block.
5-
tests/cases/compiler/letDeclarations-invalidContexts.ts(17,1): error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
5+
tests/cases/compiler/letDeclarations-invalidContexts.ts(17,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
66
tests/cases/compiler/letDeclarations-invalidContexts.ts(21,5): error TS1157: 'let' declarations can only be declared inside a block.
77
tests/cases/compiler/letDeclarations-invalidContexts.ts(24,5): error TS1157: 'let' declarations can only be declared inside a block.
88
tests/cases/compiler/letDeclarations-invalidContexts.ts(27,12): error TS1157: 'let' declarations can only be declared inside a block.
@@ -36,7 +36,7 @@ tests/cases/compiler/letDeclarations-invalidContexts.ts(30,29): error TS1157: 'l
3636
var obj;
3737
with (obj)
3838
~~~~~~~~~~
39-
!!! error TS2410: Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.
39+
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
4040
let l5 = 0;
4141

4242
for (var i = 0; i < 10; i++)

0 commit comments

Comments
 (0)