Repository navigation
cmd/compile: range over func internal compiler error with named bool type in yield #71131
Copy link
Copy link
Closed
Closed
Copy link
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Activity
- addedcompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
on Jan 5, 2025 Related Issues
- cmd/compile: internal compiler error: found illegal assignment FUNC-func() T₁ -> main.T₁; #48137 (closed)
- cmd/compile: internal compiler error: got untyped bool for autotmp #17551 (closed)
- cmd/compile: ICE compiling rangefunc for < 1.23 in combination with Cgo #67497 (closed)
- cmd/compile: internal compiler error: found illegal assignment #49875 (closed)
- "internal compiler error: assertion failed" with generic code #53834 (closed)
- cmd/compile: internal compiler error with zero-size types #65808 (closed)
- cmd/compile: unreachable code causes internal compiler error #65680 (closed)
- cmd/compile: internal compiler error using float in range #67785 (closed)
- cmd/compile: range over rune literal causes internal compiler error #64471 (closed)
- cmd/compile: internal compiler error: 'XXXXXX': not lowered: v128, Load INTER PTR SSA #43112 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Reacted by zigo101- changed the title
[-]cmd/compile: Internal compiler error when ranging over a func with a named bool return[/-][+]cmd/compile: range over func internal compiler error with named bool type in yield [/+]on Jan 5, 2025 - addedNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Jan 5, 2025 Unified IR is having trouble with this code, because there's an argument/formal mismatch it doesn't think typechecks.
Something like:
type Bool bool var iter func(func() Bool) = ... // user's iter function var yield1 func() bool = ... // the loop body closure iter(yield1)I think the frontend should either declare the yield function with a return type that matches the user's iteration function's arg's return type, or disallow named booleans as the return type.
I would lean towards the latter, as the spec only listsbool, not a named bool, as the return type.@randall77 Agreed. I will take care of this.
Change https://go.dev/cl/640599 mentions this issue:
go/types, types2: require iterator yield to return bool (work-around)- moved this from All-But-Submitted to Done in Go Compiler / Runtime / Command
on Jan 8, 2025 - added a commit that references this issue
on Jan 8, 2025 - locked and limited conversation to collaborators
on Jan 8, 2026
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
- StatusShow more project fieldsDone
Go version
go version go1.23.4 darwin/amd64
Output of
go envin your module/workspace:What did you do?
Ran this playground code.
What did you see happen?
./prog.go:7:2: internal compiler error: func() (#r bool) is not assignable to func() main.BoolWhat did you expect to see?
Either no error, or an error that isn't an internal compiler error.