// 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. typedef F1 = void Function(X); typedef F2 = X Function(X); typedef F3 = void Function(); typedef F4 = X Function(X Function(void)); typedef F5 = Y Function(X); typedef F6 = X Function(Y); class A {} mixin B on A> {} //# 01: compile-time error mixin B on A> {} //# 02: compile-time error mixin B on A> {} //# 03: compile-time error mixin B on A> {} //# 04: compile-time error mixin B on A> {} //# 05: compile-time error mixin B on A> {} //# 06: compile-time error mixin B on Object, A> {} //# 07: compile-time error mixin B on Object, A> {} //# 08: compile-time error mixin B on Object, A> {} //# 09: compile-time error mixin B on Object, A> {} //# 10: compile-time error mixin B on Object, A> {} //# 11: compile-time error mixin B on Object, A> {} //# 12: compile-time error mixin B implements A> {} //# 13: compile-time error mixin B implements A> {} //# 14: compile-time error mixin B implements A> {} //# 15: compile-time error mixin B implements A> {} //# 16: compile-time error mixin B implements A> {} //# 17: compile-time error mixin B implements A> {} //# 18: compile-time error mixin B on A {} //# 19: compile-time error mixin B on A {} //# 20: compile-time error // Two errors here: Invariance in `on` clause and // generic function type used as actual type argument. mixin B on A()> {} //# 21: compile-time error mixin B on A {} //# 22: compile-time error mixin B on A {} //# 23: compile-time error mixin B on A {} //# 24: compile-time error mixin B on Object, A {} //# 25: compile-time error mixin B on Object, A {} //# 26: compile-time error // Two errors here: Invariance in `on` clause and // generic function type used as actual type argument. mixin B //# 27: compile-time error on //# 27: continued Object, //# 27: continued A()> {} //# 27: continued mixin B //# 28: compile-time error on //# 28: continued Object, //# 28: continued A {} //# 28: continued mixin B on Object, A {} //# 29: compile-time error mixin B on Object, A {} //# 30: compile-time error mixin B implements A {} //# 31: compile-time error mixin B implements A {} //# 32: compile-time error // Two errors here: Invariance in superinterface and // generic function type used as actual type argument. mixin B //# 33: compile-time error implements //# 33: continued A()> {} //# 33: continued mixin B //# 34: compile-time error implements //# 34: continued A {} //# 34: continued mixin B implements A {} //# 35: compile-time error mixin B implements A {} //# 36: compile-time error // A superinterface variance error can arise for an inferred type. For // instance, mixin inference and instantiation to bound transforms `B` to // `B>` in subtest 37. class C extends A with B {} //# 37: compile-time error mixin B> on A {} //# 37: continued class C extends A with B {} //# 38: compile-time error mixin B> on A {} //# 38: continued class C extends A with B {} //# 39: compile-time error mixin B> on A {} //# 39: continued class C extends A with B {} //# 40: compile-time error mixin B> on A {} //# 40: continued class C extends A with B {} //# 41: compile-time error mixin B> on A {} //# 41: continued // Different kind of error here: I2b binds `Y` to `Null` which yields the // correct super-bounded type `B>`. But it is still an error // for `C`, because a superinterface cannot be a super-bounded type. class C extends A with B {} //# 42: compile-time error mixin B> on A {} //# 42: continued class C extends A with B {} //# 43: compile-time error mixin B on A {} //# 43: continued class C extends A with B {} //# 44: compile-time error mixin B on A {} //# 44: continued // Two errors here: Invariance in inferred superinterface of `C` and // generic function type used as bound. class C extends A with B {} //# 45: compile-time error mixin B()> on A {} //# 45: continued class C extends A with B {} //# 46: compile-time error mixin B on A {} //# 46: continued class C extends A with B {} //# 47: compile-time error mixin B on A {} //# 47: continued // Similar to subtest 42. class C extends A with B {} //# 48: compile-time error mixin B on A {} //# 48: continued main() { A(); }