Skip to content

Commit

Permalink
Merge pull request #52 from sjrd/tasty-query-1.2.0
Browse files Browse the repository at this point in the history
Upgrade to tasty-query v1.2.0.
  • Loading branch information
sjrd authored Dec 19, 2023
2 parents 0e83276 + a38e67f commit 5df29ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inThisBuild(Def.settings(
Developer("bishabosha", "Jamie Thompson", "bishbashboshjt@gmail.com", url("https://github.com/bishabosha")),
),

versionPolicyIntention := Compatibility.BinaryAndSourceCompatible,
versionPolicyIntention := Compatibility.BinaryCompatible,
// Ignore dependencies to internal modules whose version is like `1.2.3+4...` (see https://github.com/scalacenter/sbt-version-policy#how-to-integrate-with-sbt-dynver)
versionPolicyIgnoredInternalDependencyVersions := Some("^\\d+\\.\\d+\\.\\d+\\+\\d+".r),
))
Expand Down Expand Up @@ -94,7 +94,7 @@ lazy val tastyMiMa =
testFrameworks += new TestFramework("munit.Framework")
)
.settings(
libraryDependencies += "ch.epfl.scala" %% "tasty-query" % "1.0.0",
libraryDependencies += "ch.epfl.scala" %% "tasty-query" % "1.2.0",

Test / rtJarOpt := {
for (bootClasspath <- Option(System.getProperty("sun.boot.class.path"))) yield {
Expand Down
12 changes: 11 additions & 1 deletion tasty-mima/src/main/scala/tastymima/Analyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private[tastymima] final class Analyzer(val config: Config, val oldCtx: Context,
import tastyquery.SourceLanguage.Scala3
val oldErasedAlias = ErasedTypeRef.erase(oldAlias, Scala3)(using oldCtx)
val newErasedAlias = ErasedTypeRef.erase(newAlias, Scala3)(using newCtx)
if oldErasedAlias.toSigFullName != newErasedAlias.toSigFullName then
if !erasedTypesCorrespond(oldErasedAlias, newErasedAlias) then
reportIncompatibleTypeChange(oldErasedAlias, newErasedAlias)
end if

Expand Down Expand Up @@ -639,4 +639,14 @@ private[tastymima] object Analyzer:
case _ =>
false
end isCompatibleTypeBoundsChange

@tailrec
private def erasedTypesCorrespond(tp1: ErasedTypeRef, tp2: ErasedTypeRef): Boolean = (tp1, tp2) match
case (ErasedTypeRef.ClassRef(cls1), ErasedTypeRef.ClassRef(cls2)) =>
pathOf(cls1) == pathOf(cls2)
case (ErasedTypeRef.ArrayTypeRef(base1, dims1), ErasedTypeRef.ArrayTypeRef(base2, dims2)) =>
dims1 == dims2 && erasedTypesCorrespond(base1, base2)
case _ =>
false
end erasedTypesCorrespond
end Analyzer

0 comments on commit 5df29ab

Please sign in to comment.