Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Dec 28, 2024
1 parent d2deebb commit 4091d8a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object Scala {
case StringTerm(s, _) => meta.Lit.String(s)
case SymbolTerm(s, _) => meta.Lit.Symbol(Symbol(s))
case BooleanTerm(b, _) => meta.Lit.Boolean(b)
case UnitTerm_(_) => meta.Lit.Unit()
case UnitTerm_(_) => meta.Lit.Unit()
case _ => throw new NotImplementedError(s"not implemented ${term.getClass.getName} $term")
}
def compileTy(ty: Term)(implicit ctx: ScalaContext = null): meta.Type = ty match {
Expand Down
3 changes: 0 additions & 3 deletions syntax/shared/src/main/scala/chester/syntax/core/simple.scala
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package chester.syntax.core
import chester.doc.*
import chester.error.*
import chester.error.ProblemUpickle.*
import chester.utils.given
import chester.utils.impls.*
import upickle.default.*
import cats.data.*
import chester.doc.const.*
import chester.error.Problem
import chester.syntax.*
import chester.syntax.core.spec.spec.*
import chester.uniqid.*
import chester.utils.*
import chester.utils.doc.*
import spire.math.*
import scala.collection.immutable.HashMap
object simple {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,8 @@ object spec {
def newLocalV(name: Name, ty: Term, uniqId: UniqidOf[LocalVC[Term]], meta: OptionTermMeta): ThisTree
}

implicit def conversionTop[Term <: TermT[Term], ToplevelV <: ToplevelVC[Term]](x: UniqidOf[ToplevelVC[Term]]): UniqidOf[ToplevelV] = x.asInstanceOf[UniqidOf[ToplevelV]]
implicit def conversionTop[Term <: TermT[Term], ToplevelV <: ToplevelVC[Term]](x: UniqidOf[ToplevelVC[Term]]): UniqidOf[ToplevelV] =
x.asInstanceOf[UniqidOf[ToplevelV]]

trait LocalVC[Term <: TermT[Term]] extends ReferenceCallC[Term] {
override type ThisTree <: LocalVC[Term]
Expand Down Expand Up @@ -1800,6 +1801,6 @@ object spec {
)
}


implicit inline def effectsMConv[Term<:TermT[Term],EffectsM<:EffectsMT[Term]](x: Option[EffectsMT[Term]]): Option[EffectsM] = x.asInstanceOf[Option[EffectsM]]
implicit inline def effectsMConv[Term <: TermT[Term], EffectsM <: EffectsMT[Term]](x: Option[EffectsMT[Term]]): Option[EffectsM] =
x.asInstanceOf[Option[EffectsM]]
}
20 changes: 5 additions & 15 deletions syntax/shared/src/main/scala/chester/syntax/core/utils.scala
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
package chester.syntax.core

import chester.doc.*
import chester.error.*
import chester.error.ProblemUpickle.*
import chester.utils.given
import chester.utils.impls.*
import upickle.default.*

import scala.language.implicitConversions
import cats.data.*
import chester.doc.const.*
import chester.error.Problem
import chester.syntax.*
import chester.syntax.core.spec.spec.*
import chester.uniqid.*
import chester.utils.*
import chester.utils.doc.*
import spire.math.*

import scala.collection.immutable.HashMap

Expand All @@ -29,7 +19,7 @@ def UnitType(meta: OptionTermMeta): TupleType =
object UnitTerm_ {
def unapply(x: Any): Option[OptionTermMeta] = x match {
case TupleTerm(Vector(), meta) => Some(meta)
case _ => None
case _ => None
}

def apply(meta: OptionTermMeta): TupleTerm =
Expand All @@ -49,9 +39,9 @@ object AbstractIntTerm_ {
else IntegerTerm(value, meta)

def unapply(term: Term): Option[BigInt] = term match {
case IntTerm(value, _) => Some(BigInt(value))
case IntTerm(value, _) => Some(BigInt(value))
case IntegerTerm(value, _) => Some(value)
case _ => None
case _ => None
}
}

Expand Down Expand Up @@ -88,7 +78,7 @@ object Intersection_ {
def from(xs: Vector[Term]): Term = {
val flattened = xs.flatMap {
case Intersection(ys, _) => ys
case x => Vector(x)
case x => Vector(x)
}.distinct
if (flattened.size == 1) return flattened.head
new Intersection(flattened.assumeNonEmpty, None)
Expand All @@ -101,7 +91,7 @@ object Union_ {
val flattened = xs
.flatMap {
case Union(ys, _) => ys
case x => Vector(x)
case x => Vector(x)
}
.distinct
.filter(x => !x.isInstanceOf[NothingType])
Expand Down

0 comments on commit 4091d8a

Please sign in to comment.