blob: a6d2e7c3a1359f05ff561d5ffa3ff9e170e9a11d [file] [log] [blame]
// Copyright (c) 2011, 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.
/// @assertion The following names are allowed for user-defined operators:
/// <, >, <=, >=, ==, -, +, /, ˜/, *, %, |, ˆ, &, <<, >>, >>>, []=, [], ˜.
/// @description Checks that operator ! cannot be defined in a user class.
/// @author iefremov
class C {
bool operator !() {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
}
main() {
C? c = new C();
c!;
// ^
// [analyzer] STATIC_WARNING.UNNECESSARY_NON_NULL_ASSERTION
//^
// [cfe] Operand of null-aware operation '!' has type 'C' which excludes null.
}