Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string interpolation does not correctly reports pointer when used with maps #21889

Closed
thomas-mangin opened this issue Jul 17, 2024 · 0 comments · Fixed by #21890
Closed

string interpolation does not correctly reports pointer when used with maps #21889

thomas-mangin opened this issue Jul 17, 2024 · 0 comments · Fixed by #21890
Assignees
Labels
Auto str Method Generation Bugs/feature requests, that are related to the automatic string method generation. Bug This tag is applied to issues which reports bugs. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@thomas-mangin
Copy link
Contributor

thomas-mangin commented Jul 17, 2024

Describe the bug

When using string interpolation with maps, the element printed is returned as a value the & of the pointer is not included in the returned string.

Reproduction Steps

module main

struct Inner {
	value int
}

struct Outer {
	value map[string]&Inner
}

fn main() {
	outer := Outer{
		value: {
			'test': &Inner{
				value: 1
			}
		}
	}
	unexpected := "Outer{
    value: {'test': Inner{
        value: 1
    }}
}"
	expected := "Outer{
    value: {'test': &Inner{
        value: 1
    }}
}"
	assert '${outer}' == unexpected
	assert '${outer}' == expected
}

Expected Behavior

the expected string of the example to be returned

Current Behavior

the unexpected string of the example is returned

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.6 aa34047

Environment details (OS name and version, etc.)

V full version: V 0.4.6 aa34047
OS: macos, macOS, 14.5, 23F79
Processor: 10 cpus, 64bit, little endian, Apple M1 Max

getwd: /Users/thomas
vexe: /Users/thomas/Unix/local/v/master/v
vexe mtime: 2024-07-15 13:49:47

vroot: OK, value: /Users/thomas/Unix/local/v/master
VMODULES: OK, value: /Users/thomas/Unix/data/v/modules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.45.2
Git vroot status: weekly.2024.27-61-gaa340472 (7 commit(s) behind V master)
.git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.3.9.4)
thirdparty/tcc status: thirdparty-macos-arm64 713692d4

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@thomas-mangin thomas-mangin added the Bug This tag is applied to issues which reports bugs. label Jul 17, 2024
@felipensp felipensp self-assigned this Jul 18, 2024
@felipensp felipensp added Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Auto str Method Generation Bugs/feature requests, that are related to the automatic string method generation. labels Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto str Method Generation Bugs/feature requests, that are related to the automatic string method generation. Bug This tag is applied to issues which reports bugs. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants