nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: scalameta/scalameta
Pull request #2534 (2021-12-31 20:05:06)

ScaladocParser: take the rightmost code suffix


Patch:
diff --git a/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScaladocParser.scala b/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScaladocParser.scala
index ac0652464..21e30120b 100644
--- a/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScaladocParser.scala
+++ b/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScaladocParser.scala
@@ -47,7 +47,7 @@ object ScaladocParser {
   private def tableSpaceSep[_: P] = P(hspaces0 ~ tableSep)
 
   private def codePrefix[_: P] = P("{{{")
-  private def codeSuffix[_: P] = P(hspaces0 ~ "}}}")
+  private def codeSuffix[_: P] = P(hspaces0 ~ "}}}" ~~ !"}")
 
   private def linkPrefix[_: P] = P("[[" ~ hspaces0)
   private def linkSuffix[_: P] = P(hspaces0 ~ "]]")


Test patch:
diff --git a/tests/shared/src/test/scala/scala/meta/tests/parsers/ScaladocParserSuite.scala b/tests/shared/src/test/scala/scala/meta/tests/parsers/ScaladocParserSuite.scala
index c7f519bd0..08fa86d4b 100644
--- a/tests/shared/src/test/scala/scala/meta/tests/parsers/ScaladocParserSuite.scala
+++ b/tests/shared/src/test/scala/scala/meta/tests/parsers/ScaladocParserSuite.scala
@@ -194,7 +194,7 @@ class ScaladocParserSuite extends FunSuite {
     val testDescription = "This is a codeblock:"
     val words: Seq[Word] = testDescription.split("\\s+").map(Word.apply)
 
-    val codeBlock1 = "\"HELLO MARIANO\""
+    val codeBlock1 = "{\"HELLO MARIANO\"}"
     val codeBlock2 = "\"HELLO SORAYA\""
     val complexCodeBlock = // keep all newlines and leading spaces
       """|  ggmqwogmwogmqwomgq
@@ -207,7 +207,7 @@ class ScaladocParserSuite extends FunSuite {
       parseString(
         s"""
           /**
-            * $testDescription {{{ $codeBlock1 }}}?$testDescription
+            * $testDescription {{{$codeBlock1}}}?$testDescription
             * {{{ $codeBlock2 }}}
             *
             * $testDescription
@@ -265,17 +265,19 @@ class ScaladocParserSuite extends FunSuite {
   }
 
   test("code blocks inline") {
+    val codeBlock1 = "{\"HELLO MARIANO\"}"
     val codeBlock2 = "\"HELLO SORAYA\""
     val result = parseString(
       s"""
           /**
+            * {{{$codeBlock1}}}
             * {{{ $codeBlock2 }}}
             */
        """.stripMargin
     )
 
     val expectation = Option(
-      Scaladoc(Seq(Paragraph(Seq(Text(Seq(CodeExpr(codeBlock2, "")))))))
+      Scaladoc(Seq(Paragraph(Seq(Text(Seq(CodeExpr(codeBlock1, ""), CodeExpr(codeBlock2, "")))))))
     )
     assertEquals(result, expectation)
   }
Repository: scalameta/scalameta
Pull request #2545 (2022-01-05 15:06:18)

Show correct error when secondary constructor has no parenthesis
Fixes https://github.com/scalameta/scalameta/issues/2531


Patch:
diff --git a/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScalametaParser.scala b/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScalametaParser.scala
index 91bca25f1..b8ca7c9f7 100644
--- a/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScalametaParser.scala
+++ b/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScalametaParser.scala
@@ -4740,8 +4740,12 @@ class ScalametaParser(input: Input)(implicit dialect: Dialect) { parser =>
     rejectMod[Mod.Sealed](mods, Messages.InvalidSealed)
     val name = atPos(in.tokenPos, in.tokenPos)(Name.Anonymous())
     accept[KwThis]
-    val paramss = paramClauses(ownerIsType = true)
-    secondaryCtorRest(mods, name, paramss)
+    if (token.isNot[LeftParen]) {
+      syntaxError("auxiliary constructor needs non-implicit parameter list", at = token.pos)
+    } else {
+      val paramss = paramClauses(ownerIsType = true)
+      secondaryCtorRest(mods, name, paramss)
+    }
   }
 
   def quasiquoteCtor(): Ctor = autoPos {


Test patch:
diff --git a/tests/shared/src/test/scala/scala/meta/tests/parsers/dotty/MinorDottySuite.scala b/tests/shared/src/test/scala/scala/meta/tests/parsers/dotty/MinorDottySuite.scala
index 3604bf998..21027ecba 100644
--- a/tests/shared/src/test/scala/scala/meta/tests/parsers/dotty/MinorDottySuite.scala
+++ b/tests/shared/src/test/scala/scala/meta/tests/parsers/dotty/MinorDottySuite.scala
@@ -203,6 +203,15 @@ class MinorDottySuite extends BaseDottySuite {
     )
   }
 
+  test("no-params") {
+    runTestError[Stat](
+      """|class A
+         |class B extends A:
+         |  def this = this.f()""".stripMargin,
+      "auxiliary constructor needs non-implicit parameter list"
+    )
+  }
+
   test("trait-parameters-generic") {
     runTestAssert[Stat]("trait Foo[T](bar: T)")(
       Defn.Trait(Nil, pname("Foo"), List(pparam("T")), ctorp(List(tparam("bar", "T"))), tpl(Nil))