orc.ast.oil.type
Class Type

java.lang.Object
  extended by orc.ast.oil.type.Type
Direct Known Subclasses:
ArrowType, Bot, ClassType, Datatype, InferredType, PolymorphicTypeAlias, SiteType, Top, TupleType, TypeApplication, TypeVariable

public abstract class Type
extends java.lang.Object

Abstract superclass of syntactic types in the OIL AST. Within the OIL AST, bound type variables are represented by deBruijn indices, a serializable name-free representation. 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. The promote method converts a syntactic OIL type to a form that the typechecker can use. Types from within the typechecker may be embedded within OIL using an InferredType; however, these are temporary placeholders only, and are erased by XML serialization. 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.

Author:
dkitchin

Field Summary
static Type BOT
           
static Type TOP
           
 
Constructor Summary
Type()
           
 
Method Summary
abstract  boolean equals(java.lang.Object obj)
           
abstract  int hashCode()
           
static java.util.List<Type> inferredTypes(java.util.List<Type> argTypes)
           
abstract  Type marshal()
          Convert this type into an XML-isomorphic format for serialization.
static Type[] marshalAll(java.util.List<Type> ts)
          Convenience method, to marshal a list of types.
abstract  Type transform(TypingContext ctx)
          Convert this syntactic type into an actual type, given an appropriate type context
static java.util.List<Type> transformAll(java.util.List<Type> ts, TypingContext ctx)
          Convenience method, to transform a list of types.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP

public static final Type TOP

BOT

public static final Type BOT
Constructor Detail

Type

public Type()
Method Detail

hashCode

public abstract int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

transform

public abstract Type transform(TypingContext ctx)
                        throws TypeException
Convert this syntactic type into an actual type, given an appropriate type context

Parameters:
ctx - TODO
Returns:
A new node.
Throws:
TypeException - TODO

marshal

public abstract Type marshal()
Convert this type into an XML-isomorphic format for serialization.


marshalAll

public static Type[] marshalAll(java.util.List<Type> ts)
Convenience method, to marshal a list of types.


transformAll

public static java.util.List<Type> transformAll(java.util.List<Type> ts,
                                                TypingContext ctx)
                                         throws TypeException
Convenience method, to transform a list of types.

Parameters:
ts - A list of types
ctx - TODO
Returns:
The list of types, converted
Throws:
TypeException

inferredTypes

public static java.util.List<Type> inferredTypes(java.util.List<Type> argTypes)
Parameters:
argTypes -
Returns:
inferred type