blob: 97f0b2dbe7c6fdaf4a6337cc6c0270a429fe320e [file] [log] [blame]
// Copyright (c) 2014, 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.
// Regression test for issue 19728.
class C<T extends dynamic> {
T? field;
test() {
field = 0;
// ^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'int' can't be assigned to a variable of type 'T?'.
int i = field;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'T?' can't be assigned to a variable of type 'int'.
}
}
void main() {
new C().test();
}