From 94d7e3039341a812e18e64610f7ce1413241b66a Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Tue, 20 Nov 2018 22:01:34 +0100 Subject: [PATCH] MethodSignature doesn't have 'arguments' (#28625) Fixes: #28622 --- src/compiler/checker.ts | 1 - .../baselines/reference/arguments.errors.txt | 29 +++++++++++++++++++ tests/baselines/reference/arguments.js | 8 +++++ tests/baselines/reference/arguments.symbols | 22 ++++++++++++++ tests/baselines/reference/arguments.types | 25 ++++++++++++++++ tests/cases/compiler/arguments.ts | 8 +++++ 6 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/arguments.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6ef51bc401a..5e2c5d87690 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1420,7 +1420,6 @@ namespace ts { } break; case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: diff --git a/tests/baselines/reference/arguments.errors.txt b/tests/baselines/reference/arguments.errors.txt new file mode 100644 index 00000000000..de6aa35333f --- /dev/null +++ b/tests/baselines/reference/arguments.errors.txt @@ -0,0 +1,29 @@ +tests/cases/compiler/arguments.ts(6,25): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(7,23): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(8,19): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(9,23): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(10,34): error TS2304: Cannot find name 'arguments'. + + +==== tests/cases/compiler/arguments.ts (5 errors) ==== + function f() { + var x=arguments[12]; + } + + interface I { + method(args: typeof arguments): void; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + fn: (args: typeof arguments) => void; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + (args: typeof arguments): void; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + new (args: typeof arguments): void; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + construct: new (args: typeof arguments) => void; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + } \ No newline at end of file diff --git a/tests/baselines/reference/arguments.js b/tests/baselines/reference/arguments.js index b19821aa8f1..8622c084503 100644 --- a/tests/baselines/reference/arguments.js +++ b/tests/baselines/reference/arguments.js @@ -1,6 +1,14 @@ //// [arguments.ts] function f() { var x=arguments[12]; +} + +interface I { + method(args: typeof arguments): void; + fn: (args: typeof arguments) => void; + (args: typeof arguments): void; + new (args: typeof arguments): void; + construct: new (args: typeof arguments) => void; } //// [arguments.js] diff --git a/tests/baselines/reference/arguments.symbols b/tests/baselines/reference/arguments.symbols index 2825d792715..c8be643332c 100644 --- a/tests/baselines/reference/arguments.symbols +++ b/tests/baselines/reference/arguments.symbols @@ -6,3 +6,25 @@ function f() { >x : Symbol(x, Decl(arguments.ts, 1, 7)) >arguments : Symbol(arguments) } + +interface I { +>I : Symbol(I, Decl(arguments.ts, 2, 1)) + + method(args: typeof arguments): void; +>method : Symbol(I.method, Decl(arguments.ts, 4, 13)) +>args : Symbol(args, Decl(arguments.ts, 5, 11)) + + fn: (args: typeof arguments) => void; +>fn : Symbol(I.fn, Decl(arguments.ts, 5, 41)) +>args : Symbol(args, Decl(arguments.ts, 6, 9)) + + (args: typeof arguments): void; +>args : Symbol(args, Decl(arguments.ts, 7, 5)) + + new (args: typeof arguments): void; +>args : Symbol(args, Decl(arguments.ts, 8, 9)) + + construct: new (args: typeof arguments) => void; +>construct : Symbol(I.construct, Decl(arguments.ts, 8, 39)) +>args : Symbol(args, Decl(arguments.ts, 9, 20)) +} diff --git a/tests/baselines/reference/arguments.types b/tests/baselines/reference/arguments.types index 97a23822b7a..655f6182c6f 100644 --- a/tests/baselines/reference/arguments.types +++ b/tests/baselines/reference/arguments.types @@ -8,3 +8,28 @@ function f() { >arguments : IArguments >12 : 12 } + +interface I { + method(args: typeof arguments): void; +>method : (args: any) => void +>args : any +>arguments : any + + fn: (args: typeof arguments) => void; +>fn : (args: any) => void +>args : any +>arguments : any + + (args: typeof arguments): void; +>args : any +>arguments : any + + new (args: typeof arguments): void; +>args : any +>arguments : any + + construct: new (args: typeof arguments) => void; +>construct : new (args: any) => void +>args : any +>arguments : any +} diff --git a/tests/cases/compiler/arguments.ts b/tests/cases/compiler/arguments.ts index 5caff25129a..b486d5eed95 100644 --- a/tests/cases/compiler/arguments.ts +++ b/tests/cases/compiler/arguments.ts @@ -1,3 +1,11 @@ function f() { var x=arguments[12]; +} + +interface I { + method(args: typeof arguments): void; + fn: (args: typeof arguments) => void; + (args: typeof arguments): void; + new (args: typeof arguments): void; + construct: new (args: typeof arguments) => void; } \ No newline at end of file