Files
sdk/pkg/front_end/testcases/nnbd/issue42603.dart
T
Johnni Winther 251c3d7d42 [cfe] Allow nullable arguments to super==
Closes #42603

Change-Id: I52261ccb7c1d88a7469a72e244466b193777fe38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155330
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-28 07:41:01 +00:00

34 lines
759 B
Dart

// 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 {
bool operator ==(Object other) => true;
}
class D extends C {
bool operator ==(Object? other) => super == other;
bool method1(dynamic o) => super == o;
bool method2(Null o) => super == o;
}
class E {
bool operator ==() => true;
}
class F extends E {
bool operator ==(Object? other) => super == other;
}
main() {
expect(true, D() == D());
expect(false, D().method1(null));
expect(false, D().method2(null));
}
expect(expected, actual) {
if (expected != actual) throw 'Expected $expected, actual $actual';
}