mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
3220ab7053
commit
36cc4880a6
@ -1710,7 +1710,7 @@ pub fn (mut p Parser) parse_ident(language table.Language) ast.Ident {
|
||||
}
|
||||
|
||||
fn (p &Parser) is_typename(t token.Token) bool {
|
||||
return t.kind == .name && (t.lit.is_capital() || p.table.known_type(t.lit))
|
||||
return t.kind == .name && (t.lit[0].is_capital() || p.table.known_type(t.lit))
|
||||
}
|
||||
|
||||
// heuristics to detect `func<T>()` from `var < expr`
|
||||
|
18
vlib/v/tests/generic_fn_upper_name_type_test.v
Normal file
18
vlib/v/tests/generic_fn_upper_name_type_test.v
Normal file
@ -0,0 +1,18 @@
|
||||
struct XX {
|
||||
x int
|
||||
}
|
||||
|
||||
struct YY {
|
||||
y int
|
||||
}
|
||||
|
||||
fn show_result<T, U>(x T, y U) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
fn test_generic_fn_upper_name_type() {
|
||||
assert show_result<int, bool>(1, false)
|
||||
assert show_result<string, XX>( "s", XX{})
|
||||
assert show_result< XX, string>(XX{}, "s")
|
||||
assert show_result< XX, YY>(XX{}, YY{})
|
||||
}
|
Loading…
Reference in New Issue
Block a user