paramhints

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package paramhints infers parameter types from call site arguments.

This package analyzes function call sites to infer parameter types for functions without explicit type annotations. When a function is called with known-type arguments, those types hint at the parameter types.

Hint Collection

For each call site:

foo(123, "bar")  -- hints: param1=number, param2=string

The package collects argument types and associates them with parameter positions. Multiple call sites contribute hints that are joined.

Hint Merging

When multiple calls provide conflicting hints:

foo(1)      -- hints: param1=number
foo("a")    -- hints: param1=string

The hints are joined to produce: param1 = number | string

Integration

Parameter hints feed into function signature inference, providing types for parameters that lack explicit annotations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildParamHintSigView

func BuildParamHintSigView(
	store api.StoreView,
	graph *cfg.Graph,
	parent *scope.State,
	stdlib *scope.State,
) map[*ast.FunctionExpr][]typ.Type

BuildParamHintSigView builds a function-expression keyed hint map for this graph. It merges per-iteration scratch hints with symbol-based hints from the store. Scratch hints take precedence over symbol-derived hints.

func WidenParamHintType

func WidenParamHintType(t typ.Type) typ.Type

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL