Skip to content

go.tools/go/types assertion failure in recordTypeAndValue #8169

Closed
@kardianos

Description

@kardianos
go.tools$ hg id
75a83badcaf5+ tip

$ go version
go version go1.3rc1 linux/amd64

When I run godoc with -analysis="(something)" -http="..." it crashes
in the analysis.

The following check appears to fail in go.tools/go/types/check.go:249:


func (check *checker) recordTypeAndValue(x ast.Expr, typ Type, val exact.Value) {
    assert(x != nil && typ != nil)
    if val != nil {
        assert(isConstType(typ)) // <- Fails here.
    }
    if m := check.Types; m != nil {
        m[x] = TypeAndValue{typ, val}
    }
}


If I hide:
github.com/youtube/vitess/go/zk/

Then the issue is not triggered.


panic: assertion failed [recovered]
    panic: assertion failed [recovered]
    panic: assertion failed [recovered]
    panic: assertion failed

goroutine 1463 [running]:
runtime.panic(0x901300, 0xc2183fdc70)
    /home/daniel/code/go/src/pkg/runtime/panic.c:279 +0xf5
code.google.com/p/go.tools/go/types.(*checker).handleBailout(0xc2178fd800, 0xc20b453250)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:202 +0xcd
runtime.panic(0x901300, 0xc2183fdc70)
    /home/daniel/code/go/src/pkg/runtime/panic.c:248 +0x18d
code.google.com/p/go.tools/go/types.(*checker).handleBailout(0xc217c42b00, 0xc20b452718)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:202 +0xcd
runtime.panic(0x901300, 0xc2183fdc70)
    /home/daniel/code/go/src/pkg/runtime/panic.c:248 +0x18d
