#2930 Null safe storage operator

SlimerDude Sat 30 Nov

I just came across this little edge case today...

class Meh {
    Str text := "meh" {
        get { &text }
        set { &text = it }
    }

    Void main() {
        meh := 69 as Obj
        foo := (meh as Meh)?.&text  // --> sys::NullErr
    }
}

It appears that the storage operator does not take the null safe operator into account and throws a NullErr; whereas I would expect it to return null instead.

In this simple example, removing the storage operator & then returns null as expected.

...
        foo := (meh as Meh)?.text  // --> null
...

brian Sun 1 Dec

Thanks for reporting Steve - I pushed a fix

Login or Signup to reply.