MCPcopy
hub / github.com/google/mangle / RelTypeAlternatives

Function RelTypeAlternatives

symbols/typeexprs.go:333–339  ·  view source on GitHub ↗

RelTypeAlternatives converts a relation type expression to a list of alternatives relTypes.

(relTypeExpr ast.BaseTerm)

Source from the content-addressed store, hash-verified

331
332// RelTypeAlternatives converts a relation type expression to a list of alternatives relTypes.
333func RelTypeAlternatives(relTypeExpr ast.BaseTerm) []ast.BaseTerm {
334 if IsUnionTypeExpression(relTypeExpr) {
335 relTypes, _ := UnionTypeArgs(relTypeExpr)
336 return relTypes
337 }
338 return []ast.BaseTerm{relTypeExpr}
339}
340
341// GetTypeContext returns type context containing all type vars, with /any bound.
342func GetTypeContext(typeExpr ast.BaseTerm) map[ast.Variable]ast.BaseTerm {

Callers 4

checkClausesMethod · 0.92
feasibleAlternativesMethod · 0.92
inferRelTypesMethod · 0.92
TestRelTypeMethodsFunction · 0.85

Calls 2

IsUnionTypeExpressionFunction · 0.85
UnionTypeArgsFunction · 0.85

Tested by 1

TestRelTypeMethodsFunction · 0.68