proc: fix result type of division of untyped constants (#3794)

The Go specification says that the result of division of untyped
constants should be an untyped integer constant if both constants are
untyped integers, the go/constant package however does something
different by always producing an untyped floating constant.

Fixes #3793
This commit is contained in:
Alessandro Arzilli
2024-09-05 09:23:21 +02:00
committed by GitHub
parent c2dc6edcfc
commit a63cc8a1a3
3 changed files with 25 additions and 7 deletions

View File

@ -718,6 +718,8 @@ func getEvalExpressionTestCases() []varTest {
{"1 + 2i", false, "(1 + 2i)", "(1 + 2i)", "", nil},
{"true", false, "true", "true", "", nil},
{"\"test\"", false, "\"test\"", "\"test\"", "", nil},
{"1/2", false, "0", "0", "", nil},
{"zeropoint4 > 1/2", false, "true", "true", "", nil},
// binary operators
{"i2 + i3", false, "5", "5", "int", nil},