2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/avoid.ts ===
|
|
|
|
function f() {
|
2015-04-13 23:01:57 +02:00
|
|
|
>f : () => void, Symbol(f, Decl(avoid.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var x=1;
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : number, Symbol(x, Decl(avoid.ts, 1, 7))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var y=f(); // error void fn
|
2015-04-13 23:01:57 +02:00
|
|
|
>y : void, Symbol(y, Decl(avoid.ts, 4, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>f() : void
|
2015-04-13 23:01:57 +02:00
|
|
|
>f : () => void, Symbol(f, Decl(avoid.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var why:any=f(); // error void fn
|
2015-04-13 23:01:57 +02:00
|
|
|
>why : any, Symbol(why, Decl(avoid.ts, 5, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>f() : void
|
2015-04-13 23:01:57 +02:00
|
|
|
>f : () => void, Symbol(f, Decl(avoid.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var w:any;
|
2015-04-13 23:01:57 +02:00
|
|
|
>w : any, Symbol(w, Decl(avoid.ts, 6, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
w=f(); // error void fn
|
|
|
|
>w=f() : void
|
2015-04-13 23:01:57 +02:00
|
|
|
>w : any, Symbol(w, Decl(avoid.ts, 6, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>f() : void
|
2015-04-13 23:01:57 +02:00
|
|
|
>f : () => void, Symbol(f, Decl(avoid.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
class C {
|
2015-04-13 23:01:57 +02:00
|
|
|
>C : C, Symbol(C, Decl(avoid.ts, 7, 6))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
g() {
|
2015-04-13 23:01:57 +02:00
|
|
|
>g : () => void, Symbol(g, Decl(avoid.ts, 9, 9))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var z=new C().g(); // error void fn
|
2015-04-13 23:01:57 +02:00
|
|
|
>z : void, Symbol(z, Decl(avoid.ts, 15, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new C().g() : void
|
2015-04-13 23:01:57 +02:00
|
|
|
>new C().g : () => void, Symbol(C.g, Decl(avoid.ts, 9, 9))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new C() : C
|
2015-04-13 23:01:57 +02:00
|
|
|
>C : typeof C, Symbol(C, Decl(avoid.ts, 7, 6))
|
|
|
|
>g : () => void, Symbol(C.g, Decl(avoid.ts, 9, 9))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var N=new f(); // ok with void fn
|
2015-04-13 23:01:57 +02:00
|
|
|
>N : any, Symbol(N, Decl(avoid.ts, 16, 3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new f() : any
|
2015-04-13 23:01:57 +02:00
|
|
|
>f : () => void, Symbol(f, Decl(avoid.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
|