1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
=== tests/cases/compiler/uncalledFunctionChecksInConditional.ts ===
declare function isFoo(): boolean;
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
declare function isBar(): boolean;
>isBar : Symbol(isBar, Decl(uncalledFunctionChecksInConditional.ts, 0, 34))
declare const isUndefinedFoo: (() => boolean) | undefined;
>isUndefinedFoo : Symbol(isUndefinedFoo, Decl(uncalledFunctionChecksInConditional.ts, 2, 13))
if (isFoo) {
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// error on isFoo
}
if (isFoo || isBar) {
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
>isBar : Symbol(isBar, Decl(uncalledFunctionChecksInConditional.ts, 0, 34))
// error on isFoo, isBar
}
if (isFoo || isFoo()) {
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// error on isFoo
}
if (isUndefinedFoo || isFoo()) {
>isUndefinedFoo : Symbol(isUndefinedFoo, Decl(uncalledFunctionChecksInConditional.ts, 2, 13))
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// no error
}
if (isFoo && isFoo()) {
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// no error
}
declare const x: boolean;
>x : Symbol(x, Decl(uncalledFunctionChecksInConditional.ts, 24, 13))
declare const ux: boolean | undefined;
>ux : Symbol(ux, Decl(uncalledFunctionChecksInConditional.ts, 25, 13))
declare const y: boolean;
>y : Symbol(y, Decl(uncalledFunctionChecksInConditional.ts, 26, 13))
declare const uy: boolean | undefined;
>uy : Symbol(uy, Decl(uncalledFunctionChecksInConditional.ts, 27, 13))
declare function z(): boolean;
>z : Symbol(z, Decl(uncalledFunctionChecksInConditional.ts, 27, 38))
declare const uz: (() => boolean) | undefined;
>uz : Symbol(uz, Decl(uncalledFunctionChecksInConditional.ts, 29, 13))
if (x || isFoo) {
>x : Symbol(x, Decl(uncalledFunctionChecksInConditional.ts, 24, 13))
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// error on isFoo
}
if (isFoo || x) {
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
>x : Symbol(x, Decl(uncalledFunctionChecksInConditional.ts, 24, 13))
// error on isFoo
}
if (x || y || z() || isFoo) {
>x : Symbol(x, Decl(uncalledFunctionChecksInConditional.ts, 24, 13))
>y : Symbol(y, Decl(uncalledFunctionChecksInConditional.ts, 26, 13))
>z : Symbol(z, Decl(uncalledFunctionChecksInConditional.ts, 27, 38))
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// error on isFoo
}
if (x || uy || z || isUndefinedFoo) {
>x : Symbol(x, Decl(uncalledFunctionChecksInConditional.ts, 24, 13))
>uy : Symbol(uy, Decl(uncalledFunctionChecksInConditional.ts, 27, 13))
>z : Symbol(z, Decl(uncalledFunctionChecksInConditional.ts, 27, 38))
>isUndefinedFoo : Symbol(isUndefinedFoo, Decl(uncalledFunctionChecksInConditional.ts, 2, 13))
// error on z
}
if (ux || y || uz || isFoo) {
>ux : Symbol(ux, Decl(uncalledFunctionChecksInConditional.ts, 25, 13))
>y : Symbol(y, Decl(uncalledFunctionChecksInConditional.ts, 26, 13))
>uz : Symbol(uz, Decl(uncalledFunctionChecksInConditional.ts, 29, 13))
>isFoo : Symbol(isFoo, Decl(uncalledFunctionChecksInConditional.ts, 0, 0))
// error on isFoo
}
if (x && z) {
>x : Symbol(x, Decl(uncalledFunctionChecksInConditional.ts, 24, 13))
>z : Symbol(z, Decl(uncalledFunctionChecksInConditional.ts, 27, 38))
// no error
z();
>z : Symbol(z, Decl(uncalledFunctionChecksInConditional.ts, 27, 38))
}
|