mirror of
https://github.com/golang/go
synced 2024-11-23 01:40:03 -07:00
go/types, types2: a min/max value argument must not be untyped
Fixes #61486. Change-Id: I5770e238e44b724816894d914b3ea5dc78bc3ced Reviewed-on: https://go-review.googlesource.com/c/go/+/511835 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
4f4c23512e
commit
8abc6e2597
@ -576,6 +576,11 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
|
|||||||
// If nargs == 1, make sure x.mode is either a value or a constant.
|
// If nargs == 1, make sure x.mode is either a value or a constant.
|
||||||
if x.mode != constant_ {
|
if x.mode != constant_ {
|
||||||
x.mode = value
|
x.mode = value
|
||||||
|
// A value must not be untyped.
|
||||||
|
check.assignment(x, &emptyInterface, "argument to "+bin.name)
|
||||||
|
if x.mode == invalid {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the final type computed above for all arguments.
|
// Use the final type computed above for all arguments.
|
||||||
|
@ -575,6 +575,11 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
|
|||||||
// If nargs == 1, make sure x.mode is either a value or a constant.
|
// If nargs == 1, make sure x.mode is either a value or a constant.
|
||||||
if x.mode != constant_ {
|
if x.mode != constant_ {
|
||||||
x.mode = value
|
x.mode = value
|
||||||
|
// A value must not be untyped.
|
||||||
|
check.assignment(x, &emptyInterface, "argument to "+bin.name)
|
||||||
|
if x.mode == invalid {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the final type computed above for all arguments.
|
// Use the final type computed above for all arguments.
|
||||||
|
9
src/internal/types/testdata/fixedbugs/issue61486.go
vendored
Normal file
9
src/internal/types/testdata/fixedbugs/issue61486.go
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// 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 _(s uint) {
|
||||||
|
_ = min(1 << s)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user