tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(51,19): error TS2430: Interface 'I2<T, U>' incorrectly extends interface 'A'.
  Types of property 'a2' are incompatible.
    Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'.
      Types of parameters 'x' and 'x' are incompatible.
        Type 'number' is not assignable to type 'T'.
          'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(60,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'.
  Types of property 'a8' are incompatible.
    Type '<T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'.
      Types of parameters 'y' and 'y' are incompatible.
        Types of parameters 'arg2' and 'arg2' are incompatible.
          Type '{ foo: number; }' is not assignable to type 'Base'.
            Types of property 'foo' are incompatible.
              Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(76,19): error TS2430: Interface 'I6' incorrectly extends interface 'A'.
  Types of property 'a15' are incompatible.
    Type '<T>(x: { a: T; b: T; }) => T' is not assignable to type '(x: { a: string; b: number; }) => number'.
      Types of parameters 'x' and 'x' are incompatible.
        Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'.
          Types of property 'b' are incompatible.
            Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(80,19): error TS2430: Interface 'I7' incorrectly extends interface 'A'.
  Types of property 'a15' are incompatible.
    Type '<T extends Base>(x: { a: T; b: T; }) => number' is not assignable to type '(x: { a: string; b: number; }) => number'.
      Types of parameters 'x' and 'x' are incompatible.
        Type '{ a: string; b: number; }' is not assignable to type '{ a: Base; b: Base; }'.
          Types of property 'a' are incompatible.
            Type 'string' is not assignable to type 'Base'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(100,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'.
  The types returned by 'a2(...)' are incompatible between these types.
    Type 'string[]' is not assignable to type 'T[]'.
      Type 'string' is not assignable to type 'T'.
        'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'.
  The types returned by 'a2(...)' are incompatible between these types.
    Type 'T[]' is not assignable to type 'string[]'.
      Type 'T' is not assignable to type 'string'.


==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts (6 errors) ====
    // checking subtype relations for function types as it relates to contextual signature instantiation
    // error cases
    
    module Errors {
        class Base { foo: string; }
        class Derived extends Base { bar: string; }
        class Derived2 extends Derived { baz: string; }
        class OtherDerived extends Base { bing: string; }
    
        module WithNonGenericSignaturesInBaseType {
            // base type with non-generic call signatures
            interface A {
                a2: (x: number) => string[];
                a7: (x: (arg: Base) => Derived) => (r: Base) => Derived2;
                a8: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived;
                a10: (...x: Base[]) => Base;
                a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base;
                a12: (x: Array<Base>, y: Array<Derived2>) => Array<Derived>;
                a14: {
                    (x: number): number[];
                    (x: string): string[];
                };
                a15: (x: { a: string; b: number }) => number;
                a16: {
                    // type of parameter is overload set which means we can't do inference based on this type
                    (x: {
                        (a: number): number;
                        (a?: number): number;
                    }): number[];
                    (x: {
                        (a: boolean): boolean;
                        (a?: boolean): boolean;
                    }): boolean[];
                };
                a17: {
                    (x: {
                        <T extends Derived>(a: T): T;
                        <T extends Base>(a: T): T;
                    }): any[];
                    (x: {
                        <T extends Derived2>(a: T): T;
                        <T extends Base>(a: T): T;
                    }): any[];
                };
            }
    
            interface I extends A {
                a2: <T, U>(x: T) => U[]; // error, contextual signature instantiation doesn't relate return types so U is {}, not a subtype of string[]
            }
    
            interface I2<T, U> extends A {
                      ~~
!!! error TS2430: Interface 'I2<T, U>' incorrectly extends interface 'A'.
!!! error TS2430:   Types of property 'a2' are incompatible.
!!! error TS2430:     Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'.
!!! error TS2430:       Types of parameters 'x' and 'x' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'T'.
!!! error TS2430:           'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
                a2: (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic
            }
    
            interface I3 extends A {
                // valid, no inferences for V so it defaults to Derived2
                a7: <T extends Base, U extends Derived, V extends Derived2>(x: (arg: T) => U) => (r: T) => V;
            }
    
            interface I4 extends A {
                      ~~
!!! error TS2430: Interface 'I4' incorrectly extends interface 'A'.
!!! error TS2430:   Types of property 'a8' are incompatible.
!!! error TS2430:     Type '<T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'.
!!! error TS2430:       Types of parameters 'y' and 'y' are incompatible.
!!! error TS2430:         Types of parameters 'arg2' and 'arg2' are incompatible.
!!! error TS2430:           Type '{ foo: number; }' is not assignable to type 'Base'.
!!! error TS2430:             Types of property 'foo' are incompatible.
!!! error TS2430:               Type 'number' is not assignable to type 'string'.
                a8: <T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; // error, type mismatch
            }
    
            interface I4B extends A {
                a10: <T extends Derived>(...x: T[]) => T; // valid, parameter covariance works even after contextual signature instantiation
            }
    
            interface I4C extends A {
                a11: <T extends Derived>(x: T, y: T) => T; // valid, even though x is a Base, parameter covariance works even after contextual signature instantiation
            }
    
            interface I4E extends A {
                a12: <T extends Array<Derived2>>(x: Array<Base>, y: Array<Base>) => T; // valid, no inferences for T, defaults to Array<Derived2>
            }
    
            interface I6 extends A {
                      ~~
!!! error TS2430: Interface 'I6' incorrectly extends interface 'A'.
!!! error TS2430:   Types of property 'a15' are incompatible.
!!! error TS2430:     Type '<T>(x: { a: T; b: T; }) => T' is not assignable to type '(x: { a: string; b: number; }) => number'.
!!! error TS2430:       Types of parameters 'x' and 'x' are incompatible.
!!! error TS2430:         Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'.
!!! error TS2430:           Types of property 'b' are incompatible.
!!! error TS2430:             Type 'number' is not assignable to type 'string'.
                a15: <T>(x: { a: T; b: T }) => T; // error, T is {} which isn't an acceptable return type
            }
    
            interface I7 extends A {
                      ~~
!!! error TS2430: Interface 'I7' incorrectly extends interface 'A'.
!!! error TS2430:   Types of property 'a15' are incompatible.
!!! error TS2430:     Type '<T extends Base>(x: { a: T; b: T; }) => number' is not assignable to type '(x: { a: string; b: number; }) => number'.
!!! error TS2430:       Types of parameters 'x' and 'x' are incompatible.
!!! error TS2430:         Type '{ a: string; b: number; }' is not assignable to type '{ a: Base; b: Base; }'.
!!! error TS2430:           Types of property 'a' are incompatible.
!!! error TS2430:             Type 'string' is not assignable to type 'Base'.
                a15: <T extends Base>(x: { a: T; b: T }) => number; // error, T defaults to Base, which is not compatible with number or string
            }
    
            interface I8 extends A {
                // ok, we relate each signature of a16 to b16, and within that, we make inferences from two different signatures in the respective A.a16 signature
                a16: <T>(x: (a: T) => T) => T[];
            }
    
            interface I9 extends A {
                a17: <T>(x: (a: T) => T) => any[]; // valid, target is more constrained than source, so it is safe in the traditional constraint-contravariant fashion
            }
        }
    
        module WithGenericSignaturesInBaseType {
            // base type has generic call signature
            interface B {
                a2: <T>(x: T) => T[];
            }
    
            interface I6 extends B {
                      ~~
!!! error TS2430: Interface 'I6' incorrectly extends interface 'B'.
!!! error TS2430:   The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430:     Type 'string[]' is not assignable to type 'T[]'.
!!! error TS2430:       Type 'string' is not assignable to type 'T'.
!!! error TS2430:         'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
                a2: <T>(x: T) => string[]; // error
            }
    
            // base type has generic call signature
            interface C {
                a2: <T>(x: T) => string[];
            }
    
            interface I7 extends C {
                      ~~
!!! error TS2430: Interface 'I7' incorrectly extends interface 'C'.
!!! error TS2430:   The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430:     Type 'T[]' is not assignable to type 'string[]'.
!!! error TS2430:       Type 'T' is not assignable to type 'string'.
                a2: <T>(x: T) => T[]; // error
            }
        }
    }