Skip to content

Commit 841284e

Browse files
committed
Remove "Modified names" assertion
This assertion dates from the time where the whole Zinc 1.x was under development. As I understand it, it was put in place to make sure that the names invalidation was correct. However, the assertion itself is not correct. It violates some legit scenarios that are valid, where there are changes in APIs but there are no changes in the names. One of these examples is the following one, provided by @francisdb, where the original code is: ``` trait T2 trait T1 extends T2 { def foo: String } class C1 extends T1 { def foo = "test" } ``` And moving `foo` from `T1` to `T2` causes the assertion to fail. In this concrete scenario, we can see how the API has changed (the hashes are not the same than the previous scenario) but the names are identical. There are more examples, some of them I have occassionally run into. Therefore, this commit should fix sbt#292 once and for all, and end the pain of those who have kindly complained about it in the ticket. :)
1 parent bd27d88 commit 841284e

File tree

2 files changed

+1
-3
lines changed
  • internal/zinc-core/src/main/scala/sbt/internal/inc
  • zinc/src/sbt-test/source-dependencies/empty-modified-names

2 files changed

+1
-3
lines changed

internal/zinc-core/src/main/scala/sbt/internal/inc/Changes.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ final case class APIChangeDueToMacroDefinition(modified0: String) extends APICha
5050
* This class is used only when name hashing algorithm is enabled.
5151
*/
5252
final case class NamesChange(modified0: String, modifiedNames: ModifiedNames)
53-
extends APIChange(modified0) {
54-
assert(modifiedNames.names.nonEmpty, s"Modified names for $modified0 is empty")
55-
}
53+
extends APIChange(modified0)
5654

5755
/**
5856
* ModifiedNames are determined by comparing name hashes in two versions of an API representation.

0 commit comments

Comments
 (0)