c191551fac
TEST=Covered by existing tests. Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009 Commit-Queue: Dmitry Stefantsov <dmitryas@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
75 lines
2.9 KiB
Plaintext
75 lines
2.9 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/nnbd/issue42603.dart:18:17: Error: Operator '==' should have exactly one parameter.
|
|
// bool operator ==() => true;
|
|
// ^^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/issue42603.dart:18:17: Error: The method 'E.==' has fewer positional arguments than those of overridden method 'Object.=='.
|
|
// bool operator ==() => true;
|
|
// ^
|
|
// sdk/lib/_internal/vm/lib/object_patch.dart:21:17: Context: This is the overridden method ('==').
|
|
// bool operator ==(Object other) native "Object_equals";
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/issue42603.dart:22:17: Error: The method 'F.==' has more required arguments than those of overridden method 'E.=='.
|
|
// bool operator ==(Object? other) => super == other;
|
|
// ^
|
|
// pkg/front_end/testcases/nnbd/issue42603.dart:18:17: Context: This is the overridden method ('==').
|
|
// bool operator ==() => true;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/issue42603.dart:22:44: Error: Too many positional arguments: 0 allowed, but 1 found.
|
|
// Try removing the extra positional arguments.
|
|
// bool operator ==(Object? other) => super == other;
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class C extends core::Object {
|
|
synthetic constructor •() → self::C
|
|
: super core::Object::•()
|
|
;
|
|
operator ==(core::Object other) → core::bool
|
|
return true;
|
|
}
|
|
class D extends self::C {
|
|
synthetic constructor •() → self::D
|
|
: super self::C::•()
|
|
;
|
|
operator ==(core::Object? other) → core::bool
|
|
return super.{self::C::==}(other);
|
|
method method1(dynamic o) → core::bool
|
|
return super.{self::C::==}(o);
|
|
method method2(Null o) → core::bool
|
|
return super.{self::C::==}(o);
|
|
}
|
|
class E extends core::Object {
|
|
synthetic constructor •() → self::E
|
|
: super core::Object::•()
|
|
;
|
|
operator ==() → core::bool
|
|
return true;
|
|
}
|
|
class F extends self::E {
|
|
synthetic constructor •() → self::F
|
|
: super self::E::•()
|
|
;
|
|
operator ==(core::Object? other) → core::bool
|
|
return let final Never #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue42603.dart:22:44: Error: Too many positional arguments: 0 allowed, but 1 found.
|
|
Try removing the extra positional arguments.
|
|
bool operator ==(Object? other) => super == other;
|
|
^" in super.{self::E::==}(other);
|
|
}
|
|
static method main() → dynamic {
|
|
self::expect(true, new self::D::•().{self::D::==}(new self::D::•()));
|
|
self::expect(false, new self::D::•().{self::D::method1}(null));
|
|
self::expect(false, new self::D::•().{self::D::method2}(null));
|
|
}
|
|
static method expect(dynamic expected, dynamic actual) → dynamic {
|
|
if(!expected.{core::Object::==}(actual))
|
|
throw "Expected ${expected}, actual ${actual}";
|
|
}
|