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

Encode parent trait private members in extraHash to propagate TraitPrivateMembersModified across external dependency #1289

Merged
merged 2 commits into from
Nov 28, 2023

Conversation

Friendseeker
Copy link
Member

@Friendseeker Friendseeker commented Nov 28, 2023

This PR fixes #662

Cause of the issue

To determine if a class has API change TraitPrivateMembersModified, extraHash, which is a hash of private API of a trait is computed. Direct comparison on extraHash is used to determine if a trait has private member modified.

When we have the following dependency c.C -> b.B -> a.A, (c.C extends b.B, b.B extends a.A), for which c.C, b.B, a.A belongs to different projects, the dependencies are external, hence when A has private member modified, the following happens

  • A is recompiled
  • B is recompiled since API of A has change TraitPrivateMembersModified and B extends A.
  • API of B is not changed, hence C is not recompiled even though C extends B.

Fix

When we compute extraHash for a child trait, use the parent traits' extraHash. Therefore, when parent has private members modified, child extraHash would change, hence child would have TraitPrivateMembersModified, propagating it.

@Friendseeker Friendseeker changed the title Incorporate hierarchy information in extraHash to propagate TraitPrivateMembersModified across external dependency Encode parent trait private members in extraHash to propagate TraitPrivateMembersModified across external dependency Nov 28, 2023
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks!

@eed3si9n eed3si9n merged commit eb8909f into sbt:develop Nov 28, 2023
7 checks passed
@Friendseeker Friendseeker deleted the trait-private-transitive-dep branch November 28, 2023 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Under compilation of class that transitively extends trait which has had private field renamed
2 participants