vsl-lang/VSL

Calling methods in initializers

vihanb opened this issue · 0 comments

Initializers should not be able to call methods on self until after the fields have been initialized:

class A {
    let a: Int
    let b: Int

    init() {
        f(); // OK
        self.a = 1
        self.foo() // Error
        self.b = 2
        self.foo() // OK
    }

    func foo() { ... }
}