Files
wren/test/language/super/indirectly_inherited.wren
T
Bob Nystrom ef93496fd4 fix: remove default constructors and require explicit construct new() for all user classes
The compiler no longer auto-generates a default `new()` constructor for classes. All classes must now explicitly define `construct new() {}` to be instantiable. This change removes the `createDefaultConstructor` function from the compiler, eliminates the `return_this` primitive used by Object's default initializer, and adds explicit constructors to all test and example classes. Core metaclasses (Bool, Class, Null, Num, Object, Range, Sequence) now correctly reject `new()` calls with runtime errors.
2015-09-01 15:16:04 +00:00

21 lines
198 B
Plaintext

class A {
foo {
IO.print("A.foo")
}
}
class B is A {}
class C is B {
construct new() {}
foo {
IO.print("C.foo")
super.foo
}
}
C.new().foo
// expect: C.foo
// expect: A.foo