]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: slightly better tracing output (debugging support)
authorRobert Griesemer <gri@golang.org>
Fri, 21 Jan 2022 01:23:07 +0000 (17:23 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 24 Jan 2022 21:27:30 +0000 (21:27 +0000)
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>

src/cmd/compile/internal/types2/decl.go
src/cmd/compile/internal/types2/typexpr.go
src/go/types/decl.go
src/go/types/typexpr.go

index 41093cb6372ae8abd5e9c8be43113178f65512fb..710ae5f9c8c529c973b764e08358c90f73ce70fd 100644 (file)
@@ -278,7 +278,9 @@ loop:
                        check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef)
                }
                defer func() {
-                       if !valid {
+                       if valid {
+                               check.trace(obj.Pos(), "=> cycle is valid")
+                       } else {
                                check.trace(obj.Pos(), "=> error: cycle is invalid")
                        }
                }()
index 0c7bd626434962b1121cd045300589462a5ef5b0..991df9a082c2ab3380f6e0b14b336c7af2ffa271 100644 (file)
@@ -211,7 +211,7 @@ func goTypeName(typ Type) string {
 //
 func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) {
        if check.conf.Trace {
-               check.trace(e0.Pos(), "type %s", e0)
+               check.trace(e0.Pos(), "-- type %s", e0)
                check.indent++
                defer func() {
                        check.indent--
index 043f02491d1bda7df100e42bc815ab0eac1e4d3d..279220bec05891c9c3176aca00e96ba165d046cf 100644 (file)
@@ -277,7 +277,9 @@ loop:
                        check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef)
                }
                defer func() {
-                       if !valid {
+                       if valid {
+                               check.trace(obj.Pos(), "=> cycle is valid")
+                       } else {
                                check.trace(obj.Pos(), "=> error: cycle is invalid")
                        }
                }()
index 1e629e3fdb242a94826734bf086ef7aaa6d048b5..451662e5980dc9de917d92225b041bab6032586c 100644 (file)
@@ -209,7 +209,7 @@ func goTypeName(typ Type) string {
 //
 func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
        if trace {
-               check.trace(e0.Pos(), "type %s", e0)
+               check.trace(e0.Pos(), "-- type %s", e0)
                check.indent++
                defer func() {
                        check.indent--