You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently don't export inline bodies for map key types. I thought this was unnecessary since map indexing expressions only yield the map element type, but I forgot that range-based for loops can be used to extract the map key type.
This wasn't a problem for the old binary export format, because if an inline body was unexpectedly missing from the export data, the compiler couldn't distinguish that from it just not being inlineable. But with the indexed export format, we separately track whether a method is inlineable from whether it's (re)exported by any particular package.
$ cat a.go
package a
type k int
func (k) F() {}
type M map[k]int
$ cat b.go
package b
import "./a"
func f() {
for k := range (a.M{}) {
k.F()
}
}
$ go tool compile a.go
$ go tool compile b.go
b.go:7:6: internal compiler error: missing import reader for a.k.F
[...]
The text was updated successfully, but these errors were encountered:
We currently don't export inline bodies for map key types. I thought this was unnecessary since map indexing expressions only yield the map element type, but I forgot that range-based for loops can be used to extract the map key type.
This wasn't a problem for the old binary export format, because if an inline body was unexpectedly missing from the export data, the compiler couldn't distinguish that from it just not being inlineable. But with the indexed export format, we separately track whether a method is inlineable from whether it's (re)exported by any particular package.
The text was updated successfully, but these errors were encountered: