fix: append() was not returning a type (#84)
append() now returns the underlying array type. Method lookup was skipped for selector expression on arrays. Pointer expression was incorrectly parsed as a dereference instead of type expression.
This commit is contained in:
committed by
Ludovic Fernandez
parent
17fa77c693
commit
a99fb98f84
19
_test/a20.go
Normal file
19
_test/a20.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
type IntArray []int
|
||||
|
||||
func (h *IntArray) Add(x int) {
|
||||
*h = append(*h, x)
|
||||
}
|
||||
|
||||
func main() {
|
||||
a := IntArray{}
|
||||
a.Add(4)
|
||||
|
||||
fmt.Println(a)
|
||||
}
|
||||
|
||||
// Output:
|
||||
// [4]
|
||||
Reference in New Issue
Block a user