mirror of
https://github.com/golang/go
synced 2024-11-14 15:10:54 -07:00
[dev.typeparams] cmd/compile/internal/types2: report invalid ... in conversions
This fixes the bug below for types2. Updates #43124. Change-Id: Ic1962d41f321d8a08992d8529625bc133e526b0c Reviewed-on: https://go-review.googlesource.com/c/go/+/278012 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
5aca6e7857
commit
f8930a2413
@ -128,6 +128,10 @@ func (check *Checker) call(x *operand, call *syntax.CallExpr) exprKind {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if call.HasDots {
|
||||||
|
check.errorf(call.ArgList[0], "invalid use of ... in type conversion to %s)", T)
|
||||||
|
break
|
||||||
|
}
|
||||||
check.conversion(x, T)
|
check.conversion(x, T)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
16
src/cmd/compile/internal/types2/fixedbugs/issue43124.src
Normal file
16
src/cmd/compile/internal/types2/fixedbugs/issue43124.src
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2020 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
|
||||||
|
|
||||||
|
var _ = int(0 /* ERROR invalid use of \.\.\. in type conversion */ ...)
|
||||||
|
|
||||||
|
// test case from issue
|
||||||
|
|
||||||
|
type M []string
|
||||||
|
|
||||||
|
var (
|
||||||
|
x = []string{"a", "b"}
|
||||||
|
_ = M(x /* ERROR invalid use of \.\.\. in type conversion */ ...)
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user