aboutsummaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-10 12:55:01 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-10 12:55:01 -0400
commiteb8b501b95e4d8704245375eb5f532303cc8e2e7 (patch)
tree0b942ed50e368e3813bdcdb150fed82fe700e630 /types.c
parent793cda6013ad723018c3ff6c7654d9aa4eb3ada5 (diff)
For langs, do promotion to Text and text interpolation automatically and without adding quoting.
Diffstat (limited to 'types.c')
-rw-r--r--types.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/types.c b/types.c
index c943eb85..358a729e 100644
--- a/types.c
+++ b/types.c
@@ -338,6 +338,10 @@ PUREFUNC bool can_promote(type_t *actual, type_t *needed)
if (needed->tag == EnumType)
return (enum_single_value_tag(needed, actual) != NULL);
+ // Lang to Text:
+ if (actual->tag == TextType && needed->tag == TextType && streq(Match(needed, TextType)->lang, "Text"))
+ return true;
+
// Text to C String
if (actual->tag == TextType && !Match(actual, TextType)->lang && needed->tag == CStringType)
return true;