go: cmd/compile: local type declarations in generic code don't work
package main
func F[T1 any]() {
type x struct{}
}
func main() {
}
$ go run -gcflags=-G=3 tmp1.go
# command-line-arguments
<unknown line number>: internal compiler error: cannot export DCLTYPE (50) node
This looks like a general problem that we can’t export/import local type declarations, including for inlining.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- cmd/compile: error when using internal type declarations in generic functions We hope to support this feature one day, but it doesn't work currently. Issue a nice error message instead of having the ... — committed to golang/go by randall77 3 years ago
- doc: mention generics in release notes Also mention local types restriction. We probably want to say more at some point, this is just a placeholder to start. Update #47631 Change-Id: I828e451e1e85... — committed to golang/go by randall77 3 years ago
- cmd/compile: prevent irgen crashing for empty local declaration stmt Updates #47631 Fixes #49611 Change-Id: Ib4a4466038e0d4a9aa9380d7909f29f7d15c6c69 Reviewed-on: https://go-review.googlesource.com/... — committed to golang/go by cuonglm 3 years ago
- Disable seed obfuscator The seed obfuscator uses a type declaration in order to declare a function, which returns a function with the same type. This breaks when obfuscating literals inside generic ... — committed to lu4p/garble by lu4p 2 years ago
- Disable seed obfuscator (#535) The seed obfuscator uses a type declaration in order to declare a function, which returns a function with the same type. This breaks when obfuscating literals insid... — committed to burrowers/garble by lu4p 2 years ago
IMO this issue should be labeled as release-blocker, local type declarations are fairly common.