mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: disable generic type aliases (#10917)
This commit is contained in:
@ -3107,6 +3107,7 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
|
|||||||
}
|
}
|
||||||
mut sum_variants := []ast.TypeNode{}
|
mut sum_variants := []ast.TypeNode{}
|
||||||
generic_types := p.parse_generic_type_list()
|
generic_types := p.parse_generic_type_list()
|
||||||
|
decl_pos_with_generics := decl_pos.extend(p.prev_tok.position())
|
||||||
p.check(.assign)
|
p.check(.assign)
|
||||||
mut type_pos := p.tok.position()
|
mut type_pos := p.tok.position()
|
||||||
mut comments := []ast.Comment{}
|
mut comments := []ast.Comment{}
|
||||||
@ -3179,6 +3180,10 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// type MyType = int
|
// type MyType = int
|
||||||
|
if generic_types.len > 0 {
|
||||||
|
p.error_with_pos('generic type aliases are not yet implemented', decl_pos_with_generics)
|
||||||
|
return ast.AliasTypeDecl{}
|
||||||
|
}
|
||||||
parent_type := first_type
|
parent_type := first_type
|
||||||
parent_sym := p.table.get_type_symbol(parent_type)
|
parent_sym := p.table.get_type_symbol(parent_type)
|
||||||
pidx := parent_type.idx()
|
pidx := parent_type.idx()
|
||||||
|
3
vlib/v/parser/tests/generic_type_alias_decl.out
Normal file
3
vlib/v/parser/tests/generic_type_alias_decl.out
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
vlib/v/parser/tests/generic_type_alias_decl.vv:1:1: error: generic type aliases are not yet implemented
|
||||||
|
1 | type Pointer<T> = &T
|
||||||
|
| ~~~~~~~~~~~~~~~
|
1
vlib/v/parser/tests/generic_type_alias_decl.vv
Normal file
1
vlib/v/parser/tests/generic_type_alias_decl.vv
Normal file
@ -0,0 +1 @@
|
|||||||
|
type Pointer<T> = &T
|
Reference in New Issue
Block a user