toolsgolang.org/x/tools/internal/typeparams/genericfeatures Index | Files

package genericfeatures

import "golang.org/x/tools/internal/typeparams/genericfeatures"

The genericfeatures package provides utilities for detecting usage of generic programming in Go packages.

Index

Types

type Features

type Features int

Features is a set of flags reporting which features of generic Go code a package uses, or 0.

const (
	// GenericTypeDecls indicates whether the package declares types with type
	// parameters.
	GenericTypeDecls Features = 1 << iota

	// GenericFuncDecls indicates whether the package declares functions with
	// type parameters.
	GenericFuncDecls

	// EmbeddedTypeSets indicates whether the package declares interfaces that
	// contain structural type restrictions, i.e. are not fully described by
	// their method sets.
	EmbeddedTypeSets

	// TypeInstantiation indicates whether the package instantiates any generic
	// types.
	TypeInstantiation

	// FuncInstantiation indicates whether the package instantiates any generic
	// functions.
	FuncInstantiation
)

func ForPackage

func ForPackage(inspect *inspector.Inspector, info *types.Info) Features

ForPackage computes which generic features are used directly by the package being analyzed.

func (Features) String

func (f Features) String() string

Source Files

features.go

Version
v0.30.0 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
6 hours ago

Tools for package owners.