- 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

@@ -34,11 +34,11 @@ faultdef SOME_FAULT, ABC_FAULT;
fn void test_try_catch()
{
int val;
int? x = ABC_FAULT?;
int? x = ABC_FAULT~;
assert(@try_catch(val, x, ABC_FAULT)!!);
assert(val == 0);
assert(!@catch(@try_catch(val, x, ABC_FAULT)));
x = SOME_FAULT?;
x = SOME_FAULT~;
assert(@catch(@try_catch(val, x, ABC_FAULT)) == SOME_FAULT);
x = 3;
assert(!@try_catch(val, x, ABC_FAULT)!!);

View File

@@ -279,11 +279,11 @@ fn void test_error()
{
TestFailFn ffail_void = fn void?(bool to_fail)
{
if (to_fail) return io::FILE_NOT_FOUND?;
if (to_fail) return io::FILE_NOT_FOUND~;
};
TestIntFn ffail_int = fn int?(int a, int b)
{
if (b == 0) return io::FILE_NOT_FOUND?;
if (b == 0) return io::FILE_NOT_FOUND~;
return a / b;
};
test::@setup(state.setup_fn, state.teardown_fn);
@@ -295,7 +295,7 @@ fn void test_error()
fn void test_error_not_raised()
{
TestIntFn ffail_int = fn int?(int a, int b) {
if (b == 0) return io::FILE_NOT_FOUND?;
if (b == 0) return io::FILE_NOT_FOUND~;
return a / b;
};
test::@setup(state.setup_fn, state.teardown_fn);
@@ -307,11 +307,11 @@ fn void test_error_nofault()
{
TestFailFn ffail_void = fn void?(bool to_fail)
{
if (to_fail) return io::FILE_NOT_FOUND?;
if (to_fail) return io::FILE_NOT_FOUND~;
};
TestIntFn ffail_int = fn int?(int a, int b)
{
if (b == 0) return io::FILE_NOT_FOUND?;
if (b == 0) return io::FILE_NOT_FOUND~;
return a / b;
};
test::@setup(state.setup_fn, state.teardown_fn);
@@ -323,7 +323,7 @@ fn void test_error_nofault()
fn void test_error_nofault_not_raised()
{
TestIntFn ffail_int = fn int?(int a, int b) {
if (b == 0) return io::FILE_NOT_FOUND?;
if (b == 0) return io::FILE_NOT_FOUND~;
return a / b;
};
test::@setup(state.setup_fn, state.teardown_fn);
@@ -334,7 +334,7 @@ fn void test_error_nofault_not_raised()
fn void test_error_wrong_error_expected()
{
TestIntFn ffail_int = fn int?(int a, int b) {
if (b == 0) return io::BUSY?;
if (b == 0) return io::BUSY~;
return a / b;
};
test::@setup(state.setup_fn, state.teardown_fn);

View File

@@ -34,7 +34,7 @@ fn void scanner()
if (catch err = res)
{
if (err == NOT_FOUND) break;
return err?!!;
return err~!!;
}
String str = (String)res;
results.push(str.tconcat(""));