|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orc.ast.simple.type.Type
public abstract class Type
Abstract superclass of syntactic types in the simple AST. Within the simple AST, bound type variables are represented by objects (TypeVariable), rather than strings (NamedType). Free type variables may still occur (FreeTypeVariable), but they must be eliminated before conversion to the next AST stage. Syntactic types occur in all of the AST forms. The typechecker converts them to a different form (subclasses of orc.type.Type) for its own internal use. Syntactic types do not have methods like meet, join, and subtype; only their typechecker counterparts do. Thus, syntactic types permit only the simplest analyses; more complex analyses must wait until the syntactic type is converted within the typechecker. All syntactic types can be written explicitly in a program, whereas many of the typechecker's internal types are not representable in programs.
Field Summary | |
---|---|
static Type |
BOT
|
static Type |
TOP
|
Constructor Summary | |
---|---|
Type()
|
Method Summary | |
---|---|
abstract Type |
convert(Env<TypeVariable> env)
Convert this syntactic type into an actual type, given an appropriate type context |
static java.util.List<Type> |
convertAll(java.util.List<Type> ts,
Env<TypeVariable> env)
Convenience method, to apply convert to a list of types. |
Type |
subMap(java.util.Map<FreeTypeVariable,Type> m)
Perform a set of substitutions defined by a map. |
abstract Type |
subst(Type T,
FreeTypeVariable X)
Performs the substitution [T/X], replacing occurrences of the free type variable X with the type T (which could be any type, including another variable). |
static java.util.List<Type> |
substAll(java.util.List<Type> ts,
Type T,
FreeTypeVariable X)
Convenience method, to apply a substitution to a list of types. |
static Type |
substMaybe(Type target,
Type T,
FreeTypeVariable X)
|
Type |
subvar(TypeVariable U,
FreeTypeVariable X)
Performs the substitution [U/X], replacing occurrences of the free type variable X with the nameless type variable U. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Type TOP
public static final Type BOT
Constructor Detail |
---|
public Type()
Method Detail |
---|
public abstract Type convert(Env<TypeVariable> env) throws TypeException
env
- The type environment, used in content addressable mode to
find the appropriate deBruijn index of a type variable.
TypeException
public static java.util.List<Type> convertAll(java.util.List<Type> ts, Env<TypeVariable> env) throws TypeException
ts
- A list of typesenv
- Environment for conversion
TypeException
public abstract Type subst(Type T, FreeTypeVariable X)
T
- The replacing typeX
- The free type variable whose occurrences will be replaced
public static java.util.List<Type> substAll(java.util.List<Type> ts, Type T, FreeTypeVariable X)
public static Type substMaybe(Type target, Type T, FreeTypeVariable X)
public Type subvar(TypeVariable U, FreeTypeVariable X)
U
- The replacing type variableX
- The free type variable whose occurrences will be replaced
public Type subMap(java.util.Map<FreeTypeVariable,Type> m)
m
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |