Skip to content

feature: Add logical package parsing for sourcepath#25446

Draft
tgodzik wants to merge 1 commit intoscala:mainfrom
tgodzik:with-pruning
Draft

feature: Add logical package parsing for sourcepath#25446
tgodzik wants to merge 1 commit intoscala:mainfrom
tgodzik:with-pruning

Conversation

@tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Mar 5, 2026

The idea is that not all files follow the directory structure, which would make the current directory parsing (probably) inefficient. By creating the full package structure we also make sure that only relevant files are always loaded and no recalculation is needed.

I might be totally wrong here, so would love some feedback if it's even necessary. I've put it behind a flag just in case.

How much have your relied on LLM-based tools in this contribution?

Moderately -> LLM helped rewrite the code from the Scala 2 implementation.

How was the solution tested?

Automatic test added to the presentation compiler tests

Additional notes

I started porting changes that Julian Dragos did in Metals v2 and I realized that Scala 3 compiler is already quite efficient with loading symbols from source path, so I ported the other change used for determining package structure to use it efficiently in loading correct files from the source path

@odersky
Copy link
Contributor

odersky commented Mar 6, 2026

It would be good to have a high-level description how this works, and also a breakdown of the costs.

@tgodzik
Copy link
Contributor Author

tgodzik commented Mar 6, 2026

It would be good to have a high-level description how this works, and also a breakdown of the costs.

It's not terribly complex, we get all the sources from sourcepath, parse them to extract packages, save that in a tree like structure, use it to load specific packages and symbols on demand.

Main difference with the current approach (as I understand it) is that we don't rely on directory structure and we also check the packages eagerly (which is a consequence of not relying on the structure)

I plan to run some benchmarks anyway on this and see if maybe there is a clear performance difference.

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.

2 participants