-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Type-checking such code:
package p
const (
B = A + B
A = A + B
)
leads to non-deterministic errors, either:
initialization_cycle.go:4:2: no error expected: "initialization cycle for B"
initialization_cycle.go:5:2: no error expected: "initialization cycle: A refers to itself"
initialization_cycle.go:4:2: no error expected: "initialization cycle for B"
initialization_cycle.go:5:2: no error expected: "initialization cycle: A refers to itself"
or
initialization_cycle.go:4:2: no error expected: "initialization cycle for B"
initialization_cycle.go:5:2: no error expected: "initialization cycle: A refers to itself"
initialization_cycle.go:4:2: no error expected: "initialization cycle for B"
initialization_cycle.go:5:2: no error expected: "initialization cycle for A"
or
initialization_cycle.go:4:2: no error expected: "initialization cycle for B"
initialization_cycle.go:5:2: no error expected: "initialization cycle: A refers to itself"
initialization_cycle.go:4:2: no error expected: "initialization cycle: B refers to itself"
initialization_cycle.go:5:2: no error expected: "initialization cycle: A refers to itself"
It would be nice if go/types
always returned the same error for the same input. I am not sure whether this is something that go/types
should guarantee, feel free to close this issue, if that is fine.
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.