diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-03 15:42:07 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-03 15:42:07 -0400 |
| commit | 2acc9c1f968a9d8ac24df47c4cb7ecc44c7d3826 (patch) | |
| tree | e9125a36b18f307248cb100d5bdc2af819225be4 | |
| parent | 8ab991fba503f446c70f877969e4314d0cc7d2f3 (diff) | |
Allow empty table `{}` to work as an empty set literal in some cases
| -rw-r--r-- | src/compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compile.c b/src/compile.c index bf6f0b7f..6b465b20 100644 --- a/src/compile.c +++ b/src/compile.c @@ -1851,6 +1851,10 @@ CORD compile_to_type(env_t *env, ast_t *ast, type_t *t) auto set = Match(ast, Set); if (!set->item_type && !set->items) return compile(env, ast); + } else if (t->tag == SetType && ast->tag == Table) { + auto table = Match(ast, Table); + if (!table->key_type && !table->value_type && !table->default_value && !table->fallback && !table->entries) + return compile(env, ast); } type_t *actual = get_type(env, ast); |
