This code may be pointless, but it is legal.
Fixes golang/go#18268
Change-Id: Ibacae583606e1a6fdf0c0f01abe2e22e9e608393
Reviewed-on: https://go-review.googlesource.com/34194
Reviewed-by: Robert Griesemer <gri@golang.org>
check.errorf(ellipsis, "can only use ... with matching parameter")
return
}
- if _, ok := x.typ.Underlying().(*Slice); !ok {
+ if _, ok := x.typ.Underlying().(*Slice); !ok && x.typ != Typ[UntypedNil] { // see issue #18268
check.errorf(x.pos(), "cannot use %s as parameter of type %s", x, typ)
return
}
_ = append(nil /* ERROR not a slice */ , s)
_ = append(x /* ERROR not a slice */ , s)
_ = append(s)
+ _ = append(s, nil...)
append /* ERROR not used */ (s)
_ = append(s, b)