// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // Tests erroneous variance usage multiple type parameters. // SharedOptions=--enable-experiment=variance typedef CovFunction = T Function(); typedef ContraFunction = void Function(T); class Covariant {} class Contravariant {} class MultiTwo {} class MultiThree {} class A extends Covariant {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'out' position in supertype 'Covariant'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class B extends MultiThree {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'inout' position in supertype 'MultiThree'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class C extends MultiTwo {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'out' position in supertype 'MultiTwo'. // ^ // [cfe] Can't use 'out' type variable 'U' in an 'in' position in supertype 'MultiTwo'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class D extends MultiThree {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'inout' position in supertype 'MultiThree'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class E extends MultiThree, Covariant, Covariant> {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'out' position in supertype 'MultiThree'. // ^ // [cfe] Can't use 'out' type variable 'U' in an 'inout' position in supertype 'MultiThree'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class F extends MultiTwo, Contravariant> {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'out' position in supertype 'MultiTwo'. // ^ // [cfe] Can't use 'out' type variable 'U' in an 'in' position in supertype 'MultiTwo'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class G extends MultiThree, CovFunction, CovFunction> {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'out' position in supertype 'MultiThree'. // ^ // [cfe] Can't use 'out' type variable 'U' in an 'inout' position in supertype 'MultiThree'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE class H extends MultiTwo, ContraFunction> {} // ^ // [cfe] Can't use 'in' type variable 'T' in an 'out' position in supertype 'MultiTwo'. // ^ // [cfe] Can't use 'out' type variable 'U' in an 'in' position in supertype 'MultiTwo'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE