Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Oct 27, 2024
1 parent 6223119 commit fce400e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ThisBuild / organization := "com.github.chester-lang"

addCommandAlias("testAll", "rootJVM/test ; rootJS/test ; rootNative/test")

addCommandAlias("format0", "scalafmtAll ; scalafmtSbt ; rootJVM/scalafixAll")
addCommandAlias("format", "scalafmtAll ; scalafmtSbt ; scalafixAll")
addCommandAlias("fmt", "scalafmtAll ; scalafmtSbt")
inThisBuild(
Expand Down
2 changes: 1 addition & 1 deletion cli/shared/src/main/scala/chester/cli/CLI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class CLI[F[_]](using
def formatFiles(files: Seq[String]): F[Unit] = {
for {
_ <- IO.println(s"Formatting files: ${files.mkString(", ")}")
_ <- IO.println(s"WIP")
_ <- IO.println("WIP")
_ <- Runner.pure(())
} yield ()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package chester.truffle.node

import chester.syntax.TreeMap
import chester.syntax.core.Term
import chester.syntax.core.TermT
import com.oracle.truffle.api.frame.VirtualFrame
import scala.Function1

abstract class TermNode extends ChesterNode with TermT[TermNode] {
def executeGeneric(frame: VirtualFrame): AnyRef
Expand Down
3 changes: 1 addition & 2 deletions syntax/src/main/scala/chester/syntax/Tree.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package chester.syntax

import chester.syntax.core.Term
import chester.utils.reuse

trait Tree[RootTree <: Tree[RootTree]] extends Any {
Expand All @@ -22,7 +21,7 @@ trait Tree[RootTree <: Tree[RootTree]] extends Any {
)
final def descent2(f: TreeMap[RootTree]): ThisTree = descent(
{ x =>
implicit val ev33 = ev3(using x)
implicit val ev33: ThisTree <:< RootTree = ev3(using x)
f.use(x)
},
f
Expand Down
20 changes: 10 additions & 10 deletions syntax/src/main/scala/chester/syntax/core/Term.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ case class CallingArgTerm(
meta: OptionTermMeta
) extends WHNF
with CallingArgTermC[Term] derives ReadWriter {
override def cons = this.copy
override def cons: CallingArgTermF[Term, ThisTree] = this.copy
override type ThisTree = CallingArgTerm
override def descent(f: Term => Term, g: TreeMap[Term]): CallingArgTerm =
copy(value = f(value), ty = f(ty))
Expand Down Expand Up @@ -97,7 +97,7 @@ case class Calling(
) extends WHNF
with CallingC[Term] derives ReadWriter {
override type ThisTree = Calling
override def cons = this.copy
override def cons: CallingF[Term, ThisTree] = this.copy
override def descent(f: Term => Term, g: TreeMap[Term]): Calling = copy(args = args.map(g))
}

Expand Down Expand Up @@ -134,7 +134,7 @@ case class FCallTerm(
) extends WHNF
with FCallTermC[Term] {
override type ThisTree = FCallTerm
override def cons = this.copy
override def cons: FCallTermF[Term, ThisTree] = this.copy
override def descent(a: Term => Term, g: TreeMap[Term]): FCallTerm = thisOr(
copy(f = a(f), args = args.map(g))
)
Expand Down Expand Up @@ -178,7 +178,7 @@ case class Bind(
) extends Pat
with BindC[Term] {
override type ThisTree = Bind
override def cons = this.copy
override def cons: BindF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): Term = thisOr(copy(bind = g(bind), ty = f(ty)))
}
Expand Down Expand Up @@ -836,7 +836,7 @@ case class ArgTerm(
) extends WHNF
with ArgTermC[Term] {
override type ThisTree = ArgTerm
override def cons = this.copy
override def cons: ArgTermF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): ArgTerm = thisOr(
copy(bind = g(bind), ty = f(ty), default = default.map(f))
Expand Down Expand Up @@ -899,7 +899,7 @@ case class TelescopeTerm(
) extends WHNF
with TelescopeTermC[Term] {
override type ThisTree = TelescopeTerm
override def cons = this.copy
override def cons: TelescopeTermF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): TelescopeTerm = thisOr(
copy(args = args.map(g))
Expand Down Expand Up @@ -944,7 +944,7 @@ case class Function(
) extends WHNF
with FunctionC[Term] {
override type ThisTree = Function
override def cons = this.copy
override def cons: FunctionF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): Function = thisOr(copy(ty = g(ty), body = f(body)))
}
Expand Down Expand Up @@ -1025,7 +1025,7 @@ case class FunctionType(
) extends WHNF
with FunctionTypeC[Term] {
override type ThisTree = FunctionType
override def cons = this.copy
override def cons: FunctionTypeF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): FunctionType = thisOr(
copy(
Expand Down Expand Up @@ -1280,7 +1280,7 @@ case class LocalV(
) extends ReferenceCall
with LocalVC[Term] {
override type ThisTree = LocalV
override def cons = this.copy
override def cons: LocalVF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): LocalV = thisOr(copy(ty = f(ty)))

Expand Down Expand Up @@ -1325,7 +1325,7 @@ case class ToplevelV(
) extends ReferenceCall
with ToplevelVC[Term] {
override type ThisTree = ToplevelV
override def cons = this.copy
override def cons: ToplevelVF[Term, ThisTree] = this.copy

override def descent(f: Term => Term, g: TreeMap[Term]): ToplevelV = thisOr(copy(ty = f(ty)))

Expand Down

0 comments on commit fce400e

Please sign in to comment.