diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-02 19:53:09 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-02 19:53:09 -0400 |
| commit | 337aa911a9027602d47cd56ddbfcde0230a48943 (patch) | |
| tree | daf93f7d7972a672ee6a815702c05ce05913fb8b /types.c | |
| parent | 6d7a359f8f7757b1e23fa7c0feaf535541dcc84a (diff) | |
Auto promote to C String from Text
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -289,6 +289,10 @@ bool can_promote(type_t *actual, type_t *needed) return cmp == NUM_PRECISION_EQUAL || cmp == NUM_PRECISION_LESS; } + // Text to C String + if (actual->tag == TextType && !Match(actual, TextType)->lang && needed->tag == CStringType) + return true; + // Automatic dereferencing: if (actual->tag == PointerType && !Match(actual, PointerType)->is_optional && can_promote(Match(actual, PointerType)->pointed, needed)) |
