mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix the incorrect location of the type declaration name (#14879)
This commit is contained in:
parent
1b0754e4f3
commit
f2be115f7d
@ -3674,8 +3674,8 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
|
||||
}
|
||||
name := p.check_name()
|
||||
if name.len == 1 && name[0].is_capital() {
|
||||
p.error_with_pos('single letter capital names are reserved for generic template types.',
|
||||
decl_pos)
|
||||
p.error_with_pos('single letter capital names are reserved for generic template types',
|
||||
name_pos)
|
||||
return ast.FnTypeDecl{}
|
||||
}
|
||||
if name in p.imported_symbols {
|
||||
|
5
vlib/v/parser/tests/type_decl_name_err.out
Normal file
5
vlib/v/parser/tests/type_decl_name_err.out
Normal file
@ -0,0 +1,5 @@
|
||||
vlib/v/parser/tests/type_decl_name_err.vv:1:6: error: single letter capital names are reserved for generic template types
|
||||
1 | type A = int | string
|
||||
| ^
|
||||
2 |
|
||||
3 | fn main() {
|
6
vlib/v/parser/tests/type_decl_name_err.vv
Normal file
6
vlib/v/parser/tests/type_decl_name_err.vv
Normal file
@ -0,0 +1,6 @@
|
||||
type A = int | string
|
||||
|
||||
fn main() {
|
||||
a := A(11)
|
||||
println(a)
|
||||
}
|
Loading…
Reference in New Issue
Block a user