Skip to content

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:**

@hamzaremmal hamzaremmal force-pushed the i18677 branch 3 times, most recently from 3345567 to 72f0abf Compare February 2, 2024 16:22
@hamzaremmal hamzaremmal marked this pull request as ready for review February 2, 2024 16:23
@hamzaremmal hamzaremmal force-pushed the i18677 branch 2 times, most recently from 563b3a1 to 1723086 Compare February 9, 2024 17:23
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

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