diff --git a/tests/cases/conformance/functions/strictBindCallApply1.ts b/tests/cases/conformance/functions/strictBindCallApply1.ts index 5a94d4b5416..4194c41ec24 100644 --- a/tests/cases/conformance/functions/strictBindCallApply1.ts +++ b/tests/cases/conformance/functions/strictBindCallApply1.ts @@ -2,11 +2,19 @@ declare function foo(a: number, b: string): string; +declare function overloaded(s: string): number; +declare function overloaded(n: number): string; + +declare function generic(x: T): T; + let f00 = foo.bind(undefined); let f01 = foo.bind(undefined, 10); let f02 = foo.bind(undefined, 10, "hello"); let f03 = foo.bind(undefined, 10, 20); // Error +let f04 = overloaded.bind(undefined); // typeof overloaded +let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error let c02 = foo.call(undefined, 10, 20); // Error @@ -20,6 +28,10 @@ let a03 = foo.apply(undefined, [10, "hello", 30]); // Error class C { constructor(a: number, b: string) {} foo(this: this, a: number, b: string): string { return "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -31,6 +43,9 @@ let f12 = c.foo.bind(c, 10, "hello"); let f13 = c.foo.bind(c, 10, 20); // Error let f14 = c.foo.bind(undefined); // Error +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +let f16 = c.generic.bind(c); // typeof C.prototype.generic + let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error let c12 = c.foo.call(c, 10, 20); // Error