diff options
| author | Julius Ikkala <julius.ikkala@gmail.com> | 2025-01-10 03:24:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-10 01:24:00 +0000 |
| commit | e8217c70072080e9d1f499cb670cc08f146818f2 (patch) | |
| tree | aba8a73dc7dcbd04fdb91dfb82c5b699e688268c /tests/cpu-program | |
| parent | b72e62f5caacd16cb98ee4a746ad06a536691e27 (diff) | |
Fix implicit string conversion breaking NativeStrings (#6035)
* Fix implicit string conversion breaking NativeStrings
* Allow string literals to coerce to either string type
* Add test for CPU string passing
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/cpu-program')
| -rw-r--r-- | tests/cpu-program/string-passing.slang | 17 | ||||
| -rw-r--r-- | tests/cpu-program/string-passing.slang.expected | 6 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/cpu-program/string-passing.slang b/tests/cpu-program/string-passing.slang new file mode 100644 index 000000000..3ae736a57 --- /dev/null +++ b/tests/cpu-program/string-passing.slang @@ -0,0 +1,17 @@ +//TEST:EXECUTABLE: + +void printer(NativeString string) +{ + printf(string); +} + +void indirectPrinter(String string) +{ + printer(string); +} + +export __extern_cpp int main() +{ + indirectPrinter("success\n"); + return 0; +} diff --git a/tests/cpu-program/string-passing.slang.expected b/tests/cpu-program/string-passing.slang.expected new file mode 100644 index 000000000..0eb55acbf --- /dev/null +++ b/tests/cpu-program/string-passing.slang.expected @@ -0,0 +1,6 @@ +result code = 0 +standard error = { +} +standard output = { +success +} |
