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

Generic typeof of map bug #23952

Closed
kbkpbot opened this issue Mar 16, 2025 · 1 comment · Fixed by #23958
Closed

Generic typeof of map bug #23952

kbkpbot opened this issue Mar 16, 2025 · 1 comment · Fixed by #23958
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Generics[T] Bugs/feature requests, that are related to the V generics. Status: Confirmed This bug has been confirmed to be valid by a contributor.

Comments

@kbkpbot
Copy link
Contributor

kbkpbot commented Mar 16, 2025

Describe the bug

As the code shown

This is extract from issue #23916

Reproduction Steps

m.v

module main

fn second[K,V](x map[K]V) {
	println('second: x.typename = ${typeof(x).name}')
}

fn first[T]() {
	x := T{}
	println('first: x.typename = ${typeof(x).name}')
	second(x)
}

fn main() {
	first[map[string]string]()
	first[map[string]int]()
	first[map[string]u8]()
	first[map[string]rune]()
}

Expected Behavior

first: x.typename = map[string]string
second: x.typename = map[string]string
first: x.typename = map[string]int
second: x.typename = map[string]int
first: x.typename = map[string]u8
second: x.typename = map[string]u8
first: x.typename = map[string]rune
second: x.typename = map[string]rune

Current Behavior

first: x.typename = map[string]string
second: x.typename = map[string]rune
first: x.typename = map[string]int
second: x.typename = map[string]rune
first: x.typename = map[string]u8
second: x.typename = map[string]rune
first: x.typename = map[string]rune
second: x.typename = map[string]rune

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.9 1769580.28c901b

Environment details (OS name and version, etc.)

V full version V 0.4.9 1769580.28c901b
OS linux, Ubuntu 24.04.2 LTS
Processor 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Memory 8.14GB/15.51GB
V executable /media/HD/github/kbkpbot/v/v
V last modified time 2025-03-16 00:51:53
V home dir OK, value: /media/HD/github/kbkpbot/v
VMODULES OK, value: /home/mars/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/mars/v/bug
Git version git version 2.43.0
V git status weekly.2025.11-42-g28c901b9-dirty (3 commit(s) behind V master)
.git/config present true
cc version cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
gcc version gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
clang version Ubuntu clang version 18.1.3 (1ubuntu1)
tcc version tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
tcc git status thirdparty-linux-amd64 0134e9b9-dirty
emcc version N/A
glibc version ldd (Ubuntu GLIBC 2.39-0ubuntu8.4) 2.39

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.

@kbkpbot kbkpbot added the Bug This tag is applied to issues which reports bugs. label Mar 16, 2025
Copy link

Connected to Huly®: V_0.6-22348

@kbkpbot kbkpbot added the Generics[T] Bugs/feature requests, that are related to the V generics. label Mar 16, 2025
@felipensp felipensp self-assigned this Mar 16, 2025
@felipensp felipensp added the Status: Confirmed This bug has been confirmed to be valid by a contributor. label Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Generics[T] Bugs/feature requests, that are related to the V generics. Status: Confirmed This bug has been confirmed to be valid by a contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants