Skip to content
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

go/types: crash in assignment between "unexported" named interface types #5512

Closed
remyoudompheng opened this issue May 18, 2013 · 2 comments
Closed

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?

Typechekck the follwoing pair of files:

$ cat main.go
package blah

import "testb/pkg"

type stringer interface {
    String() string
}

func F() {
      var t pkg.T
    var s stringer = t.Field
}

$ cat pkg/pkg.go
package pkg

type stringer interface {
    String() string
}

type T struct {
    Field stringer
}

What is the expected output? What do you see instead?

Expected: no error

Instead:
$ gotype .
INTERNAL PANIC: runtime error: invalid memory address or nil pointer dereference
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x487765]

goroutine 1 [running]:
main.func·002()
    /home/remy/travail/go/src/code.google.com/p/go.tools/gotype/gotype.go:185 +0xa2
code.google.com/p/go.tools/go/types.func·003()
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/check.go:447 +0x175
code.google.com/p/go.tools/go/types.identicalMethods(0xc200087820, 0x1, 0x1,
0xc200087850, 0x1, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/predicates.go:219 +0xe5
code.google.com/p/go.tools/go/types.IsIdentical(0xc200079b00, 0xc200064a00,
0xc200079b00, 0xc200064a40, 0x0, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/predicates.go:165 +0x8de
code.google.com/p/go.tools/go/types.(*operand).isAssignable(0xc2000a5cc0, 0xc2000a5480,
0xc200079b40, 0xc2000a2840, 0x0, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/operand.go:144 +0x172
code.google.com/p/go.tools/go/types.(*checker).assignment(0xc20008c0b0, 0xc2000a5cc0,
0xc200079b40, 0xc2000a2840, 0x1, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/stmt.go:36 +0x1dd
code.google.com/p/go.tools/go/types.(*checker).assign1to1(0xc20008c0b0, 0xc2000a5040,
0xc200064660, 0xc2000a52c0, 0xc2000646e0, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/stmt.go:139 +0x563
code.google.com/p/go.tools/go/types.(*checker).valueSpec(0xc20008c0b0, 0x73,
0xc20007d910, 0xc2000a5c40, 0xc200000228, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/check.go:162 +0x3a9
code.google.com/p/go.tools/go/types.(*checker).object(0xc20008c0b0, 0xc20007d910,
0xc2000a5c40, 0xc2000a5c00)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/check.go:247 +0x3ca
code.google.com/p/go.tools/go/types.(*checker).decl(0xc20008c0b0, 0xc200079f80,
0xc2000a53c0)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/check.go:391 +0x44c
code.google.com/p/go.tools/go/types.(*checker).stmt(0xc20008c0b0, 0xc2000a5380,
0xc200087730)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/stmt.go:298 +0x3108
code.google.com/p/go.tools/go/types.(*checker).stmtList(0xc20008c0b0, 0xc200064700, 0x2,
0x2)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/stmt.go:247 +0x68
code.google.com/p/go.tools/go/types.check(0xc2000a5480, 0x5ce2a0, 0x1, 0xc200079e40,
0xc200000240, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/check.go:485 +0x4cf
code.google.com/p/go.tools/go/types.(*Context).Check(0xc2000a5480, 0x5ce2a0, 0x1,
0xc200079e40, 0xc200000240, ...)
    /home/remy/travail/go/src/code.google.com/p/go.tools/go/types/api.go:112 +0x6c
main.processPackage(0xc200079e40, 0xc200000240, 0x1, 0x1)
    /home/remy/travail/go/src/code.google.com/p/go.tools/gotype/gotype.go:189 +0xd9
main.processFiles(0xc200086700, 0x2, 0x64, 0xc200000100)
    /home/remy/travail/go/src/code.google.com/p/go.tools/gotype/gotype.go:167 +0x178
main.processDirectory(0x7fff7b5d0923, 0x1)
    /home/remy/travail/go/src/code.google.com/p/go.tools/gotype/gotype.go:146 +0x24a
main.processFiles(0xc200064010, 0x1, 0x1, 0x417301)
    /home/remy/travail/go/src/code.google.com/p/go.tools/gotype/gotype.go:157 +0x1d9
main.main()
    /home/remy/travail/go/src/code.google.com/p/go.tools/gotype/gotype.go:200 +0xea

goroutine 2 [runnable]:


Please use labels and text to provide additional information.
@davecheney
Copy link
Contributor

Comment 1:

Issue #5568 has been merged into this issue.

@remyoudompheng
Copy link
Contributor Author

Comment 2:

The issue was fixed by the fix for issue #5675 (revision eeb58a9dd66a).
The first good revision is:
changeset:   42:eeb58a9dd66a
user:        Robert Griesemer <gri@golang.org>
date:        Tue Jun 11 10:00:00 2013 -0700
summary:     go.tools/go/types: fix isAssignable and IsIdentical
https://code.google.com/p/go/source/detail?r=eeb58a9dd66a&repo=tools

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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