PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: scalameta/scalameta (scala)
Issue: Scaladoc param name is incorrect when description is started on next line
The following doc comment is currently not parsed correctly.
```
/**
  *   @param x
  *       This is a really long description
  */
case class A(x: String)
```

The name is parsed to `x\nThis` and the body `is a really long description` correct should be that the name is `x` and the body should be `This is a really long description`.
Pull request description: Fixes #4264

Patch:
diff --git a/scalameta/trees/shared/src/main/scala/scala/meta/contrib/ScaladocParser.scala b/scalameta/trees/shared/src/main/scala/scala/meta/contrib/ScaladocParser.scala
index 52a2ffcec8..3b2f659b35 100644
--- a/scalameta/trees/shared/src/main/scala/scala/meta/contrib/ScaladocParser.scala
+++ b/scalameta/trees/shared/src/main/scala/scala/meta/contrib/ScaladocParser.scala
@@ -84,10 +84,10 @@ object ScaladocParser {
         require(kind.numberParameters == 2)
         // Multiple parameter doc tokens
         def parser[$: P] = {
-          def nameParser: P[String] = ((AnyChar ~ !" ").rep ~ AnyChar).!.map(_.trim)
+          def nameParser: P[String] = ((AnyChar ~ !(" " | "\n")).rep ~ AnyChar).!.map(_.trim)
 
           def nameAndBodyParsers: P[DocToken] = (nameParser ~ " ".rep.? ~ bodyParser.!).map {
-            case (name, body) => DocToken(kind, name, body)
+            case (name, body) => DocToken(kind, name, body.trim)
           }
           P(s"$label" ~ nameAndBodyParsers)
         }


Test patch:
diff --git a/tests/shared/src/test/scala/scala/meta/tests/contrib/ScaladocParserSuite.scala b/tests/shared/src/test/scala/scala/meta/tests/contrib/ScaladocParserSuite.scala
index 2de58f4c47..f9e0017ff3 100644
--- a/tests/shared/src/test/scala/scala/meta/tests/contrib/ScaladocParserSuite.scala
+++ b/tests/shared/src/test/scala/scala/meta/tests/contrib/ScaladocParserSuite.scala
@@ -236,4 +236,19 @@ class ScaladocParserSuite extends FunSuite {
     assertEquals(result, expectation)
   }
 
+  test("multiline param") {
+    val description = "This description starts on the next line."
+    val result = parseString(
+      s"""|/** @param a
+            *    $description
+            */
+          |case class foo(a: String)
+          |""".stripMargin
+    )
+
+    val expectation = Some(List(DocToken(Param, Some("a"), Some(description))))
+
+    assertEquals(result, expectation)
+  }
+
 }