]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: better error message for invalid untyped operation
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 15 Jun 2021 14:40:49 +0000 (21:40 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 16 Jun 2021 06:05:23 +0000 (06:05 +0000)
commit785a8f677fbba9432ee67b14d41004ba7fd35ddb
tree61983c6c5dd15729d7a2531f3abc358742d10fe1
parenta752bc07462f01a4c1ee1940c3ea316b270af146
cmd/compile: better error message for invalid untyped operation

For typed vs un-typed operation, the compiler do the conversion
un-conditionally, so if the operation is invalid, the error report is
pointed to the conversion, instead of the invalid operation itself.

To fix this, only do the conversion when the operations are valid
for both types.

Fixes #46749

Change-Id: Ib71c7bcd3ed5454e6df55b6a8db4e0f189259ba7
Reviewed-on: https://go-review.googlesource.com/c/go/+/328050
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/typecheck/const.go
test/fixedbugs/issue46749.go [new file with mode: 0644]
test/run.go