fix: is-operator, try with generic Result, Unwrap exits on panic
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
Desugar `is` to tag/value equality in bootstrap and selfhost so LIR no longer drops hIs as false. Resolve monomorphized Result/Option type names for `?` (_Tag/_Data). Call bux_exit(1) after Unwrap panic messages. Add is_operator example and document follow-up fixes.
This commit is contained in:
@@ -29,6 +29,7 @@ module Std::Option {
|
||||
func Option_Unwrap<T>(o: Option<T>) -> T {
|
||||
if o.tag != Option_Some {
|
||||
PrintLine("panic: unwrap on None");
|
||||
bux_exit(1);
|
||||
}
|
||||
return o.data.Some_0;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ module Std::Result {
|
||||
func Result_Unwrap<T, E>(r: Result<T, E>) -> T {
|
||||
if r.tag != Result_Ok {
|
||||
PrintLine("panic: unwrap on Err");
|
||||
bux_exit(1);
|
||||
}
|
||||
return r.data.Ok_0;
|
||||
}
|
||||
@@ -53,6 +54,7 @@ module Std::Result {
|
||||
func Result_UnwrapErr<T, E>(r: Result<T, E>) -> E {
|
||||
if r.tag != Result_Err {
|
||||
PrintLine("panic: unwrap_err on Ok");
|
||||
bux_exit(1);
|
||||
}
|
||||
return r.data.Err_0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user