From e1c55597d1cd8fc8466246f38d32ae53e9bc3391 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 16:36:21 +0800 Subject: [PATCH 01/17] chore: Use `/` in build.sbt --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9c3eecc3..61140061 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ lazy val readme = scalatex.ScalatexReadme( source = "Readme", autoResources = List("out.js", "JProfiler.png") ).settings( - (resources in Compile) += baseDirectory.value/".."/"out"/"demo"/"fullOpt.dest"/"out.js", + (Compile / resources) += baseDirectory.value/".."/"out"/"demo"/"fullOpt.dest"/"out.js", scalaVersion := "2.12.18" ) From 687a5f9134c895fccc5c58aed5b51a279810d95d Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 22:01:55 +0800 Subject: [PATCH 02/17] chore: update scala 3 to 3.3.3 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index f736c069..d57e22b5 100644 --- a/build.sc +++ b/build.sc @@ -13,7 +13,7 @@ import $ivy.`com.github.lolgab::mill-mima::0.0.23` import de.tobiasroeser.mill.vcs.version.VcsVersion import com.github.lolgab.mill.mima._ -val scala3 = "3.3.1" +val scala3 = "3.3.3" val scala213 = "2.13.10" val scala212 = "2.12.17" val scalaJS1 = "1.12.0" From 20570e0cc0fa7676abc56fda22bfca0dad84a68e Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 22:05:17 +0800 Subject: [PATCH 03/17] chore: update scala 2.13.14 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index d57e22b5..2258e67f 100644 --- a/build.sc +++ b/build.sc @@ -14,7 +14,7 @@ import de.tobiasroeser.mill.vcs.version.VcsVersion import com.github.lolgab.mill.mima._ val scala3 = "3.3.3" -val scala213 = "2.13.10" +val scala213 = "2.13.14" val scala212 = "2.12.17" val scalaJS1 = "1.12.0" val scalaNative04 = "0.5.0" From 90ca4e7eec88a344d18d5d7c7e77ded79304b6c3 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 22:05:55 +0800 Subject: [PATCH 04/17] chore: update scala 2.12.19 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 2258e67f..74138d7c 100644 --- a/build.sc +++ b/build.sc @@ -15,7 +15,7 @@ import com.github.lolgab.mill.mima._ val scala3 = "3.3.3" val scala213 = "2.13.14" -val scala212 = "2.12.17" +val scala212 = "2.12.19" val scalaJS1 = "1.12.0" val scalaNative04 = "0.5.0" val crossVersions = Seq(scala3, scala213, scala212) From 2ca9570b3f1b0fa91d9df4cc252ac1183979fc46 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 22:07:52 +0800 Subject: [PATCH 05/17] chore: update scala js to 0.16.0 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 74138d7c..8158af23 100644 --- a/build.sc +++ b/build.sc @@ -16,7 +16,7 @@ import com.github.lolgab.mill.mima._ val scala3 = "3.3.3" val scala213 = "2.13.14" val scala212 = "2.12.19" -val scalaJS1 = "1.12.0" +val scalaJS1 = "1.16.0" val scalaNative04 = "0.5.0" val crossVersions = Seq(scala3, scala213, scala212) From b14a73834fc586d950de622cda3c6fb13501699a Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 22:10:21 +0800 Subject: [PATCH 06/17] chore: update scala native to 0.5.1 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 8158af23..8fcc219d 100644 --- a/build.sc +++ b/build.sc @@ -17,7 +17,7 @@ val scala3 = "3.3.3" val scala213 = "2.13.14" val scala212 = "2.12.19" val scalaJS1 = "1.16.0" -val scalaNative04 = "0.5.0" +val scalaNative04 = "0.5.1" val crossVersions = Seq(scala3, scala213, scala212) object fastparse extends Module{ From aaec9957a22498092254f5d3323e7271974e8f8b Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 00:00:07 +0800 Subject: [PATCH 07/17] chore: turn on `-Xlint:unused` --- build.sc | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sc b/build.sc index 8fcc219d..096e0602 100644 --- a/build.sc +++ b/build.sc @@ -208,6 +208,7 @@ trait CommonTestModule extends ScalaModule with TestModule.Utest{ super.scalacOptions() ++ Agg.when(scalaVersion() == scala213)( "-Xfatal-warnings", + "-Xlint:unused", "-Wconf:cat=feature:s,cat=deprecation:s" ) } From 411bb3efa6259cb641ea80c14b5aa0214990ec8e Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 00:07:52 +0800 Subject: [PATCH 08/17] chore: update tests with unused lint --- cssparse/test/src-jvm/cssparse/TestUtil.scala | 1 + fastparse/test/src-2.12+/fastparse/IteratorTests.scala | 2 +- fastparse/test/src/fastparse/ExampleTests.scala | 3 ++- fastparse/test/src/fastparse/IndentationTests.scala | 1 - fastparse/test/src/fastparse/JsonTests.scala | 1 - fastparse/test/src/fastparse/ParsingTests.scala | 3 +-- fastparse/test/src/fastparse/TypeTests.scala | 8 +++++--- pythonparse/test/src/pythonparse/RegressionTests.scala | 2 -- pythonparse/test/src/pythonparse/UnitTests.scala | 2 +- .../test/src-2-jvm/scalaparse/ProjectTests.scala | 10 ++++------ .../test/src-2-jvm/scalaparse/ScalacParser.scala | 2 +- scalaparse/test/src/scalaparse/unit/SuccessTests.scala | 4 +--- 12 files changed, 17 insertions(+), 22 deletions(-) diff --git a/cssparse/test/src-jvm/cssparse/TestUtil.scala b/cssparse/test/src-jvm/cssparse/TestUtil.scala index fdd3bb3d..088d411b 100644 --- a/cssparse/test/src-jvm/cssparse/TestUtil.scala +++ b/cssparse/test/src-jvm/cssparse/TestUtil.scala @@ -49,6 +49,7 @@ object TestUtil { def warning(ex: CSSParseException) = println("WARNING " + ex) }) val sheet = parser.parseStyleSheet(source, null, null) + assert(sheet != null) errors.toSeq } diff --git a/fastparse/test/src-2.12+/fastparse/IteratorTests.scala b/fastparse/test/src-2.12+/fastparse/IteratorTests.scala index 1fb05a11..ae8bfbdd 100644 --- a/fastparse/test/src-2.12+/fastparse/IteratorTests.scala +++ b/fastparse/test/src-2.12+/fastparse/IteratorTests.scala @@ -58,7 +58,7 @@ object IteratorTests extends TestSuite { } test("whitespaceImmediateCutDrop"){ - import NoWhitespace.{noWhitespaceImplicit => _, _} + import NoWhitespace.{noWhitespaceImplicit => _} implicit val whitespace: Whitespace = { implicit ctx: P[_] => import NoWhitespace.noWhitespaceImplicit " ".? ~ " ".rep diff --git a/fastparse/test/src/fastparse/ExampleTests.scala b/fastparse/test/src/fastparse/ExampleTests.scala index 6cbfe93b..78f2aad5 100644 --- a/fastparse/test/src/fastparse/ExampleTests.scala +++ b/fastparse/test/src/fastparse/ExampleTests.scala @@ -13,7 +13,7 @@ object ExampleTests extends TestSuite{ val tests = Tests{ test("basic"){ test("simple"){ - import fastparse._, NoWhitespace._ + import fastparse._ def parseA[$: P] = P("a") val Parsed.Success(value, successIndex) = parse("a", parseA(_)) @@ -243,6 +243,7 @@ object ExampleTests extends TestSuite{ def even[$: P] = P( digits.filter(_ % 2 == 0) ) val Parsed.Success(12, _) = parse("12", even(_)) val failure = parse("123", even(_)).asInstanceOf[Parsed.Failure] + assert(!failure.isSuccess) } test("opaque"){ def digit[$: P] = CharIn("0-9") diff --git a/fastparse/test/src/fastparse/IndentationTests.scala b/fastparse/test/src/fastparse/IndentationTests.scala index 99afd872..002b4144 100644 --- a/fastparse/test/src/fastparse/IndentationTests.scala +++ b/fastparse/test/src/fastparse/IndentationTests.scala @@ -2,7 +2,6 @@ package test.fastparse import utest._ import fastparse._ -import fastparse.internal.Util /** * Same as MathTests, but demonstrating the use of whitespace diff --git a/fastparse/test/src/fastparse/JsonTests.scala b/fastparse/test/src/fastparse/JsonTests.scala index c00ba63e..73eb04e6 100644 --- a/fastparse/test/src/fastparse/JsonTests.scala +++ b/fastparse/test/src/fastparse/JsonTests.scala @@ -1,7 +1,6 @@ package test.fastparse -import fastparse._ import fastparse._ import utest._ diff --git a/fastparse/test/src/fastparse/ParsingTests.scala b/fastparse/test/src/fastparse/ParsingTests.scala index 3a23d72a..57254e39 100644 --- a/fastparse/test/src/fastparse/ParsingTests.scala +++ b/fastparse/test/src/fastparse/ParsingTests.scala @@ -5,7 +5,7 @@ import utest._ object ParsingTests extends TestSuite{ - import Parsed.{Success, Failure} + import Parsed.Success def check[T](parser: P[_] => P[T], input: (String, Int), rhs: Parsed[T]) = { val (str, index) = input @@ -105,7 +105,6 @@ object ParsingTests extends TestSuite{ } test("fail"){ import fastparse._ - import NoWhitespace._ def fail1[T: P] = Fail.! val wat = "Shouldn't success" val Parsed.Failure(_, _, _) = parse(wat, fail1(_)) diff --git a/fastparse/test/src/fastparse/TypeTests.scala b/fastparse/test/src/fastparse/TypeTests.scala index 167f11ca..a8f7c704 100644 --- a/fastparse/test/src/fastparse/TypeTests.scala +++ b/fastparse/test/src/fastparse/TypeTests.scala @@ -3,15 +3,17 @@ package test.fastparse import fastparse.Implicits +import scala.annotation.nowarn + /** * Make sure the type-level logic does the right thing. Doesn't * actually need to execute; compiling is enough! */ object TypeTests { class P[T]{ - def ~[V, R](other: P[V])(implicit sum: Implicits.Sequencer[T, V, R]): P[R] = new P[R] - def rep[R](implicit rep: Implicits.Repeater[T, R]): P[R] = new P[R] - def ?[R](implicit rep: Implicits.Optioner[T, R]): P[R] = new P[R] + def ~[V, R](other: P[V])(implicit @nowarn("msg=never used") sum: Implicits.Sequencer[T, V, R]): P[R] = new P[R] + def rep[R](implicit @nowarn("msg=never used") rep: Implicits.Repeater[T, R]): P[R] = new P[R] + def ?[R](implicit @nowarn("msg=never used") rep: Implicits.Optioner[T, R]): P[R] = new P[R] } def P[T] = new P[T] diff --git a/pythonparse/test/src/pythonparse/RegressionTests.scala b/pythonparse/test/src/pythonparse/RegressionTests.scala index 0a15fdb1..59427b2a 100644 --- a/pythonparse/test/src/pythonparse/RegressionTests.scala +++ b/pythonparse/test/src/pythonparse/RegressionTests.scala @@ -1,12 +1,10 @@ package pythonparse import utest._ -import fastparse._ object RegressionTests extends TestSuite{ import Ast.expr._ import Ast.stmt._ import Ast.expr_context._ - import Ast.cmpop._ import Ast.operator._ import Ast.unaryop._ import Ast._ diff --git a/pythonparse/test/src/pythonparse/UnitTests.scala b/pythonparse/test/src/pythonparse/UnitTests.scala index 742b407e..3d87a671 100644 --- a/pythonparse/test/src/pythonparse/UnitTests.scala +++ b/pythonparse/test/src/pythonparse/UnitTests.scala @@ -1,7 +1,7 @@ package pythonparse import utest._ -import fastparse._ + /** * Tests to cover most basic syntactic constructs. It's likely there are * interactions between the constructs that will cause problems, but these diff --git a/scalaparse/test/src-2-jvm/scalaparse/ProjectTests.scala b/scalaparse/test/src-2-jvm/scalaparse/ProjectTests.scala index 9bcf7558..75ab48ef 100644 --- a/scalaparse/test/src-2-jvm/scalaparse/ProjectTests.scala +++ b/scalaparse/test/src-2-jvm/scalaparse/ProjectTests.scala @@ -1,13 +1,11 @@ package scalaparse import java.io.File -import java.nio.file.{Files, Path, Paths} - - - +import java.nio.file.{Files, Paths} import concurrent.ExecutionContext.Implicits.global import utest._ +import scala.annotation.nowarn import scala.concurrent.duration.Duration import scala.concurrent.{Await, Future} @@ -16,7 +14,8 @@ object ProjectTests extends TestSuite{ println("running") def tests = this{ - def checkDir(path: String, filter: String => Boolean = _ => true) = { + @nowarn + def checkDir(path: String, filter: String => Boolean = _ => true): Unit = { println("Checking Dir " + path) def listFiles(s: File): Seq[String] = { val (dirs, files) = Option(s.listFiles).getOrElse(Array[File]()).partition(_.isDirectory) @@ -53,7 +52,6 @@ object ProjectTests extends TestSuite{ if (scala.util.Properties.javaVersion.startsWith("1.8")) { val repo = "https://github.com/" + testPath.value.last - import sys.process._ val name = repo.split("/").last println("CLONING?") val path = Paths.get("out", "repos", name) diff --git a/scalaparse/test/src-2-jvm/scalaparse/ScalacParser.scala b/scalaparse/test/src-2-jvm/scalaparse/ScalacParser.scala index 404b8d24..4d43c488 100644 --- a/scalaparse/test/src-2-jvm/scalaparse/ScalacParser.scala +++ b/scalaparse/test/src-2-jvm/scalaparse/ScalacParser.scala @@ -27,7 +27,7 @@ object ScalacParser{ val global = new Global(settings) def checkParseFails(input: String) = this.synchronized{ - val run = new global.Run() + new global.Run() var fail = false import global.syntaxAnalyzer.Offset val cu = new global.CompilationUnit(global.newSourceFile(input)) diff --git a/scalaparse/test/src/scalaparse/unit/SuccessTests.scala b/scalaparse/test/src/scalaparse/unit/SuccessTests.scala index 6ad76ab6..c823f0c8 100644 --- a/scalaparse/test/src/scalaparse/unit/SuccessTests.scala +++ b/scalaparse/test/src/scalaparse/unit/SuccessTests.scala @@ -1,7 +1,6 @@ package scalaparse.unit -import scalaparse.{TestUtil, Scala} -import fastparse._ +import scalaparse.TestUtil import utest._ import TestUtil._ object SuccessTests extends TestSuite{ @@ -1305,7 +1304,6 @@ object SuccessTests extends TestSuite{ val d1 = "dca5" val d2 = "20ac" val d3 = "d83c" - val d4 = "dca5" test - check( s"""object U{ | Seq( From 49f406952f5cfbd4237376f52a6d2ce71a49ba96 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 00:08:20 +0800 Subject: [PATCH 09/17] chore: remove 2.11 support --- fastparse/src-2.11/fastparse/internal/NoWarn.scala | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 fastparse/src-2.11/fastparse/internal/NoWarn.scala diff --git a/fastparse/src-2.11/fastparse/internal/NoWarn.scala b/fastparse/src-2.11/fastparse/internal/NoWarn.scala deleted file mode 100644 index c5111856..00000000 --- a/fastparse/src-2.11/fastparse/internal/NoWarn.scala +++ /dev/null @@ -1,5 +0,0 @@ -package fastparse.internal - -object NoWarn{ - class nowarn(msg: String = "") -} From 3e406ea7f8e8fce7ecadf9f0c0c2e99ab059f5d2 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 00:23:21 +0800 Subject: [PATCH 10/17] chore: Rename scalaNative04 to scalaNative05 --- build.sc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sc b/build.sc index 096e0602..8f8c90a2 100644 --- a/build.sc +++ b/build.sc @@ -17,7 +17,7 @@ val scala3 = "3.3.3" val scala213 = "2.13.14" val scala212 = "2.12.19" val scalaJS1 = "1.16.0" -val scalaNative04 = "0.5.1" +val scalaNative05 = "0.5.1" val crossVersions = Seq(scala3, scala213, scala212) object fastparse extends Module{ @@ -47,7 +47,7 @@ object fastparse extends Module{ object native extends Cross[fastparseNativeModule](crossVersions) trait fastparseNativeModule extends FastparseModule with ScalaNativeModule { - def scalaNativeVersion = scalaNative04 + def scalaNativeVersion = scalaNative05 object test extends ScalaNativeTests with CommonTestModule } @@ -170,7 +170,7 @@ trait ExampleParseJvmModule extends CommonCrossModule{ } trait ExampleParseNativeModule extends CommonCrossModule with ScalaNativeModule{ - def scalaNativeVersion = scalaNative04 + def scalaNativeVersion = scalaNative05 def moduleDeps = Seq(fastparse.native()) object test extends ScalaNativeTests with CommonTestModule From 6982bb688f8be38eb07f816c54b6ca6bf7ca30c5 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 00:09:00 +0800 Subject: [PATCH 11/17] chore: use scala.annotation.nowarn directly in scala 2.12 --- fastparse/src-2.12/fastparse/internal/NoWarn.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastparse/src-2.12/fastparse/internal/NoWarn.scala b/fastparse/src-2.12/fastparse/internal/NoWarn.scala index c5111856..c01756c0 100644 --- a/fastparse/src-2.12/fastparse/internal/NoWarn.scala +++ b/fastparse/src-2.12/fastparse/internal/NoWarn.scala @@ -1,5 +1,5 @@ package fastparse.internal object NoWarn{ - class nowarn(msg: String = "") + type nowarn = scala.annotation.nowarn } From c262686e7eacc5f61db90bb851dba48a6faa8f69 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 00:10:42 +0800 Subject: [PATCH 12/17] chore: fix nowarn issue --- .../fastparse/internal/MacroRepImpls.scala | 29 ++++++++++--------- fastparse/src-2/fastparse/package.scala | 4 +-- fastparse/src/fastparse/Whitespace.scala | 5 ++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/fastparse/src-2/fastparse/internal/MacroRepImpls.scala b/fastparse/src-2/fastparse/internal/MacroRepImpls.scala index a187b999..d36f14d3 100644 --- a/fastparse/src-2/fastparse/internal/MacroRepImpls.scala +++ b/fastparse/src-2/fastparse/internal/MacroRepImpls.scala @@ -31,7 +31,7 @@ object MacroRepImpls{ val parsedMsg = TermName(c.freshName("parsedMsg")) val lastAgg = TermName(c.freshName("lastAgg")) val parsedAgg = TermName(c.freshName("parsedAgg")) - val ((endSnippet, aggregateSnippet), minCut) = min match{ + val ((endSnippet, _), minCut) = min match{ case None => q""" $ctx1.freshSuccess($repeater1.result($acc), $startIndex, $originalCut) @@ -47,22 +47,25 @@ object MacroRepImpls{ q"""$originalCut && ($count < $min1)""" } - val wsSnippet = whitespace match{ - case None => q"$rec($beforeSepIndex, $count + 1, $parsedAgg)" - case Some(ws) => - q""" - - @fastparse.internal.NoWarn.nowarn - val isNotNoWhitespace = $ws ne _root_.fastparse.NoWhitespace.noWhitespaceImplicit - if (isNotNoWhitespace) { - _root_.fastparse.internal.Util.consumeWhitespace($ws, $ctx1) - } + val rhsSnippet = + q""" if (!$ctx1.isSuccess && $ctx1.cut) $ctx1.asInstanceOf[_root_.fastparse.ParsingRun[scala.Nothing]] - else{ + else { $ctx1.cut = false $rec($beforeSepIndex, $count + 1, $parsedAgg) } - """ + """ + + val wsSnippet = whitespace match{ + case None => q"$rec($beforeSepIndex, $count + 1, $parsedAgg)" + case Some(ws) => + if (ws.tpe =:= typeOf[fastparse.NoWhitespace.noWhitespaceImplicit.type]) + rhsSnippet + else + q""" + _root_.fastparse.internal.Util.consumeWhitespace($ws, $ctx1) + $rhsSnippet + """ } q""" diff --git a/fastparse/src-2/fastparse/package.scala b/fastparse/src-2/fastparse/package.scala index 45523ac7..a2481dc6 100644 --- a/fastparse/src-2/fastparse/package.scala +++ b/fastparse/src-2/fastparse/package.scala @@ -1,7 +1,7 @@ import fastparse.internal._ -import fastparse.internal.{Instrument, Logger} -import language.experimental.macros +import scala.language.experimental.macros +import scala.language.implicitConversions package object fastparse extends fastparse.SharedPackageDefs { /** diff --git a/fastparse/src/fastparse/Whitespace.scala b/fastparse/src/fastparse/Whitespace.scala index e97ae013..04bd7664 100644 --- a/fastparse/src/fastparse/Whitespace.scala +++ b/fastparse/src/fastparse/Whitespace.scala @@ -1,10 +1,9 @@ package fastparse import fastparse._ -import fastparse.internal.Util +import fastparse.internal.{Msgs, Util} -import scala.annotation.{Annotation, switch, tailrec} -import fastparse.internal.Msgs +import scala.annotation.{switch, tailrec} trait Whitespace{ def apply(ctx: ParsingRun[_]): ParsingRun[Unit] From 75753868319d3d9752e58e5aac4445bfbc3a6dfe Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sat, 18 May 2024 22:24:23 +0800 Subject: [PATCH 13/17] chore: update mill to 0.11.7-86-18d144 --- .mill-version | 2 +- build.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.mill-version b/.mill-version index 26696041..883f9bf5 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.11.7-29-f2e220 \ No newline at end of file +0.11.7-86-18d144 \ No newline at end of file diff --git a/build.sbt b/build.sbt index 61140061..ac078f5e 100644 --- a/build.sbt +++ b/build.sbt @@ -6,6 +6,6 @@ lazy val readme = scalatex.ScalatexReadme( autoResources = List("out.js", "JProfiler.png") ).settings( (Compile / resources) += baseDirectory.value/".."/"out"/"demo"/"fullOpt.dest"/"out.js", - scalaVersion := "2.12.18" + scalaVersion := "2.12.19" ) From 828827b2fb3a4c48981b975906110124f5c97459 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 08:34:46 +0800 Subject: [PATCH 14/17] chore: update default mill version to 0.11.7 --- mill | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mill b/mill index b395d818..19fea10c 100755 --- a/mill +++ b/mill @@ -7,7 +7,7 @@ set -e if [ -z "${DEFAULT_MILL_VERSION}" ] ; then - DEFAULT_MILL_VERSION=0.11.1 + DEFAULT_MILL_VERSION=0.11.7 fi if [ -z "$MILL_VERSION" ] ; then From 82dec8cfbec47753a1a97aebaea2be7ead8d1c8d Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 08:47:07 +0800 Subject: [PATCH 15/17] chore: Deprecate the fast parse internal nowarn --- build.sc | 2 +- fastparse/src-2.12/fastparse/internal/NoWarn.scala | 3 ++- fastparse/src-2.13/fastparse/internal/NoWarn.scala | 1 + fastparse/src-3/fastparse/internal/NoWarn.scala | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sc b/build.sc index 8f8c90a2..d7713e12 100644 --- a/build.sc +++ b/build.sc @@ -112,7 +112,7 @@ trait FastparseModule extends CommonCrossModule with Mima{ else super.mimaPreviousArtifacts() def mimaBinaryIssueFilters = super.mimaBinaryIssueFilters() ++ Seq( - ProblemFilter.exclude[IncompatibleResultTypeProblem]("fastparse.Parsed#Failure.unapply") + ProblemFilter.exclude[IncompatibleResultTypeProblem]("fastparse.Parsed#Failure.unapply"), ) } diff --git a/fastparse/src-2.12/fastparse/internal/NoWarn.scala b/fastparse/src-2.12/fastparse/internal/NoWarn.scala index c01756c0..de1601c4 100644 --- a/fastparse/src-2.12/fastparse/internal/NoWarn.scala +++ b/fastparse/src-2.12/fastparse/internal/NoWarn.scala @@ -1,5 +1,6 @@ package fastparse.internal object NoWarn{ - type nowarn = scala.annotation.nowarn + @deprecated("Use scala.annotation.nowarn instead", "3.1.1") + class nowarn(msg: String = "") } diff --git a/fastparse/src-2.13/fastparse/internal/NoWarn.scala b/fastparse/src-2.13/fastparse/internal/NoWarn.scala index 2a16b34e..5582414f 100644 --- a/fastparse/src-2.13/fastparse/internal/NoWarn.scala +++ b/fastparse/src-2.13/fastparse/internal/NoWarn.scala @@ -1,5 +1,6 @@ package fastparse.internal object NoWarn{ + @deprecated("Use scala.annotation.nowarn instead", "3.1.1") type nowarn = scala.annotation.nowarn } \ No newline at end of file diff --git a/fastparse/src-3/fastparse/internal/NoWarn.scala b/fastparse/src-3/fastparse/internal/NoWarn.scala index c01756c0..5e76b160 100644 --- a/fastparse/src-3/fastparse/internal/NoWarn.scala +++ b/fastparse/src-3/fastparse/internal/NoWarn.scala @@ -1,5 +1,6 @@ package fastparse.internal object NoWarn{ + @deprecated("Use scala.annotation.nowarn instead", "3.1.1") type nowarn = scala.annotation.nowarn } From f242c9a7ebc3fceb8d87125dda2f23922ded1b06 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 09:29:35 +0800 Subject: [PATCH 16/17] chore: split scala 2.12 and scala 2.13 scala parser tests --- .../scalaparse/ScalacParser.scala | 0 .../scalaparse/ScalacParser.scala | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+) rename scalaparse/test/{src-2-jvm => src-2.12-jvm}/scalaparse/ScalacParser.scala (100%) create mode 100644 scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala diff --git a/scalaparse/test/src-2-jvm/scalaparse/ScalacParser.scala b/scalaparse/test/src-2.12-jvm/scalaparse/ScalacParser.scala similarity index 100% rename from scalaparse/test/src-2-jvm/scalaparse/ScalacParser.scala rename to scalaparse/test/src-2.12-jvm/scalaparse/ScalacParser.scala diff --git a/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala b/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala new file mode 100644 index 00000000..019c2ec9 --- /dev/null +++ b/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala @@ -0,0 +1,61 @@ +package scalaparse + +import scala.reflect.internal.util.CodeAction +import scala.tools.nsc.{Global, Settings} + +object ScalacParser{ + var current = Thread.currentThread().getContextClassLoader + val files = collection.mutable.Buffer.empty[java.io.File] + files.appendAll( + System.getProperty("sun.boot.class.path") + .split(":") + .map(new java.io.File(_)) + ) + while(current != null){ + current match{ + case t: java.net.URLClassLoader => + files.appendAll(t.getURLs.map(u => new java.io.File(u.toURI))) + case _ => + } + current = current.getParent + } + + val settings = new Settings() + settings.usejavacp.value = true + settings.embeddedDefaults[ScalacParser.type] + settings.classpath.append(files.mkString(":")) + + val global = new Global(settings) + + def checkParseFails(input: String) = this.synchronized{ + new global.Run() + var fail = false + import global.syntaxAnalyzer.Offset + val cu = new global.CompilationUnit(global.newSourceFile(input)) + val parser = new global.syntaxAnalyzer.UnitParser(cu, Nil){ + override def newScanner() = new global.syntaxAnalyzer.UnitScanner(cu, Nil){ + override def error(off: Offset, msg: String) = { + fail = true + } + override def syntaxError(off: Offset, msg: String) = { + fail = true + } + override def incompleteInputError(off: Offset, msg: String) = { + fail = true + } + } + + override def incompleteInputError(msg: String, actions: List[CodeAction]): Unit = { + fail = true + super.incompleteInputError(msg, actions) + } + + override def syntaxError(offset: global.syntaxAnalyzer.Offset, msg: String, actions: List[CodeAction]): Unit = { + fail = true + super.syntaxError(offset, msg, actions) + } + } + parser.parse() + fail + } +} \ No newline at end of file From 6f7a7cecdcd3da5d0f31cfd87d6e541074b3702a Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 19 May 2024 09:43:04 +0800 Subject: [PATCH 17/17] chore: Add blank line ending --- .mill-version | 2 +- scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.mill-version b/.mill-version index 883f9bf5..d24383fc 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.11.7-86-18d144 \ No newline at end of file +0.11.7-86-18d144 diff --git a/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala b/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala index 019c2ec9..cd3c3eb8 100644 --- a/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala +++ b/scalaparse/test/src-2.13-jvm/scalaparse/ScalacParser.scala @@ -58,4 +58,4 @@ object ScalacParser{ parser.parse() fail } -} \ No newline at end of file +}