affiliation

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package affiliation implements the affliation analyzer that tries to find the concrete implementation of an interface and create full triggers for them.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:       "nilaway_affiliation_analyzer",
	Doc:        _doc,
	Run:        analysishelper.WrapRun(run),
	FactTypes:  []analysis.Fact{new(AffliliationCache)},
	ResultType: reflect.TypeOf((*analysishelper.Result[[]annotation.FullTrigger])(nil)),
	Requires:   []*analysis.Analyzer{config.Analyzer},
}

Analyzer here is the analyzer that tracks interface implementations and analyzes for nilability variance, and passes them onto the accumulator to be added to existing assertions to be matched against annotations.

Functions

This section is empty.

Types

type Affiliation

type Affiliation struct {
	// contains filtered or unexported fields
}

Affiliation is used to track the association between an interface and its concrete implementations in the form of a map, where the key is a function where the affiliation was witnessed and value is an array of full triggers computed for the affiliation key

type AffliliationCache

type AffliliationCache struct {
	Cache ImplementedDeclaredTypesCache
}

AffliliationCache stores the mapping between interfaces and their implementations that have been analyzed. This information can be used by downstream packages to avoid re-analysis of the same affiliations

func (*AffliliationCache) AFact

func (*AffliliationCache) AFact()

AFact enables use of the facts passing mechanism in Go's analysis framework

type ImplementedDeclaredTypesCache

type ImplementedDeclaredTypesCache map[Pair]bool

ImplementedDeclaredTypesCache declares a map of a concrete implementation (e.g., struct) and its implemented interfaces in the form of their fully qualified paths (key: <structFQ>#<interfaceFQ>, value: true/false)

type Pair

type Pair struct {
	ImplementedID string
	DeclaredID    string
}

Pair is a struct to store struct-interface affiliation pairs

Jump to

Keyboard shortcuts

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