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
$ gotip version
go version devel go1.18-cfa233d76b Wed Sep 15 22:53:42 2021 +0000 linux/amd64
For good measure, I've also tested with patch set 1 of https://golang.org/cl/349909 from #48337 (not yet merged as of this writing) and confirmed that it exhibits the same behavior:
$ gotip version
go version devel go1.18-e908806648 Tue Sep 14 09:13:23 2021 -0700 linux/amd64
Does this issue reproduce with the latest release?
No, using the latest master.
What operating system and processor architecture are you using (go env)?
-- go.mod --
module github.com/ahamlinman/typeparams-no-location
go 1.18
-- main.go --
package main
import "github.com/ahamlinman/typeparams-no-location/controller"
func main() {
controller.NewController().Status()
}
-- controller/controller.go --
package controller
import "github.com/ahamlinman/typeparams-no-location/value"
type State int
const StateNone State = iota
type Status struct {
State State
}
type Controller struct {
status *value.Value[Status]
}
func NewController() *Controller {
return &Controller{
status: value.NewValue(Status{}),
}
}
func (c *Controller) Status() Status {
return c.status.Get()
}
-- value/value.go --
package value
type Value[T any] struct {
value T
}
func NewValue[T any](value T) *Value[T] {
return &Value[T]{value}
}
func (v *Value[T]) Get() T {
return v.value
}
What did you expect to see?
A successful build with no errors reported.
What did you see instead?
# github.com/ahamlinman/typeparams-no-location
./main.go:6:35: internal compiler error: value.(*Value[.shape.struct{ State "".State }_0]).Get has no location
Full error with stack trace
# github.com/ahamlinman/typeparams-no-location
./main.go:6:35: internal compiler error: value.(*Value[.shape.struct{ State "".State }_0]).Get has no location
What version of Go are you using (
go version
)?For good measure, I've also tested with patch set 1 of https://golang.org/cl/349909 from #48337 (not yet merged as of this writing) and confirmed that it exhibits the same behavior:
Does this issue reproduce with the latest release?
No, using the latest master.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Attempt to
go build
the contents of https://github.com/ahamlinman/typeparams-no-location:What did you expect to see?
A successful build with no errors reported.
What did you see instead?
Full error with stack trace
Any one of the following allows the program to build successfully in my testing:
go build -gcflags=-l
(disable inlining)GOEXPERIMENT=unified go build
State
field incontroller.Status
, e.g. fromState
toint
The text was updated successfully, but these errors were encountered: