Package dev.cel.checker
Class InferenceContext
- java.lang.Object
-
- dev.cel.checker.InferenceContext
-
@Internal public class InferenceContext extends java.lang.Object
An object holding a context for type inference.Consists of a type substitution and a generator for free type variables in the context, as well as methods to work with the context.
CEL Library Internals. Do Not Use.
-
-
Constructor Summary
Constructors Constructor Description InferenceContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CelTypefinalize(CelType type)Finalizes the given type by applying the current type substitution and mapping all remaining type parameters to DYN.booleanisAssignable(CelType type1, CelType type2)Checks whether type1 is assignable to type2 under refinement of the type substitution.booleanisAssignable(java.util.List<CelType> list1, java.util.List<CelType> list2)Same asisAssignable(CelType, CelType)for lists of types.CelTypenewInstance(java.lang.Iterable<java.lang.String> typeParams, CelType type)Returns an instance of the given type where all given type parameters are replaced by fresh type variables.CelTypenewTypeVar(java.lang.String prefix)Creates a fresh type variable in the given context.CelTypespecialize(CelType type)Specializes the given type using the substitution of this context.java.util.List<CelType>specialize(java.util.List<CelType> types)Specializes using given type list of types using the substitution of this context.
-
-
-
Method Detail
-
newTypeVar
public CelType newTypeVar(java.lang.String prefix)
Creates a fresh type variable in the given context.
-
newInstance
public CelType newInstance(java.lang.Iterable<java.lang.String> typeParams, CelType type)
Returns an instance of the given type where all given type parameters are replaced by fresh type variables.
-
isAssignable
@CanIgnoreReturnValue public boolean isAssignable(CelType type1, CelType type2)
Checks whether type1 is assignable to type2 under refinement of the type substitution. Returns true on success, and false on failure. The substitution in the type context will not be modified on failure.
-
isAssignable
public boolean isAssignable(java.util.List<CelType> list1, java.util.List<CelType> list2)
Same asisAssignable(CelType, CelType)for lists of types.
-
specialize
public CelType specialize(CelType type)
Specializes the given type using the substitution of this context.
-
specialize
public java.util.List<CelType> specialize(java.util.List<CelType> types)
Specializes using given type list of types using the substitution of this context.
-
-