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

Symbols loaded for Tasty Inspector are not correctly marked as absent #10453

Open
abgruszecki opened this issue Nov 23, 2020 · 1 comment
Open
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API itype:bug itype:crash

Comments

@abgruszecki
Copy link
Contributor

Short summary

When we load symbols, in some cases we over-approximate and create symbols that don't really exist. These should be later on marked as absent, i.e. their denots should have their info set to NoType. This doesn't correctly work when using Tasty Inspector.

It is possible to find symbols either by asking for them by name, or by listing members of definitions (say, of a package) that have a denot with info still set to NoCompleter. Nearly any operation on such symbols will cause a crash.

Demo and affected code

#10451 will demonstrate an exception when it finishes.

Doctool is affected, as it needs to look up definitions for definition-link-resolving purposes. At the moment, we circumvent this by checking if a symbol is complete (see https://github.com/lampepfl/dotty/blob/master/scala3doc/src/dotty/dokka/tasty/comments/MemberLookup.scala#L62-L78).

Any code that tries to use Tasty Inspector for definition lookup will probably be affected as well.

Potential fixes

I tried to fix this by marking still-incomplete symbols as absent in https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala#L870-L874. This resulted in exceptions being thrown when bootstrapping the compiler, though I don't know whether that can be fixed further or not.

Another good place to mark the symbols as absent would be the ReadTasty class, which is responsible for forcing symbols when loading them for Tasty Inspector.

/cc @nicolasstucki @smarter @odersky

@abgruszecki
Copy link
Contributor Author

@nicolasstucki asking before I forget. Do you think we have to fix this for RC1? It seems like a serious bug to leave for the release, though fixing it will be painful as well.

@nicolasstucki nicolasstucki removed their assignment Feb 24, 2021
@nicolasstucki nicolasstucki added area:metaprogramming:reflection Issues related to the quotes reflection API and removed area:metaprogramming labels Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API itype:bug itype:crash
Projects
None yet
Development

No branches or pull requests

2 participants