The r-prefixed waves absorb the runtime, reject, and byte-compare rows of the migrated native carriers; each fixture is one directory with one case.ww and a //ww:error, //ww:compile, //ww:run, or //ww:run-exit directive covering both frontends.
7 lines
407 B
Plaintext
7 lines
407 B
Plaintext
//ww:run-exit 2
|
|
package main;
|
|
type invalid = !void;
|
|
fn validate(s: str) (void | invalid) = { return; };
|
|
fn fromutf8(s: str) (str | invalid) = { let v: (void | invalid) = validate(s); match (v) { case void => return s; case let e: invalid => return e; }; let e: invalid; return e; };
|
|
fn main() i32 = { match (fromutf8("hi")) { case let s: str => return s.len: i32; case invalid => return -1; }; return 0; };
|