Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint fixes for various doc comments #562

Merged
merged 1 commit into from Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cel/decls.go
Expand Up @@ -165,7 +165,7 @@ type Type struct {
isAssignableRuntimeType func(other ref.Type) bool
}

// IsAssignableFrom determines whether the current type is type-check assignable from the input fromType.
// IsAssignableType determines whether the current type is type-check assignable from the input fromType.
func (t *Type) IsAssignableType(fromType *Type) bool {
if t.isAssignableType != nil {
return t.isAssignableType(fromType)
Expand Down
4 changes: 4 additions & 0 deletions cel/env.go
Expand Up @@ -61,13 +61,17 @@ func (ast *Ast) SourceInfo() *exprpb.SourceInfo {

// ResultType returns the output type of the expression if the Ast has been type-checked, else
// returns decls.Dyn as the parse step cannot infer the type.
//
// Deprecated: use OutputType
func (ast *Ast) ResultType() *exprpb.Type {
if !ast.IsChecked() {
return decls.Dyn
}
return ast.typeMap[ast.expr.GetId()]
}

// OutputType returns the output type of the expression if the Ast has been type-checked, else
// returns cel.DynType as the parse step cannot infer types.
func (ast *Ast) OutputType() *Type {
t, err := ExprTypeToType(ast.ResultType())
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion cel/macro.go
Expand Up @@ -20,6 +20,10 @@ import (
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)

// Macro describes a function signature to match and the MacroExpander to apply.
//
// Note: when a Macro should apply to multiple overloads (based on arg count) of a given function,
// a Macro should be created per arg-count or as a var arg macro.
type Macro = parser.Macro

// MacroExpander converts a call and its associated arguments into a new CEL abstract syntax tree, or an error
Expand Down Expand Up @@ -85,7 +89,7 @@ func MapMacroExpander(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.E
return parser.MakeMap(meh, target, args)
}

// MakeFilter expands the input call arguments into a comprehension which produces a list which contains
// FilterMacroExpander expands the input call arguments into a comprehension which produces a list which contains
// only elements which match the provided predicate expression:
// <iterRange>.filter(<iterVar>, <predicate>)
func FilterMacroExpander(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
Expand Down
2 changes: 1 addition & 1 deletion parser/macro.go
Expand Up @@ -284,7 +284,7 @@ const (
quantifierExistsOne
)

// MakeExists expands the input call arguments into a comprehension that returns true if all of the
// MakeAll expands the input call arguments into a comprehension that returns true if all of the
// elements in the range match the predicate expressions:
// <iterRange>.all(<iterVar>, <predicate>)
func MakeAll(eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
Expand Down