-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Wildcard export ignores synthetic members generated from desugaring #10857
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
Comments
I think this may have something to do with creator application changes, if you take a look suing |
more bad news, it seems you cant wildcard export definitions that are added after desugaring: object T:
object Command:
case class Update(cellUpdates: Int)
export Command._ in this example the synthetic companion object for Will need to investigate if this is a fundamental issue with export desugaring at |
That's a pity... Using |
It's a conscious decision not to export synthetic members. One positive aspect of this is that you can export all cases from an enum without also exporting the synthetic |
@odersky would it be desirable to treat the non-(private/synthetic) symbols as names that can then be reinterpreted as an explicit selector, which would then pick up the companion object of case classes? |
a wildcard export will first search for all public and non-synthetic members to add. Then once a valid member is found, that name is then used to search for all term or type members that use that name and are not given or private. As a consequence members like companion objects to case classes will be exported alongside a type alias to the case class
a wildcard export will first search for all public and non-synthetic members to add. Then once a valid member is found, that name is then used to search for all term or type members that use that name and are not given or private. As a consequence members like companion objects to case classes will be exported alongside a type alias to the case class
a wildcard export will first search for all public and non-synthetic members to add. Then once a valid member is found, that name is then used to search for all term or type members that use that name and are not given or private. As a consequence members like companion objects to case classes will be exported alongside a type alias to the case class
@bishabosha Yes, I think that could work. I.e. if one of a pair of type/term definitions with the same name is non-synthatic, the other is imported as well. |
a wildcard export will first search for all public and non-synthetic members to add. Then once a valid member is found, that name is then used to search for all term or type members that use that name and are not given or private. As a consequence members like companion objects to case classes will be exported alongside a type alias to the case class
fix #10857: export from wildcard defs with same name as user declared ones
Minimized code
Up-to Scala 3.0.0-M2, a wildcard export worked as expected: ALL members were exported, both singleton members as class case members:
In Scala 3.0.0-M3, the above code exports
ResetSudokuDetailState
, but notUpdate
andGetSudokuDetailState
.The workaround is to export all members explicitly:
Output
Expectation
Doing a wildcard export on an enum should export all members
The text was updated successfully, but these errors were encountered: