Newer
Older
zweic / sources / zweic / Type.scala
@glproj03 glproj03 on 20 Dec 2005 815 bytes new files part 4
/*  zweic -- a compiler for zwei
 *
 *  Stephane Micheloud & LAMP
 *
 *  $Id$
 */

package zweic;

// Internal type
abstract class Type {

  override def toString(): String = this match {
    // ... à compléter ...
    case IBadType => "<Bad>"
  }

  def isSubtype(that: Type): Boolean = Pair(this, that) match {
    // ... à compléter ...
    case _ => false
  }

  def isSametype(that: Type): Boolean = Pair(this, that) match {
    // ... à compléter ...
    case _ => false
  }

  def lub(that: Type): Option[Type] = Pair(this, that) match {
    // ... à compléter ...
    case _ => None
  }

}

// Class type
case class IClassType(c: ClassSymbol) extends Type;

// Integer type
case object IIntType extends Type;

// Null type
case object INullType extends Type;

// Bad type
case object IBadType extends Type;