From decec4db657e72b2c2a2be2c7692cd1e265427a8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 28 Dec 2015 15:56:44 -0500 Subject: [PATCH] Accepted baselines. --- ...overloadOnConstAsTypeAnnotation.errors.txt | 11 ---- .../overloadOnConstAsTypeAnnotation.js | 8 +-- .../overloadOnConstAsTypeAnnotation.symbols | 7 +++ .../overloadOnConstAsTypeAnnotation.types | 9 +++ ...ubtypeOfNonSpecializedSignature.errors.txt | 4 +- ...reIsNotSubtypeOfNonSpecializedSignature.js | 56 +++++++++++++++++-- 6 files changed, 71 insertions(+), 24 deletions(-) delete mode 100644 tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt create mode 100644 tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols create mode 100644 tests/baselines/reference/overloadOnConstAsTypeAnnotation.types diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt deleted file mode 100644 index 7c651707eeb..00000000000 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,5): error TS2322: Type 'string' is not assignable to type '(x: "hi") => number'. -tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,37): error TS1005: ';' expected. - - -==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ==== - - var f: (x: 'hi') => number = ('hi') => { return 1; }; - ~ -!!! error TS2322: Type 'string' is not assignable to type '(x: "hi") => number'. - ~~ -!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js index aa5c8701f28..94250b48cbc 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js @@ -1,10 +1,6 @@ //// [overloadOnConstAsTypeAnnotation.ts] -var f: (x: 'hi') => number = ('hi') => { return 1; }; +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; //// [overloadOnConstAsTypeAnnotation.js] -var f = ('hi'); -{ - return 1; -} -; +var f = function (x) { return 1; }; diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols new file mode 100644 index 00000000000..c420e50cda2 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts === + +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; +>f : Symbol(f, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 3)) +>x : Symbol(x, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 8)) +>x : Symbol(x, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 30)) + diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.types b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.types new file mode 100644 index 00000000000..10a185708d4 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts === + +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; +>f : (x: "hi") => number +>x : "hi" +>(x: 'hi') => { return 1; } : (x: "hi") => number +>x : "hi" +>1 : number + diff --git a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt index d698193d02b..73318e782a3 100644 --- a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt +++ b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt @@ -1,9 +1,7 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(2,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (1 errors) ==== - // Specialized signatures must be a subtype of a non-specialized signature - // All the below should be errors function foo(x: 'a'); ~~~ diff --git a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js index f2946cbeab8..bb2dab55957 100644 --- a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js +++ b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js @@ -1,6 +1,4 @@ //// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts] -// Specialized signatures must be a subtype of a non-specialized signature -// All the below should be errors function foo(x: 'a'); function foo(x: number) { } @@ -67,8 +65,6 @@ var a3: { //// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js] -// Specialized signatures must be a subtype of a non-specialized signature -// All the below should be errors function foo(x) { } var C = (function () { function C() { @@ -91,3 +87,55 @@ var C3 = (function () { var a; var a2; var a3; + + +//// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.d.ts] +declare function foo(x: 'a'): any; +declare class C { + foo(x: 'a'): any; + foo(x: number): any; +} +declare class C2 { + foo(x: 'a'): any; + foo(x: T): any; +} +declare class C3 { + foo(x: 'a'): any; + foo(x: T): any; +} +interface I { + (x: 'a'): any; + (x: number): any; + foo(x: 'a'): any; + foo(x: number): any; +} +interface I2 { + (x: 'a'): any; + (x: T): any; + foo(x: 'a'): any; + foo(x: T): any; +} +interface I3 { + (x: 'a'): any; + (x: T): any; + foo(x: 'a'): any; + foo(x: T): any; +} +declare var a: { + (x: 'a'); + (x: number); + foo(x: 'a'); + foo(x: number); +}; +declare var a2: { + (x: 'a'); + (x: T); + foo(x: 'a'); + foo(x: T); +}; +declare var a3: { + (x: 'a'); + (x: T); + foo(x: 'a'); + foo(x: T); +};