When using the & operator on a str variable, Wave produces unexpected results.
Currently, str is internally treated as an i8*, so applying & creates a pointer-to-pointer (i8**).
This leads to confusing output instead of the expected string address or string content.
Steps to Reproduce
- Create a file test/test40.wave with the following code:
fun main() {
var msg: str = "Hello";
var msg_ptr: ptr<str> = &msg;
var msg_ptr2: ptr<i8> = &msg;
println("{}", msg_ptr);
println("{}", msg_ptr2);
}
- Run
cargo run -- run test/test40.wave
- Output
Expected Behavior
&msg should either be:
- Valid pointer to the string data (
"Hello"), or
- Disallowed by the compiler if
str is already a pointer type.
Actual Behavior
&msg creates a pointer-to-pointer (i8**), resulting in unexpected values being printed.
When using the
&operator on astrvariable, Wave produces unexpected results.Currently,
stris internally treated as ani8*, so applying&creates a pointer-to-pointer (i8**).This leads to confusing output instead of the expected string address or string content.
Steps to Reproduce
Expected Behavior
&msgshould either be:"Hello"), orstris already a pointer type.Actual Behavior
&msgcreates a pointer-to-pointer (i8**), resulting in unexpected values being printed.