Skip to content

Commit

Permalink
TokenOps: no blank line for scaladoc in expression
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jun 24, 2020
1 parent cce0e2c commit 5ca963c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.scalafmt.util

import scala.meta.classifiers.Classifier
import scala.meta.{Defn, Pkg, Template, Tree}
import scala.meta.{Defn, Pkg, Source, Template, Term, Tree}
import scala.meta.tokens.Token
import scala.meta.tokens.Token._
import scala.meta.tokens.Tokens
Expand Down Expand Up @@ -54,8 +54,13 @@ object TokenOps {
style.optIn.forceNewlineBeforeDocstringSummary &&
ft.right.is[Token.Comment] && !ft.left.is[Token.Comment] &&
ft.meta.right.text.startsWith("/**") &&
!ft.meta.leftOwner.is[meta.Mod] &&
!TreeOps.existsParentOfType[meta.Mod](ft.meta.leftOwner)
TreeOps
.findTreeOrParent(ft.meta.leftOwner) {
case _: Pkg | _: Source | _: Template | _: Term.Block => Some(false)
case t if t.pos.end > ft.right.start => Some(true)
case _ => None
}
.isEmpty

// 2.13 implements SeqOps.findLast
def findLast[A](seq: Seq[A])(cond: A => Boolean): Option[A] =
Expand Down
1 change: 0 additions & 1 deletion scalafmt-tests/src/test/resources/test/JavaDoc.stat
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,6 @@ object Day extends Enumeration {
type Day = Value

val

/** Monday */
MON = Value
}

0 comments on commit 5ca963c

Please sign in to comment.