Skip to content

Commit fef14fd

Browse files
committed
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 <[email protected]> Run-TryBot: Robert Griesemer <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 2abfa30 commit fef14fd

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ loop:
278278
check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef)
279279
}
280280
defer func() {
281-
if !valid {
281+
if valid {
282+
check.trace(obj.Pos(), "=> cycle is valid")
283+
} else {
282284
check.trace(obj.Pos(), "=> error: cycle is invalid")
283285
}
284286
}()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func goTypeName(typ Type) string {
211211
//
212212
func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) {
213213
if check.conf.Trace {
214-
check.trace(e0.Pos(), "type %s", e0)
214+
check.trace(e0.Pos(), "-- type %s", e0)
215215
check.indent++
216216
defer func() {
217217
check.indent--

src/go/types/decl.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ loop:
277277
check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef)
278278
}
279279
defer func() {
280-
if !valid {
280+
if valid {
281+
check.trace(obj.Pos(), "=> cycle is valid")
282+
} else {
281283
check.trace(obj.Pos(), "=> error: cycle is invalid")
282284
}
283285
}()

src/go/types/typexpr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func goTypeName(typ Type) string {
209209
//
210210
func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
211211
if trace {
212-
check.trace(e0.Pos(), "type %s", e0)
212+
check.trace(e0.Pos(), "-- type %s", e0)
213213
check.indent++
214214
defer func() {
215215
check.indent--

0 commit comments

Comments
 (0)