assert(tsig != nil || inst != nil)
if !check.allowVersion(check.pkg, pos, 1, 18) {
- check.versionErrorf(inst.Pos(), "go1.18", "function instantiation")
+ var posn poser
+ if inst != nil {
+ posn = inst.Pos()
+ } else {
+ posn = pos
+ }
+ check.versionErrorf(posn, "go1.18", "function instantiation")
}
// targs and xlist are the type arguments and corresponding type expressions, or nil.
assert(tsig != nil || ix != nil)
if !check.allowVersion(check.pkg, pos, 1, 18) {
- check.softErrorf(inNode(ix.Orig, ix.Lbrack), UnsupportedFeature, "function instantiation requires go1.18 or later")
+ var posn positioner
+ if ix != nil {
+ posn = inNode(ix.Orig, ix.Lbrack)
+ } else {
+ posn = atPos(pos)
+ }
+ check.softErrorf(posn, UnsupportedFeature, "function instantiation requires go1.18 or later")
}
// targs and xlist are the type arguments and corresponding type expressions, or nil.
--- /dev/null
+// -reverseTypeInference -lang=go1.17
+
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+func f[P /* ERROR "requires go1.18" */ interface{}](P) {}
+
+var v func(int) = f /* ERROR "requires go1.18" */