Documentation
¶
Overview ¶
Package resolve rewrites G++ method-syntax uses of generic methods into calls (or closures) over the lowered package-level functions.
It runs a fixpoint: type-check the current shadow texts tolerantly with go/packages overlays, rewrite every call site whose receiver type is known, and repeat — chained calls resolve inside-out, one nesting level per iteration. go/types records the receiver's fully-instantiated type (and addressability) even when the selector itself fails to resolve, which is exactly what each rewrite needs.
Index ¶
Constants ¶
const RefineCarrier = "//gpp:refine "
RefineCarrier is the carrier comment prefix.
Variables ¶
This section is empty.
Functions ¶
func Backstop ¶
Backstop type-checks the final emitted texts strictly and returns every error, remapped into .gpp positions where the error lies in a generated file. This is the full go/types safety net behind the targeted resolution pass: anything the lowering got wrong, and any ordinary type error the user wrote, surfaces here exactly once — before anything is written to disk.
Types ¶
type Input ¶
type Input struct {
Dir string // working directory for package loading
Patterns []string // package patterns to load
Texts map[string][]byte // abs output path -> current shadow text
MethodsByDir map[string][]*registry.Method // dir -> generic methods declared there (PkgPath unset)
EnumsByDir map[string][]*registry.Enum // dir -> enums declared there (PkgPath provisional)
// v0.5.0 typeclasses (PkgPath provisional, cloned on registration).
ClassesByDir map[string][]*registry.Class
InstancesByDir map[string][]*registry.Instance
TotalsByDir map[string][]*registry.Total
DepsByDir map[string][]*registry.DepFn
}
Input configures a fixpoint run.