parser: disable generic type aliases (#10917)
parent
2c0c211c79
commit
fe5e3c452f
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
| ~~~~~~~~~~~~~~~
|
|
@ -0,0 +1 @@
|
||||||
|
type Pointer<T> = &T
|
Loading…
Reference in New Issue