Skip to content

go/types: vague docs about "incrementally" type checking files #20124

@mdempsky

Description

@mdempsky

The go/types documentation twice mentions "incrementally":

Alternatively, create a new type checker with NewChecker and invoke it incrementally by calling Checker.Files.

NewChecker returns a new Checker instance for a given package. Package files may be added incrementally via checker.Files.

However, it's unclear to me what that's supposed to mean. The types tutorial doesn't mention "incrementally" at all either, or even describe using the types.Checker API.

Intuitively, I would think an "incremental" API means the caller only needs to supply new information; e.g., to call Files({A}) and then Files({B}). But looking at the implementation, it appears the second call actually needs to be Files({A,B}). That's fine (and can't change now anyway), but I'm not clear in what sense it's "incremental." It doesn't build on any previous work, except to reuse the same maps previously allocated.

/cc @griesemer @alandonovan

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions