Skip to content

Commit 4f948ef

Browse files
committed
remove outFile from all relevant test cases
1 parent 17d60db commit 4f948ef

89 files changed

Lines changed: 3939 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//// [tests/cases/compiler/blockScopedClassDeclarationAcrossFiles.ts] ////
2+
3+
//// [c.ts]
4+
let foo: typeof C;
5+
//// [b.ts]
6+
class C { }
7+
8+
9+
//// [c.js]
10+
"use strict";
11+
let foo;
12+
//// [b.js]
13+
"use strict";
14+
class C {
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//// [tests/cases/compiler/blockScopedClassDeclarationAcrossFiles.ts] ////
2+
3+
=== c.ts ===
4+
let foo: typeof C;
5+
>foo : Symbol(foo, Decl(c.ts, 0, 3))
6+
>C : Symbol(C, Decl(b.ts, 0, 0))
7+
8+
=== b.ts ===
9+
class C { }
10+
>C : Symbol(C, Decl(b.ts, 0, 0))
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//// [tests/cases/compiler/blockScopedClassDeclarationAcrossFiles.ts] ////
2+
3+
=== c.ts ===
4+
let foo: typeof C;
5+
>foo : typeof C
6+
>C : typeof C
7+
8+
=== b.ts ===
9+
class C { }
10+
>C : C
11+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
weird.js(1,1): error TS2552: Cannot find name 'someFunction'. Did you mean 'Function'?
2+
weird.js(1,23): error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
3+
weird.js(9,17): error TS7006: Parameter 'error' implicitly has an 'any' type.
4+
5+
6+
==== weird.js (3 errors) ====
7+
someFunction(function(BaseClass) {
8+
~~~~~~~~~~~~
9+
!!! error TS2552: Cannot find name 'someFunction'. Did you mean 'Function'?
10+
!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
11+
~~~~~~~~~
12+
!!! error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
13+
'use strict';
14+
const DEFAULT_MESSAGE = "nop!";
15+
class Hello extends BaseClass {
16+
constructor() {
17+
super();
18+
this.foo = "bar";
19+
}
20+
_render(error) {
21+
~~~~~
22+
!!! error TS7006: Parameter 'error' implicitly has an 'any' type.
23+
const message = error.message || DEFAULT_MESSAGE;
24+
}
25+
}
26+
});
27+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//// [tests/cases/compiler/checkIndexConstraintOfJavascriptClassExpression.ts] ////
2+
3+
=== weird.js ===
4+
someFunction(function(BaseClass) {
5+
>BaseClass : Symbol(BaseClass, Decl(weird.js, 0, 22))
6+
7+
'use strict';
8+
const DEFAULT_MESSAGE = "nop!";
9+
>DEFAULT_MESSAGE : Symbol(DEFAULT_MESSAGE, Decl(weird.js, 2, 9))
10+
11+
class Hello extends BaseClass {
12+
>Hello : Symbol(Hello, Decl(weird.js, 2, 35))
13+
>BaseClass : Symbol(BaseClass, Decl(weird.js, 0, 22))
14+
15+
constructor() {
16+
super();
17+
this.foo = "bar";
18+
>this.foo : Symbol(Hello.foo, Decl(weird.js, 5, 20))
19+
>this : Symbol(Hello, Decl(weird.js, 2, 35))
20+
>foo : Symbol(Hello.foo, Decl(weird.js, 5, 20))
21+
}
22+
_render(error) {
23+
>_render : Symbol(Hello._render, Decl(weird.js, 7, 9))
24+
>error : Symbol(error, Decl(weird.js, 8, 16))
25+
26+
const message = error.message || DEFAULT_MESSAGE;
27+
>message : Symbol(message, Decl(weird.js, 9, 17))
28+
>error : Symbol(error, Decl(weird.js, 8, 16))
29+
>DEFAULT_MESSAGE : Symbol(DEFAULT_MESSAGE, Decl(weird.js, 2, 9))
30+
}
31+
}
32+
});
33+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//// [tests/cases/compiler/checkIndexConstraintOfJavascriptClassExpression.ts] ////
2+
3+
=== weird.js ===
4+
someFunction(function(BaseClass) {
5+
>someFunction(function(BaseClass) { 'use strict'; const DEFAULT_MESSAGE = "nop!"; class Hello extends BaseClass { constructor() { super(); this.foo = "bar"; } _render(error) { const message = error.message || DEFAULT_MESSAGE; } }}) : any
6+
>someFunction : any
7+
>function(BaseClass) { 'use strict'; const DEFAULT_MESSAGE = "nop!"; class Hello extends BaseClass { constructor() { super(); this.foo = "bar"; } _render(error) { const message = error.message || DEFAULT_MESSAGE; } }} : (BaseClass: any) => void
8+
>BaseClass : any
9+
10+
'use strict';
11+
>'use strict' : "use strict"
12+
13+
const DEFAULT_MESSAGE = "nop!";
14+
>DEFAULT_MESSAGE : "nop!"
15+
>"nop!" : "nop!"
16+
17+
class Hello extends BaseClass {
18+
>Hello : Hello
19+
>BaseClass : any
20+
21+
constructor() {
22+
super();
23+
>super() : void
24+
>super : any
25+
26+
this.foo = "bar";
27+
>this.foo = "bar" : "bar"
28+
>this.foo : any
29+
>this : this
30+
>foo : any
31+
>"bar" : "bar"
32+
}
33+
_render(error) {
34+
>_render : (error: any) => void
35+
>error : any
36+
37+
const message = error.message || DEFAULT_MESSAGE;
38+
>message : any
39+
>error.message || DEFAULT_MESSAGE : any
40+
>error.message : any
41+
>error : any
42+
>message : any
43+
>DEFAULT_MESSAGE : "nop!"
44+
}
45+
}
46+
});
47+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//// [tests/cases/compiler/constDeclarations-useBeforeDefinition2.ts] ////
2+
3+
//// [file1.ts]
4+
c;
5+
6+
//// [file2.ts]
7+
const c = 0;
8+
9+
10+
//// [file1.js]
11+
"use strict";
12+
c;
13+
//// [file2.js]
14+
"use strict";
15+
const c = 0;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//// [tests/cases/compiler/constDeclarations-useBeforeDefinition2.ts] ////
2+
3+
=== file1.ts ===
4+
c;
5+
>c : Symbol(c, Decl(file2.ts, 0, 5))
6+
7+
=== file2.ts ===
8+
const c = 0;
9+
>c : Symbol(c, Decl(file2.ts, 0, 5))
10+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//// [tests/cases/compiler/constDeclarations-useBeforeDefinition2.ts] ////
2+
3+
=== file1.ts ===
4+
c;
5+
>c : 0
6+
7+
=== file2.ts ===
8+
const c = 0;
9+
>c : 0
10+
>0 : 0
11+
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
error TS5055: Cannot write file 'controlFlowJavascript.js' because it would overwrite input file.
2+
Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
3+
4+
5+
!!! error TS5055: Cannot write file 'controlFlowJavascript.js' because it would overwrite input file.
6+
!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
7+
==== controlFlowJavascript.js (0 errors) ====
8+
let cond = true;
9+
10+
// CFA for 'let' and no initializer
11+
function f1() {
12+
let x;
13+
if (cond) {
14+
x = 1;
15+
}
16+
if (cond) {
17+
x = "hello";
18+
}
19+
const y = x; // string | number | undefined
20+
}
21+
22+
// CFA for 'let' and 'undefined' initializer
23+
function f2() {
24+
let x = undefined;
25+
if (cond) {
26+
x = 1;
27+
}
28+
if (cond) {
29+
x = "hello";
30+
}
31+
const y = x; // string | number | undefined
32+
}
33+
34+
// CFA for 'let' and 'null' initializer
35+
function f3() {
36+
let x = null;
37+
if (cond) {
38+
x = 1;
39+
}
40+
if (cond) {
41+
x = "hello";
42+
}
43+
const y = x; // string | number | null
44+
}
45+
46+
// CFA for 'var' with no initializer
47+
function f5() {
48+
var x;
49+
if (cond) {
50+
x = 1;
51+
}
52+
if (cond) {
53+
x = "hello";
54+
}
55+
const y = x; // string | number | undefined
56+
}
57+
58+
// CFA for 'var' with 'undefined' initializer
59+
function f6() {
60+
var x = undefined;
61+
if (cond) {
62+
x = 1;
63+
}
64+
if (cond) {
65+
x = "hello";
66+
}
67+
const y = x; // string | number | undefined
68+
}
69+
70+
// CFA for 'var' with 'null' initializer
71+
function f7() {
72+
var x = null;
73+
if (cond) {
74+
x = 1;
75+
}
76+
if (cond) {
77+
x = "hello";
78+
}
79+
const y = x; // string | number | null
80+
}
81+
82+
// No CFA for captured outer variables
83+
function f9() {
84+
let x;
85+
if (cond) {
86+
x = 1;
87+
}
88+
if (cond) {
89+
x = "hello";
90+
}
91+
const y = x; // string | number | undefined
92+
function f() {
93+
const z = x; // any
94+
}
95+
}
96+
97+
// No CFA for captured outer variables
98+
function f10() {
99+
let x;
100+
if (cond) {
101+
x = 1;
102+
}
103+
if (cond) {
104+
x = "hello";
105+
}
106+
const y = x; // string | number | undefined
107+
const f = () => {
108+
const z = x; // any
109+
};
110+
}
111+

0 commit comments

Comments
 (0)