Skip to content

Commit 1be381d

Browse files
committed
WIP more tests, almost done
1 parent b45165d commit 1be381d

File tree

129 files changed

+10734
-5
lines changed

Some content is hidden

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

129 files changed

+10734
-5
lines changed

src/compiler/binder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ namespace ts {
13511351
const clause = clauses[i];
13521352
bind(clause);
13531353
fallthroughFlow = currentFlow;
1354-
if (!(currentFlow.flags & FlowFlags.Unreachable) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
1354+
if (!(currentFlow.flags & FlowFlags.Unreachable) && i !== clauses.length - 1 && getFileLocalCompilerOption(file, options, "noFallthroughCasesInSwitch")) {
13551355
clause.fallthroughFlowNode = currentFlow;
13561356
}
13571357
}

src/compiler/checker.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -12742,7 +12742,7 @@ namespace ts {
1274212742
return symbol;
1274312743
}
1274412744
if (skipObjectFunctionPropertyAugment) return undefined;
12745-
const file = symbol?.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration);
12745+
const file = resolved.symbol?.declarations?.[0] && getSourceFileOfNode(resolved.symbol.declarations[0]);
1274612746
const functionType = resolved === anyFunctionType ? globalFunctionType :
1274712747
resolved.callSignatures.length ? globalCallableFunctionType(file) :
1274812748
resolved.constructSignatures.length ? globalNewableFunctionType(file) :
@@ -19123,8 +19123,8 @@ namespace ts {
1912319123
}
1912419124

