We should track the source positions for the code we're in the process of type-checking so that we can report a position when panicking.

This won't simplify debugging (we can always turn on tracing), but it will make it easier for end-users to possibly find a work-around when presented with a compiler issue.

Comment From: griesemer

Didn't get to this. For 1.25.

Comment From: gopherbot

Change https://go.dev/cl/670495 mentions this issue: internal/types/errors: add error code for non-bailout panics

Comment From: griesemer

@mrkfrmn Mark, is there anything left to do here, or can we close this?

Comment From: mrkfrmn

@griesemer Just the printing of the stack — I prioritized the grammar documentation over this for a bit, but can come back to finish it up.

Comment From: griesemer

ACK. Let's finish this so we can close it. Shouldn't be too much work left. Thanks!

Comment From: gopherbot

Change https://go.dev/cl/676815 mentions this issue: go/types, types2: dump position stack for non-bailout panics

Comment From: gopherbot

Change https://go.dev/cl/676816 mentions this issue: go/types, types2: flip on position tracing