diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-16 16:10:05 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-16 16:10:05 -0400 |
| commit | e5f432d4c913b31922da5b2855237d37ceef0432 (patch) | |
| tree | 420992617ce615cc7abd028b378be22645b4ce70 | |
| parent | de49bc5bb3198f450cb367085f9def0d89782258 (diff) | |
Fix `not x` for optional values
| -rw-r--r-- | compile.c | 2 | ||||
| -rw-r--r-- | test/optionals.tm | 6 |
2 files changed, 7 insertions, 1 deletions
@@ -1865,7 +1865,7 @@ CORD compile(env_t *env, ast_t *ast) } case Not: { ast_t *value = Match(ast, Not)->value; - type_t *t = get_type(env, ast); + type_t *t = get_type(env, value); binding_t *b = get_namespace_binding(env, value, "negated"); if (b && b->type->tag == FunctionType) { diff --git a/test/optionals.tm b/test/optionals.tm index 2c87d6c9..e2d616b7 100644 --- a/test/optionals.tm +++ b/test/optionals.tm @@ -315,3 +315,9 @@ func main(): >> opt else: >> opt + + >> not 5? + = no + + >> not !Int + = yes |
