Skip to content

Conversation

@som-snytt
Copy link
Contributor

Fixes #15944
Fixes #24879

If exports added members, then check for more constructor proxies.

Follow up previous tweak for using constructor proxy of exported member, by preserving its prefix.

Although needsConstructorProxies is not expensive, it's also cheap to exclude terms first and save calls; there are many more term members than types.

@som-snytt som-snytt marked this pull request as ready for review January 3, 2026 04:13
@Gedochao Gedochao requested a review from odersky January 8, 2026 14:59
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM!


/** Does symbol `sym` need constructor proxies to be generated? */
def needsConstructorProxies(sym: Symbol)(using Context): Boolean =
!sym.isTerm
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this optimization is needed. If it is a term, the previous logic would ask isClass and then isType and then return false. Both of these calls are extremely cheap. So, no need to complicate the logic in this case.

if hasExport(rest) then
hasExport(rest) && {
process(rest)
exported
Copy link
Contributor

Choose a reason for hiding this comment

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

This construct is logically correct but mixes two concerns. I would suggest to something more along the lines of what we had:

if hasExport(rest) then
   process(rest)

exported

@odersky odersky assigned som-snytt and unassigned odersky Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants