MCPcopy Create free account

hub / github.com/BurntSushi/go-sumtype / functions

Functions37 in github.com/BurntSushi/go-sumtype

↓ 9 callersFunctionrun
(pkgs []*packages.Package)
main.go:32
↓ 8 callersFunctionsetupPackages
(t *testing.T, code string)
help_test.go:12
↓ 8 callersFunctionteardownPackage
(t *testing.T, dir string)
help_test.go:28
↓ 3 callersMethodLocation
Location returns a short string describing where this declaration was found.
decl.go:28
↓ 3 callersMethodNames
Names returns a sorted list of names corresponding to the missing variant cases.
check.go:30
↓ 3 callersFunctionmissingNames
(t *testing.T, err error)
check_test.go:234
↓ 2 callersFunctionindirect
indirect dereferences through an arbitrary number of pointer types.
def.go:143
↓ 2 callersFunctiontycheckAll
(args []string)
main.go:54
↓ 1 callersMethodError
()
def.go:15
↓ 1 callersFunctioncheck
check does exhaustiveness checking for the given sum type definitions in the given package. Every instance of inexhaustive case analysis is returned.
check.go:41
↓ 1 callersFunctioncheckSwitch
checkSwitch performs an exhaustiveness check on the given type switch statement. If the type switch is used on a sum type and does not cover all varia
check.go:65
↓ 1 callersFunctiondefaultClauseAlwaysPanics
defaultClauseAlwaysPanics returns true if the given switch statement has a default clause that always panics. Note that this is done on a best-effort
check.go:131
↓ 1 callersFunctionfindDef
findDef returns the sum type definition corresponding to the given type. If no such sum type definition exists, then nil is returned.
check.go:175
↓ 1 callersFunctionfindSumTypeDecls
findSumTypeDecls searches every package given for sum type declarations of the form `go-sumtype:decl ...`.
decl.go:34
↓ 1 callersFunctionfindSumTypeDefs
findSumTypeDefs attempts to find a Go type definition for each of the given sum type declarations. If no such sum type definition could be found for a
def.go:54
↓ 1 callersFunctionfindTypeAssertExpr
findTypeAssertExpr extracts the expression that is being type asserted from a type swtich statement.
check.go:163
↓ 1 callersFunctionisSumTypeDecl
isSumTypeDecl returns true if and only if this line in a Go source file is a sum type decl.
decl.go:107
↓ 1 callersMethodmissing
missing returns a list of variants in this sum type that are not in the given list of types.
def.go:123
↓ 1 callersFunctionmissingVariantsInSwitch
missingVariantsInSwitch returns a list of missing variants corresponding to the given switch statement. The corresponding sum type definition is also
check.go:85
↓ 1 callersFunctionnewSumTypeDef
newSumTypeDef attempts to extract a sum type definition from a single package. If no such type corresponds to the given decl, then this function retur
def.go:78
↓ 1 callersFunctionparseSumTypeDecl
parseSumTypeDecl parses the type name out of a sum type decl. If no such decl could be found, then this returns an empty string.
decl.go:97
↓ 1 callersFunctionsumTypeDeclSearch
sumTypeDeclSearch searches the given file for sum type declarations of the form `go-sumtype:decl ...`.
decl.go:57
↓ 1 callersFunctionswitchVariants
switchVariants returns all case expressions found in a type switch. This includes expressions from cases that have a list of expressions.
check.go:112
MethodError
()
check.go:22
MethodError
()
def.go:28
MethodError
()
def.go:38
MethodString
()
def.go:117
FunctionTestMissingOne
TestMissingOne tests that we detect a single missing variant.
check_test.go:10
FunctionTestMissingOneWithPanic
TestMissingOneWithPanic tests that we detect a single missing variant even if we have a trivial default case that panics.
check_test.go:76
FunctionTestMissingTwo
TestMissingTwo tests that we detect a two missing variants.
check_test.go:41
FunctionTestNoMissing
TestNoMissing tests that we correctly detect exhaustive case analysis.
check_test.go:109
FunctionTestNoMissingDefault
TestNoMissingDefault tests that even if we have a missing variant, a default case should thwart exhaustiveness checking.
check_test.go:141
FunctionTestNotFound
TestNotFound tests that we report an error if one tries to declare a sum type that isn't defined.
check_test.go:194
FunctionTestNotInterface
TestNotInterface tests that we report an error if one tries to declare a sum type that doesn't correspond to an interface.
check_test.go:214
FunctionTestNotSealed
TestNotSealed tests that we report an error if one tries to declare a sum type with an unsealed interface.
check_test.go:172
Functionmain
()
main.go:12
FunctionpkgFiles
(pkg *ast.Package)
def.go:150