diff --git a/build.sbt b/build.sbt index 42d0832c..bbd210ae 100644 --- a/build.sbt +++ b/build.sbt @@ -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( diff --git a/cli/shared/src/main/scala/chester/cli/CLI.scala b/cli/shared/src/main/scala/chester/cli/CLI.scala index a0da9bfb..190478fd 100644 --- a/cli/shared/src/main/scala/chester/cli/CLI.scala +++ b/cli/shared/src/main/scala/chester/cli/CLI.scala @@ -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 () } diff --git a/interpreter/jvm/src/main/scala/chester/truffle/node/TermNode.scala b/interpreter/jvm/src/main/scala/chester/truffle/node/TermNode.scala index 2af022f6..178957cb 100644 --- a/interpreter/jvm/src/main/scala/chester/truffle/node/TermNode.scala +++ b/interpreter/jvm/src/main/scala/chester/truffle/node/TermNode.scala @@ -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 diff --git a/syntax/src/main/scala/chester/syntax/Tree.scala b/syntax/src/main/scala/chester/syntax/Tree.scala index b8d6f4ba..be181c7e 100644 --- a/syntax/src/main/scala/chester/syntax/Tree.scala +++ b/syntax/src/main/scala/chester/syntax/Tree.scala @@ -1,6 +1,5 @@ package chester.syntax -import chester.syntax.core.Term import chester.utils.reuse trait Tree[RootTree <: Tree[RootTree]] extends Any { @@ -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 diff --git a/syntax/src/main/scala/chester/syntax/core/Term.scala b/syntax/src/main/scala/chester/syntax/core/Term.scala index 52a90e8c..b08ef33d 100644 --- a/syntax/src/main/scala/chester/syntax/core/Term.scala +++ b/syntax/src/main/scala/chester/syntax/core/Term.scala @@ -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)) @@ -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)) } @@ -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)) ) @@ -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))) } @@ -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)) @@ -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)) @@ -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))) } @@ -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( @@ -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))) @@ -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)))