blob: f586299c39c04e8808731b12befc73161bb35780 [file] [log] [blame]
// Copyright (c) 2020, 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.
class C {
C e() => this;
C operator -() => this;
C operator ~() => this;
}
void main() {
final C? c = new C();
-c?.e();
// [error column 3, length 1]
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// [cfe] Operator 'unary-' cannot be called on 'C?' because it is potentially null.
~c?.e();
// [error column 3, length 1]
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// [cfe] Operator '~' cannot be called on 'C?' because it is potentially null.
}