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:
Marc Vertes
2019-02-06 14:50:37 +01:00
committed by Ludovic Fernandez
parent 17fa77c693
commit a99fb98f84
3 changed files with 60 additions and 6 deletions

19
_test/a20.go Normal file
View 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]