orc.type
Class TypingContext

java.lang.Object
  extended by orc.type.TypingContext

public class TypingContext
extends java.lang.Object

The context used by the typechecker. Subsumes the variable typing context and the type binding stack, each of which is accessed using a different method. Also internalizes kinding checks, providing separate lookupType and lookupTycon methods on the type binding stack.

Author:
dkitchin

Field Summary
protected  Config config
           
protected  InferenceContinuation ic
           
protected  Env<Type> typeContext
           
protected  Env<Type> varContext
           
 
Constructor Summary
TypingContext()
           
TypingContext(Config config)
           
TypingContext(Env<Type> varContext, Env<Type> typeContext, Config config)
           
TypingContext(Env<Type> varContext, Env<Type> typeContext, Config config, InferenceContinuation ic)
           
 
Method Summary
 TypingContext bindIC(InferenceContinuation ic)
           
 TypingContext bindType(Type T)
           
 TypingContext bindVar(Type T)
           
 Type lookupType(int var)
          Find the binding for this type variable.
 Type lookupVar(int var)
          Find the binding for this program variable.
 Type promote(Type t)
           
 java.util.List<Type> promoteAll(java.util.List<Type> ts)
           
 Type requestInference(ArrowType arrowType)
           
 Type resolveClassType(java.lang.String classname)
           
 Type resolveSiteType(java.lang.String classname)
           
 Type subst(Type T)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

varContext

protected Env<Type> varContext

typeContext

protected Env<Type> typeContext

config

protected Config config

ic

protected InferenceContinuation ic
Constructor Detail

TypingContext

public TypingContext()

TypingContext

public TypingContext(Config config)

TypingContext

public TypingContext(Env<Type> varContext,
                     Env<Type> typeContext,
                     Config config)

TypingContext

public TypingContext(Env<Type> varContext,
                     Env<Type> typeContext,
                     Config config,
                     InferenceContinuation ic)
Method Detail

lookupVar

public Type lookupVar(int var)
Find the binding for this program variable.

Parameters:
var -
Returns:
The type of var in this context

lookupType

public Type lookupType(int var)
Find the binding for this type variable.

Parameters:
var -
Returns:
The type of var in this context

bindVar

public TypingContext bindVar(Type T)

bindType

public TypingContext bindType(Type T)

bindIC

public TypingContext bindIC(InferenceContinuation ic)

resolveSiteType

public Type resolveSiteType(java.lang.String classname)
                     throws TypeException
Throws:
TypeException

resolveClassType

public Type resolveClassType(java.lang.String classname)
                      throws TypeException
Throws:
TypeException

subst

public Type subst(Type T)
           throws TypeException
Throws:
TypeException

promote

public Type promote(Type t)
             throws TypeException
Throws:
TypeException

promoteAll

public java.util.List<Type> promoteAll(java.util.List<Type> ts)
                                throws TypeException
Throws:
TypeException

requestInference

public Type requestInference(ArrowType arrowType)
                      throws TypeException
Throws:
TypeException