96 lines
6.6 KiB
Text
96 lines
6.6 KiB
Text
=== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/methodSignaturesWithOverloads2.ts ===
|
|
// Object type literals permit overloads with optionality but they must match
|
|
|
|
var c: {
|
|
>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; }, Symbol(c,Decl(methodSignaturesWithOverloads2.ts,2,3))
|
|
|
|
func4?(x: number): number;
|
|
>func4 : { (x: number): number; (s: string): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,2,8),Decl(methodSignaturesWithOverloads2.ts,3,30))
|
|
>x : number, Symbol(x,Decl(methodSignaturesWithOverloads2.ts,3,11))
|
|
|
|
func4?(s: string): string;
|
|
>func4 : { (x: number): number; (s: string): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,2,8),Decl(methodSignaturesWithOverloads2.ts,3,30))
|
|
>s : string, Symbol(s,Decl(methodSignaturesWithOverloads2.ts,4,11))
|
|
|
|
func5?: {
|
|
>func5 : { (x: number): number; (s: string): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,4,30))
|
|
|
|
(x: number): number;
|
|
>x : number, Symbol(x,Decl(methodSignaturesWithOverloads2.ts,6,9))
|
|
|
|
(s: string): string;
|
|
>s : string, Symbol(s,Decl(methodSignaturesWithOverloads2.ts,7,9))
|
|
|
|
};
|
|
};
|
|
|
|
// no errors
|
|
c.func4 = c.func5;
|
|
>c.func4 = c.func5 : { (x: number): number; (s: string): string; }
|
|
>c.func4 : { (x: number): number; (s: string): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,2,8),Decl(methodSignaturesWithOverloads2.ts,3,30))
|
|
>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; }, Symbol(c,Decl(methodSignaturesWithOverloads2.ts,2,3))
|
|
>func4 : { (x: number): number; (s: string): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,2,8),Decl(methodSignaturesWithOverloads2.ts,3,30))
|
|
>c.func5 : { (x: number): number; (s: string): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,4,30))
|
|
>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; }, Symbol(c,Decl(methodSignaturesWithOverloads2.ts,2,3))
|
|
>func5 : { (x: number): number; (s: string): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,4,30))
|
|
|
|
c.func5 = c.func4;
|
|
>c.func5 = c.func4 : { (x: number): number; (s: string): string; }
|
|
>c.func5 : { (x: number): number; (s: string): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,4,30))
|
|
>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; }, Symbol(c,Decl(methodSignaturesWithOverloads2.ts,2,3))
|
|
>func5 : { (x: number): number; (s: string): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,4,30))
|
|
>c.func4 : { (x: number): number; (s: string): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,2,8),Decl(methodSignaturesWithOverloads2.ts,3,30))
|
|
>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; }, Symbol(c,Decl(methodSignaturesWithOverloads2.ts,2,3))
|
|
>func4 : { (x: number): number; (s: string): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,2,8),Decl(methodSignaturesWithOverloads2.ts,3,30))
|
|
|
|
|
|
var c2: {
|
|
>c2 : { func4?<T>(x: T): number; func4?<T>(s: T): string; func5?: { <T>(x: T): number; <T>(s: T): string; }; }, Symbol(c2,Decl(methodSignaturesWithOverloads2.ts,16,3))
|
|
|
|
func4?<T>(x: T): number;
|
|
>func4 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,16,9),Decl(methodSignaturesWithOverloads2.ts,17,28))
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,17,11))
|
|
>x : T, Symbol(x,Decl(methodSignaturesWithOverloads2.ts,17,14))
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,17,11))
|
|
|
|
func4? <T>(s: T): string;
|
|
>func4 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,16,9),Decl(methodSignaturesWithOverloads2.ts,17,28))
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,18,12))
|
|
>s : T, Symbol(s,Decl(methodSignaturesWithOverloads2.ts,18,15))
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,18,12))
|
|
|
|
func5?: {
|
|
>func5 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,18,29))
|
|
|
|
<T>(x: T): number;
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,20,9))
|
|
>x : T, Symbol(x,Decl(methodSignaturesWithOverloads2.ts,20,12))
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,20,9))
|
|
|
|
<T>(s: T): string;
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,21,9))
|
|
>s : T, Symbol(s,Decl(methodSignaturesWithOverloads2.ts,21,12))
|
|
>T : T, Symbol(T,Decl(methodSignaturesWithOverloads2.ts,21,9))
|
|
|
|
};
|
|
};
|
|
|
|
// no errors
|
|
c2.func4 = c2.func5;
|
|
>c2.func4 = c2.func5 : { <T>(x: T): number; <T>(s: T): string; }
|
|
>c2.func4 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,16,9),Decl(methodSignaturesWithOverloads2.ts,17,28))
|
|
>c2 : { func4?<T>(x: T): number; func4?<T>(s: T): string; func5?: { <T>(x: T): number; <T>(s: T): string; }; }, Symbol(c2,Decl(methodSignaturesWithOverloads2.ts,16,3))
|
|
>func4 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,16,9),Decl(methodSignaturesWithOverloads2.ts,17,28))
|
|
>c2.func5 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,18,29))
|
|
>c2 : { func4?<T>(x: T): number; func4?<T>(s: T): string; func5?: { <T>(x: T): number; <T>(s: T): string; }; }, Symbol(c2,Decl(methodSignaturesWithOverloads2.ts,16,3))
|
|
>func5 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,18,29))
|
|
|
|
c2.func5 = c2.func4;
|
|
>c2.func5 = c2.func4 : { <T>(x: T): number; <T>(s: T): string; }
|
|
>c2.func5 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,18,29))
|
|
>c2 : { func4?<T>(x: T): number; func4?<T>(s: T): string; func5?: { <T>(x: T): number; <T>(s: T): string; }; }, Symbol(c2,Decl(methodSignaturesWithOverloads2.ts,16,3))
|
|
>func5 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func5,Decl(methodSignaturesWithOverloads2.ts,18,29))
|
|
>c2.func4 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,16,9),Decl(methodSignaturesWithOverloads2.ts,17,28))
|
|
>c2 : { func4?<T>(x: T): number; func4?<T>(s: T): string; func5?: { <T>(x: T): number; <T>(s: T): string; }; }, Symbol(c2,Decl(methodSignaturesWithOverloads2.ts,16,3))
|
|
>func4 : { <T>(x: T): number; <T>(s: T): string; }, Symbol(func4,Decl(methodSignaturesWithOverloads2.ts,16,9),Decl(methodSignaturesWithOverloads2.ts,17,28))
|
|
|