Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scalameta 4.9.x #1927

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused since 1ab1d7e

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brings false negatives now that quasiquotes have positions (since scalameta/scalameta#3425). This is effectively a very minor breaking change in the API.

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)
}
}