aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-18 15:21:20 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-18 15:21:20 -0500
commit1db70d46c62c9478ea84ccff204fb315136e518c (patch)
tree0d0699614814d4a5064642c48d54c7382e8a9a8d /compile.c
parent1df02db239aad3d19d142cacd04113f9934e947c (diff)
Fix cross promotion between types with/without defaults
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 38d25e1f..770b0191 100644
--- a/compile.c
+++ b/compile.c
@@ -126,6 +126,10 @@ static bool promote(env_t *env, ast_t *ast, CORD *code, type_t *actual, type_t *
if (actual->tag == PointerType && needed->tag == PointerType)
return true;
+ // Cross-promotion between tables with default values and without
+ if (needed->tag == TableType && actual->tag == TableType)
+ return true;
+
if (needed->tag == ClosureType && actual->tag == FunctionType) {
*code = CORD_all("((Closure_t){", *code, ", NULL})");
return true;