1912519125
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean {
19126-
const sourceNoImplicitAny = noImplicitAny(source.symbol?.valueDeclaration);
19127-
const targetNoImplicitAny = noImplicitAny(target.symbol?.valueDeclaration);
19126+
const sourceNoImplicitAny = noImplicitAny(source.symbol?.declarations?.[0]);
19127+
const targetNoImplicitAny = noImplicitAny(target.symbol?.declarations?.[0]);
1912819128
if (!isExcessPropertyCheckTarget(target) || !(sourceNoImplicitAny || targetNoImplicitAny) && getObjectFlags(target) & ObjectFlags.JSLiteral) {
1912919129
return false; // Disable excess property checks on JS literals to simulate having an implicit "index signature" - but only outside of noImplicitAny
1913019130
}
@@ -43113,7 +43113,7 @@ namespace ts {
4311343113
function getAugmentedPropertiesOfType(type: Type): Symbol[] {
4311443114
type = getApparentType(type);
4311543115
const propsByName = createSymbolTable(getPropertiesOfType(type));
43116-
const file = type.symbol?.valueDeclaration && getSourceFileOfNode(type.symbol.valueDeclaration);
43116+
const file = type.symbol?.declarations?.[0] && getSourceFileOfNode(type.symbol.declarations[0]);
4311743117
const functionType = getSignaturesOfType(type, SignatureKind.Call).length ? globalCallableFunctionType(file) :
4311843118
getSignaturesOfType(type, SignatureKind.Construct).length ? globalNewableFunctionType(file) :
4311943119
undefined;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
tests/cases/conformance/pragma/alwaysStrict/file1.ts(2,5): error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
2+
tests/cases/conformance/pragma/alwaysStrict/file2.ts(2,5): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode.
3+
4+
5+
==== tests/cases/conformance/pragma/alwaysStrict/file1.ts (1 errors) ====
6+
// @ts-alwaysStrict
7+
let private = {};
8+
~~~~~~~
9+
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
10+
==== tests/cases/conformance/pragma/alwaysStrict/file2.ts (1 errors) ====
11+
// @ts-alwaysStrict true
12+
let protected = {};
13+
~~~~~~~~~
14+
!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode.
15+
==== tests/cases/conformance/pragma/alwaysStrict/file3.ts (0 errors) ====
16+
// @ts-alwaysStrict false
17+
let public = {};
18+
==== tests/cases/conformance/pragma/alwaysStrict/file4.ts (0 errors) ====
19+
let static = {};
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//// [tests/cases/conformance/pragma/alwaysStrict/alwaysStrictPragma1.ts] ////
2+
3+
//// [file1.ts]
4+
// @ts-alwaysStrict
5+
let private = {};
6+
//// [file2.ts]
7+
// @ts-alwaysStrict true
8+
let protected = {};
9+
//// [file3.ts]
10+
// @ts-alwaysStrict false
11+
let public = {};
12+
//// [file4.ts]
13+
let static = {};
14+
15+
16+
//// [file1.js]
17+
"use strict";
18+
// @ts-alwaysStrict
19+
var private = {};
20+
//// [file2.js]
21+
"use strict";
22+
// @ts-alwaysStrict true
23+
var protected = {};
24+
//// [file3.js]
25+
// @ts-alwaysStrict false
26+
var public = {};
27+
//// [file4.js]
28+
var static = {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/conformance/pragma/alwaysStrict/file1.ts ===
2+
// @ts-alwaysStrict
3+
let private = {};
4+
>private : Symbol(private, Decl(file1.ts, 1, 3))
5+
6+
=== tests/cases/conformance/pragma/alwaysStrict/file2.ts ===
7+
// @ts-alwaysStrict true
8+
let protected = {};
9+
>protected : Symbol(protected, Decl(file2.ts, 1, 3))
10+
11+
=== tests/cases/conformance/pragma/alwaysStrict/file3.ts ===
12+
// @ts-alwaysStrict false
13+
let public = {};
14+
>public : Symbol(public, Decl(file3.ts, 1, 3))
15+
16+
=== tests/cases/conformance/pragma/alwaysStrict/file4.ts ===
17+
let static = {};
18+
>static : Symbol(static, Decl(file4.ts, 0, 3))
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/conformance/pragma/alwaysStrict/file1.ts ===
2+
// @ts-alwaysStrict
3+
let private = {};
4+
>private : {}
5+
>{} : {}
6+
7+
=== tests/cases/conformance/pragma/alwaysStrict/file2.ts ===
8+
// @ts-alwaysStrict true
9+
let protected = {};
10+
>protected : {}
11+
>{} : {}
12+
13+
=== tests/cases/conformance/pragma/alwaysStrict/file3.ts ===
14+
// @ts-alwaysStrict false
15+
let public = {};
16+
>public : {}
17+
>{} : {}
18+
19+
=== tests/cases/conformance/pragma/alwaysStrict/file4.ts ===
20+
let static = {};
21+
>static : {}
22+
>{} : {}
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
tests/cases/conformance/pragma/alwaysStrict/file1.ts(2,5): error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
2+
tests/cases/conformance/pragma/alwaysStrict/file2.ts(2,5): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode.
3+
tests/cases/conformance/pragma/alwaysStrict/file4.ts(1,5): error TS1212: Identifier expected. 'static' is a reserved word in strict mode.
4+
5+
6+
==== tests/cases/conformance/pragma/alwaysStrict/file1.ts (1 errors) ====
7+
// @ts-alwaysStrict
8+
let private = {};
9+
~~~~~~~
10+
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode.
11+
==== tests/cases/conformance/pragma/alwaysStrict/file2.ts (1 errors) ====
12+
// @ts-alwaysStrict true
13+
let protected = {};
14+
~~~~~~~~~
15+
!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode.
16+
==== tests/cases/conformance/pragma/alwaysStrict/file3.ts (0 errors) ====
17+
// @ts-alwaysStrict false
18+
let public = {};
19+
==== tests/cases/conformance/pragma/alwaysStrict/file4.ts (1 errors) ====
20+
let static = {};
21+
~~~~~~
22+
!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode.
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//// [tests/cases/conformance/pragma/alwaysStrict/alwaysStrictPragma2.ts] ////
2+
3+
//// [file1.ts]
4+
// @ts-alwaysStrict
5+
let private = {};
6+
//// [file2.ts]
7+
// @ts-alwaysStrict true
8+
let protected = {};
9+
//// [file3.ts]
10+
// @ts-alwaysStrict false
11+
let public = {};
12+
//// [file4.ts]
13+
let static = {};
14+
15+
16+
//// [file1.js]
17+
"use strict";
18+
// @ts-alwaysStrict
19+
var private = {};
20+
//// [file2.js]
21+
"use strict";
22+
// @ts-alwaysStrict true
23+
var protected = {};
24+
//// [file3.js]
25+
// @ts-alwaysStrict false
26+
var public = {};
27+
//// [file4.js]
28+
"use strict";
29+
var static = {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/conformance/pragma/alwaysStrict/file1.ts ===
2+
// @ts-alwaysStrict
3+
let private = {};
4+
>private : Symbol(private, Decl(file1.ts, 1, 3))
5+
6+
=== tests/cases/conformance/pragma/alwaysStrict/file2.ts ===
7+
// @ts-alwaysStrict true
8+
let protected = {};
9+
>protected : Symbol(protected, Decl(file2.ts, 1, 3))
10+
11+
=== tests/cases/conformance/pragma/alwaysStrict/file3.ts ===
12+
// @ts-alwaysStrict false
13+
let public = {};
14+
>public : Symbol(public, Decl(file3.ts, 1, 3))
15+
16+
=== tests/cases/conformance/pragma/alwaysStrict/file4.ts ===
17+
let static = {};
18+
>static : Symbol(static, Decl(file4.ts, 0, 3))
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/conformance/pragma/alwaysStrict/file1.ts ===
2+
// @ts-alwaysStrict
3+
let private = {};
4+
>private : {}
5+
>{} : {}
6+
7+
=== tests/cases/conformance/pragma/alwaysStrict/file2.ts ===
8+
// @ts-alwaysStrict true
9+
let protected = {};
10+
>protected : {}
11+
>{} : {}
12+
13+
=== tests/cases/conformance/pragma/alwaysStrict/file3.ts ===
14+
// @ts-alwaysStrict false
15+
let public = {};
16+
>public : {}
17+
>{} : {}
18+
19+
=== tests/cases/conformance/pragma/alwaysStrict/file4.ts ===
20+
let static = {};
21+
>static : {}
22+
>{} : {}
23+

0 commit comments

Comments
 (0)