XO0178: a line starts with a binary operator; end the previous line with it
A newline ends a statement when the line’s last token is an identifier, literal, ), ], }, ?, or return, break, continue (core 1.3, Go’s rule). So an expression continued on the next line must leave its operator at the end of the first line: a line that starts with ||, &&, +, ==, ??, or another binary operator would begin a new statement. Rust, Swift, Kotlin, and some Go style guides put the operator first; Xo cannot, because -x, !x, and ..n start expressions and a leading || reads as a closure. The machine fix moves the operator to the end of the previous line, and the parser reads the expression as continued, so no other error follows. A line starting with . continues a method chain and is allowed. See decision 0136.
Example
fn ready(a: Int, b: Int) -> Bool {
a > 0
|| b > 0
}Fix
fn ready(a: Int, b: Int) -> Bool {
a > 0 ||
b > 0
}Run xo explain XO0178 for this text in a terminal, or see
section 10.6 of the specification.