Skip to content

Harmonize TASTy comment loading #6032

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

Open
abgruszecki opened this issue Mar 6, 2019 · 1 comment
Open

Harmonize TASTy comment loading #6032

abgruszecki opened this issue Mar 6, 2019 · 1 comment
Labels
area:library Standard library backlog No work planned on this by the core team for the time being. itype:enhancement

Comments

@abgruszecki
Copy link
Contributor

abgruszecki commented Mar 6, 2019

Currently ReadComments context mode is required to load & store comments when reading TASTY files. Now that we have an API for accessing the comments ( #6028 ), the users can observe inconsistent behaviour. We should try to make it consistent instead.

When accessing comments for code symbols in inline method bodies, whether the comment is accessible or not depends on where it's defined and current mood of incremental compilation. If the symbol is compiled in the current run, its documentation will be accessible irrelevant of the ReadComments mode. If the symbol is defined in a library (and therefore loaded from a TASTY file), the documentation will be only accessible if ReadComments mode was on when the symbol was being read. Same goes for the situation in which the symbol was compiled in a previous run, and incremental compilation decided to not touch it during current run.

Currently when accessing the symbols through ConsumeTasty API, ReadComments mode is always set, so the comments are always available. However, the mode is not set for TastyDecompiler. The latter may or may not be a problem.

The final problem is what accessing the comments should return. Right now it returns Option[Comment], attempting to throw sometimes if ReadComments was not on when reading TASTY files. It likely should either never throw, or always throw if the comments were not read due to the mode being off. The problem is that right now, as outlined above, there's no reliable way to detect that.

@abgruszecki
Copy link
Contributor Author

/cc @nicolasstucki

@nicolasstucki nicolasstucki changed the title Harmonize TASTY comment loading Harmonize TASTy comment loading Mar 6, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 7, 2019
Macros seem to be expanded before the comments are registered in the symbol.
Comments where added to be used while loadind a TASTy file trough the tasty.Reflection API,
hence this use case is not critical.

See scala#6032
@odersky odersky added the backlog No work planned on this by the core team for the time being. label Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:library Standard library backlog No work planned on this by the core team for the time being. itype:enhancement
Projects
None yet
Development

No branches or pull requests

2 participants