diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2023-06-25 22:59:33 +0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-06-26 17:08:05 +0000 |
| commit | b3ca8d2b3c78d36595c534de0ca604e7d3e37123 (patch) | |
| tree | d4f7fed7fc804159af92202b1a19747c2aa5b543 /src | |
| parent | ee361ce66ca5c8923e636348aba559a5e5c76c15 (diff) | |
| download | go-b3ca8d2b3c78d36595c534de0ca604e7d3e37123.tar.xz | |
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/types2/builtins.go | 5 | ||||
| -rw-r--r-- | src/go/types/builtins.go | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/builtins.go b/src/cmd/compile/internal/types2/builtins.go index a3e1981af6..f3763862ec 100644 --- a/src/cmd/compile/internal/types2/builtins.go +++ b/src/cmd/compile/internal/types2/builtins.go @@ -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 { diff --git a/src/go/types/builtins.go b/src/go/types/builtins.go index 837a9b5e14..7795f2552d 100644 --- a/src/go/types/builtins.go +++ b/src/go/types/builtins.go @@ -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 { |
