Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2015-12-28 15:56:44 -05:00
parent 5f9983a698
commit decec4db65
6 changed files with 71 additions and 24 deletions

View File

@@ -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.

View File

@@ -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; };

View File

@@ -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))

View File

@@ -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

View File

@@ -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');
~~~

View File

@@ -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<T> {
foo(x: 'a'): any;
foo(x: T): any;
}
declare class C3<T extends String> {
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<T> {
(x: 'a'): any;
(x: T): any;
foo(x: 'a'): any;
foo(x: T): any;
}
interface I3<T extends String> {
(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');
<T>(x: T);
foo(x: 'a');
foo<T>(x: T);
};
declare var a3: {
(x: 'a');
<T>(x: T);
foo(x: 'a');
foo<T extends String>(x: T);
};