diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d6ece60..6b51e86 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "DCal", + "name": "Forja", "build": { "dockerfile": "Dockerfile" }, diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3958729..eaa5853 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,3 +17,7 @@ jobs: with: jvm: ${{ matrix.jvm }} - run: scala-cli test . + - name: "Run all formatters on a clean tree" + run: scala-cli run . --main-class scripts.rewrite_src_sc + - name: "Check: the tree did not change due to the formatters" + run: scala-cli run . --main-class scripts.check_no_diff_sc diff --git a/langs/calc/CalcParser.scala b/langs/calc/CalcParser.scala index a8ed8fb..7a62926 100644 --- a/langs/calc/CalcParser.scala +++ b/langs/calc/CalcParser.scala @@ -96,6 +96,7 @@ object CalcParser extends PassSeq: object AddSubPass extends Pass: val wellformed = prevWellformed.makeDerived: Node.Top.removeCases(AddOp, SubOp) + Group.removeCases(AddOp, SubOp) Expression.addCases(Add, Sub) Add ::= fields( Expression, diff --git a/scripts/check_no_diff.scala b/scripts/check_no_diff.scala new file mode 100644 index 0000000..39913a9 --- /dev/null +++ b/scripts/check_no_diff.scala @@ -0,0 +1,31 @@ +// Copyright 2024-2025 Forja Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scripts + +@main +def check_no_diff_sc(): Unit = + val result = os + .proc("git", "status", "--porcelain") + .call(cwd = os.pwd, mergeErrIntoOut = true) + val strippedOut = result.out.text().strip() + + if strippedOut.isEmpty + then + println("ok: no diff detected") + sys.exit(0) + else + println("diff detected!") + strippedOut.linesIterator.foreach(println) + sys.exit(1)