You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
funmain() {
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
0x7fffdda81078
�"e
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.
The original corrupted-output reproduction is stale: current builds print pointer values consistently. A narrower semantic defect remains—the compiler accepts ptr<i8> = &message even though &message has type ptr<str>. That current contract and its check/build regressions are tracked in #358. Closing this stale report in favor of the precise replacement.
Activity
LunaStev commentedon Aug 25, 2026
The original corrupted-output reproduction is stale: current builds print pointer values consistently. A narrower semantic defect remains—the compiler accepts
ptr<i8> = &messageeven though&messagehas typeptr<str>. That current contract and its check/build regressions are tracked in #358. Closing this stale report in favor of the precise replacement.