-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugA problem that causes incorrect behavior or crashes.A problem that causes incorrect behavior or crashes.good first issueIssues that are good for newcomers or first-time contributors.Issues that are good for newcomers or first-time contributors.
Description
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
0x7fffdda81078
�"e
Expected Behavior
&msgshould either be:- Valid pointer to the string data (
"Hello"), or - Disallowed by the compiler if
stris already a pointer type.
- Valid pointer to the string data (
Actual Behavior
&msgcreates a pointer-to-pointer (i8**), resulting in unexpected values being printed.
Metadata
Metadata
Assignees
Labels
bugA problem that causes incorrect behavior or crashes.A problem that causes incorrect behavior or crashes.good first issueIssues that are good for newcomers or first-time contributors.Issues that are good for newcomers or first-time contributors.
Type
Projects
Status
Backlog