Skip to content

Commit

Permalink
Consider missing signature equivalent to non-generic one
Browse files Browse the repository at this point in the history
Since for those it should be sufficient to check the descriptor anyway,
and the Scala compiler started emitting more signatures between
3.1.1 and 3.1.2

(from the functional tests it seems there were already a couple
of cases where Scala3 produced more signatures than expected, we now
ignore those as well)

References #693
  • Loading branch information
raboof committed Apr 13, 2022
1 parent 1f5c4ce commit 6e017db
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 12 additions & 3 deletions core/src/main/scala/com/typesafe/tools/mima/core/Signature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ class Signature(private val signature: String) {
}

def matches(newer: Signature, isConstructor: Boolean): Boolean = {
return (signature == newer.signature) ||
(isConstructor && hasMatchingCtorSig(newer.signature)) ||
canonicalized == newer.canonicalized
// If the signature is identical obviously it matches
(signature == newer.signature) ||
// Consider missing signatures identical to non-generic ones.
// This is particularly helpful because between Scala 3.1.1 and 3.1.2 the compiler
// started emitting signatures for non-generic methods. Incompatibilities for those
// will be caught through mismatching descriptors anyway.
(signature == "" && newer.signature.indexOf('<') == -1) ||
(newer.signature == "" && signature.indexOf('<') == -1) ||
// Special rules for constructors
(isConstructor && hasMatchingCtorSig(newer.signature)) ||
// Also match when the signature only differs in the name of a type parameter
canonicalized == newer.canonicalized
}

// Special case for scala#7975
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 6e017db

Please sign in to comment.