mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-14 18:39:19 -05:00
partially suppress reachability errors in tests
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
tests/cases/compiler/commentsAtEndOfFile1.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/commentsAtEndOfFile1.ts (1 errors) ====
|
||||
Input:
|
||||
~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
;
|
||||
//Testing two
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [commentsAtEndOfFile1.ts]
|
||||
|
||||
Input:
|
||||
;
|
||||
//Testing two
|
||||
|
||||
7
tests/baselines/reference/commentsAtEndOfFile1.symbols
Normal file
7
tests/baselines/reference/commentsAtEndOfFile1.symbols
Normal file
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/commentsAtEndOfFile1.ts ===
|
||||
|
||||
No type information for this code.Input:
|
||||
No type information for this code.;
|
||||
No type information for this code.//Testing two
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
8
tests/baselines/reference/commentsAtEndOfFile1.types
Normal file
8
tests/baselines/reference/commentsAtEndOfFile1.types
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/commentsAtEndOfFile1.ts ===
|
||||
|
||||
Input:
|
||||
>Input : any
|
||||
|
||||
;
|
||||
//Testing two
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts(2,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts (1 errors) ====
|
||||
target1:
|
||||
target2:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
break target1;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [parser_breakTarget3.ts]
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
8
tests/baselines/reference/parser_breakTarget3.symbols
Normal file
8
tests/baselines/reference/parser_breakTarget3.symbols
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts ===
|
||||
|
||||
No type information for this code.target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. break target1;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
14
tests/baselines/reference/parser_breakTarget3.types
Normal file
14
tests/baselines/reference/parser_breakTarget3.types
Normal file
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts ===
|
||||
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
break target1;
|
||||
>target1 : any
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts (1 errors) ====
|
||||
target1:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
target2:
|
||||
while (true) {
|
||||
break target2;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [parser_breakTarget4.ts]
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
8
tests/baselines/reference/parser_breakTarget4.symbols
Normal file
8
tests/baselines/reference/parser_breakTarget4.symbols
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts ===
|
||||
|
||||
No type information for this code.target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. break target2;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
14
tests/baselines/reference/parser_breakTarget4.types
Normal file
14
tests/baselines/reference/parser_breakTarget4.types
Normal file
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts ===
|
||||
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
break target2;
|
||||
>target2 : any
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts(2,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts (1 errors) ====
|
||||
target1:
|
||||
target2:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
continue target1;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [parser_continueTarget3.ts]
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
8
tests/baselines/reference/parser_continueTarget3.symbols
Normal file
8
tests/baselines/reference/parser_continueTarget3.symbols
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts ===
|
||||
|
||||
No type information for this code.target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. continue target1;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
14
tests/baselines/reference/parser_continueTarget3.types
Normal file
14
tests/baselines/reference/parser_continueTarget3.types
Normal file
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts ===
|
||||
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
continue target1;
|
||||
>target1 : any
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts (1 errors) ====
|
||||
target1:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
target2:
|
||||
while (true) {
|
||||
continue target2;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [parser_continueTarget4.ts]
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
8
tests/baselines/reference/parser_continueTarget4.symbols
Normal file
8
tests/baselines/reference/parser_continueTarget4.symbols
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts ===
|
||||
|
||||
No type information for this code.target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. continue target2;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
14
tests/baselines/reference/parser_continueTarget4.types
Normal file
14
tests/baselines/reference/parser_continueTarget4.types
Normal file
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts ===
|
||||
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
continue target2;
|
||||
>target2 : any
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts(4,5): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
function f() {
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [parser_duplicateLabel3.ts]
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
function f() {
|
||||
|
||||
12
tests/baselines/reference/parser_duplicateLabel3.symbols
Normal file
12
tests/baselines/reference/parser_duplicateLabel3.symbols
Normal file
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts ===
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(parser_duplicateLabel3.ts, 2, 14))
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
19
tests/baselines/reference/parser_duplicateLabel3.types
Normal file
19
tests/baselines/reference/parser_duplicateLabel3.types
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts ===
|
||||
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts(5,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
}
|
||||
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
while (true) {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [parser_duplicateLabel4.ts]
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
}
|
||||
|
||||
10
tests/baselines/reference/parser_duplicateLabel4.symbols
Normal file
10
tests/baselines/reference/parser_duplicateLabel4.symbols
Normal file
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts ===
|
||||
|
||||
No type information for this code.target:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.target:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
15
tests/baselines/reference/parser_duplicateLabel4.types
Normal file
15
tests/baselines/reference/parser_duplicateLabel4.types
Normal file
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts ===
|
||||
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
}
|
||||
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
tests/cases/compiler/recursiveMods.ts(9,3): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/recursiveMods.ts (1 errors) ====
|
||||
export module Foo {
|
||||
export class C {}
|
||||
}
|
||||
|
||||
export module Foo {
|
||||
|
||||
function Bar() : C {
|
||||
if (true) { return Bar();}
|
||||
return new C();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
function Baz() : C {
|
||||
var c = Baz();
|
||||
return Bar();
|
||||
}
|
||||
|
||||
function Gar() {
|
||||
var c : C = Baz();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [recursiveMods.ts]
|
||||
|
||||
export module Foo {
|
||||
export class C {}
|
||||
}
|
||||
|
||||
48
tests/baselines/reference/recursiveMods.symbols
Normal file
48
tests/baselines/reference/recursiveMods.symbols
Normal file
@@ -0,0 +1,48 @@
|
||||
=== tests/cases/compiler/recursiveMods.ts ===
|
||||
|
||||
export module Foo {
|
||||
>Foo : Symbol(Foo, Decl(recursiveMods.ts, 0, 0), Decl(recursiveMods.ts, 3, 1))
|
||||
|
||||
export class C {}
|
||||
>C : Symbol(C, Decl(recursiveMods.ts, 1, 19))
|
||||
}
|
||||
|
||||
export module Foo {
|
||||
>Foo : Symbol(Foo, Decl(recursiveMods.ts, 0, 0), Decl(recursiveMods.ts, 3, 1))
|
||||
|
||||
function Bar() : C {
|
||||
>Bar : Symbol(Bar, Decl(recursiveMods.ts, 5, 19))
|
||||
>C : Symbol(C, Decl(recursiveMods.ts, 1, 19))
|
||||
|
||||
if (true) { return Bar();}
|
||||
>Bar : Symbol(Bar, Decl(recursiveMods.ts, 5, 19))
|
||||
|
||||
return new C();
|
||||
>C : Symbol(C, Decl(recursiveMods.ts, 1, 19))
|
||||
}
|
||||
|
||||
function Baz() : C {
|
||||
>Baz : Symbol(Baz, Decl(recursiveMods.ts, 10, 2))
|
||||
>C : Symbol(C, Decl(recursiveMods.ts, 1, 19))
|
||||
|
||||
var c = Baz();
|
||||
>c : Symbol(c, Decl(recursiveMods.ts, 13, 5))
|
||||
>Baz : Symbol(Baz, Decl(recursiveMods.ts, 10, 2))
|
||||
|
||||
return Bar();
|
||||
>Bar : Symbol(Bar, Decl(recursiveMods.ts, 5, 19))
|
||||
}
|
||||
|
||||
function Gar() {
|
||||
>Gar : Symbol(Gar, Decl(recursiveMods.ts, 15, 2))
|
||||
|
||||
var c : C = Baz();
|
||||
>c : Symbol(c, Decl(recursiveMods.ts, 18, 5))
|
||||
>C : Symbol(C, Decl(recursiveMods.ts, 1, 19))
|
||||
>Baz : Symbol(Baz, Decl(recursiveMods.ts, 10, 2))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
tests/baselines/reference/recursiveMods.types
Normal file
54
tests/baselines/reference/recursiveMods.types
Normal file
@@ -0,0 +1,54 @@
|
||||
=== tests/cases/compiler/recursiveMods.ts ===
|
||||
|
||||
export module Foo {
|
||||
>Foo : typeof Foo
|
||||
|
||||
export class C {}
|
||||
>C : C
|
||||
}
|
||||
|
||||
export module Foo {
|
||||
>Foo : typeof Foo
|
||||
|
||||
function Bar() : C {
|
||||
>Bar : () => C
|
||||
>C : C
|
||||
|
||||
if (true) { return Bar();}
|
||||
>true : boolean
|
||||
>Bar() : C
|
||||
>Bar : () => C
|
||||
|
||||
return new C();
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
}
|
||||
|
||||
function Baz() : C {
|
||||
>Baz : () => C
|
||||
>C : C
|
||||
|
||||
var c = Baz();
|
||||
>c : C
|
||||
>Baz() : C
|
||||
>Baz : () => C
|
||||
|
||||
return Bar();
|
||||
>Bar() : C
|
||||
>Bar : () => C
|
||||
}
|
||||
|
||||
function Gar() {
|
||||
>Gar : () => void
|
||||
|
||||
var c : C = Baz();
|
||||
>c : C
|
||||
>C : C
|
||||
>Baz() : C
|
||||
>Baz : () => C
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
tests/cases/compiler/returnStatement1.ts(5,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/returnStatement1.ts (1 errors) ====
|
||||
function f() {
|
||||
return function (s) {
|
||||
var x = s;
|
||||
};
|
||||
("harmless extra line");
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [returnStatement1.ts]
|
||||
|
||||
function f() {
|
||||
return function (s) {
|
||||
var x = s;
|
||||
|
||||
15
tests/baselines/reference/returnStatement1.symbols
Normal file
15
tests/baselines/reference/returnStatement1.symbols
Normal file
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/returnStatement1.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(returnStatement1.ts, 0, 0))
|
||||
|
||||
return function (s) {
|
||||
>s : Symbol(s, Decl(returnStatement1.ts, 2, 21))
|
||||
|
||||
var x = s;
|
||||
>x : Symbol(x, Decl(returnStatement1.ts, 3, 11))
|
||||
>s : Symbol(s, Decl(returnStatement1.ts, 2, 21))
|
||||
|
||||
};
|
||||
("harmless extra line");
|
||||
}
|
||||
18
tests/baselines/reference/returnStatement1.types
Normal file
18
tests/baselines/reference/returnStatement1.types
Normal file
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/returnStatement1.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => (s: any) => void
|
||||
|
||||
return function (s) {
|
||||
>function (s) { var x = s; } : (s: any) => void
|
||||
>s : any
|
||||
|
||||
var x = s;
|
||||
>x : any
|
||||
>s : any
|
||||
|
||||
};
|
||||
("harmless extra line");
|
||||
>("harmless extra line") : string
|
||||
>"harmless extra line" : string
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
tests/cases/compiler/sourceMapValidationLabeled.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/sourceMapValidationLabeled.ts (1 errors) ====
|
||||
x:
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
var b = 10;
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [sourceMapValidationLabeled.ts]
|
||||
|
||||
x:
|
||||
var b = 10;
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [sourceMapValidationLabeled.js.map]
|
||||
{"version":3,"file":"sourceMapValidationLabeled.js","sourceRoot":"","sources":["sourceMapValidationLabeled.ts"],"names":[],"mappings":"AAAA,CAAC,EACD,IAAI,CAAC,GAAG,EAAE,CAAC"}
|
||||
{"version":3,"file":"sourceMapValidationLabeled.js","sourceRoot":"","sources":["sourceMapValidationLabeled.ts"],"names":[],"mappings":"AACA,CAAC,EACD,IAAI,CAAC,GAAG,EAAE,CAAC"}
|
||||
@@ -18,7 +18,8 @@ sourceFile:sourceMapValidationLabeled.ts
|
||||
7 > ^^
|
||||
8 > ^
|
||||
9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
1 >
|
||||
>
|
||||
2 >x
|
||||
3 > :
|
||||
>
|
||||
@@ -27,13 +28,13 @@ sourceFile:sourceMapValidationLabeled.ts
|
||||
6 > =
|
||||
7 > 10
|
||||
8 > ;
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0)
|
||||
3 >Emitted(1, 4) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(1, 8) Source(2, 5) + SourceIndex(0)
|
||||
5 >Emitted(1, 9) Source(2, 6) + SourceIndex(0)
|
||||
6 >Emitted(1, 12) Source(2, 9) + SourceIndex(0)
|
||||
7 >Emitted(1, 14) Source(2, 11) + SourceIndex(0)
|
||||
8 >Emitted(1, 15) Source(2, 12) + SourceIndex(0)
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 2) Source(2, 2) + SourceIndex(0)
|
||||
3 >Emitted(1, 4) Source(3, 1) + SourceIndex(0)
|
||||
4 >Emitted(1, 8) Source(3, 5) + SourceIndex(0)
|
||||
5 >Emitted(1, 9) Source(3, 6) + SourceIndex(0)
|
||||
6 >Emitted(1, 12) Source(3, 9) + SourceIndex(0)
|
||||
7 >Emitted(1, 14) Source(3, 11) + SourceIndex(0)
|
||||
8 >Emitted(1, 15) Source(3, 12) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMapValidationLabeled.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/sourceMapValidationLabeled.ts ===
|
||||
|
||||
x:
|
||||
var b = 10;
|
||||
>b : Symbol(b, Decl(sourceMapValidationLabeled.ts, 2, 3))
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/sourceMapValidationLabeled.ts ===
|
||||
|
||||
x:
|
||||
>x : any
|
||||
|
||||
var b = 10;
|
||||
>b : number
|
||||
>10 : number
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts(12,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts(22,9): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts(46,25): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts (3 errors) ====
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
THREE:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
FIVE:
|
||||
~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
switch ('') {
|
||||
case 'a':
|
||||
SIX:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break SIX;
|
||||
}
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
switch ('') {
|
||||
case 'a':
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break SEVEN;
|
||||
EIGHT:
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
switch ('') {
|
||||
case 'a':
|
||||
var fn = function () { }
|
||||
break EIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [switchBreakStatements.ts]
|
||||
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break;
|
||||
|
||||
59
tests/baselines/reference/switchBreakStatements.symbols
Normal file
59
tests/baselines/reference/switchBreakStatements.symbols
Normal file
@@ -0,0 +1,59 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts ===
|
||||
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
FIVE:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
switch ('') {
|
||||
case 'a':
|
||||
SIX:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break SIX;
|
||||
}
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
switch ('') {
|
||||
case 'a':
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break SEVEN;
|
||||
EIGHT:
|
||||
switch ('') {
|
||||
case 'a':
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(switchBreakStatements.ts, 49, 35))
|
||||
|
||||
break EIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
127
tests/baselines/reference/switchBreakStatements.types
Normal file
127
tests/baselines/reference/switchBreakStatements.types
Normal file
@@ -0,0 +1,127 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts ===
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
break ONE;
|
||||
>ONE : any
|
||||
}
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
break THREE;
|
||||
>THREE : any
|
||||
}
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
break FOUR;
|
||||
>FOUR : any
|
||||
}
|
||||
}
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
break SIX;
|
||||
>SIX : any
|
||||
}
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
break SEVEN;
|
||||
>SEVEN : any
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
switch ('') {
|
||||
>'' : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
break EIGHT;
|
||||
>EIGHT : any
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
tests/cases/compiler/systemModule8.ts(19,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/systemModule8.ts (1 errors) ====
|
||||
|
||||
export var x;
|
||||
x = 1;
|
||||
x++;
|
||||
x--;
|
||||
++x;
|
||||
--x;
|
||||
x += 1;
|
||||
x -= 1;
|
||||
x *= 1;
|
||||
x /= 1;
|
||||
x |= 1;
|
||||
x &= 1;
|
||||
x + 1;
|
||||
x - 1;
|
||||
x & 1;
|
||||
x | 1;
|
||||
for (x = 5;;x++) {}
|
||||
for (x = 8;;x--) {}
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
for (x = 15;;++x) {}
|
||||
for (x = 18;;--x) {}
|
||||
|
||||
for (let x = 50;;) {}
|
||||
function foo() {
|
||||
x = 100;
|
||||
}
|
||||
|
||||
export let [y] = [1];
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
for ([x] of [[1]]) {}
|
||||
92
tests/baselines/reference/systemModule8.symbols
Normal file
92
tests/baselines/reference/systemModule8.symbols
Normal file
@@ -0,0 +1,92 @@
|
||||
=== tests/cases/compiler/systemModule8.ts ===
|
||||
|
||||
export var x;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x++;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x--;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
++x;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
--x;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x += 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x -= 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x *= 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x /= 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x |= 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x &= 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x + 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x - 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x & 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
x | 1;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
for (x = 5;;x++) {}
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
for (x = 8;;x--) {}
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
for (x = 15;;++x) {}
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
for (x = 18;;--x) {}
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
for (let x = 50;;) {}
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 22, 8))
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(systemModule8.ts, 22, 21))
|
||||
|
||||
x = 100;
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
}
|
||||
|
||||
export let [y] = [1];
|
||||
>y : Symbol(y, Decl(systemModule8.ts, 27, 12))
|
||||
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
>a : Symbol(a, Decl(systemModule8.ts, 28, 36))
|
||||
>z0 : Symbol(z0, Decl(systemModule8.ts, 28, 14))
|
||||
>b : Symbol(b, Decl(systemModule8.ts, 28, 44))
|
||||
>c : Symbol(c, Decl(systemModule8.ts, 28, 49))
|
||||
>z1 : Symbol(z1, Decl(systemModule8.ts, 28, 25))
|
||||
>a : Symbol(a, Decl(systemModule8.ts, 28, 36))
|
||||
>b : Symbol(b, Decl(systemModule8.ts, 28, 44))
|
||||
>c : Symbol(c, Decl(systemModule8.ts, 28, 49))
|
||||
|
||||
for ([x] of [[1]]) {}
|
||||
>x : Symbol(x, Decl(systemModule8.ts, 1, 10))
|
||||
|
||||
143
tests/baselines/reference/systemModule8.types
Normal file
143
tests/baselines/reference/systemModule8.types
Normal file
@@ -0,0 +1,143 @@
|
||||
=== tests/cases/compiler/systemModule8.ts ===
|
||||
|
||||
export var x;
|
||||
>x : any
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x++;
|
||||
>x++ : number
|
||||
>x : any
|
||||
|
||||
x--;
|
||||
>x-- : number
|
||||
>x : any
|
||||
|
||||
++x;
|
||||
>++x : number
|
||||
>x : any
|
||||
|
||||
--x;
|
||||
>--x : number
|
||||
>x : any
|
||||
|
||||
x += 1;
|
||||
>x += 1 : any
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x -= 1;
|
||||
>x -= 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x *= 1;
|
||||
>x *= 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x /= 1;
|
||||
>x /= 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x |= 1;
|
||||
>x |= 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x &= 1;
|
||||
>x &= 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x + 1;
|
||||
>x + 1 : any
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x - 1;
|
||||
>x - 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x & 1;
|
||||
>x & 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
x | 1;
|
||||
>x | 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
|
||||
for (x = 5;;x++) {}
|
||||
>x = 5 : number
|
||||
>x : any
|
||||
>5 : number
|
||||
>x++ : number
|
||||
>x : any
|
||||
|
||||
for (x = 8;;x--) {}
|
||||
>x = 8 : number
|
||||
>x : any
|
||||
>8 : number
|
||||
>x-- : number
|
||||
>x : any
|
||||
|
||||
for (x = 15;;++x) {}
|
||||
>x = 15 : number
|
||||
>x : any
|
||||
>15 : number
|
||||
>++x : number
|
||||
>x : any
|
||||
|
||||
for (x = 18;;--x) {}
|
||||
>x = 18 : number
|
||||
>x : any
|
||||
>18 : number
|
||||
>--x : number
|
||||
>x : any
|
||||
|
||||
for (let x = 50;;) {}
|
||||
>x : number
|
||||
>50 : number
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
x = 100;
|
||||
>x = 100 : number
|
||||
>x : any
|
||||
>100 : number
|
||||
}
|
||||
|
||||
export let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
>1 : number
|
||||
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
>a : any
|
||||
>z0 : boolean
|
||||
>b : any
|
||||
>c : any
|
||||
>z1 : string
|
||||
>{a: true, b: {c: "123"}} : { a: boolean; b: { c: string; }; }
|
||||
>a : boolean
|
||||
>true : boolean
|
||||
>b : { c: string; }
|
||||
>{c: "123"} : { c: string; }
|
||||
>c : string
|
||||
>"123" : string
|
||||
|
||||
for ([x] of [[1]]) {}
|
||||
>[x] : any[]
|
||||
>x : any
|
||||
>[[1]] : number[][]
|
||||
>[1] : number[]
|
||||
>1 : number
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts(15,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts (1 errors) ====
|
||||
function fn(x) {
|
||||
throw x;
|
||||
}
|
||||
|
||||
<T>(x: T) => { throw x; }
|
||||
|
||||
var y: string;
|
||||
switch (y) {
|
||||
case 'a':
|
||||
throw y;
|
||||
default:
|
||||
throw y;
|
||||
}
|
||||
|
||||
var z = 0;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
while (z < 10) {
|
||||
throw z;
|
||||
}
|
||||
|
||||
for (var i = 0; ;) { throw i; }
|
||||
|
||||
for (var idx in {}) { throw idx; }
|
||||
|
||||
do { throw null; }while(true)
|
||||
|
||||
var j = 0;
|
||||
while (j < 0) { throw j; }
|
||||
|
||||
class C<T> {
|
||||
private value: T;
|
||||
biz() {
|
||||
throw this.value;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
throw this;
|
||||
}
|
||||
}
|
||||
|
||||
var aa = {
|
||||
id:12,
|
||||
biz() {
|
||||
throw this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [throwInEnclosingStatements.ts]
|
||||
|
||||
function fn(x) {
|
||||
throw x;
|
||||
}
|
||||
|
||||
94
tests/baselines/reference/throwInEnclosingStatements.symbols
Normal file
94
tests/baselines/reference/throwInEnclosingStatements.symbols
Normal file
@@ -0,0 +1,94 @@
|
||||
=== tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts ===
|
||||
|
||||
function fn(x) {
|
||||
>fn : Symbol(fn, Decl(throwInEnclosingStatements.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 1, 12))
|
||||
|
||||
throw x;
|
||||
>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 1, 12))
|
||||
}
|
||||
|
||||
<T>(x: T) => { throw x; }
|
||||
>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 5, 1))
|
||||
>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 5, 4))
|
||||
>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 5, 1))
|
||||
>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 5, 4))
|
||||
|
||||
var y: string;
|
||||
>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3))
|
||||
|
||||
switch (y) {
|
||||
>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3))
|
||||
|
||||
case 'a':
|
||||
throw y;
|
||||
>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3))
|
||||
|
||||
default:
|
||||
throw y;
|
||||
>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3))
|
||||
}
|
||||
|
||||
var z = 0;
|
||||
>z : Symbol(z, Decl(throwInEnclosingStatements.ts, 15, 3))
|
||||
|
||||
while (z < 10) {
|
||||
>z : Symbol(z, Decl(throwInEnclosingStatements.ts, 15, 3))
|
||||
|
||||
throw z;
|
||||
>z : Symbol(z, Decl(throwInEnclosingStatements.ts, 15, 3))
|
||||
}
|
||||
|
||||
for (var i = 0; ;) { throw i; }
|
||||
>i : Symbol(i, Decl(throwInEnclosingStatements.ts, 20, 8))
|
||||
>i : Symbol(i, Decl(throwInEnclosingStatements.ts, 20, 8))
|
||||
|
||||
for (var idx in {}) { throw idx; }
|
||||
>idx : Symbol(idx, Decl(throwInEnclosingStatements.ts, 22, 8))
|
||||
>idx : Symbol(idx, Decl(throwInEnclosingStatements.ts, 22, 8))
|
||||
|
||||
do { throw null; }while(true)
|
||||
|
||||
var j = 0;
|
||||
>j : Symbol(j, Decl(throwInEnclosingStatements.ts, 26, 3))
|
||||
|
||||
while (j < 0) { throw j; }
|
||||
>j : Symbol(j, Decl(throwInEnclosingStatements.ts, 26, 3))
|
||||
>j : Symbol(j, Decl(throwInEnclosingStatements.ts, 26, 3))
|
||||
|
||||
class C<T> {
|
||||
>C : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26))
|
||||
>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 29, 8))
|
||||
|
||||
private value: T;
|
||||
>value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12))
|
||||
>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 29, 8))
|
||||
|
||||
biz() {
|
||||
>biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 30, 21))
|
||||
|
||||
throw this.value;
|
||||
>this.value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12))
|
||||
>this : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26))
|
||||
>value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12))
|
||||
}
|
||||
|
||||
constructor() {
|
||||
throw this;
|
||||
>this : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26))
|
||||
}
|
||||
}
|
||||
|
||||
var aa = {
|
||||
>aa : Symbol(aa, Decl(throwInEnclosingStatements.ts, 40, 3))
|
||||
|
||||
id:12,
|
||||
>id : Symbol(id, Decl(throwInEnclosingStatements.ts, 40, 10))
|
||||
|
||||
biz() {
|
||||
>biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 41, 10))
|
||||
|
||||
throw this;
|
||||
}
|
||||
}
|
||||
|
||||
110
tests/baselines/reference/throwInEnclosingStatements.types
Normal file
110
tests/baselines/reference/throwInEnclosingStatements.types
Normal file
@@ -0,0 +1,110 @@
|
||||
=== tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts ===
|
||||
|
||||
function fn(x) {
|
||||
>fn : (x: any) => void
|
||||
>x : any
|
||||
|
||||
throw x;
|
||||
>x : any
|
||||
}
|
||||
|
||||
<T>(x: T) => { throw x; }
|
||||
><T>(x: T) => { throw x; } : <T>(x: T) => void
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>x : T
|
||||
|
||||
var y: string;
|
||||
>y : string
|
||||
|
||||
switch (y) {
|
||||
>y : string
|
||||
|
||||
case 'a':
|
||||
>'a' : string
|
||||
|
||||
throw y;
|
||||
>y : string
|
||||
|
||||
default:
|
||||
throw y;
|
||||
>y : string
|
||||
}
|
||||
|
||||
var z = 0;
|
||||
>z : number
|
||||
>0 : number
|
||||
|
||||
while (z < 10) {
|
||||
>z < 10 : boolean
|
||||
>z : number
|
||||
>10 : number
|
||||
|
||||
throw z;
|
||||
>z : number
|
||||
}
|
||||
|
||||
for (var i = 0; ;) { throw i; }
|
||||
>i : number
|
||||
>0 : number
|
||||
>i : number
|
||||
|
||||
for (var idx in {}) { throw idx; }
|
||||
>idx : any
|
||||
>{} : {}
|
||||
>idx : any
|
||||
|
||||
do { throw null; }while(true)
|
||||
>null : null
|
||||
>true : boolean
|
||||
|
||||
var j = 0;
|
||||
>j : number
|
||||
>0 : number
|
||||
|
||||
while (j < 0) { throw j; }
|
||||
>j < 0 : boolean
|
||||
>j : number
|
||||
>0 : number
|
||||
>j : number
|
||||
|
||||
class C<T> {
|
||||
>C : C<T>
|
||||
>T : T
|
||||
|
||||
private value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
|
||||
biz() {
|
||||
>biz : () => void
|
||||
|
||||
throw this.value;
|
||||
>this.value : T
|
||||
>this : this
|
||||
>value : T
|
||||
}
|
||||
|
||||
constructor() {
|
||||
throw this;
|
||||
>this : this
|
||||
}
|
||||
}
|
||||
|
||||
var aa = {
|
||||
>aa : { id: number; biz(): void; }
|
||||
>{ id:12, biz() { throw this; }} : { id: number; biz(): void; }
|
||||
|
||||
id:12,
|
||||
>id : number
|
||||
>12 : number
|
||||
|
||||
biz() {
|
||||
>biz : () => void
|
||||
|
||||
throw this;
|
||||
>this : any
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
tests/cases/conformance/statements/throwStatements/throwStatements.ts(29,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/throwStatements/throwStatements.ts (1 errors) ====
|
||||
// all legal
|
||||
|
||||
interface I {
|
||||
id: number;
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
id: number;
|
||||
}
|
||||
|
||||
class D<T>{
|
||||
source: T;
|
||||
recurse: D<T>;
|
||||
wrapped: D<D<T>>
|
||||
}
|
||||
|
||||
function F(x: string): number { return 42; }
|
||||
|
||||
module M {
|
||||
export class A {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function F2(x: number): string { return x.toString(); }
|
||||
}
|
||||
|
||||
var aNumber = 9.9;
|
||||
throw aNumber;
|
||||
var aString = 'this is a string';
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
throw aString;
|
||||
var aDate = new Date(12);
|
||||
throw aDate;
|
||||
var anObject = new Object();
|
||||
throw anObject;
|
||||
|
||||
var anAny = null;
|
||||
throw anAny;
|
||||
var anOtherAny = <any> new C();
|
||||
throw anOtherAny;
|
||||
var anUndefined = undefined;
|
||||
throw anUndefined;
|
||||
|
||||
var aClass = new C();
|
||||
throw aClass;
|
||||
var aGenericClass = new D<string>();
|
||||
throw aGenericClass;
|
||||
var anObjectLiteral = { id: 12 };
|
||||
throw anObjectLiteral;
|
||||
|
||||
var aFunction = F;
|
||||
throw aFunction;
|
||||
throw aFunction('');
|
||||
var aLambda = (x) => 2;
|
||||
throw aLambda;
|
||||
throw aLambda(1);
|
||||
|
||||
var aModule = M;
|
||||
throw aModule;
|
||||
throw typeof M;
|
||||
var aClassInModule = new M.A();
|
||||
throw aClassInModule;
|
||||
var aFunctionInModule = M.F2;
|
||||
throw aFunctionInModule;
|
||||
|
||||
// no initializer or annotation, so this is an 'any'
|
||||
var x;
|
||||
throw x;
|
||||
|
||||
// literals
|
||||
throw 0.0;
|
||||
throw false;
|
||||
throw null;
|
||||
throw undefined;
|
||||
throw 'a string';
|
||||
throw function () { return 'a string' };
|
||||
throw <T>(x:T) => 42;
|
||||
throw { x: 12, y: 13 };
|
||||
throw [];
|
||||
throw ['a', ['b']];
|
||||
throw /[a-z]/;
|
||||
throw new Date();
|
||||
throw new C();
|
||||
throw new Object();
|
||||
throw new D<number>();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [throwStatements.ts]
|
||||
|
||||
// all legal
|
||||
|
||||
interface I {
|
||||
|
||||
216
tests/baselines/reference/throwStatements.symbols
Normal file
216
tests/baselines/reference/throwStatements.symbols
Normal file
@@ -0,0 +1,216 @@
|
||||
=== tests/cases/conformance/statements/throwStatements/throwStatements.ts ===
|
||||
|
||||
// all legal
|
||||
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(throwStatements.ts, 0, 0))
|
||||
|
||||
id: number;
|
||||
>id : Symbol(id, Decl(throwStatements.ts, 3, 13))
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : Symbol(C, Decl(throwStatements.ts, 5, 1))
|
||||
>I : Symbol(I, Decl(throwStatements.ts, 0, 0))
|
||||
|
||||
id: number;
|
||||
>id : Symbol(id, Decl(throwStatements.ts, 7, 22))
|
||||
}
|
||||
|
||||
class D<T>{
|
||||
>D : Symbol(D, Decl(throwStatements.ts, 9, 1))
|
||||
>T : Symbol(T, Decl(throwStatements.ts, 11, 8))
|
||||
|
||||
source: T;
|
||||
>source : Symbol(source, Decl(throwStatements.ts, 11, 11))
|
||||
>T : Symbol(T, Decl(throwStatements.ts, 11, 8))
|
||||
|
||||
recurse: D<T>;
|
||||
>recurse : Symbol(recurse, Decl(throwStatements.ts, 12, 14))
|
||||
>D : Symbol(D, Decl(throwStatements.ts, 9, 1))
|
||||
>T : Symbol(T, Decl(throwStatements.ts, 11, 8))
|
||||
|
||||
wrapped: D<D<T>>
|
||||
>wrapped : Symbol(wrapped, Decl(throwStatements.ts, 13, 18))
|
||||
>D : Symbol(D, Decl(throwStatements.ts, 9, 1))
|
||||
>D : Symbol(D, Decl(throwStatements.ts, 9, 1))
|
||||
>T : Symbol(T, Decl(throwStatements.ts, 11, 8))
|
||||
}
|
||||
|
||||
function F(x: string): number { return 42; }
|
||||
>F : Symbol(F, Decl(throwStatements.ts, 15, 1))
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 17, 11))
|
||||
|
||||
module M {
|
||||
>M : Symbol(M, Decl(throwStatements.ts, 17, 44))
|
||||
|
||||
export class A {
|
||||
>A : Symbol(A, Decl(throwStatements.ts, 19, 10))
|
||||
|
||||
name: string;
|
||||
>name : Symbol(name, Decl(throwStatements.ts, 20, 20))
|
||||
}
|
||||
|
||||
export function F2(x: number): string { return x.toString(); }
|
||||
>F2 : Symbol(F2, Decl(throwStatements.ts, 22, 5))
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 24, 23))
|
||||
>x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 24, 23))
|
||||
>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
|
||||
var aNumber = 9.9;
|
||||
>aNumber : Symbol(aNumber, Decl(throwStatements.ts, 27, 3))
|
||||
|
||||
throw aNumber;
|
||||
>aNumber : Symbol(aNumber, Decl(throwStatements.ts, 27, 3))
|
||||
|
||||
var aString = 'this is a string';
|
||||
>aString : Symbol(aString, Decl(throwStatements.ts, 29, 3))
|
||||
|
||||
throw aString;
|
||||
>aString : Symbol(aString, Decl(throwStatements.ts, 29, 3))
|
||||
|
||||
var aDate = new Date(12);
|
||||
>aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
throw aDate;
|
||||
>aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3))
|
||||
|
||||
var anObject = new Object();
|
||||
>anObject : Symbol(anObject, Decl(throwStatements.ts, 33, 3))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
throw anObject;
|
||||
>anObject : Symbol(anObject, Decl(throwStatements.ts, 33, 3))
|
||||
|
||||
var anAny = null;
|
||||
>anAny : Symbol(anAny, Decl(throwStatements.ts, 36, 3))
|
||||
|
||||
throw anAny;
|
||||
>anAny : Symbol(anAny, Decl(throwStatements.ts, 36, 3))
|
||||
|
||||
var anOtherAny = <any> new C();
|
||||
>anOtherAny : Symbol(anOtherAny, Decl(throwStatements.ts, 38, 3))
|
||||
>C : Symbol(C, Decl(throwStatements.ts, 5, 1))
|
||||
|
||||
throw anOtherAny;
|
||||
>anOtherAny : Symbol(anOtherAny, Decl(throwStatements.ts, 38, 3))
|
||||
|
||||
var anUndefined = undefined;
|
||||
>anUndefined : Symbol(anUndefined, Decl(throwStatements.ts, 40, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
throw anUndefined;
|
||||
>anUndefined : Symbol(anUndefined, Decl(throwStatements.ts, 40, 3))
|
||||
|
||||
var aClass = new C();
|
||||
>aClass : Symbol(aClass, Decl(throwStatements.ts, 43, 3))
|
||||
>C : Symbol(C, Decl(throwStatements.ts, 5, 1))
|
||||
|
||||
throw aClass;
|
||||
>aClass : Symbol(aClass, Decl(throwStatements.ts, 43, 3))
|
||||
|
||||
var aGenericClass = new D<string>();
|
||||
>aGenericClass : Symbol(aGenericClass, Decl(throwStatements.ts, 45, 3))
|
||||
>D : Symbol(D, Decl(throwStatements.ts, 9, 1))
|
||||
|
||||
throw aGenericClass;
|
||||
>aGenericClass : Symbol(aGenericClass, Decl(throwStatements.ts, 45, 3))
|
||||
|
||||
var anObjectLiteral = { id: 12 };
|
||||
>anObjectLiteral : Symbol(anObjectLiteral, Decl(throwStatements.ts, 47, 3))
|
||||
>id : Symbol(id, Decl(throwStatements.ts, 47, 23))
|
||||
|
||||
throw anObjectLiteral;
|
||||
>anObjectLiteral : Symbol(anObjectLiteral, Decl(throwStatements.ts, 47, 3))
|
||||
|
||||
var aFunction = F;
|
||||
>aFunction : Symbol(aFunction, Decl(throwStatements.ts, 50, 3))
|
||||
>F : Symbol(F, Decl(throwStatements.ts, 15, 1))
|
||||
|
||||
throw aFunction;
|
||||
>aFunction : Symbol(aFunction, Decl(throwStatements.ts, 50, 3))
|
||||
|
||||
throw aFunction('');
|
||||
>aFunction : Symbol(aFunction, Decl(throwStatements.ts, 50, 3))
|
||||
|
||||
var aLambda = (x) => 2;
|
||||
>aLambda : Symbol(aLambda, Decl(throwStatements.ts, 53, 3))
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 53, 15))
|
||||
|
||||
throw aLambda;
|
||||
>aLambda : Symbol(aLambda, Decl(throwStatements.ts, 53, 3))
|
||||
|
||||
throw aLambda(1);
|
||||
>aLambda : Symbol(aLambda, Decl(throwStatements.ts, 53, 3))
|
||||
|
||||
var aModule = M;
|
||||
>aModule : Symbol(aModule, Decl(throwStatements.ts, 57, 3))
|
||||
>M : Symbol(M, Decl(throwStatements.ts, 17, 44))
|
||||
|
||||
throw aModule;
|
||||
>aModule : Symbol(aModule, Decl(throwStatements.ts, 57, 3))
|
||||
|
||||
throw typeof M;
|
||||
>M : Symbol(M, Decl(throwStatements.ts, 17, 44))
|
||||
|
||||
var aClassInModule = new M.A();
|
||||
>aClassInModule : Symbol(aClassInModule, Decl(throwStatements.ts, 60, 3))
|
||||
>M.A : Symbol(M.A, Decl(throwStatements.ts, 19, 10))
|
||||
>M : Symbol(M, Decl(throwStatements.ts, 17, 44))
|
||||
>A : Symbol(M.A, Decl(throwStatements.ts, 19, 10))
|
||||
|
||||
throw aClassInModule;
|
||||
>aClassInModule : Symbol(aClassInModule, Decl(throwStatements.ts, 60, 3))
|
||||
|
||||
var aFunctionInModule = M.F2;
|
||||
>aFunctionInModule : Symbol(aFunctionInModule, Decl(throwStatements.ts, 62, 3))
|
||||
>M.F2 : Symbol(M.F2, Decl(throwStatements.ts, 22, 5))
|
||||
>M : Symbol(M, Decl(throwStatements.ts, 17, 44))
|
||||
>F2 : Symbol(M.F2, Decl(throwStatements.ts, 22, 5))
|
||||
|
||||
throw aFunctionInModule;
|
||||
>aFunctionInModule : Symbol(aFunctionInModule, Decl(throwStatements.ts, 62, 3))
|
||||
|
||||
// no initializer or annotation, so this is an 'any'
|
||||
var x;
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 66, 3))
|
||||
|
||||
throw x;
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 66, 3))
|
||||
|
||||
// literals
|
||||
throw 0.0;
|
||||
throw false;
|
||||
throw null;
|
||||
throw undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
throw 'a string';
|
||||
throw function () { return 'a string' };
|
||||
throw <T>(x:T) => 42;
|
||||
>T : Symbol(T, Decl(throwStatements.ts, 76, 7))
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 76, 10))
|
||||
>T : Symbol(T, Decl(throwStatements.ts, 76, 7))
|
||||
|
||||
throw { x: 12, y: 13 };
|
||||
>x : Symbol(x, Decl(throwStatements.ts, 77, 7))
|
||||
>y : Symbol(y, Decl(throwStatements.ts, 77, 14))
|
||||
|
||||
throw [];
|
||||
throw ['a', ['b']];
|
||||
throw /[a-z]/;
|
||||
throw new Date();
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
throw new C();
|
||||
>C : Symbol(C, Decl(throwStatements.ts, 5, 1))
|
||||
|
||||
throw new Object();
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
throw new D<number>();
|
||||
>D : Symbol(D, Decl(throwStatements.ts, 9, 1))
|
||||
|
||||
267
tests/baselines/reference/throwStatements.types
Normal file
267
tests/baselines/reference/throwStatements.types
Normal file
@@ -0,0 +1,267 @@
|
||||
=== tests/cases/conformance/statements/throwStatements/throwStatements.ts ===
|
||||
|
||||
// all legal
|
||||
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : C
|
||||
>I : I
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
}
|
||||
|
||||
class D<T>{
|
||||
>D : D<T>
|
||||
>T : T
|
||||
|
||||
source: T;
|
||||
>source : T
|
||||
>T : T
|
||||
|
||||
recurse: D<T>;
|
||||
>recurse : D<T>
|
||||
>D : D<T>
|
||||
>T : T
|
||||
|
||||
wrapped: D<D<T>>
|
||||
>wrapped : D<D<T>>
|
||||
>D : D<T>
|
||||
>D : D<T>
|
||||
>T : T
|
||||
}
|
||||
|
||||
function F(x: string): number { return 42; }
|
||||
>F : (x: string) => number
|
||||
>x : string
|
||||
>42 : number
|
||||
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
export class A {
|
||||
>A : A
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
}
|
||||
|
||||
export function F2(x: number): string { return x.toString(); }
|
||||
>F2 : (x: number) => string
|
||||
>x : number
|
||||
>x.toString() : string
|
||||
>x.toString : (radix?: number) => string
|
||||
>x : number
|
||||
>toString : (radix?: number) => string
|
||||
}
|
||||
|
||||
var aNumber = 9.9;
|
||||
>aNumber : number
|
||||
>9.9 : number
|
||||
|
||||
throw aNumber;
|
||||
>aNumber : number
|
||||
|
||||
var aString = 'this is a string';
|
||||
>aString : string
|
||||
>'this is a string' : string
|
||||
|
||||
throw aString;
|
||||
>aString : string
|
||||
|
||||
var aDate = new Date(12);
|
||||
>aDate : Date
|
||||
>new Date(12) : Date
|
||||
>Date : DateConstructor
|
||||
>12 : number
|
||||
|
||||
throw aDate;
|
||||
>aDate : Date
|
||||
|
||||
var anObject = new Object();
|
||||
>anObject : Object
|
||||
>new Object() : Object
|
||||
>Object : ObjectConstructor
|
||||
|
||||
throw anObject;
|
||||
>anObject : Object
|
||||
|
||||
var anAny = null;
|
||||
>anAny : any
|
||||
>null : null
|
||||
|
||||
throw anAny;
|
||||
>anAny : any
|
||||
|
||||
var anOtherAny = <any> new C();
|
||||
>anOtherAny : any
|
||||
><any> new C() : any
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
throw anOtherAny;
|
||||
>anOtherAny : any
|
||||
|
||||
var anUndefined = undefined;
|
||||
>anUndefined : any
|
||||
>undefined : undefined
|
||||
|
||||
throw anUndefined;
|
||||
>anUndefined : any
|
||||
|
||||
var aClass = new C();
|
||||
>aClass : C
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
throw aClass;
|
||||
>aClass : C
|
||||
|
||||
var aGenericClass = new D<string>();
|
||||
>aGenericClass : D<string>
|
||||
>new D<string>() : D<string>
|
||||
>D : typeof D
|
||||
|
||||
throw aGenericClass;
|
||||
>aGenericClass : D<string>
|
||||
|
||||
var anObjectLiteral = { id: 12 };
|
||||
>anObjectLiteral : { id: number; }
|
||||
>{ id: 12 } : { id: number; }
|
||||
>id : number
|
||||
>12 : number
|
||||
|
||||
throw anObjectLiteral;
|
||||
>anObjectLiteral : { id: number; }
|
||||
|
||||
var aFunction = F;
|
||||
>aFunction : (x: string) => number
|
||||
>F : (x: string) => number
|
||||
|
||||
throw aFunction;
|
||||
>aFunction : (x: string) => number
|
||||
|
||||
throw aFunction('');
|
||||
>aFunction('') : number
|
||||
>aFunction : (x: string) => number
|
||||
>'' : string
|
||||
|
||||
var aLambda = (x) => 2;
|
||||
>aLambda : (x: any) => number
|
||||
>(x) => 2 : (x: any) => number
|
||||
>x : any
|
||||
>2 : number
|
||||
|
||||
throw aLambda;
|
||||
>aLambda : (x: any) => number
|
||||
|
||||
throw aLambda(1);
|
||||
>aLambda(1) : number
|
||||
>aLambda : (x: any) => number
|
||||
>1 : number
|
||||
|
||||
var aModule = M;
|
||||
>aModule : typeof M
|
||||
>M : typeof M
|
||||
|
||||
throw aModule;
|
||||
>aModule : typeof M
|
||||
|
||||
throw typeof M;
|
||||
>typeof M : string
|
||||
>M : typeof M
|
||||
|
||||
var aClassInModule = new M.A();
|
||||
>aClassInModule : M.A
|
||||
>new M.A() : M.A
|
||||
>M.A : typeof M.A
|
||||
>M : typeof M
|
||||
>A : typeof M.A
|
||||
|
||||
throw aClassInModule;
|
||||
>aClassInModule : M.A
|
||||
|
||||
var aFunctionInModule = M.F2;
|
||||
>aFunctionInModule : (x: number) => string
|
||||
>M.F2 : (x: number) => string
|
||||
>M : typeof M
|
||||
>F2 : (x: number) => string
|
||||
|
||||
throw aFunctionInModule;
|
||||
>aFunctionInModule : (x: number) => string
|
||||
|
||||
// no initializer or annotation, so this is an 'any'
|
||||
var x;
|
||||
>x : any
|
||||
|
||||
throw x;
|
||||
>x : any
|
||||
|
||||
// literals
|
||||
throw 0.0;
|
||||
>0.0 : number
|
||||
|
||||
throw false;
|
||||
>false : boolean
|
||||
|
||||
throw null;
|
||||
>null : null
|
||||
|
||||
throw undefined;
|
||||
>undefined : undefined
|
||||
|
||||
throw 'a string';
|
||||
>'a string' : string
|
||||
|
||||
throw function () { return 'a string' };
|
||||
>function () { return 'a string' } : () => string
|
||||
>'a string' : string
|
||||
|
||||
throw <T>(x:T) => 42;
|
||||
><T>(x:T) => 42 : <T>(x: T) => number
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>42 : number
|
||||
|
||||
throw { x: 12, y: 13 };
|
||||
>{ x: 12, y: 13 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>12 : number
|
||||
>y : number
|
||||
>13 : number
|
||||
|
||||
throw [];
|
||||
>[] : undefined[]
|
||||
|
||||
throw ['a', ['b']];
|
||||
>['a', ['b']] : (string | string[])[]
|
||||
>'a' : string
|
||||
>['b'] : string[]
|
||||
>'b' : string
|
||||
|
||||
throw /[a-z]/;
|
||||
>/[a-z]/ : RegExp
|
||||
|
||||
throw new Date();
|
||||
>new Date() : Date
|
||||
>Date : DateConstructor
|
||||
|
||||
throw new C();
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
throw new Object();
|
||||
>new Object() : Object
|
||||
>Object : ObjectConstructor
|
||||
|
||||
throw new D<number>();
|
||||
>new D<number>() : D<number>
|
||||
>D : typeof D
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts(44,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts(45,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts (2 errors) ====
|
||||
// typeof operator on boolean type
|
||||
var BOOLEAN: boolean;
|
||||
|
||||
function foo(): boolean { return true; }
|
||||
|
||||
class A {
|
||||
public a: boolean;
|
||||
static foo() { return false; }
|
||||
}
|
||||
module M {
|
||||
export var n: boolean;
|
||||
}
|
||||
|
||||
var objA = new A();
|
||||
|
||||
// boolean type var
|
||||
var ResultIsString1 = typeof BOOLEAN;
|
||||
|
||||
// boolean type literal
|
||||
var ResultIsString2 = typeof true;
|
||||
var ResultIsString3 = typeof { x: true, y: false };
|
||||
|
||||
// boolean type expressions
|
||||
var ResultIsString4 = typeof objA.a;
|
||||
var ResultIsString5 = typeof M.n;
|
||||
var ResultIsString6 = typeof foo();
|
||||
var ResultIsString7 = typeof A.foo();
|
||||
|
||||
// multiple typeof operator
|
||||
var ResultIsString8 = typeof typeof BOOLEAN;
|
||||
|
||||
// miss assignment operators
|
||||
typeof true;
|
||||
typeof BOOLEAN;
|
||||
typeof foo();
|
||||
typeof true, false;
|
||||
typeof objA.a;
|
||||
typeof M.n;
|
||||
|
||||
// use typeof in type query
|
||||
var z: boolean;
|
||||
var x: boolean[];
|
||||
var r: () => boolean;
|
||||
z: typeof BOOLEAN;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
r: typeof foo;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
var y = { a: true, b: false};
|
||||
z: typeof y.a;
|
||||
z: typeof objA.a;
|
||||
z: typeof A.foo;
|
||||
z: typeof M.n;
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [typeofOperatorWithBooleanType.ts]
|
||||
|
||||
// typeof operator on boolean type
|
||||
var BOOLEAN: boolean;
|
||||
|
||||
|
||||
131
tests/baselines/reference/typeofOperatorWithBooleanType.symbols
Normal file
131
tests/baselines/reference/typeofOperatorWithBooleanType.symbols
Normal file
@@ -0,0 +1,131 @@
|
||||
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts ===
|
||||
|
||||
// typeof operator on boolean type
|
||||
var BOOLEAN: boolean;
|
||||
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
|
||||
|
||||
function foo(): boolean { return true; }
|
||||
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
|
||||
|
||||
public a: boolean;
|
||||
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
|
||||
static foo() { return false; }
|
||||
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
|
||||
}
|
||||
module M {
|
||||
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
|
||||
|
||||
export var n: boolean;
|
||||
>n : Symbol(n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
}
|
||||
|
||||
var objA = new A();
|
||||
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
|
||||
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
|
||||
|
||||
// boolean type var
|
||||
var ResultIsString1 = typeof BOOLEAN;
|
||||
>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithBooleanType.ts, 17, 3))
|
||||
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
|
||||
|
||||
// boolean type literal
|
||||
var ResultIsString2 = typeof true;
|
||||
>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithBooleanType.ts, 20, 3))
|
||||
|
||||
var ResultIsString3 = typeof { x: true, y: false };
|
||||
>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithBooleanType.ts, 21, 3))
|
||||
>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 21, 30))
|
||||
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 21, 39))
|
||||
|
||||
// boolean type expressions
|
||||
var ResultIsString4 = typeof objA.a;
|
||||
>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithBooleanType.ts, 24, 3))
|
||||
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
|
||||
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
|
||||
var ResultIsString5 = typeof M.n;
|
||||
>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithBooleanType.ts, 25, 3))
|
||||
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
|
||||
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
|
||||
var ResultIsString6 = typeof foo();
|
||||
>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithBooleanType.ts, 26, 3))
|
||||
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
|
||||
|
||||
var ResultIsString7 = typeof A.foo();
|
||||
>ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithBooleanType.ts, 27, 3))
|
||||
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
|
||||
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
|
||||
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
|
||||
|
||||
// multiple typeof operator
|
||||
var ResultIsString8 = typeof typeof BOOLEAN;
|
||||
>ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithBooleanType.ts, 30, 3))
|
||||
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
|
||||
|
||||
// miss assignment operators
|
||||
typeof true;
|
||||
typeof BOOLEAN;
|
||||
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
|
||||
|
||||
typeof foo();
|
||||
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
|
||||
|
||||
typeof true, false;
|
||||
typeof objA.a;
|
||||
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
|
||||
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
|
||||
typeof M.n;
|
||||
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
|
||||
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
|
||||
// use typeof in type query
|
||||
var z: boolean;
|
||||
>z : Symbol(z, Decl(typeofOperatorWithBooleanType.ts, 41, 3))
|
||||
|
||||
var x: boolean[];
|
||||
>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 42, 3))
|
||||
|
||||
var r: () => boolean;
|
||||
>r : Symbol(r, Decl(typeofOperatorWithBooleanType.ts, 43, 3))
|
||||
|
||||
z: typeof BOOLEAN;
|
||||
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
|
||||
|
||||
r: typeof foo;
|
||||
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
|
||||
|
||||
var y = { a: true, b: false};
|
||||
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 46, 3))
|
||||
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9))
|
||||
>b : Symbol(b, Decl(typeofOperatorWithBooleanType.ts, 46, 18))
|
||||
|
||||
z: typeof y.a;
|
||||
>y.a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9))
|
||||
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 46, 3))
|
||||
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9))
|
||||
|
||||
z: typeof objA.a;
|
||||
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
|
||||
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
|
||||
|
||||
z: typeof A.foo;
|
||||
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
|
||||
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
|
||||
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
|
||||
|
||||
z: typeof M.n;
|
||||
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
|
||||
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|
||||
|
||||
177
tests/baselines/reference/typeofOperatorWithBooleanType.types
Normal file
177
tests/baselines/reference/typeofOperatorWithBooleanType.types
Normal file
@@ -0,0 +1,177 @@
|
||||
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts ===
|
||||
|
||||
// typeof operator on boolean type
|
||||
var BOOLEAN: boolean;
|
||||
>BOOLEAN : boolean
|
||||
|
||||
function foo(): boolean { return true; }
|
||||
>foo : () => boolean
|
||||
>true : boolean
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
public a: boolean;
|
||||
>a : boolean
|
||||
|
||||
static foo() { return false; }
|
||||
>foo : () => boolean
|
||||
>false : boolean
|
||||
}
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
export var n: boolean;
|
||||
>n : boolean
|
||||
}
|
||||
|
||||
var objA = new A();
|
||||
>objA : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
|
||||
// boolean type var
|
||||
var ResultIsString1 = typeof BOOLEAN;
|
||||
>ResultIsString1 : string
|
||||
>typeof BOOLEAN : string
|
||||
>BOOLEAN : boolean
|
||||
|
||||
// boolean type literal
|
||||
var ResultIsString2 = typeof true;
|
||||
>ResultIsString2 : string
|
||||
>typeof true : string
|
||||
>true : boolean
|
||||
|
||||
var ResultIsString3 = typeof { x: true, y: false };
|
||||
>ResultIsString3 : string
|
||||
>typeof { x: true, y: false } : string
|
||||
>{ x: true, y: false } : { x: boolean; y: boolean; }
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
>y : boolean
|
||||
>false : boolean
|
||||
|
||||
// boolean type expressions
|
||||
var ResultIsString4 = typeof objA.a;
|
||||
>ResultIsString4 : string
|
||||
>typeof objA.a : string
|
||||
>objA.a : boolean
|
||||
>objA : A
|
||||
>a : boolean
|
||||
|
||||
var ResultIsString5 = typeof M.n;
|
||||
>ResultIsString5 : string
|
||||
>typeof M.n : string
|
||||
>M.n : boolean
|
||||
>M : typeof M
|
||||
>n : boolean
|
||||
|
||||
var ResultIsString6 = typeof foo();
|
||||
>ResultIsString6 : string
|
||||
>typeof foo() : string
|
||||
>foo() : boolean
|
||||
>foo : () => boolean
|
||||
|
||||
var ResultIsString7 = typeof A.foo();
|
||||
>ResultIsString7 : string
|
||||
>typeof A.foo() : string
|
||||
>A.foo() : boolean
|
||||
>A.foo : () => boolean
|
||||
>A : typeof A
|
||||
>foo : () => boolean
|
||||
|
||||
// multiple typeof operator
|
||||
var ResultIsString8 = typeof typeof BOOLEAN;
|
||||
>ResultIsString8 : string
|
||||
>typeof typeof BOOLEAN : string
|
||||
>typeof BOOLEAN : string
|
||||
>BOOLEAN : boolean
|
||||
|
||||
// miss assignment operators
|
||||
typeof true;
|
||||
>typeof true : string
|
||||
>true : boolean
|
||||
|
||||
typeof BOOLEAN;
|
||||
>typeof BOOLEAN : string
|
||||
>BOOLEAN : boolean
|
||||
|
||||
typeof foo();
|
||||
>typeof foo() : string
|
||||
>foo() : boolean
|
||||
>foo : () => boolean
|
||||
|
||||
typeof true, false;
|
||||
>typeof true, false : boolean
|
||||
>typeof true : string
|
||||
>true : boolean
|
||||
>false : boolean
|
||||
|
||||
typeof objA.a;
|
||||
>typeof objA.a : string
|
||||
>objA.a : boolean
|
||||
>objA : A
|
||||
>a : boolean
|
||||
|
||||
typeof M.n;
|
||||
>typeof M.n : string
|
||||
>M.n : boolean
|
||||
>M : typeof M
|
||||
>n : boolean
|
||||
|
||||
// use typeof in type query
|
||||
var z: boolean;
|
||||
>z : boolean
|
||||
|
||||
var x: boolean[];
|
||||
>x : boolean[]
|
||||
|
||||
var r: () => boolean;
|
||||
>r : () => boolean
|
||||
|
||||
z: typeof BOOLEAN;
|
||||
>z : any
|
||||
>typeof BOOLEAN : string
|
||||
>BOOLEAN : boolean
|
||||
|
||||
r: typeof foo;
|
||||
>r : any
|
||||
>typeof foo : string
|
||||
>foo : () => boolean
|
||||
|
||||
var y = { a: true, b: false};
|
||||
>y : { a: boolean; b: boolean; }
|
||||
>{ a: true, b: false} : { a: boolean; b: boolean; }
|
||||
>a : boolean
|
||||
>true : boolean
|
||||
>b : boolean
|
||||
>false : boolean
|
||||
|
||||
z: typeof y.a;
|
||||
>z : any
|
||||
>typeof y.a : string
|
||||
>y.a : boolean
|
||||
>y : { a: boolean; b: boolean; }
|
||||
>a : boolean
|
||||
|
||||
z: typeof objA.a;
|
||||
>z : any
|
||||
>typeof objA.a : string
|
||||
>objA.a : boolean
|
||||
>objA : A
|
||||
>a : boolean
|
||||
|
||||
z: typeof A.foo;
|
||||
>z : any
|
||||
>typeof A.foo : string
|
||||
>A.foo : () => boolean
|
||||
>A : typeof A
|
||||
>foo : () => boolean
|
||||
|
||||
z: typeof M.n;
|
||||
>z : any
|
||||
>typeof M.n : string
|
||||
>M.n : boolean
|
||||
>M : typeof M
|
||||
>n : boolean
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts(26,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts (1 errors) ====
|
||||
// typeof operator on enum type
|
||||
|
||||
enum ENUM { };
|
||||
enum ENUM1 { A, B, "" };
|
||||
|
||||
// enum type var
|
||||
var ResultIsString1 = typeof ENUM;
|
||||
var ResultIsString2 = typeof ENUM1;
|
||||
|
||||
// enum type expressions
|
||||
var ResultIsString3 = typeof ENUM1["A"];
|
||||
var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]);
|
||||
|
||||
// multiple typeof operators
|
||||
var ResultIsString5 = typeof typeof ENUM;
|
||||
var ResultIsString6 = typeof typeof typeof (ENUM[0] + ENUM1.B);
|
||||
|
||||
// miss assignment operators
|
||||
typeof ENUM;
|
||||
typeof ENUM1;
|
||||
typeof ENUM1["B"];
|
||||
typeof ENUM, ENUM1;
|
||||
|
||||
// use typeof in type query
|
||||
enum z { };
|
||||
z: typeof ENUM;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof ENUM1;
|
||||
@@ -1,4 +1,5 @@
|
||||
//// [typeofOperatorWithEnumType.ts]
|
||||
|
||||
// typeof operator on enum type
|
||||
|
||||
enum ENUM { };
|
||||
|
||||
70
tests/baselines/reference/typeofOperatorWithEnumType.symbols
Normal file
70
tests/baselines/reference/typeofOperatorWithEnumType.symbols
Normal file
@@ -0,0 +1,70 @@
|
||||
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts ===
|
||||
|
||||
// typeof operator on enum type
|
||||
|
||||
enum ENUM { };
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
|
||||
enum ENUM1 { A, B, "" };
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
>A : Symbol(ENUM1.A, Decl(typeofOperatorWithEnumType.ts, 4, 12))
|
||||
>B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15))
|
||||
|
||||
// enum type var
|
||||
var ResultIsString1 = typeof ENUM;
|
||||
>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithEnumType.ts, 7, 3))
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
|
||||
var ResultIsString2 = typeof ENUM1;
|
||||
>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithEnumType.ts, 8, 3))
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
|
||||
// enum type expressions
|
||||
var ResultIsString3 = typeof ENUM1["A"];
|
||||
>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithEnumType.ts, 11, 3))
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
>"A" : Symbol(ENUM1.A, Decl(typeofOperatorWithEnumType.ts, 4, 12))
|
||||
|
||||
var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]);
|
||||
>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithEnumType.ts, 12, 3))
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
>"B" : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15))
|
||||
|
||||
// multiple typeof operators
|
||||
var ResultIsString5 = typeof typeof ENUM;
|
||||
>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithEnumType.ts, 15, 3))
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
|
||||
var ResultIsString6 = typeof typeof typeof (ENUM[0] + ENUM1.B);
|
||||
>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithEnumType.ts, 16, 3))
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
>ENUM1.B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15))
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
>B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15))
|
||||
|
||||
// miss assignment operators
|
||||
typeof ENUM;
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
|
||||
typeof ENUM1;
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
|
||||
typeof ENUM1["B"];
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
>"B" : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15))
|
||||
|
||||
typeof ENUM, ENUM1;
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
|
||||
// use typeof in type query
|
||||
enum z { };
|
||||
>z : Symbol(z, Decl(typeofOperatorWithEnumType.ts, 22, 19))
|
||||
|
||||
z: typeof ENUM;
|
||||
>ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0))
|
||||
|
||||
z: typeof ENUM1;
|
||||
>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14))
|
||||
|
||||
99
tests/baselines/reference/typeofOperatorWithEnumType.types
Normal file
99
tests/baselines/reference/typeofOperatorWithEnumType.types
Normal file
@@ -0,0 +1,99 @@
|
||||
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts ===
|
||||
|
||||
// typeof operator on enum type
|
||||
|
||||
enum ENUM { };
|
||||
>ENUM : ENUM
|
||||
|
||||
enum ENUM1 { A, B, "" };
|
||||
>ENUM1 : ENUM1
|
||||
>A : ENUM1
|
||||
>B : ENUM1
|
||||
|
||||
// enum type var
|
||||
var ResultIsString1 = typeof ENUM;
|
||||
>ResultIsString1 : string
|
||||
>typeof ENUM : string
|
||||
>ENUM : typeof ENUM
|
||||
|
||||
var ResultIsString2 = typeof ENUM1;
|
||||
>ResultIsString2 : string
|
||||
>typeof ENUM1 : string
|
||||
>ENUM1 : typeof ENUM1
|
||||
|
||||
// enum type expressions
|
||||
var ResultIsString3 = typeof ENUM1["A"];
|
||||
>ResultIsString3 : string
|
||||
>typeof ENUM1["A"] : string
|
||||
>ENUM1["A"] : ENUM1
|
||||
>ENUM1 : typeof ENUM1
|
||||
>"A" : string
|
||||
|
||||
var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]);
|
||||
>ResultIsString4 : string
|
||||
>typeof (ENUM[0] + ENUM1["B"]) : string
|
||||
>(ENUM[0] + ENUM1["B"]) : string
|
||||
>ENUM[0] + ENUM1["B"] : string
|
||||
>ENUM[0] : string
|
||||
>ENUM : typeof ENUM
|
||||
>0 : number
|
||||
>ENUM1["B"] : ENUM1
|
||||
>ENUM1 : typeof ENUM1
|
||||
>"B" : string
|
||||
|
||||
// multiple typeof operators
|
||||
var ResultIsString5 = typeof typeof ENUM;
|
||||
>ResultIsString5 : string
|
||||
>typeof typeof ENUM : string
|
||||
>typeof ENUM : string
|
||||
>ENUM : typeof ENUM
|
||||
|
||||
var ResultIsString6 = typeof typeof typeof (ENUM[0] + ENUM1.B);
|
||||
>ResultIsString6 : string
|
||||
>typeof typeof typeof (ENUM[0] + ENUM1.B) : string
|
||||
>typeof typeof (ENUM[0] + ENUM1.B) : string
|
||||
>typeof (ENUM[0] + ENUM1.B) : string
|
||||
>(ENUM[0] + ENUM1.B) : string
|
||||
>ENUM[0] + ENUM1.B : string
|
||||
>ENUM[0] : string
|
||||
>ENUM : typeof ENUM
|
||||
>0 : number
|
||||
>ENUM1.B : ENUM1
|
||||
>ENUM1 : typeof ENUM1
|
||||
>B : ENUM1
|
||||
|
||||
// miss assignment operators
|
||||
typeof ENUM;
|
||||
>typeof ENUM : string
|
||||
>ENUM : typeof ENUM
|
||||
|
||||
typeof ENUM1;
|
||||
>typeof ENUM1 : string
|
||||
>ENUM1 : typeof ENUM1
|
||||
|
||||
typeof ENUM1["B"];
|
||||
>typeof ENUM1["B"] : string
|
||||
>ENUM1["B"] : ENUM1
|
||||
>ENUM1 : typeof ENUM1
|
||||
>"B" : string
|
||||
|
||||
typeof ENUM, ENUM1;
|
||||
>typeof ENUM, ENUM1 : typeof ENUM1
|
||||
>typeof ENUM : string
|
||||
>ENUM : typeof ENUM
|
||||
>ENUM1 : typeof ENUM1
|
||||
|
||||
// use typeof in type query
|
||||
enum z { };
|
||||
>z : z
|
||||
|
||||
z: typeof ENUM;
|
||||
>z : any
|
||||
>typeof ENUM : string
|
||||
>ENUM : typeof ENUM
|
||||
|
||||
z: typeof ENUM1;
|
||||
>z : any
|
||||
>typeof ENUM1 : string
|
||||
>ENUM1 : typeof ENUM1
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
Input:
|
||||
;
|
||||
//Testing two
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//@module: commonjs
|
||||
// @allowUnreachableCode: true
|
||||
// @module: commonjs
|
||||
|
||||
export module Foo {
|
||||
export class C {}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnreachableCode: true
|
||||
|
||||
function f() {
|
||||
return function (s) {
|
||||
var x = s;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
// @sourcemap: true
|
||||
|
||||
x:
|
||||
var b = 10;
|
||||
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: true
|
||||
// @module: system
|
||||
|
||||
export var x;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
// typeof operator on boolean type
|
||||
var BOOLEAN: boolean;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
// typeof operator on enum type
|
||||
|
||||
enum ENUM { };
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
target1:
|
||||
target2:
|
||||
while (true) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
function f() {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// @allowUnusedLabels: true
|
||||
// @allowUnreachableCode: true
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// @allowUnusedLabels: true
|
||||
// @allowUnreachableCode: true
|
||||
|
||||
switch ('') {
|
||||
case 'a':
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnreachableCode: true
|
||||
|
||||
function fn(x) {
|
||||
throw x;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @allowUnreachableCode: true
|
||||
|
||||
// all legal
|
||||
|
||||
interface I {
|
||||
|
||||
Reference in New Issue
Block a user