mirror of
https://github.com/golang/go
synced 2024-11-22 09:24:41 -07:00
types2, go/types: record final type for min/max arguments
Fixes #60991 Change-Id: I6130ccecbdc209996dbb376491be9df3b8988327 Reviewed-on: https://go-review.googlesource.com/c/go/+/506055 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
ee361ce66c
commit
b3ca8d2b3c
@ -578,6 +578,11 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
|
||||
x.mode = value
|
||||
}
|
||||
|
||||
// Use the final type computed above for all arguments.
|
||||
for _, a := range args {
|
||||
check.updateExprType(a.expr, x.typ, true)
|
||||
}
|
||||
|
||||
if check.recordTypes() && x.mode != constant_ {
|
||||
types := make([]Type, nargs)
|
||||
for i := range types {
|
||||
|
@ -577,6 +577,11 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
|
||||
x.mode = value
|
||||
}
|
||||
|
||||
// Use the final type computed above for all arguments.
|
||||
for _, a := range args {
|
||||
check.updateExprType(a.expr, x.typ, true)
|
||||
}
|
||||
|
||||
if check.recordTypes() && x.mode != constant_ {
|
||||
types := make([]Type, nargs)
|
||||
for i := range types {
|
||||
|
13
test/fixedbugs/issue60991.go
Normal file
13
test/fixedbugs/issue60991.go
Normal file
@ -0,0 +1,13 @@
|
||||
// build
|
||||
|
||||
// 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
|
||||
|
||||
import "math"
|
||||
|
||||
func f() {
|
||||
_ = min(0.1, 0.2, math.Sqrt(1))
|
||||
}
|
Loading…
Reference in New Issue
Block a user