This contrived code should check if a relative path is a directory. e.g. if I passed in ./repro ., there'd be no / and I'd just expect it to return Ok({}). Instead, it builds just fine but then crashes at runtime with: [ROC CRASHED] dispatch on a value that can never exist.
Full easy reproduction (AI genn'ed, but I tested) here
app [main!] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.0/F1JVZPYfWP71s8vk6tHcV1Qx1Ef6CZkwswGoCn8VHZmL.tar.zst",
}
import pf.OsStr
import pf.Path
require! = |root, relative| {
path = relative.split_on("/").fold(root, Path.join)
is_dir = Path.is_dir!(path)?
if is_dir Ok({}) else Err(Missing(relative))
}
main! = |args|
match args.drop_first(1).map(OsStr.display) {
[text] => require!(Path.utf8(text), "")
_ => Err(BadArgs)
}
This contrived code should check if a relative path is a directory. e.g. if I passed in
./repro ., there'd be no/and I'd just expect it to returnOk({}). Instead, it builds just fine but then crashes at runtime with:[ROC CRASHED] dispatch on a value that can never exist.Full easy reproduction (AI genn'ed, but I tested) here