TypeScript/tests/baselines/reference/parameterInitializersForwardReferencing.errors.txt

74 lines
4.1 KiB
Plaintext
Raw Normal View History

tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(6,20): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(11,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(11,28): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(17,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(23,25): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(32,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(33,16): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(37,14): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(37,21): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(37,28): error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it.
2014-09-11 23:52:14 +02:00
==== tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts (10 errors) ====
2014-07-13 01:04:16 +02:00
function left(a, b = a, c = b) {
a;
b;
}
function right(a = b, b = a) {
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
a;
b;
}
function right2(a = b, b = c, c = a) {
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
~
!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
2014-07-13 01:04:16 +02:00
a;
b;
c;
}
function inside(a = b) {
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
var b;
}
function outside() {
var b;
function inside(a = b) { // Still an error because b is declared inside the function
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
var b;
}
}
function defaultArgFunction(a = function () { return b; }, b = 1) { }
function defaultArgArrow(a = () => () => b, b = 3) { }
class C {
constructor(a = b, b = 1) { }
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
method(a = b, b = 1) { }
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
}
// Function expressions
var x = (a = b, b = c, c = d) => { var d; };
~
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
2014-07-13 01:04:16 +02:00
~
!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
2014-07-13 01:04:16 +02:00
~
!!! error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it.
2014-09-11 23:52:14 +02:00
// Should not produce errors - can reference later parameters if they occur within a function expression initializer.
function f(a, b = function () { return c; }, c = b()) {
}