- Create optional with ~ instead of ?. return io::EOF?; becomes return io::EOF~.

- Deprecated use of `?` to create optional.
This commit is contained in:
Christoffer Lerno
2026-01-20 16:10:28 +01:00
parent 5390ca6250
commit cdabe8fd9e
159 changed files with 710 additions and 707 deletions

View File

@@ -119,7 +119,7 @@ macro bool @in(#needle, ...) @builtin @const
*>
macro anycast(any v, $Type) @builtin
{
if (v.type != $Type.typeid) return TYPE_MISMATCH?;
if (v.type != $Type.typeid) return TYPE_MISMATCH~;
return ($Type*)v.ptr;
}
@@ -129,7 +129,7 @@ macro anycast(any v, $Type) @builtin
*>
macro any.to(self, $Type)
{
if (self.type != $Type.typeid) return TYPE_MISMATCH?;
if (self.type != $Type.typeid) return TYPE_MISMATCH~;
return *($Type*)self.ptr;
}
@@ -350,7 +350,7 @@ macro enum_by_name($Type, String enum_name) @builtin
{
if (name == enum_name) return $Type.from_ordinal(i);
}
return NOT_FOUND?;
return NOT_FOUND~;
}
<*
@@ -367,7 +367,7 @@ macro @enum_from_value($Type, #value, value) @builtin @deprecated("Use Enum.look
{
if (e.#value == value) return e;
}
return NOT_FOUND?;
return NOT_FOUND~;
}
<*
@@ -537,7 +537,7 @@ macro bool @ok(#expr) @builtin
macro void? @try(#v, #expr) @builtin @maydiscard
{
var res = #expr;
if (catch err = res) return err?;
if (catch err = res) return err~;
#v = res;
}
@@ -581,7 +581,7 @@ macro bool? @try_catch(#v, #expr, fault expected_fault) @builtin
var res = #expr;
if (catch err = res)
{
return err == expected_fault ? true : err?;
return err == expected_fault ? true : err~;
}
#v = res;
return false;