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

Add checks for the consistency of the parents in TreeChecker #18935

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

hamzaremmal
Copy link
Member

This PR adds a check for the parents in the TreeChecker.

In the context of macro annotations, this PR doesn't allow the modification of the parents. This restriction will probably be partially lifted as we come up with the final specification.

This PR is related to #18677 put does not close it.

@hamzaremmal
Copy link
Member Author

This check is available under -Xcheck-macros and -Ycheck:**

case _ => tree.symbol.isConstructor && tree.symbol.owner.is(Flags.Trait)
tree.symbol.is(Flags.Trait) || isTraitConstructor

val newParents = if impl.parents.tail eq newTraits then impl.parents
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the formatting we use for multiline expressions. It should be all on the right of the = or at the indented next line.

val newParents = 
  if impl.parents.tail eq newTraits then impl.parents
  else impl.parents.head :: newTraits

Copy link
Member Author

Choose a reason for hiding this comment

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

We should have a document with "Best practices" when working on Dotty with some of these guidelines.

@nicolasstucki
Copy link
Contributor

Otherwise LGTM

@hamzaremmal hamzaremmal merged commit a0ea484 into scala:main Feb 12, 2024
19 checks passed
@hamzaremmal hamzaremmal deleted the i18677 branch February 12, 2024 14:59
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
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.

3 participants