TypeScript/tests/baselines/reference/invalidWhileBreakStatements.errors.txt
2015-10-03 00:20:15 -07:00

65 lines
2.7 KiB
Plaintext

tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(7,1): error TS7028: Unused label.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(8,14): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(11,1): error TS7027: Unreachable code detected.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
==== tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts (8 errors) ====
// All errors
// naked break not allowed
break;
~~~~~~
!!! error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement.
// non-existent label
ONE:
~~~
!!! error TS7028: Unused label.
while (true) break TWO;
~~~~~~~~~~
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
// break from inside function
TWO:
~~~
!!! error TS7027: Unreachable code detected.
while (true){
var x = () => {
break TWO;
~~~~~~~~~~
!!! error TS1107: Jump target cannot cross function boundary.
}
}
THREE:
while (true) {
var fn = function () {
break THREE;
~~~~~~~~~~~~
!!! error TS1107: Jump target cannot cross function boundary.
}
}
// break forward
while (true) {
break FIVE;
~~~~~~~~~~~
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
FIVE:
while (true) { }
}
// label on non-loop statement
NINE:
var y = 12;
while (true) {
break NINE;
~~~~~~~~~~~
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
}