code.google.com/p/go.tools/go/types.(*checker).handleBailout(0xc217d2c700, 0xc20b451be0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:202 +0xcd
runtime.panic(0x901300, 0xc2183fdc70)
    /home/daniel/code/go/src/pkg/runtime/panic.c:248 +0x18d
code.google.com/p/go.tools/go/types.assert(0x7f719be7f600)
    /home/daniel/src/code.google.com/p/go.tools/go/types/errors.go:18 +0x68
code.google.com/p/go.tools/go/types.(*checker).recordTypeAndValue(0xc217d2c700,
0x7f719be9abe8, 0xc217cd4de0, 0x7f719be7f6d0, 0xebbfc0, 0x7f719be7f698, 0x1)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:252 +0x70
code.google.com/p/go.tools/go/types.(*checker).rawExpr(0xc217d2c700, 0xc218499300,
0x7f719be9abe8, 0xc217cd4de0, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:938 +0x30b
code.google.com/p/go.tools/go/types.(*checker).use(0xc217d2c700, 0xc217cd0ab0, 0x1, 0x1)
    /home/daniel/src/code.google.com/p/go.tools/go/types/call.go:91 +0xd5
code.google.com/p/go.tools/go/types.(*checker).call(0xc217d2c700, 0xc218499280,
0xc217cdc1c0, 0xc217cdc1c0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/call.go:19 +0xad
code.google.com/p/go.tools/go/types.(*checker).exprInternal(0xc217d2c700, 0xc218499280,
0x7f719be9ac20, 0xc217cdc1c0, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:1332 +0x244f
code.google.com/p/go.tools/go/types.(*checker).rawExpr(0xc217d2c700, 0xc218499280,
0x7f719be9ac20, 0xc217cdc1c0, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:915 +0x84
code.google.com/p/go.tools/go/types.(*checker).expr(0xc217d2c700, 0xc218499280,
0x7f719be9ac20, 0xc217cdc1c0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:1419 +0x64
code.google.com/p/go.tools/go/types.func·007(0xc218499280, 0x3)
    /home/daniel/src/code.google.com/p/go.tools/go/types/call.go:64 +0x7e
code.google.com/p/go.tools/go/types.(*checker).arguments(0xc217d2c700, 0xc218499280,
0xc217cdc200, 0xc21847a5d0, 0xc20b450600, 0x4)
    /home/daniel/src/code.google.com/p/go.tools/go/types/call.go:182 +0x90
code.google.com/p/go.tools/go/types.(*checker).call(0xc217d2c700, 0xc218499280,
0xc217cdc200, 0xc217cdc200)
    /home/daniel/src/code.google.com/p/go.tools/go/types/call.go:65 +0x826
code.google.com/p/go.tools/go/types.(*checker).exprInternal(0xc217d2c700, 0xc218499280,
0x7f719be9ac20, 0xc217cdc200, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:1332 +0x244f
code.google.com/p/go.tools/go/types.(*checker).rawExpr(0xc217d2c700, 0xc218499280,
0x7f719be9ac20, 0xc217cdc200, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:915 +0x84
code.google.com/p/go.tools/go/types.(*checker).expr(0xc217d2c700, 0xc218499280,
0x7f719be9ac20, 0xc217cdc200)
    /home/daniel/src/code.google.com/p/go.tools/go/types/expr.go:1419 +0x64
code.google.com/p/go.tools/go/types.func·002(0xc218499280, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/assignments.go:211 +0x77
code.google.com/p/go.tools/go/types.unpack(0xc20b450f10, 0x1, 0x42e301, 0xd0, 0xa240a0,
0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/call.go:121 +0x5f
code.google.com/p/go.tools/go/types.(*checker).initVars(0xc217d2c700, 0xc2183fdbe0, 0x2,
0x2, 0xc217cd0ac0, 0x1, 0x1, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/assignments.go:211 +0xc8
code.google.com/p/go.tools/go/types.(*checker).shortVarDecl(0xc217d2c700, 0x7c29cf,
0xc217cd4b60, 0x2, 0x2, 0xc217cd0ac0, 0x1, 0x1)
    /home/daniel/src/code.google.com/p/go.tools/go/types/assignments.go:310 +0x459
code.google.com/p/go.tools/go/types.(*checker).stmt(0xc217d2c700, 0x0, 0x7f719be9ac58,
0xc217cdc240)
    /home/daniel/src/code.google.com/p/go.tools/go/types/stmt.go:291 +0x4f23
code.google.com/p/go.tools/go/types.(*checker).stmtList(0xc217d2c700, 0x0, 0xc217cca480,
0x5, 0x8)
    /home/daniel/src/code.google.com/p/go.tools/go/types/stmt.go:91 +0x106
code.google.com/p/go.tools/go/types.(*checker).funcBody(0xc217d2c700, 0xc218154480,
0xc217cd0910, 0xd, 0xc2183f7440, 0xc217cd2f30)
    /home/daniel/src/code.google.com/p/go.tools/go/types/stmt.go:39 +0x158
code.google.com/p/go.tools/go/types.(*checker).functionBodies(0xc217d2c700)
    /home/daniel/src/code.google.com/p/go.tools/go/types/resolver.go:379 +0xf2
code.google.com/p/go.tools/go/types.(*checker).Files(0xc217d2c700, 0xc217c7cfc0, 0xb,
0xb, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:218 +0x10e
code.google.com/p/go.tools/go/loader.typeCheckFiles(0xc21798f0e0, 0xc217c7cfc0, 0xb, 0xb)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:745 +0x22d
code.google.com/p/go.tools/go/loader.(*importer).importFromSource(0xc209ad5e20,
0xc217c48a81, 0x26, 0x26, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:733 +0x11c
code.google.com/p/go.tools/go/loader.(*importer).importPackage(0xc209ad5e20,
0xc217c48a81, 0x26, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:693 +0x31b
code.google.com/p/go.tools/go/loader.(*importer).doImport(0xc209ad5e20, 0xc20984c5d0,
0xc217c48a81, 0x26, 0xc20b451e98, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:666 +0xc2
code.google.com/p/go.tools/go/loader.*importer.(code.google.com/p/go.tools/go/loader.doImport)·fm(0xc20984c5d0,
0xc217c48a81, 0x26, 0x26, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:763 +0x56
code.google.com/p/go.tools/go/types.(*checker).collectObjects(0xc217c42b00)
    /home/daniel/src/code.google.com/p/go.tools/go/types/resolver.go:166 +0x221d
code.google.com/p/go.tools/go/types.(*checker).Files(0xc217c42b00, 0xc217732f20, 0x15,
0x15, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:212 +0xb7
code.google.com/p/go.tools/go/loader.typeCheckFiles(0xc21798e870, 0xc217732f20, 0x15,
0x15)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:745 +0x22d
code.google.com/p/go.tools/go/loader.(*importer).importFromSource(0xc209ad5e20,
0xc2178e3e31, 0x28, 0x28, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:733 +0x11c
code.google.com/p/go.tools/go/loader.(*importer).importPackage(0xc209ad5e20,
0xc2178e3e31, 0x28, 0x0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:693 +0x31b
code.google.com/p/go.tools/go/loader.(*importer).doImport(0xc209ad5e20, 0xc20984c5d0,
0xc2178e3e31, 0x28, 0xc20b4529d0, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:666 +0xc2
code.google.com/p/go.tools/go/loader.*importer.(code.google.com/p/go.tools/go/loader.doImport)·fm(0xc20984c5d0,
0xc2178e3e31, 0x28, 0x28, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:763 +0x56
code.google.com/p/go.tools/go/types.(*checker).collectObjects(0xc2178fd800)
    /home/daniel/src/code.google.com/p/go.tools/go/types/resolver.go:166 +0x221d
code.google.com/p/go.tools/go/types.(*checker).Files(0xc2178fd800, 0xc21789d080, 0x6,
0x6, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/types/check.go:212 +0xb7
code.google.com/p/go.tools/go/loader.typeCheckFiles(0xc217883950, 0xc21789d080, 0x6, 0x6)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:745 +0x22d
code.google.com/p/go.tools/go/loader.(*importer).importFromSource(0xc209ad5e20,
0xc208647bd1, 0x26, 0x26, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:733 +0x11c
code.google.com/p/go.tools/go/loader.(*importer).importPackage(0xc209ad5e20,
0xc208647bd1, 0x26, 0xc20b453510, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:693 +0x31b
code.google.com/p/go.tools/go/loader.(*Config).Load(0xc2087161b0, 0x1, 0x0, 0x0)
    /home/daniel/src/code.google.com/p/go.tools/go/loader/loader.go:494 +0x253
code.google.com/p/go.tools/godoc/analysis.Run(0xa81501, 0xc20802ce70)
    /home/daniel/src/code.google.com/p/go.tools/godoc/analysis/analysis.go:341 +0xad0
created by main.main
    /home/daniel/src/code.google.com/p/go.tools/cmd/godoc/main.go:306 +0x177d

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions