Package de.monticore.types.check
Class SymTypeExpression
java.lang.Object
de.monticore.types.check.SymTypeExpression
- All Implemented Interfaces:
Comparable<SymTypeExpression>
- Direct Known Subclasses:
SymTypeArray,SymTypeInferenceVariable,SymTypeObscure,SymTypeOfFunction,SymTypeOfGenerics,SymTypeOfIntersection,SymTypeOfNull,SymTypeOfNumericWithSIUnit,SymTypeOfObject,SymTypeOfRegEx,SymTypeOfSIUnit,SymTypeOfTuple,SymTypeOfUnion,SymTypeOfWildcard,SymTypePrimitive,SymTypeVariable,SymTypeVoid
SymTypeExpression is the superclass for all typeexpressions, such as
TypeConstants, TypeVariables and applications of Type-Constructors.
It shares common functionality
(such as comparison, printing)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<FunctionSymbol> Deprecated, for removal: This API element is subject to removal in a future version.protected static final Stringprotected SymTypeSourceInfoprotected TypeSymbolDeprecated, for removal: This API element is subject to removal in a future version.TypeSymbols are to be found in the corresponding subclasses, however, not every subclass will have a type symbol -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid_internal_setSourceInfo(SymTypeSourceInfo sourceInfo) used during deep-cloning, clones the SymTypeSourceInfovoidaccept(ISymTypeVisitor visitor) intabstract booleangetCorrectFields(String fieldName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version.protected List<VariableSymbol> getCorrectFields(String fieldName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.getCorrectMethods(String methodName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version.protected List<FunctionSymbol> getCorrectMethods(String methodName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.getFieldList(String fieldName, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version.getFieldList(String fieldName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version.getFieldList(String fieldName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.getFieldList(String fieldName, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.getMethodList(String methodName, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version.getMethodList(String methodName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version.getMethodList(String methodName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.getMethodList(String methodname, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.Contains information where this SymTypeExpression comes from.Returns an TypeSymbol representing the type Only to be called according tohasTypeInfo()booleanWhether we can call getTypeInfobooleanAm I an array?booleanAm I a function type (e.g.booleanAm I a generic type? (such as"List<Integer>")booleanAm I a free type variable?booleanAm I an intersection type (e.g.booleanAm I of null type?booleanAm I a numeric with SIUnit type (e.g.,"[km/h]<float>")booleanAm I an object type? (e.g.booleanCan I not have a type derived from (e.g.booleanAm I primitive? (such as "int") (default: no)booleanAm I a regex type (e.g.booleanAm I an SIUnit type (e.g., "[km/h]")booleanAm I a tuple type (e.g.booleanAm I a bound type variable?booleanAm I an union type (e.g.booleanDeprecated, for removal: This API element is subject to removal in a future version.not well-thought-out and unusedbooleanAm I of void type?booleanAm I a wildcard (s.print()print: Conversion to a compact string, such as"int","Person","List< A >"protected StringprintAsJson: Umwandlung in einen kompakten Json StringprintFullName: prints the full name of the symbol, such as"java.util.List<java.lang.String>"voidreplaceTypeVariables(Map<TypeVarSymbol, SymTypeExpression> replaceMap) Deprecated, for removal: This API element is subject to removal in a future version.protected List<VariableSymbol> transformFieldList(String fieldName, List<VariableSymbol> fields) Deprecated, for removal: This API element is subject to removal in a future version.protected List<FunctionSymbol> transformMethodList(String methodName, List<FunctionSymbol> functions) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
LOG_NAME
- See Also:
-
functionList
Deprecated, for removal: This API element is subject to removal in a future version. -
typeSymbol
Deprecated, for removal: This API element is subject to removal in a future version.TypeSymbols are to be found in the corresponding subclasses, however, not every subclass will have a type symbol -
sourceInfo
-
-
Constructor Details
-
SymTypeExpression
public SymTypeExpression()
-
-
Method Details
-
print
print: Conversion to a compact string, such as"int","Person","List< A >" -
printFullName
printFullName: prints the full name of the symbol, such as"java.util.List<java.lang.String>"- Returns:
-
printAsJson
printAsJson: Umwandlung in einen kompakten Json String -
isValidType
Deprecated, for removal: This API element is subject to removal in a future version.not well-thought-out and unusedAm I a not valid type? e.g. unknown type, not all type variables set, pseudo types like typeVariables -
isPrimitive
public boolean isPrimitive()Am I primitive? (such as "int") (default: no) -
asPrimitive
-
isGenericType
public boolean isGenericType()Am I a generic type? (such as"List<Integer>") -
asGenericType
-
isTypeVariable
public boolean isTypeVariable()Am I a bound type variable? -
asTypeVariable
-
isInferenceVariable
public boolean isInferenceVariable()Am I a free type variable? -
asInferenceVariable
-
isArrayType
public boolean isArrayType()Am I an array? -
asArrayType
-
isVoidType
public boolean isVoidType()Am I of void type? -
asVoidType
-
isNullType
public boolean isNullType()Am I of null type? -
asNullType
-
isObjectType
public boolean isObjectType()Am I an object type? (e.g. "String", "Person") -
asObjectType
-
isRegExType
public boolean isRegExType()Am I a regex type (e.g. 'R"rege(x(es)?|xps?)"') -
asRegExType
-
isFunctionType
public boolean isFunctionType()Am I a function type (e.g."String -> Integer") -
asFunctionType
-
isSIUnitType
public boolean isSIUnitType()Am I an SIUnit type (e.g., "[km/h]") -
asSIUnitType
-
isNumericWithSIUnitType
public boolean isNumericWithSIUnitType()Am I a numeric with SIUnit type (e.g.,"[km/h]<float>") -
asNumericWithSIUnitType
-
isTupleType
public boolean isTupleType()Am I a tuple type (e.g. "(String, int)") -
asTupleType
-
isUnionType
public boolean isUnionType()Am I an union type (e.g. "(A|B)")? -
asUnionType
-
isIntersectionType
public boolean isIntersectionType()Am I an intersection type (e.g."(A&B)") -
asIntersectionType
-
isObscureType
public boolean isObscureType()Can I not have a type derived from (e.g. "1 - student")? -
asObscureType
-
isWildcard
public boolean isWildcard()Am I a wildcard (s. generics)? -
asWildcard
-
deepClone
-
deepEquals
-
compareTo
- Specified by:
compareToin interfaceComparable<SymTypeExpression>
-
getMethodList
@Deprecated(forRemoval=true) public List<FunctionSymbol> getMethodList(String methodName, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version. -
getMethodList
@Deprecated(forRemoval=true) public List<FunctionSymbol> getMethodList(String methodname, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.returns the list of methods the SymTypeExpression can access and filters these for a method with specific name the last calculated type in the type check was no type -
getCorrectMethods
@Deprecated(forRemoval=true) public List<FunctionSymbol> getCorrectMethods(String methodName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version. -
getCorrectMethods
@Deprecated(forRemoval=true) protected List<FunctionSymbol> getCorrectMethods(String methodName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.return the correct methods for the two situations: 1) the last calculated type in the type check was a type, then filter for non-static methods and add the static methods of this type 2) the last calculated type in the type check was an instance, then just resolve for methods- Parameters:
methodName- name of the method we search forouterIsType- true if last result of type check was type, false if it was an instanceabstractTc- true if the tc is not used for object-oriented languages- Returns:
- the correct methods for the specific case
-
transformMethodList
@Deprecated(forRemoval=true) protected List<FunctionSymbol> transformMethodList(String methodName, List<FunctionSymbol> functions) Deprecated, for removal: This API element is subject to removal in a future version.transforms the methods by replacing their type variables with the actual type arguments- Parameters:
methodName- name of the method we search forfunctions- methods that need to be transformed- Returns:
- transformed methods
-
replaceTypeVariables
@Deprecated(forRemoval=true) public void replaceTypeVariables(Map<TypeVarSymbol, SymTypeExpression> replaceMap) Deprecated, for removal: This API element is subject to removal in a future version. -
getMethodList
@Deprecated(forRemoval=true) public List<FunctionSymbol> getMethodList(String methodName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version. -
getMethodList
@Deprecated(forRemoval=true) public List<FunctionSymbol> getMethodList(String methodName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.returns the correct methods in both cases: 1) the last result was a type, 2) the last result was an instance- Parameters:
methodName- name of the method we search forouterIsType- true if the last result was a type, false if it was an instance- Returns:
- the correct methods for the specific case
-
getFieldList
@Deprecated(forRemoval=true) public List<VariableSymbol> getFieldList(String fieldName, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version. -
getFieldList
@Deprecated(forRemoval=true) public List<VariableSymbol> getFieldList(String fieldName, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.returns the list of fields the SymTypeExpression can access and filters these for a field with specific name -
getFieldList
@Deprecated(forRemoval=true) public List<VariableSymbol> getFieldList(String fieldName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version. -
getFieldList
@Deprecated(forRemoval=true) public List<VariableSymbol> getFieldList(String fieldName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.returns the correct fields in both cases: 1) the last result was a type, 2) the last result was an instance- Parameters:
fieldName- name of the field we search forouterIsType- true if the last result was a type, false if it was an instance- Returns:
- the correct fields for the specific case
-
getCorrectFields
@Deprecated(forRemoval=true) public List<VariableSymbol> getCorrectFields(String fieldName, boolean outerIsType, boolean abstractTc) Deprecated, for removal: This API element is subject to removal in a future version. -
getCorrectFields
@Deprecated(forRemoval=true) protected List<VariableSymbol> getCorrectFields(String fieldName, boolean outerIsType, boolean abstractTc, de.monticore.symboltable.modifiers.AccessModifier modifier) Deprecated, for removal: This API element is subject to removal in a future version.return the correct fields for the two situations: 1) the last calculated type in the type check was a type, then filter for non-static fields and add the static fields of this type 2) the last calculated type in the type check was an instance, then just resolve for fields- Parameters:
fieldName- name of the field we search forouterIsType- true if last result of type check was type, false if it was an instance- Returns:
- the correct fields for the specific case
-
transformFieldList
@Deprecated(forRemoval=true) protected List<VariableSymbol> transformFieldList(String fieldName, List<VariableSymbol> fields) Deprecated, for removal: This API element is subject to removal in a future version.transforms the fields by replacing their type variables with the actual type arguments- Parameters:
fieldName- name of the field we search forfields- fields that need to be transformed- Returns:
- transformed fields
-
hasTypeInfo
public boolean hasTypeInfo()Whether we can call getTypeInfo -
getTypeInfo
Returns an TypeSymbol representing the type Only to be called according tohasTypeInfo()As most SymTypeExpressions do not have a TypeSymbol (this is legacy), this method will log a warning and is expected to be overridden, if a TypeSymbol exists.
-
getSourceInfo
Contains information where this SymTypeExpression comes from. Used in CoCos, code-generation, etc.not considered during
deepEquals(SymTypeExpression). -
_internal_setSourceInfo
used during deep-cloning, clones the SymTypeSourceInfo -
accept
-