mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: check generic interface method declaration (#15095)
This commit is contained in:
parent
5e0899853b
commit
8d24522d02
@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/generic_interface_method_decl_err.vv:2:8: error: no need to add generic type names in generic interface's method
|
||||
1 | interface Expr {
|
||||
2 | accept<R>(v Visitor<R>) R
|
||||
| ^
|
||||
3 | }
|
||||
4 |
|
@ -0,0 +1,9 @@
|
||||
interface Expr {
|
||||
accept<R>(v Visitor<R>) R
|
||||
}
|
||||
|
||||
interface Visitor<R> {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
@ -622,6 +622,11 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
|
||||
is_mut = true
|
||||
mut_pos = fields.len
|
||||
}
|
||||
if p.peek_tok.kind == .lt {
|
||||
p.error_with_pos("no need to add generic type names in generic interface's method",
|
||||
p.peek_tok.pos())
|
||||
return ast.InterfaceDecl{}
|
||||
}
|
||||
if p.peek_tok.kind == .lpar {
|
||||
method_start_pos := p.tok.pos()
|
||||
line_nr := p.tok.line_nr
|
||||
|
Loading…
Reference in New Issue
Block a user