OxL Reference

error override-without-open

error Standard: [§4.7]

What it means#

Only a method declared open fn in the embedded type can be overridden (§4.7). Using override on a method that is not open, or that does not exist in the embedded type, is an error.

Example#

oxl✓ checked in CI
data Animal { name: str }
impl Animal {
  fn speak() -> str => "..."
}

data Dog { embed Animal; breed: str }
impl Dog {
  override fn speak() -> str => "Woof"      // <- override-without-open
}
error
override-without-open

How to fix#

oxl✓ checked in CI
data Animal { name: str }
impl Animal {
  open fn speak() -> str => "..."
}

data Dog { embed Animal; breed: str }
impl Dog {
  override fn speak() -> str => "Woof"
}

Declare the method open fn in the embedded type (if you own it), or drop override and use a differently named method.

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides