[go] cmd/compile: fix conversion from constant to type parameter

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jun 10, 2026, 3:13:30 PM (yesterday) Jun 10
to Cuong Manh Le, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Robert Griesemer, golang-co...@googlegroups.com

Gopher Robot submitted the change with unreviewed changes

Unreviewed changes

1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: src/cmd/compile/internal/noder/reader.go
Insertions: 3, Deletions: 1.

The diff is too large to show. Please review the diff.
```

Change information

Commit message:
cmd/compile: fix conversion from constant to type parameter

CL 421874 changed Unified IR to treat constant to type parameter
conversion as non-constant. However, the checking condition happens too
late, so it only works when source and destination type are identical.

Fixing this by doing the check right after the source expression is
constructed, allowing precisely check in subtle case like converting
untyped complex constant to float.

Fixes #79812
Change-Id: I45edd7470c7b313245d858ae8d0bb7a3c8b5f87e
Auto-Submit: Cuong Manh Le <cuong.m...@gmail.com>
Reviewed-by: Cherry Mui <cher...@google.com>
Reviewed-by: Keith Randall <k...@golang.org>
Reviewed-by: Keith Randall <k...@google.com>
Files:
  • M src/cmd/compile/internal/noder/reader.go
  • A test/fixedbugs/issue79812.go
Change size: M
Delta: 2 files changed, 43 insertions(+), 7 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I45edd7470c7b313245d858ae8d0bb7a3c8b5f87e
Gerrit-Change-Number: 786920
Gerrit-PatchSet: 3
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages