1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: check generic fn call argument type mismatch (#17680)

This commit is contained in:
yuyi
2023-03-17 03:19:03 +08:00
committed by GitHub
parent b345d77805
commit d349c1d86d
5 changed files with 24 additions and 4 deletions

View File

@ -130,14 +130,14 @@ fn (e &Encoder) encode_value_with_level[T](val T, level int, mut wr io.Writer) !
e.encode_any(val, level, mut wr)!
} $else $if T is []Any {
e.encode_any(val, level, mut wr)!
} $else $if T in [Null, bool, $Float, $Int] {
e.encode_any(val, level, mut wr)!
} $else $if T is Encodable {
wr.write(val.json_str().bytes())!
} $else $if T is $Struct {
e.encode_struct(val, level, mut wr)!
} $else $if T is $Enum {
e.encode_any(Any(int(val)), level, mut wr)!
} $else $if T in [Null, bool, $Float, $Int] {
e.encode_any(val, level, mut wr)!
} $else {
// dump(val.str())
return error('cannot encode value with ${typeof(val).name} type')