From 7750a88957fec5c41fb286b8d59dfb4487a1b63c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 2 Oct 2017 18:50:05 -0700 Subject: [PATCH] Accepted baselines. --- .../decoratorOnClassMethod6.errors.txt | 4 +- .../decoratorOnClassProperty11.errors.txt | 4 +- .../potentiallyUncalledDecorators.errors.txt | 57 +++++++++++-------- .../potentiallyUncalledDecorators.js | 19 +++++++ .../potentiallyUncalledDecorators.symbols | 54 ++++++++++++------ .../potentiallyUncalledDecorators.types | 18 ++++++ 6 files changed, 109 insertions(+), 47 deletions(-) diff --git a/tests/baselines/reference/decoratorOnClassMethod6.errors.txt b/tests/baselines/reference/decoratorOnClassMethod6.errors.txt index 7a9e5fea355..b863a9db72c 100644 --- a/tests/baselines/reference/decoratorOnClassMethod6.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethod6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1329: This value has type '() => (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'? ==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): class C { @dec ["method"]() {} ~~~~ -!!! error TS1329: This value has type '() => (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'? } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassProperty11.errors.txt b/tests/baselines/reference/decoratorOnClassProperty11.errors.txt index 9d16d64df41..537daaf44ea 100644 --- a/tests/baselines/reference/decoratorOnClassProperty11.errors.txt +++ b/tests/baselines/reference/decoratorOnClassProperty11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1329: This value has type '() => (target: any, propertyKey: string) => void' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'? ==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts( class C { @dec prop; ~~~~ -!!! error TS1329: This value has type '() => (target: any, propertyKey: string) => void' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'? } \ No newline at end of file diff --git a/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt b/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt index e2858160ba9..9028ebe0377 100644 --- a/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt +++ b/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt @@ -1,39 +1,39 @@ -tests/cases/compiler/potentiallyUncalledDecorators.ts(4,5): error TS1329: This value has type '(bindingPropertyName?: string) => any' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? -tests/cases/compiler/potentiallyUncalledDecorators.ts(34,1): error TS1329: This value has type '() => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? -tests/cases/compiler/potentiallyUncalledDecorators.ts(36,5): error TS1329: This value has type '() => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? -tests/cases/compiler/potentiallyUncalledDecorators.ts(37,5): error TS1329: This value has type '() => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? -tests/cases/compiler/potentiallyUncalledDecorators.ts(40,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(4,5): error TS1329: 'Input' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@Input()'? +tests/cases/compiler/potentiallyUncalledDecorators.ts(35,1): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? +tests/cases/compiler/potentiallyUncalledDecorators.ts(37,5): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? +tests/cases/compiler/potentiallyUncalledDecorators.ts(38,5): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? +tests/cases/compiler/potentiallyUncalledDecorators.ts(41,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. Type 'OmniDecorator' is not assignable to type 'typeof B'. Type 'OmniDecorator' provides no match for the signature 'new (): B'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(42,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(43,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. Unable to resolve signature of property decorator when called as an expression. -tests/cases/compiler/potentiallyUncalledDecorators.ts(43,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(44,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(46,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(47,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. Type 'OmniDecorator' is not assignable to type 'typeof C'. Type 'OmniDecorator' provides no match for the signature 'new (): C'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(48,5): error TS1329: This value has type '(x?: any) => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? -tests/cases/compiler/potentiallyUncalledDecorators.ts(49,5): error TS1329: This value has type '(x?: any) => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? -tests/cases/compiler/potentiallyUncalledDecorators.ts(52,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(49,5): error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'? +tests/cases/compiler/potentiallyUncalledDecorators.ts(50,5): error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'? +tests/cases/compiler/potentiallyUncalledDecorators.ts(53,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. Type 'OmniDecorator' is not assignable to type 'typeof D'. Type 'OmniDecorator' provides no match for the signature 'new (): D'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(54,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(55,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. Unable to resolve signature of property decorator when called as an expression. -tests/cases/compiler/potentiallyUncalledDecorators.ts(55,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(56,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(58,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(59,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. Type 'OmniDecorator' is not assignable to type 'typeof E'. Type 'OmniDecorator' provides no match for the signature 'new (): E'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(60,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(61,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. Unable to resolve signature of property decorator when called as an expression. -tests/cases/compiler/potentiallyUncalledDecorators.ts(61,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(62,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(64,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(65,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. Type 'OmniDecorator' is not assignable to type 'typeof F'. Type 'OmniDecorator' provides no match for the signature 'new (): F'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(66,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'. Unable to resolve signature of property decorator when called as an expression. -tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. +tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'. @@ -43,7 +43,7 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1241: Unabl class FooComponent { @Input foo: string; ~~~~~~ -!!! error TS1329: This value has type '(bindingPropertyName?: string) => any' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'Input' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@Input()'? } // Glimmer-style tracked API: @@ -72,17 +72,18 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1241: Unabl declare function twoOptional(x?: any, y?: any): OmniDecorator; declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator; declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator; + declare const anyDec: any; @noArgs ~~~~~~~ -!!! error TS1329: This value has type '() => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? class A { @noArgs foo: any; ~~~~~~~ -!!! error TS1329: This value has type '() => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? @noArgs bar() { } ~~~~~~~ -!!! error TS1329: This value has type '() => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? } @allRest @@ -109,10 +110,10 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1241: Unabl class C { @oneOptional foo: any; ~~~~~~~~~~~~ -!!! error TS1329: This value has type '(x?: any) => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'? @oneOptional bar() { } ~~~~~~~~~~~~ -!!! error TS1329: This value has type '(x?: any) => OmniDecorator' which accepts too few arguments to be used as a decorator here. Did you mean to call it first? +!!! error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'? } @twoOptional @@ -163,5 +164,11 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1241: Unabl !!! error TS1241: Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'. } + @anyDec + class G { + @anyDec foo: any; + @anyDec bar() { } + } + export { }; \ No newline at end of file diff --git a/tests/baselines/reference/potentiallyUncalledDecorators.js b/tests/baselines/reference/potentiallyUncalledDecorators.js index a0dcc80ea0e..b69f848a8c9 100644 --- a/tests/baselines/reference/potentiallyUncalledDecorators.js +++ b/tests/baselines/reference/potentiallyUncalledDecorators.js @@ -31,6 +31,7 @@ declare function oneOptional(x?: any): OmniDecorator; declare function twoOptional(x?: any, y?: any): OmniDecorator; declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator; declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator; +declare const anyDec: any; @noArgs class A { @@ -68,6 +69,12 @@ class F { @oneOptionalWithRest bar() { } } +@anyDec +class G { + @anyDec foo: any; + @anyDec bar() { } +} + export { }; @@ -168,3 +175,15 @@ __decorate([ F = __decorate([ oneOptionalWithRest ], F); +let G = class G { + bar() { } +}; +__decorate([ + anyDec +], G.prototype, "foo", void 0); +__decorate([ + anyDec +], G.prototype, "bar", null); +G = __decorate([ + anyDec +], G); diff --git a/tests/baselines/reference/potentiallyUncalledDecorators.symbols b/tests/baselines/reference/potentiallyUncalledDecorators.symbols index ff7cc253a27..38fe3f3dc52 100644 --- a/tests/baselines/reference/potentiallyUncalledDecorators.symbols +++ b/tests/baselines/reference/potentiallyUncalledDecorators.symbols @@ -88,94 +88,112 @@ declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator; >args : Symbol(args, Decl(potentiallyUncalledDecorators.ts, 31, 45)) >OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1)) +declare const anyDec: any; +>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13)) + @noArgs >noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1)) class A { ->A : Symbol(A, Decl(potentiallyUncalledDecorators.ts, 31, 77)) +>A : Symbol(A, Decl(potentiallyUncalledDecorators.ts, 32, 26)) @noArgs foo: any; >noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1)) ->foo : Symbol(A.foo, Decl(potentiallyUncalledDecorators.ts, 34, 9)) +>foo : Symbol(A.foo, Decl(potentiallyUncalledDecorators.ts, 35, 9)) @noArgs bar() { } >noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1)) ->bar : Symbol(A.bar, Decl(potentiallyUncalledDecorators.ts, 35, 21)) +>bar : Symbol(A.bar, Decl(potentiallyUncalledDecorators.ts, 36, 21)) } @allRest >allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41)) class B { ->B : Symbol(B, Decl(potentiallyUncalledDecorators.ts, 37, 1)) +>B : Symbol(B, Decl(potentiallyUncalledDecorators.ts, 38, 1)) @allRest foo: any; >allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41)) ->foo : Symbol(B.foo, Decl(potentiallyUncalledDecorators.ts, 40, 9)) +>foo : Symbol(B.foo, Decl(potentiallyUncalledDecorators.ts, 41, 9)) @allRest bar() { } >allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41)) ->bar : Symbol(B.bar, Decl(potentiallyUncalledDecorators.ts, 41, 22)) +>bar : Symbol(B.bar, Decl(potentiallyUncalledDecorators.ts, 42, 22)) } @oneOptional >oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56)) class C { ->C : Symbol(C, Decl(potentiallyUncalledDecorators.ts, 43, 1)) +>C : Symbol(C, Decl(potentiallyUncalledDecorators.ts, 44, 1)) @oneOptional foo: any; >oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56)) ->foo : Symbol(C.foo, Decl(potentiallyUncalledDecorators.ts, 46, 9)) +>foo : Symbol(C.foo, Decl(potentiallyUncalledDecorators.ts, 47, 9)) @oneOptional bar() { } >oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56)) ->bar : Symbol(C.bar, Decl(potentiallyUncalledDecorators.ts, 47, 26)) +>bar : Symbol(C.bar, Decl(potentiallyUncalledDecorators.ts, 48, 26)) } @twoOptional >twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53)) class D { ->D : Symbol(D, Decl(potentiallyUncalledDecorators.ts, 49, 1)) +>D : Symbol(D, Decl(potentiallyUncalledDecorators.ts, 50, 1)) @twoOptional foo: any; >twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53)) ->foo : Symbol(D.foo, Decl(potentiallyUncalledDecorators.ts, 52, 9)) +>foo : Symbol(D.foo, Decl(potentiallyUncalledDecorators.ts, 53, 9)) @twoOptional bar() { } >twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53)) ->bar : Symbol(D.bar, Decl(potentiallyUncalledDecorators.ts, 53, 26)) +>bar : Symbol(D.bar, Decl(potentiallyUncalledDecorators.ts, 54, 26)) } @threeOptional >threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62)) class E { ->E : Symbol(E, Decl(potentiallyUncalledDecorators.ts, 55, 1)) +>E : Symbol(E, Decl(potentiallyUncalledDecorators.ts, 56, 1)) @threeOptional foo: any; >threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62)) ->foo : Symbol(E.foo, Decl(potentiallyUncalledDecorators.ts, 58, 9)) +>foo : Symbol(E.foo, Decl(potentiallyUncalledDecorators.ts, 59, 9)) @threeOptional bar() { } >threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62)) ->bar : Symbol(E.bar, Decl(potentiallyUncalledDecorators.ts, 59, 28)) +>bar : Symbol(E.bar, Decl(potentiallyUncalledDecorators.ts, 60, 28)) } @oneOptionalWithRest >oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73)) class F { ->F : Symbol(F, Decl(potentiallyUncalledDecorators.ts, 61, 1)) +>F : Symbol(F, Decl(potentiallyUncalledDecorators.ts, 62, 1)) @oneOptionalWithRest foo: any; >oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73)) ->foo : Symbol(F.foo, Decl(potentiallyUncalledDecorators.ts, 64, 9)) +>foo : Symbol(F.foo, Decl(potentiallyUncalledDecorators.ts, 65, 9)) @oneOptionalWithRest bar() { } >oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73)) ->bar : Symbol(F.bar, Decl(potentiallyUncalledDecorators.ts, 65, 34)) +>bar : Symbol(F.bar, Decl(potentiallyUncalledDecorators.ts, 66, 34)) +} + +@anyDec +>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13)) + +class G { +>G : Symbol(G, Decl(potentiallyUncalledDecorators.ts, 68, 1)) + + @anyDec foo: any; +>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13)) +>foo : Symbol(G.foo, Decl(potentiallyUncalledDecorators.ts, 71, 9)) + + @anyDec bar() { } +>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13)) +>bar : Symbol(G.bar, Decl(potentiallyUncalledDecorators.ts, 72, 21)) } export { }; diff --git a/tests/baselines/reference/potentiallyUncalledDecorators.types b/tests/baselines/reference/potentiallyUncalledDecorators.types index d79972659d3..cad861fc7b4 100644 --- a/tests/baselines/reference/potentiallyUncalledDecorators.types +++ b/tests/baselines/reference/potentiallyUncalledDecorators.types @@ -94,6 +94,9 @@ declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator; >args : any[] >OmniDecorator : OmniDecorator +declare const anyDec: any; +>anyDec : any + @noArgs >noArgs : () => OmniDecorator @@ -184,5 +187,20 @@ class F { >bar : () => void } +@anyDec +>anyDec : any + +class G { +>G : G + + @anyDec foo: any; +>anyDec : any +>foo : any + + @anyDec bar() { } +>anyDec : any +>bar : () => void +} + export { };