mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:17:14 +00:00
Fix language_2/super_call4_test.
Change-Id: I1173d7121e7f557f93ec1f61341b627f141e6802 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116800 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Mayank Patke <fishythefish@google.com>
This commit is contained in:
parent
c464a12eb0
commit
d18bfb409f
|
@ -4,12 +4,7 @@
|
|||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Checks that noSuchMethod is resolved in the super class and not in the
|
||||
// current class.
|
||||
|
||||
class C {
|
||||
E e = new E();
|
||||
|
||||
bool foo();
|
||||
bool bar(int a);
|
||||
bool baz({int b});
|
||||
|
@ -21,34 +16,30 @@ class C {
|
|||
class D extends C {
|
||||
bool noSuchMethod(Invocation im) => false;
|
||||
|
||||
// `super.foo()` et al. will statically use [C]'s [noSuchMethod] forwarder,
|
||||
// but the forwarder will (virtually) call [D]'s [noSuchMethod] at runtime.
|
||||
|
||||
test1() {
|
||||
return super.foo(); //# 01: compile-time error
|
||||
return super.foo();
|
||||
}
|
||||
|
||||
test2() {
|
||||
return super.bar(1); //# 01: compile-time error
|
||||
return super.bar(1);
|
||||
}
|
||||
|
||||
test3() {
|
||||
return super.baz(b: 2); //# 01: compile-time error
|
||||
return super.baz(b: 2);
|
||||
}
|
||||
|
||||
test4() {
|
||||
return super.boz(1, c: 2); //# 01: compile-time error
|
||||
return super.boz(1, c: 2);
|
||||
}
|
||||
}
|
||||
|
||||
class E {
|
||||
bool foo() => true;
|
||||
bool bar(int a) => a == 1;
|
||||
bool baz({int b}) => b == 2;
|
||||
bool boz(int a, {int c}) => a == 1 && c == 2;
|
||||
}
|
||||
|
||||
main() {
|
||||
var d = new D();
|
||||
Expect.isNull(d.test1());
|
||||
Expect.isNull(d.test2());
|
||||
Expect.isNull(d.test3());
|
||||
Expect.isNull(d.test4());
|
||||
Expect.isFalse(d.test1());
|
||||
Expect.isFalse(d.test2());
|
||||
Expect.isFalse(d.test3());
|
||||
Expect.isFalse(d.test4());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue