diff --git a/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala b/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala index 7e8f21e1..ced7637a 100644 --- a/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala +++ b/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala @@ -15,6 +15,7 @@ object Scala { case StringTerm(s, _) => Lit.String(s) case SymbolTerm(s, _) => Lit.Symbol(Symbol(s)) case BooleanTerm(b, _) => Lit.Boolean(b) + case UnitTerm(_) => Lit.Unit() case _ => throw new NotImplementedError(s"not implemented ${term.getClass.getName} $term") } diff --git a/syntax/src/main/scala/chester/syntax/core/Term.scala b/syntax/src/main/scala/chester/syntax/core/Term.scala index 5a0da5cc..7c869451 100644 --- a/syntax/src/main/scala/chester/syntax/core/Term.scala +++ b/syntax/src/main/scala/chester/syntax/core/Term.scala @@ -1230,11 +1230,17 @@ case class Annotation( } } -// TODO: tuple? def UnitType(meta: OptionTermMeta) = - ObjectType(Vector.empty, meta = meta) -def UnitTerm(meta: OptionTermMeta) = - ObjectTerm(Vector.empty, meta = meta) + TupleType(Vector.empty, meta = meta) +object UnitTerm { + def unapply(x: Any): Option[OptionTermMeta] = x match { + case TupleTerm(Vector(), meta) => Some(meta) + case _ => None + } + def apply(meta: OptionTermMeta) = + TupleTerm(Vector.empty, meta = meta) + +} case class FieldTerm( name: Name,