Skip to content

Commit 0717dfb

Browse files
cuonglmawly
authored andcommitted
types2, go/types: record final type for min/max arguments
Fixes golang#60991 Change-Id: I6130ccecbdc209996dbb376491be9df3b8988327 Reviewed-on: https://go-review.googlesource.com/c/go/+/506055 Run-TryBot: Cuong Manh Le <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Cuong Manh Le <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 73e5f34 commit 0717dfb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/cmd/compile/internal/types2/builtins.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
588588
check.updateExprType(a.expr, x.typ, true)
589589
}
590590

591+
// Use the final type computed above for all arguments.
592+
for _, a := range args {
593+
check.updateExprType(a.expr, x.typ, true)
594+
}
595+
591596
if check.recordTypes() && x.mode != constant_ {
592597
types := make([]Type, nargs)
593598
for i := range types {

src/go/types/builtins.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,11 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
587587
check.updateExprType(a.expr, x.typ, true)
588588
}
589589

590+
// Use the final type computed above for all arguments.
591+
for _, a := range args {
592+
check.updateExprType(a.expr, x.typ, true)
593+
}
594+
590595
if check.recordTypes() && x.mode != constant_ {
591596
types := make([]Type, nargs)
592597
for i := range types {

0 commit comments

Comments
 (0)