Skip to content

Commit

Permalink
Remove "Modified names" assertion
Browse files Browse the repository at this point in the history
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 #292 once and for all, and end the
pain of those who have kindly complained about it in the ticket. :)
  • Loading branch information
jvican committed Jan 22, 2018
1 parent bd27d88 commit 841284e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ final case class APIChangeDueToMacroDefinition(modified0: String) extends APICha
* This class is used only when name hashing algorithm is enabled.
*/
final case class NamesChange(modified0: String, modifiedNames: ModifiedNames)
extends APIChange(modified0) {
assert(modifiedNames.names.nonEmpty, s"Modified names for $modified0 is empty")
}
extends APIChange(modified0)

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

0 comments on commit 841284e

Please sign in to comment.