TypeScript/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt
Cyrus Najmabadi fe57f3d2e4 Support modifiers on object literal methods and accessors, and question tokens on object literal methods.
This makes parsing of these constructs the same whether they are in an object literal or a class.

This is important for incrementla parsing for knowing if we can reuse these nodes if we run
into them.
2014-12-10 22:30:40 -08:00

46 lines
2.2 KiB
Plaintext

tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(4,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(11,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(21,5): error TS2300: Duplicate identifier 'foo'.
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (6 errors) ====
// Optional parameters allow initializers only in implementation signatures
// All the below declarations are errors
function foo(x = 2);
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
function foo(x = 1) { }
foo(1);
foo();
class C {
foo(x = 2);
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
foo(x = 1) { }
}
var c: C;
c.foo();
c.foo(1);
var b = {
foo(x = 1), // error
~
!!! error TS1005: '{' expected.
~~~
!!! error TS2300: Duplicate identifier 'foo'.
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
foo(x = 1) { }, // error
~~~
!!! error TS2300: Duplicate identifier 'foo'.
}
b.foo();
b.foo(1);