// It is an error to set both FakeImportC and go115UsesCgo.
go115UsesCgo bool
- // If trace is set, a debug trace is printed to stdout.
- trace bool
+ // If _Trace is set, a debug trace is printed to stdout.
+ _Trace bool
// If Error != nil, it is called with each error found
// during type checking; err has dynamic type Error.
assert(check != nil)
assert(len(targs) == typ.TypeParams().Len())
- if check.conf.trace {
+ if check.conf._Trace {
check.trace(pos, "-- instantiating signature %s with %s", typ, targs)
check.indent++
defer func() {
defer check.handleBailout(&err)
print := func(msg string) {
- if check.conf.trace {
+ if check.conf._Trace {
fmt.Println()
fmt.Println(msg)
}
// this is a sufficiently bounded process.
for i := top; i < len(check.delayed); i++ {
a := &check.delayed[i]
- if check.conf.trace {
+ if check.conf._Trace {
if a.desc != nil {
check.trace(a.desc.pos.Pos(), "-- "+a.desc.format, a.desc.args...)
} else {
}
}
a.f() // may append to check.delayed
- if check.conf.trace {
+ if check.conf._Trace {
fmt.Println()
}
}
}
// typecheck and collect typechecker errors
- *boolFieldAddr(&conf, "trace") = manual && testing.Verbose()
+ *boolFieldAddr(&conf, "_Trace") = manual && testing.Verbose()
if imp == nil {
imp = importer.Default()
}
// objDecl type-checks the declaration of obj in its respective (file) environment.
// For the meaning of def, see Checker.definedType, in typexpr.go.
func (check *Checker) objDecl(obj Object, def *Named) {
- if check.conf.trace && obj.Type() == nil {
+ if check.conf._Trace && obj.Type() == nil {
if check.indent == 0 {
fmt.Println() // empty line between top-level objects for readability
}
}
}
- if check.conf.trace {
+ if check.conf._Trace {
check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", pathString(cycle), obj.Name(), len(cycle))
if tparCycle {
check.trace(obj.Pos(), "## cycle contains: generic type in a type parameter list")
tparams = append(tparams, tpar)
}
- if check.conf.trace && len(names) > 0 {
+ if check.conf._Trace && len(names) > 0 {
check.trace(names[0].Pos(), "type params = %v", tparams[len(tparams)-len(names):])
}
check.firstErr = err
}
- if check.conf.trace {
+ if check.conf._Trace {
pos := e.Pos
msg := e.Msg
check.trace(pos, "ERROR: %s", msg)
// If allowGeneric is set, the operand type may be an uninstantiated
// parameterized type or function value.
func (check *Checker) rawExpr(x *operand, e ast.Expr, hint Type, allowGeneric bool) exprKind {
- if check.conf.trace {
+ if check.conf._Trace {
check.trace(e.Pos(), "-- expr %s", e)
check.indent++
defer func() {
renameIdent(f, "InsertLazy", "_InsertLazy")
},
"selection.go": nil,
- "sizes.go": func(f *ast.File) { renameIdent(f, "IsSyncAtomicAlign64", "isSyncAtomicAlign64") },
+ "sizes.go": func(f *ast.File) { renameIdent(f, "IsSyncAtomicAlign64", "_IsSyncAtomicAlign64") },
"slice.go": nil,
"subst.go": func(f *ast.File) { fixTokenPos(f); fixTraceSel(f) },
"termlist.go": nil,
ast.Inspect(f, func(n ast.Node) bool {
switch n := n.(type) {
case *ast.SelectorExpr:
- // rewrite x.Trace to x.trace (for Config.Trace)
+ // rewrite x.Trace to x._Trace (for Config.Trace)
if n.Sel.Name == "Trace" {
- n.Sel.Name = "trace"
+ n.Sel.Name = "_Trace"
return false
}
}
// returning the result. Returns Typ[Invalid] if there was an error.
func (n *Named) expandUnderlying() Type {
check := n.check
- if check != nil && check.conf.trace {
+ if check != nil && check.conf._Trace {
check.trace(n.obj.pos, "-- Named.expandUnderlying %s", n)
check.indent++
defer func() {
// is the same as unsafe.Alignof(x[0]), but at least 1."
return s.Alignof(t.elem)
case *Struct:
- if len(t.fields) == 0 && isSyncAtomicAlign64(T) {
+ if len(t.fields) == 0 && _IsSyncAtomicAlign64(T) {
// Special case: sync/atomic.align64 is an
// empty struct we recognize as a signal that
// the struct it contains must be
return a
}
-func isSyncAtomicAlign64(T Type) bool {
+func _IsSyncAtomicAlign64(T Type) bool {
named, ok := T.(*Named)
if !ok {
return false
panic("function body not ignored")
}
- if check.conf.trace {
+ if check.conf._Trace {
check.trace(body.Pos(), "-- %s: %s", name, sig)
}
case *Named:
// dump is for debugging
dump := func(string, ...interface{}) {}
- if subst.check != nil && subst.check.conf.trace {
+ if subst.check != nil && subst.check.conf._Trace {
subst.check.indent++
defer func() {
subst.check.indent--
return &topTypeSet
}
- if check != nil && check.conf.trace {
+ if check != nil && check.conf._Trace {
// Types don't generally have position information.
// If we don't have a valid pos provided, try to use
// one close enough.
// typInternal drives type checking of types.
// Must only be called by definedType or genericType.
func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
- if check.conf.trace {
+ if check.conf._Trace {
check.trace(e0.Pos(), "-- type %s", e0)
check.indent++
defer func() {
}
func (check *Checker) instantiatedType(ix *typeparams.IndexExpr, def *Named) (res Type) {
- if check.conf.trace {
+ if check.conf._Trace {
check.trace(ix.Pos(), "-- instantiating type %s with %s", ix.X, ix.Indices)
check.indent++
defer func() {