Skip to content

Commit b2321e7

Browse files
adonovangopherbot
authored andcommitted
gopls/internal/golang: refine crash report golang/go#69362
This CL splits the various fallible checks that may have been responsible for the crash report in golang/go#69362 onto separate lines so that we can confirm whether a nil map entry is indeed the cause. (I am almost certain that it is, but I still can't explain it.) Updates golang/go#69362 Change-Id: I0469e285bda65c21e80a348af04ea0e69f6a31c0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/627015 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent c875677 commit b2321e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gopls/internal/golang/hover.go

+7
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,13 @@ func hover(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, pp pro
344344
// if they embed platform-variant types.
345345
//
346346
var sizeOffset string // optional size/offset description
347+
// debugging #69362: unexpected nil Defs[ident] value (?)
348+
_ = ident.Pos() // (can't be nil due to check after referencedObject)
349+
_ = pkg.TypesInfo() // (can't be nil due to check in call to inferredSignature)
350+
_ = pkg.TypesInfo().Defs // (can't be nil due to nature of cache.Package)
351+
if def, ok := pkg.TypesInfo().Defs[ident]; ok {
352+
_ = def.Pos() // can't be nil due to reasoning in #69362.
353+
}
347354
if def, ok := pkg.TypesInfo().Defs[ident]; ok && ident.Pos() == def.Pos() {
348355
// This is the declaring identifier.
349356
// (We can't simply use ident.Pos() == obj.Pos() because

0 commit comments

Comments
 (0)