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.
9 lines
181 B
Plaintext
9 lines
181 B
Plaintext
class Base {}
|
|
|
|
class Derived is Base {
|
|
construct new() {}
|
|
foo { super.doesNotExist(1) } // expect runtime error: Base does not implement 'doesNotExist(_)'.
|
|
}
|
|
|
|
Derived.new().foo
|