mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Accepted baselines.
This commit is contained in:
parent
820a2cb257
commit
5d94e48e42
@ -1,37 +0,0 @@
|
||||
//// [conformanceFunctionOverloads.ts]
|
||||
// Function overloads do not emit code
|
||||
|
||||
// Function overload signature with optional parameter
|
||||
|
||||
// Function overload signature with optional parameter
|
||||
|
||||
// Function overloads with generic and non-generic overloads
|
||||
|
||||
// Function overloads whose only difference is returning different unconstrained generic parameters
|
||||
|
||||
// Function overloads whose only difference is returning different constrained generic parameters
|
||||
|
||||
// Function overloads that differ only by type parameter constraints
|
||||
|
||||
// Function overloads with matching accessibility
|
||||
|
||||
// Function overloads with matching export
|
||||
|
||||
// Function overloads with more params than implementation signature
|
||||
|
||||
// Function overloads where return types are same infinitely recursive type reference
|
||||
|
||||
|
||||
|
||||
//// [conformanceFunctionOverloads.js]
|
||||
// Function overloads do not emit code
|
||||
// Function overload signature with optional parameter
|
||||
// Function overload signature with optional parameter
|
||||
// Function overloads with generic and non-generic overloads
|
||||
// Function overloads whose only difference is returning different unconstrained generic parameters
|
||||
// Function overloads whose only difference is returning different constrained generic parameters
|
||||
// Function overloads that differ only by type parameter constraints
|
||||
// Function overloads with matching accessibility
|
||||
// Function overloads with matching export
|
||||
// Function overloads with more params than implementation signature
|
||||
// Function overloads where return types are same infinitely recursive type reference
|
||||
@ -1,25 +0,0 @@
|
||||
=== tests/cases/conformance/functions/conformanceFunctionOverloads.ts ===
|
||||
// Function overloads do not emit code
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overload signature with optional parameter
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overload signature with optional parameter
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with generic and non-generic overloads
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads whose only difference is returning different unconstrained generic parameters
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads whose only difference is returning different constrained generic parameters
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads that differ only by type parameter constraints
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with matching accessibility
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with matching export
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with more params than implementation signature
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads where return types are same infinitely recursive type reference
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@ -1,25 +0,0 @@
|
||||
=== tests/cases/conformance/functions/conformanceFunctionOverloads.ts ===
|
||||
// Function overloads do not emit code
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overload signature with optional parameter
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overload signature with optional parameter
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with generic and non-generic overloads
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads whose only difference is returning different unconstrained generic parameters
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads whose only difference is returning different constrained generic parameters
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads that differ only by type parameter constraints
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with matching accessibility
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with matching export
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads with more params than implementation signature
|
||||
No type information for this code.
|
||||
No type information for this code.// Function overloads where return types are same infinitely recursive type reference
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
18
tests/baselines/reference/functionOverloads43.errors.txt
Normal file
18
tests/baselines/reference/functionOverloads43.errors.txt
Normal file
@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/functionOverloads43.ts(1,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionOverloads43.ts (1 errors) ====
|
||||
function foo(bar: { a:number }[]): number;
|
||||
~~~
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function foo(bar: { a:string }[]): string;
|
||||
function foo([x]: { a:number | string }[]): string | number {
|
||||
if (x) {
|
||||
return x.a;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var x = foo([{a: "str"}]);
|
||||
var y = foo([{a: 100}]);
|
||||
24
tests/baselines/reference/functionOverloads43.js
Normal file
24
tests/baselines/reference/functionOverloads43.js
Normal file
@ -0,0 +1,24 @@
|
||||
//// [functionOverloads43.ts]
|
||||
function foo(bar: { a:number }[]): number;
|
||||
function foo(bar: { a:string }[]): string;
|
||||
function foo([x]: { a:number | string }[]): string | number {
|
||||
if (x) {
|
||||
return x.a;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var x = foo([{a: "str"}]);
|
||||
var y = foo([{a: 100}]);
|
||||
|
||||
//// [functionOverloads43.js]
|
||||
function foo(_a) {
|
||||
var x = _a[0];
|
||||
if (x) {
|
||||
return x.a;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
var x = foo([{ a: "str" }]);
|
||||
var y = foo([{ a: 100 }]);
|
||||
37
tests/baselines/reference/functionOverloads44.js
Normal file
37
tests/baselines/reference/functionOverloads44.js
Normal file
@ -0,0 +1,37 @@
|
||||
//// [functionOverloads44.ts]
|
||||
interface Animal { animal }
|
||||
interface Dog extends Animal { dog }
|
||||
interface Cat extends Animal { cat }
|
||||
|
||||
function foo1(bar: { a:number }[]): Dog;
|
||||
function foo1(bar: { a:string }[]): Animal;
|
||||
function foo1([x]: { a:number | string }[]): Dog {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function foo2(bar: { a:number }[]): Cat;
|
||||
function foo2(bar: { a:string }[]): Cat | Dog;
|
||||
function foo2([x]: { a:number | string }[]): Cat {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
var x1 = foo1([{a: "str"}]);
|
||||
var y1 = foo1([{a: 100}]);
|
||||
|
||||
var x2 = foo2([{a: "str"}]);
|
||||
var y2 = foo2([{a: 100}]);
|
||||
|
||||
//// [functionOverloads44.js]
|
||||
function foo1(_a) {
|
||||
var x = _a[0];
|
||||
return undefined;
|
||||
}
|
||||
function foo2(_a) {
|
||||
var x = _a[0];
|
||||
return undefined;
|
||||
}
|
||||
var x1 = foo1([{ a: "str" }]);
|
||||
var y1 = foo1([{ a: 100 }]);
|
||||
var x2 = foo2([{ a: "str" }]);
|
||||
var y2 = foo2([{ a: 100 }]);
|
||||
81
tests/baselines/reference/functionOverloads44.symbols
Normal file
81
tests/baselines/reference/functionOverloads44.symbols
Normal file
@ -0,0 +1,81 @@
|
||||
=== tests/cases/compiler/functionOverloads44.ts ===
|
||||
interface Animal { animal }
|
||||
>Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0))
|
||||
>animal : Symbol(animal, Decl(functionOverloads44.ts, 0, 18))
|
||||
|
||||
interface Dog extends Animal { dog }
|
||||
>Dog : Symbol(Dog, Decl(functionOverloads44.ts, 0, 27))
|
||||
>Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0))
|
||||
>dog : Symbol(dog, Decl(functionOverloads44.ts, 1, 30))
|
||||
|
||||
interface Cat extends Animal { cat }
|
||||
>Cat : Symbol(Cat, Decl(functionOverloads44.ts, 1, 36))
|
||||
>Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0))
|
||||
>cat : Symbol(cat, Decl(functionOverloads44.ts, 2, 30))
|
||||
|
||||
function foo1(bar: { a:number }[]): Dog;
|
||||
>foo1 : Symbol(foo1, Decl(functionOverloads44.ts, 2, 36), Decl(functionOverloads44.ts, 4, 40), Decl(functionOverloads44.ts, 5, 43))
|
||||
>bar : Symbol(bar, Decl(functionOverloads44.ts, 4, 14))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 4, 20))
|
||||
>Dog : Symbol(Dog, Decl(functionOverloads44.ts, 0, 27))
|
||||
|
||||
function foo1(bar: { a:string }[]): Animal;
|
||||
>foo1 : Symbol(foo1, Decl(functionOverloads44.ts, 2, 36), Decl(functionOverloads44.ts, 4, 40), Decl(functionOverloads44.ts, 5, 43))
|
||||
>bar : Symbol(bar, Decl(functionOverloads44.ts, 5, 14))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 5, 20))
|
||||
>Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0))
|
||||
|
||||
function foo1([x]: { a:number | string }[]): Dog {
|
||||
>foo1 : Symbol(foo1, Decl(functionOverloads44.ts, 2, 36), Decl(functionOverloads44.ts, 4, 40), Decl(functionOverloads44.ts, 5, 43))
|
||||
>x : Symbol(x, Decl(functionOverloads44.ts, 6, 15))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 6, 20))
|
||||
>Dog : Symbol(Dog, Decl(functionOverloads44.ts, 0, 27))
|
||||
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
function foo2(bar: { a:number }[]): Cat;
|
||||
>foo2 : Symbol(foo2, Decl(functionOverloads44.ts, 8, 1), Decl(functionOverloads44.ts, 10, 40), Decl(functionOverloads44.ts, 11, 46))
|
||||
>bar : Symbol(bar, Decl(functionOverloads44.ts, 10, 14))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 10, 20))
|
||||
>Cat : Symbol(Cat, Decl(functionOverloads44.ts, 1, 36))
|
||||
|
||||
function foo2(bar: { a:string }[]): Cat | Dog;
|
||||
>foo2 : Symbol(foo2, Decl(functionOverloads44.ts, 8, 1), Decl(functionOverloads44.ts, 10, 40), Decl(functionOverloads44.ts, 11, 46))
|
||||
>bar : Symbol(bar, Decl(functionOverloads44.ts, 11, 14))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 11, 20))
|
||||
>Cat : Symbol(Cat, Decl(functionOverloads44.ts, 1, 36))
|
||||
>Dog : Symbol(Dog, Decl(functionOverloads44.ts, 0, 27))
|
||||
|
||||
function foo2([x]: { a:number | string }[]): Cat {
|
||||
>foo2 : Symbol(foo2, Decl(functionOverloads44.ts, 8, 1), Decl(functionOverloads44.ts, 10, 40), Decl(functionOverloads44.ts, 11, 46))
|
||||
>x : Symbol(x, Decl(functionOverloads44.ts, 12, 15))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 12, 20))
|
||||
>Cat : Symbol(Cat, Decl(functionOverloads44.ts, 1, 36))
|
||||
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
|
||||
var x1 = foo1([{a: "str"}]);
|
||||
>x1 : Symbol(x1, Decl(functionOverloads44.ts, 17, 3))
|
||||
>foo1 : Symbol(foo1, Decl(functionOverloads44.ts, 2, 36), Decl(functionOverloads44.ts, 4, 40), Decl(functionOverloads44.ts, 5, 43))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 17, 16))
|
||||
|
||||
var y1 = foo1([{a: 100}]);
|
||||
>y1 : Symbol(y1, Decl(functionOverloads44.ts, 18, 3))
|
||||
>foo1 : Symbol(foo1, Decl(functionOverloads44.ts, 2, 36), Decl(functionOverloads44.ts, 4, 40), Decl(functionOverloads44.ts, 5, 43))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 18, 16))
|
||||
|
||||
var x2 = foo2([{a: "str"}]);
|
||||
>x2 : Symbol(x2, Decl(functionOverloads44.ts, 20, 3))
|
||||
>foo2 : Symbol(foo2, Decl(functionOverloads44.ts, 8, 1), Decl(functionOverloads44.ts, 10, 40), Decl(functionOverloads44.ts, 11, 46))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 20, 16))
|
||||
|
||||
var y2 = foo2([{a: 100}]);
|
||||
>y2 : Symbol(y2, Decl(functionOverloads44.ts, 21, 3))
|
||||
>foo2 : Symbol(foo2, Decl(functionOverloads44.ts, 8, 1), Decl(functionOverloads44.ts, 10, 40), Decl(functionOverloads44.ts, 11, 46))
|
||||
>a : Symbol(a, Decl(functionOverloads44.ts, 21, 16))
|
||||
|
||||
97
tests/baselines/reference/functionOverloads44.types
Normal file
97
tests/baselines/reference/functionOverloads44.types
Normal file
@ -0,0 +1,97 @@
|
||||
=== tests/cases/compiler/functionOverloads44.ts ===
|
||||
interface Animal { animal }
|
||||
>Animal : Animal
|
||||
>animal : any
|
||||
|
||||
interface Dog extends Animal { dog }
|
||||
>Dog : Dog
|
||||
>Animal : Animal
|
||||
>dog : any
|
||||
|
||||
interface Cat extends Animal { cat }
|
||||
>Cat : Cat
|
||||
>Animal : Animal
|
||||
>cat : any
|
||||
|
||||
function foo1(bar: { a:number }[]): Dog;
|
||||
>foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; }
|
||||
>bar : { a: number; }[]
|
||||
>a : number
|
||||
>Dog : Dog
|
||||
|
||||
function foo1(bar: { a:string }[]): Animal;
|
||||
>foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; }
|
||||
>bar : { a: string; }[]
|
||||
>a : string
|
||||
>Animal : Animal
|
||||
|
||||
function foo1([x]: { a:number | string }[]): Dog {
|
||||
>foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>Dog : Dog
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
function foo2(bar: { a:number }[]): Cat;
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>bar : { a: number; }[]
|
||||
>a : number
|
||||
>Cat : Cat
|
||||
|
||||
function foo2(bar: { a:string }[]): Cat | Dog;
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>bar : { a: string; }[]
|
||||
>a : string
|
||||
>Cat : Cat
|
||||
>Dog : Dog
|
||||
|
||||
function foo2([x]: { a:number | string }[]): Cat {
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>Cat : Cat
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
|
||||
var x1 = foo1([{a: "str"}]);
|
||||
>x1 : Animal
|
||||
>foo1([{a: "str"}]) : Animal
|
||||
>foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; }
|
||||
>[{a: "str"}] : { a: string; }[]
|
||||
>{a: "str"} : { a: string; }
|
||||
>a : string
|
||||
>"str" : string
|
||||
|
||||
var y1 = foo1([{a: 100}]);
|
||||
>y1 : Dog
|
||||
>foo1([{a: 100}]) : Dog
|
||||
>foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; }
|
||||
>[{a: 100}] : { a: number; }[]
|
||||
>{a: 100} : { a: number; }
|
||||
>a : number
|
||||
>100 : number
|
||||
|
||||
var x2 = foo2([{a: "str"}]);
|
||||
>x2 : Cat | Dog
|
||||
>foo2([{a: "str"}]) : Cat | Dog
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>[{a: "str"}] : { a: string; }[]
|
||||
>{a: "str"} : { a: string; }
|
||||
>a : string
|
||||
>"str" : string
|
||||
|
||||
var y2 = foo2([{a: 100}]);
|
||||
>y2 : Cat
|
||||
>foo2([{a: 100}]) : Cat
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>[{a: 100}] : { a: number; }[]
|
||||
>{a: 100} : { a: number; }
|
||||
>a : number
|
||||
>100 : number
|
||||
|
||||
31
tests/baselines/reference/functionOverloads45.errors.txt
Normal file
31
tests/baselines/reference/functionOverloads45.errors.txt
Normal file
@ -0,0 +1,31 @@
|
||||
tests/cases/compiler/functionOverloads45.ts(5,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/compiler/functionOverloads45.ts(11,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionOverloads45.ts (2 errors) ====
|
||||
interface Animal { animal }
|
||||
interface Dog extends Animal { dog }
|
||||
interface Cat extends Animal { cat }
|
||||
|
||||
function foo1(bar: { a:number }[]): Cat;
|
||||
~~~~
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function foo1(bar: { a:string }[]): Dog;
|
||||
function foo1([x]: { a:number | string }[]): Animal {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function foo2(bar: { a:number }[]): Cat;
|
||||
~~~~
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function foo2(bar: { a:string }[]): Dog;
|
||||
function foo2([x]: { a:number | string }[]): Cat | Dog {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
var x1 = foo1([{a: "str"}]);
|
||||
var y1 = foo1([{a: 100}]);
|
||||
|
||||
var x2 = foo2([{a: "str"}]);
|
||||
var y2 = foo2([{a: 100}]);
|
||||
37
tests/baselines/reference/functionOverloads45.js
Normal file
37
tests/baselines/reference/functionOverloads45.js
Normal file
@ -0,0 +1,37 @@
|
||||
//// [functionOverloads45.ts]
|
||||
interface Animal { animal }
|
||||
interface Dog extends Animal { dog }
|
||||
interface Cat extends Animal { cat }
|
||||
|
||||
function foo1(bar: { a:number }[]): Cat;
|
||||
function foo1(bar: { a:string }[]): Dog;
|
||||
function foo1([x]: { a:number | string }[]): Animal {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function foo2(bar: { a:number }[]): Cat;
|
||||
function foo2(bar: { a:string }[]): Dog;
|
||||
function foo2([x]: { a:number | string }[]): Cat | Dog {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
var x1 = foo1([{a: "str"}]);
|
||||
var y1 = foo1([{a: 100}]);
|
||||
|
||||
var x2 = foo2([{a: "str"}]);
|
||||
var y2 = foo2([{a: 100}]);
|
||||
|
||||
//// [functionOverloads45.js]
|
||||
function foo1(_a) {
|
||||
var x = _a[0];
|
||||
return undefined;
|
||||
}
|
||||
function foo2(_a) {
|
||||
var x = _a[0];
|
||||
return undefined;
|
||||
}
|
||||
var x1 = foo1([{ a: "str" }]);
|
||||
var y1 = foo1([{ a: 100 }]);
|
||||
var x2 = foo2([{ a: "str" }]);
|
||||
var y2 = foo2([{ a: 100 }]);
|
||||
Loading…
x
Reference in New Issue
Block a user