Diagnostics
T433
invalid use of `self`
T433
Inside a method, self refers to the value the method is called on. Choose another name for a parameter or local variable. Outside methods, self is an ordinary name.
Failing example
script "conf"
type Zone {
lo: float
hi: float
fn width(self: float) -> float { return self }
}
data chart = subscribe(data.ohlcv)
on chart.update {
let zone = Zone { lo: 0.0, hi: 1.0 }
let width = zone.width(1.0)
}Corrected example
script "fixed"
type Zone {
lo: float
hi: float
fn width() -> float { return self.hi - self.lo }
}
data chart = subscribe(data.ohlcv)
on chart.update {
let zone = Zone { lo: 0.0, hi: 1.0 }
let width = zone.width()
}