Skip to content

Commit

Permalink
Add comments on test-only interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
tchajed committed Nov 14, 2024
1 parent 8352f2a commit 8d13c77
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion goose.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ func NewPkgCtx(pkg *packages.Package, tr TranslationConfig) Ctx {

// NewCtx loads a context for files passed directly,
// rather than loaded from a packages.
//
// NOTE: this is only used to load the negative tests by file; prefer to use
// NewPkgCtx and let [packages.Load] load and type check the Go code.
func NewCtx(pkgPath string, conf PkgConfig) Ctx {
info := &types.Info{
Defs: make(map[*ast.Ident]types.Object),
Expand All @@ -131,7 +134,8 @@ func NewCtx(pkgPath string, conf PkgConfig) Ctx {

// TypeCheck type-checks a set of files and stores the result in the Ctx
//
// This is needed before conversion to Coq to disambiguate some methods.
// NOTE: this is only needed when using NewCtx in the negative tests, which load
// individual files rather than a package.
func (ctx Ctx) TypeCheck(files []*ast.File) error {
imp := importer.ForCompiler(ctx.Fset, "source", nil)
conf := types.Config{Importer: imp}
Expand Down

0 comments on commit 8d13c77

Please sign in to comment.