Skip to content
Snippets Groups Projects
Commit f9daa0d7 authored by Nicolas Voirol's avatar Nicolas Voirol
Browse files

Ordering on characters

parent a81517e5
No related branches found
No related tags found
No related merge requests found
...@@ -466,25 +466,33 @@ trait Expressions { self: Trees => ...@@ -466,25 +466,33 @@ trait Expressions { self: Trees =>
/** $encodingof `... < ...`*/ /** $encodingof `... < ...`*/
case class LessThan(lhs: Expr, rhs: Expr) extends Expr with CachingTyped { case class LessThan(lhs: Expr, rhs: Expr) extends Expr with CachingTyped {
protected def computeType(implicit s: Symbols): Type = protected def computeType(implicit s: Symbols): Type =
if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType else Untyped if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType
else if (lhs.getType == CharType && rhs.getType == CharType) BooleanType
else Untyped
} }
/** $encodingof `... > ...`*/ /** $encodingof `... > ...`*/
case class GreaterThan(lhs: Expr, rhs: Expr) extends Expr with CachingTyped{ case class GreaterThan(lhs: Expr, rhs: Expr) extends Expr with CachingTyped{
protected def computeType(implicit s: Symbols): Type = protected def computeType(implicit s: Symbols): Type =
if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType else Untyped if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType
else if (lhs.getType == CharType && rhs.getType == CharType) BooleanType
else Untyped
} }
/** $encodingof `... <= ...`*/ /** $encodingof `... <= ...`*/
case class LessEquals(lhs: Expr, rhs: Expr) extends Expr with CachingTyped { case class LessEquals(lhs: Expr, rhs: Expr) extends Expr with CachingTyped {
protected def computeType(implicit s: Symbols): Type = protected def computeType(implicit s: Symbols): Type =
if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType else Untyped if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType
else if (lhs.getType == CharType && rhs.getType == CharType) BooleanType
else Untyped
} }
/** $encodingof `... >= ...`*/ /** $encodingof `... >= ...`*/
case class GreaterEquals(lhs: Expr, rhs: Expr) extends Expr with CachingTyped { case class GreaterEquals(lhs: Expr, rhs: Expr) extends Expr with CachingTyped {
protected def computeType(implicit s: Symbols): Type = protected def computeType(implicit s: Symbols): Type =
if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType else Untyped if (numericType(lhs.getType, rhs.getType) != Untyped) BooleanType
else if (lhs.getType == CharType && rhs.getType == CharType) BooleanType
else Untyped
} }
......
...@@ -254,6 +254,7 @@ trait Printers { ...@@ -254,6 +254,7 @@ trait Printers {
case BagAdd(b, e) => p"$b + $e" case BagAdd(b, e) => p"$b + $e"
case MultiplicityInBag(e, b) => p"$b($e)" case MultiplicityInBag(e, b) => p"$b($e)"
case MapApply(m, k) => p"$m($k)" case MapApply(m, k) => p"$m($k)"
case MapUpdated(m, k, v) => p"$m.updated($k, $v)"
case Not(expr) => p"\u00AC$expr" case Not(expr) => p"\u00AC$expr"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment