mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Create optional with ~ instead of ?. return io::EOF?; becomes return io::EOF~.
- Deprecated use of `?` to create optional.
This commit is contained in:
@@ -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)!!);
|
||||
|
||||
Reference in New Issue
Block a user