162 lines
3.9 KiB
Plaintext
162 lines
3.9 KiB
Plaintext
tests/cases/compiler/reachabilityChecks6.ts(6,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(31,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(41,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(52,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(80,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(86,13): error TS7027: Unreachable code detected.
|
|
tests/cases/compiler/reachabilityChecks6.ts(94,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(97,13): error TS7027: Unreachable code detected.
|
|
tests/cases/compiler/reachabilityChecks6.ts(116,10): error TS7030: Not all code paths return a value.
|
|
tests/cases/compiler/reachabilityChecks6.ts(123,13): error TS7027: Unreachable code detected.
|
|
|
|
|
|
==== tests/cases/compiler/reachabilityChecks6.ts (10 errors) ====
|
|
|
|
function f0(x) {
|
|
while (true);
|
|
}
|
|
|
|
function f1(x) {
|
|
~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
if (x) {
|
|
return 1
|
|
}
|
|
}
|
|
|
|
function f2(x) {
|
|
while (x) {
|
|
throw new Error();
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
function f3(x) {
|
|
while (x) {
|
|
throw new Error();
|
|
}
|
|
}
|
|
|
|
function f3_1 (x) {
|
|
while (x) {
|
|
}
|
|
throw new Error();
|
|
}
|
|
|
|
function f4(x) {
|
|
~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
try {
|
|
if (x) {
|
|
return 1;
|
|
}
|
|
}
|
|
catch (e) {
|
|
}
|
|
}
|
|
|
|
function f5(x) {
|
|
~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
try {
|
|
if (x) {
|
|
return 1;
|
|
}
|
|
}
|
|
catch (e) {
|
|
return 2;
|
|
}
|
|
}
|
|
|
|
function f6(x) {
|
|
~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
try {
|
|
if (x) {
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
throw new Error();
|
|
}
|
|
}
|
|
catch (e) {
|
|
}
|
|
}
|
|
|
|
function f7(x) {
|
|
try {
|
|
if (x) {
|
|
return 1;
|
|
}
|
|
else {
|
|
throw new Error();
|
|
}
|
|
}
|
|
catch (e) {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function f8(x) {
|
|
~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
try {
|
|
if (true) {
|
|
x++;
|
|
}
|
|
else {
|
|
return 1;
|
|
~~~~~~
|
|
!!! error TS7027: Unreachable code detected.
|
|
}
|
|
}
|
|
catch (e) {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function f9(x) {
|
|
~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
try {
|
|
while (false) {
|
|
return 1;
|
|
~~~~~~
|
|
!!! error TS7027: Unreachable code detected.
|
|
}
|
|
}
|
|
catch (e) {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function f10(x) {
|
|
try {
|
|
do {
|
|
x++;
|
|
} while (true);
|
|
}
|
|
catch (e) {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function f11(x) {
|
|
~~~
|
|
!!! error TS7030: Not all code paths return a value.
|
|
test:
|
|
try {
|
|
do {
|
|
do {
|
|
break test;
|
|
} while (true);
|
|
x++;
|
|
~
|
|
!!! error TS7027: Unreachable code detected.
|
|
} while (true);
|
|
}
|
|
catch (e) {
|
|
return 1;
|
|
}
|
|
} |