Error codes

E0252: ?. on T! (optional chaining is for T? only)

In a terminal: auk explain E0252 prints this page.

On this page

x?.f continues only when the optional x is present. On a T! it would silently drop the error, so Auk asks you to pass it up first: (x?).f.

Wrong#

auk
fn load(): str! = "a"
fn main(): ()! { print(load()?.len()) }

Fixed#

auk
fn load(): str! = "a"
fn main(): ()! { print((load()?).len()) }

Common causes#

  • Treating T! like T?: write (x?).f() to pass the error up, then call.
  • Use else for a fallback: (load() else "").len().

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page