Skip to content

reflect: unexpected non-empty PkgPath on tip #16328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ianlancetaylor opened this issue Jul 12, 2016 · 2 comments
Closed

reflect: unexpected non-empty PkgPath on tip #16328

ianlancetaylor opened this issue Jul 12, 2016 · 2 comments
Milestone

Comments

@ianlancetaylor
Copy link
Member

This program panics on tip but exits normally with earlier versions of Go.

package main

import (
    "reflect"
)

type S struct {}

func (s *S) Get() int { return 0 }

type I interface {
    F(*S)
}

func main() {
    ft := reflect.TypeOf((*I)(nil)).Elem()
    m := ft.Method(0)
    mt := m.Type
    for i := 0; i < mt.NumIn(); i++ {
        if mt.In(i).PkgPath() != "" {
            panic(mt.In(i).PkgPath())
        }
    }
}
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Jul 12, 2016
@ianlancetaylor
Copy link
Member Author

Simpler case:

package main

import (
    "reflect"
)

type S struct {}

func (s *S) Get() int { return 0 }

func main() {
    st := reflect.TypeOf((*S)(nil))
    if st.PkgPath() != "" {
        panic(st.PkgPath())
    }
}

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/24862 mentions this issue.

@golang golang locked and limited conversation to collaborators Jul 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants