blob: 629cf9604d1dbe191fbee87923ce3b2c912f508d [file] [log] [blame]
// 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 field usage for the `out` variance modifier.
// SharedOptions=--enable-experiment=variance
class A<out T> {
void set a(T value) => value;
// ^
// [analyzer] unspecified
// [cfe] Can't use 'out' type variable 'T' in an 'in' position.
final void Function(T) b = (T val) {};
// ^
// [analyzer] unspecified
// [cfe] Can't use 'out' type variable 'T' in an 'in' position.
T c;
//^
// [analyzer] unspecified
// [cfe] Can't use 'out' type variable 'T' in an 'in' position.
}
mixin BMixin<out T> {
void set a(T value) => value;
// ^
// [analyzer] unspecified
// [cfe] Can't use 'out' type variable 'T' in an 'in' position.
final void Function(T) b = (T val) {};
// ^
// [analyzer] unspecified
// [cfe] Can't use 'out' type variable 'T' in an 'in' position.
T c;
//^
// [analyzer] unspecified
// [cfe] Can't use 'out' type variable 'T' in an 'in' position.
}