checker: reject method that have multi-value type receiver (#8696)
parent
70a30374b9
commit
2911f03627
|
@ -5753,6 +5753,8 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) {
|
||||||
c.error('method overrides built-in array method', node.pos)
|
c.error('method overrides built-in array method', node.pos)
|
||||||
} else if sym.kind == .sum_type && node.name == 'type_name' {
|
} else if sym.kind == .sum_type && node.name == 'type_name' {
|
||||||
c.error('method overrides built-in sum type method', node.pos)
|
c.error('method overrides built-in sum type method', node.pos)
|
||||||
|
} else if sym.kind == .multi_return {
|
||||||
|
c.error('cannot define method on multi-value', node.method_type_pos)
|
||||||
}
|
}
|
||||||
if sym.name.len == 1 {
|
if sym.name.len == 1 {
|
||||||
// One letter types are reserved for generics.
|
// One letter types are reserved for generics.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
vlib/v/checker/tests/multi_value_method_err.vv:1:7: error: cannot define method on multi-value
|
||||||
|
1 | fn (v (int, int)) f() {}
|
||||||
|
| ~~~~~~~~~~
|
|
@ -0,0 +1 @@
|
||||||
|
fn (v (int, int)) f() {}
|
Loading…
Reference in New Issue