1
0
mirror of https://github.com/golang/go synced 2024-11-24 04:10:14 -07:00

go/types, types2: slightly better tracing output (debugging support)

Change-Id: I48804eba94ec455c4764d52af148f4210faf7d94
Reviewed-on: https://go-review.googlesource.com/c/go/+/379836
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Griesemer 2022-01-20 17:23:07 -08:00
parent 2abfa30f9e
commit fef14fdd1d
4 changed files with 8 additions and 4 deletions

View File

@ -278,7 +278,9 @@ loop:
check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef) check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef)
} }
defer func() { defer func() {
if !valid { if valid {
check.trace(obj.Pos(), "=> cycle is valid")
} else {
check.trace(obj.Pos(), "=> error: cycle is invalid") check.trace(obj.Pos(), "=> error: cycle is invalid")
} }
}() }()

View File

@ -211,7 +211,7 @@ func goTypeName(typ Type) string {
// //
func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) { func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) {
if check.conf.Trace { if check.conf.Trace {
check.trace(e0.Pos(), "type %s", e0) check.trace(e0.Pos(), "-- type %s", e0)
check.indent++ check.indent++
defer func() { defer func() {
check.indent-- check.indent--

View File

@ -277,7 +277,9 @@ loop:
check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef) check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef)
} }
defer func() { defer func() {
if !valid { if valid {
check.trace(obj.Pos(), "=> cycle is valid")
} else {
check.trace(obj.Pos(), "=> error: cycle is invalid") check.trace(obj.Pos(), "=> error: cycle is invalid")
} }
}() }()

View File

@ -209,7 +209,7 @@ func goTypeName(typ Type) string {
// //
func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) { func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
if trace { if trace {
check.trace(e0.Pos(), "type %s", e0) check.trace(e0.Pos(), "-- type %s", e0)
check.indent++ check.indent++
defer func() { defer func() {
check.indent-- check.indent--