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
pubstructUser {
name string
age int
height f64
}
typeUsers=map[string]User
fn (mut decoder Decoder) decode_map[K, V](mut val map[K]V) ! {
asserttrue
}
// Decoder represents a JSON decoder.structDecoder {
}
pub fndecode[T](val string) !T {
mutdecoder:= Decoder{
}
mutresult:= T{}
decoder.decode_value(mut result)!return result
}
fn (mut decoder Decoder) decode_value[T](mut val T) ! {
$if T.unaliased_typ is $map {
decoder.decode_map(mut val)!
}
}
fnmain() {
decode[Users]('')!
decode[map[string]User]('')!
}
Expected Behavior
not error
Current Behavior
Can't run code. The server returned an error:code.v:30:26: error: cannot use `&Users` as `&map[Users]User` in argument 1 to `Decoder.decode_map` 28 | fn (mut decoder Decoder) decode_value[T](mut val T) ! { 29 | $if T.unaliased_typ is $map { 30 | decoder.decode_map(mut val)! | ~~~ 31 | } 32 | }Exited with error status 1
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 d629a01
Environment details (OS name and version, etc.)
Linux
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.
The text was updated successfully, but these errors were encountered:
Describe the bug
Wrong method check
Reproduction Steps
Expected Behavior
not error
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 d629a01
Environment details (OS name and version, etc.)
Linux
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.
The text was updated successfully, but these errors were encountered: