// 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 with `variance` flag disabled // Correct variance modifier usage will issue an error. import 'package:expect/expect.dart'; abstract class A { // ^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. int foo(X bar); } class B {} // ^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. // ^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. // ^^^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. class C extends A { // ^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. @override int foo(T bar) { return 2; } } mixin D {} // ^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. class E1 {} mixin E {} // ^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. class F = Object with D; // ^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. class G {} // ^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. class H {} // ^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'variance' language feature to be enabled. main() { B b = B(); C c = C(); Expect.equals(2, c.foo(3)); F f = F(); G g = G(); H h = H(); }