Skip to content

Commit

Permalink
Merge pull request #1927 from scalacenter/test-scalameta
Browse files Browse the repository at this point in the history
scalameta 4.9.x
  • Loading branch information
bjaglin authored Feb 21, 2024
2 parents 0c3e52d + 5f4ef49 commit 7902fb7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ lazy val docs = projectMatrix
scalacOptions += "-Wconf:msg='match may not be exhaustive':s", // silence exhaustive pattern matching warning for documentation
scalacOptions += "-Xfatal-warnings",
mdoc := (Compile / run).evaluated,
libraryDependencies += metaconfigDoc
libraryDependencies += metaconfigDoc,
dependencyOverrides += scalameta // force eviction of mdoc transitive dependency
)
.defaultAxes(VirtualAxis.jvm)
.jvmPlatform(scalaVersions = Seq(scala213))
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object Dependencies {
val metaconfigV = "0.12.0"
val nailgunV = "0.9.1"
val scalaXmlV = "2.2.0"
val scalametaV = "4.8.15"
val scalametaV = "4.9.0"
val scalatestV = "3.2.18"
val munitV = "0.7.29"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import scala.meta._
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.semanticdb.Scala.Descriptor
import scala.meta.internal.semanticdb.Scala.DescriptorParser
import scala.meta.internal.trees.Origin
import scala.meta.internal.{semanticdb => s}
import scala.meta.trees.Origin

object ScalametaInternals {
private val EOL = System.lineSeparator()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package scala.meta.internal.scalafix

import scala.meta.Tree
import scala.meta.internal.semanticdb.Scala.Names
import scala.meta.internal.trees.Origin

object ScalafixScalametaHacks {
def resetOrigin(tree: Tree): Tree = tree.withOrigin(Origin.None)
def encode(name: String): String = Names.encode(name)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import scala.annotation.tailrec
import scala.collection.mutable

import scala.meta._
import scala.meta.trees.Origin

import scalafix.XtensionOptionPatch
import scalafix.XtensionSeqPatch
Expand Down Expand Up @@ -200,7 +201,11 @@ object ImportPatchOps {
allImports.filter(_.importers.forall(isRemovedImporter))

def remove(toRemove: Tree): Patch = {
if (toRemove.pos == Position.None) return Patch.empty
val isSameInput = (toRemove.origin, ctx.tree.origin) match {
case (a: Origin.Parsed, b: Origin.Parsed) => a.input == b.input
case _ => false
}
if (!isSameInput) return Patch.empty
// Imagine "import a.b, c.d, e.f, g.h" where a.b, c.d and g.h are unused.
// All unused imports are responible to delete their leading comma but
// c.d is additionally responsible for deleting its trailling comma.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package scala.meta.internal.prettyprinters

// compatibility hack until https://github.com/scalameta/mdoc/pull/842 is released
object enquote {
def apply(s: String, style: QuoteStyle): String = {
style(s)
}
}

0 comments on commit 7902fb7

Please sign in to comment.