Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: absent const expressions resolve identifiers ignoring new declarations #53585

Closed
griesemer opened this issue Jun 28, 2022 · 3 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

griesemer commented Jun 28, 2022

Reminder issue. See #49157 for background.

package main

const X = 3

func main() {
	const (
		X = X + X
		Y
	)
	
	println(X, Y)
}

produces the output 6 6 instead of 6 12.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 28, 2022
@griesemer griesemer added this to the Gccgo milestone Jun 28, 2022
@griesemer
Copy link
Contributor Author

cc @ianlancetaylor

@gopherbot
Copy link

Change https://go.dev/cl/414795 mentions this issue: test: add more tests for const decls with ommitted RHS expressions

gopherbot pushed a commit that referenced this issue Jun 28, 2022
Add analogous tests to go/types and types2 test suites.
Make sure "assert" built-in is available in type-checker
tests.

For #49157.
For #53585.

Change-Id: I092901ecb43eb4833c09bd8f5e38efbe0285babe
Reviewed-on: https://go-review.googlesource.com/c/go/+/414795
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@gopherbot
Copy link

Change https://go.dev/cl/414914 mentions this issue: compiler: check repeated const expressions in new scope

realqhc pushed a commit to realqhc/gofrontend that referenced this issue Aug 4, 2022
Test case is const8.go in https://go.dev/cl/414795.

Fixes golang/go#53585

Change-Id: I12d78381c201e5a7de63cacbc30904aafbc7006e
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414914
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
Add analogous tests to go/types and types2 test suites.
Make sure "assert" built-in is available in type-checker
tests.

For golang#49157.
For golang#53585.

Change-Id: I092901ecb43eb4833c09bd8f5e38efbe0285babe
Reviewed-on: https://go-review.googlesource.com/c/go/+/414795
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Jun 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants