Package org.eclipse.xtext.xbase.typesystem.computation
This package contains the primary hooks for the actual type computation in Xbase
as well as their respective base implementations.
Sensible entry points to explore are these interfaces.
ITypeComputer
- The primary SPI. Clients implement this interface in order to compute types or expressions. This is pretty much the only interface that is expected to be implemented by clients. It is highly recommend to inherit from thedefault implementation
.ITypeComputationState
- The state is passed around during the computation process. It allows to define expectations for child expressions and trigger their type inference. Other aspects are validation, querying for the current expected type and adding elements to the scope.ITypeExpectation
- One of the currently expected types. This can be evaluated in order to compute a type which depends on the current context, e.g. astring
with one character may be aCharacter
,char
orstring
.ITypeComputationResult
- The (possibly intermediate) result of a type computation for an expression. It offers a means to query for the expected type which is the one that was finally picked from all expectations for that expression.
SynonymTypesProvider
- Registers automatic conversions of existing types to others that do not depend on the current context. By default these include conversions fromiterables
to arrays and vice versa as well as boxing and unboxing semantics for primitives. Synonyms are not considered to be retrieved for demand conversions, e.g. function type conversion.NumberLiterals
- Type computation forXNumberLiteral
, e.g. which sort of concrete syntax may yield aBigDecimal
orBigInteger
.ClosureTypeComputer
- The type computation oflambda expressions
is implemented in this utility.
Linking candidates
- These implement the Java'ish logic for feature linking in combination with extension method semantics, precedences and the like.ITypeAssigner
- The type assigner allows to bulk-assign local variables that are defined on the same level. Good use cases includeparameters
of lambdas or methods.ClosureTypeComputer
- The type computation oflambda expressions
is implemented in this utility.
-
Interface Summary Interface Description IAmbiguousLinkingCandidate A linking candidate may be ambiguous if the passed arguments do match multiple candidates equally well.IApplicableCandidate A candidate encapsulates intermediate computation results.IClosureCandidate A closure candidate knows about the assumptions that have been made about a lambda expression regarding the implicitly available parameters.IConstructorLinkingCandidate A constructor linking candidate represents an actual or a possible value of aconstructor call
.IFeatureLinkingCandidate Exposes additional information about the linked feature if the to-be-linked instance is anXAbstractFeatureCall
.ILinkingCandidate A linking candidate encapsulates a linked feature.ISuspiciouslyOverloadedCandidate A linking candidate may be overloaded by other candidates from different implicit receivers.ITypeAssigner Allows to bulk-assign types foridentifiable elements
, e.g.ITypeComputationResult The result of the type computation for a given expression.ITypeComputationState The current state of the type computation.ITypeComputer The type computer is the central component when it comes to type inferrence forexpressions
.ITypeExpectation -
Class Summary Class Description AbstractClosureTypeHelper Base strategy to compute the type of lambda expressions.AbstractTypeComputer Base class for type computers, e.g.ClosureTypeComputer Externalized strategy for closure type computation which allows for easier unit testing.ClosureWithExpectationHelper Strategy to compute types for lambda expression that do have an expected type.ClosureWithoutExpectationHelper Strategy to compute types for lambda expression that do not have an expected type or that have an expected type which is not a SAM type.CollectionLiteralsTypeComputer Utility that helps to compute the type for collection literals.DiagnosticOnFirstKeyword ElementOrComponentTypeComputer A small utility that allows to query an arbitrary type reference for the value that is bound to the type parameterT
ofjava.lang.Iterable<T>
.EnumLiteralImporter Imports the enum literals that are defined in a given enum type statically.NumberLiterals ResolvingTypeParameterHintCollector If this collector encounters an unbound type reference that was already resolved internally or transitively, it'll use the resolved version of that reference.SynonymTypesProvider TheSynonymTypesProvider
allows to define automatic conversion rules for specific types.SynonymTypesProvider.Acceptor Clients of theSynonymTypesProvider
may use a custom acceptor to handle the available synonym types.UnknownClosureTypeHelper XbaseTypeComputer Base implementation for theITypeComputer
.XbaseTypeComputer.BranchExpressionProcessor