sdk
sdk copied to clipboard
Fletch allows overloading
For example, a modified version of tests/unsorted/10_test.dart:
import 'package:expect/expect.dart';
class A {
A() {
}
a() {
return 12;
}
}
class B extends A {
b() {
return 42;
}
a(int x) {
}
}
main() {
A a = new B();
A b = new A();
Expect.equals(12, b.a());
Expect.equals(42, a.b());
Expect.equals(12, a.a());
}
This test is supposed to throw an exception when we call a.a() as the method has been overridden in a subclass. The compiler needs to be aware of this situation and insert a stub in B that throws if you try to call a().