}
// pathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g].
-// TODO(gri) remove once we don't need the old cycle detection (explicitly passed
-// []*TypeName path) anymore
-func pathString(path []*TypeName) string {
- var s string
- for i, p := range path {
- if i > 0 {
- s += "->"
- }
- s += p.Name()
- }
- return s
-}
-
-// objPathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g].
-// TODO(gri) s/objPathString/pathString/ once we got rid of pathString above
-func objPathString(path []Object) string {
+func pathString(path []Object) string {
var s string
for i, p := range path {
if i > 0 {
// For the meaning of def, see Checker.definedType, in typexpr.go.
func (check *Checker) objDecl(obj Object, def *Named) {
if trace {
- check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, objPathString(check.objPath))
+ check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, pathString(check.objPath))
check.indent++
defer func() {
check.indent--
}
if trace {
- check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", objPathString(cycle), obj.Name(), ncycle)
+ check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", pathString(cycle), obj.Name(), ncycle)
check.trace(obj.Pos(), "## cycle contains: %d values, has indirection = %v, has type definition = %v", nval, hasIndir, hasTDef)
defer func() {
if isCycle {