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

Make Ref.apply() return trees usable in the largest scope possible #22240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jchyb
Copy link
Contributor

@jchyb jchyb commented Dec 18, 2024

Previously for symbols contained in objects (prefixed by, let's say, 'pre'), we would return:

  • an Ident if pre contained only static object and packages;
  • Select(This(moduleClassSymbol), sym) if pre contained a class.

However, this meant that in the second case, the generated tree would require the macro to be expanded inside of the object, even though it should be enough to just expand inside of the innermost class.
This was unexpected and confusing, so it was changed to not return innermost module classes wrapped with This().

Fixes #20349

Previously for symbols contained in objects (prefixed by, let's say,
'pre'), we would return:
* an Ident if pre contained only static
object and packages;
* Select(This(moduleClassSymbol), sym) if a prefix contained a class.

However, this meant that in the second case, the generated tree would
require the macro to be expanded inside of the object, even though it
should be enough to just expand inside of the innermost class.
This was unexpected and confusing, so it was changed to not return
innermost module classes wrapped with This().
@jchyb jchyb marked this pull request as ready for review January 2, 2025 12:01
@@ -1950,7 +1950,6 @@ object SymDenotations {

/** The this-type depends on the kind of class:
* - for a package class `p`: ThisType(TypeRef(Noprefix, p))
* - for a module class `m`: A term ref to m's source module.
Copy link
Contributor Author

@jchyb jchyb Jan 2, 2025

Choose a reason for hiding this comment

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

Removed, as it has not been true since dc02760

@jchyb jchyb requested a review from hamzaremmal January 2, 2025 12:15
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.

Assertion error during macro generation for an enum
1 participant