Skip to content

Conversation

@mbovel
Copy link
Member

@mbovel mbovel commented Apr 7, 2025

Fixes #22731.

Work-in-progress.

Started during today's Compiler Spree with @ajafri2001.

@mbovel mbovel changed the title WIP: record application style Fix rewrite for using arguments Apr 7, 2025
@mbovel mbovel force-pushed the mb/22731 branch 3 times, most recently from 3de26e7 to afa470e Compare April 8, 2025 08:46
@mbovel mbovel changed the title Fix rewrite for using arguments Fix insertion of using in applications with trailing lambda syntax Apr 8, 2025
@som-snytt
Copy link
Contributor

I'm dubious about adding "mechanism" to track the user syntax. For rewriting "unused imports", I spent 100 LOC to inspect the text, since an import is not precisely represented in the trees. My thinking was that, as with error messages, the cost should be deferred (and kept off the happy path). It sounds easier to look for paren or brace (but I didn't try it).

OTOH, when I needed ApplyKind for something, it was so clever and handy. Maybe this will pay for itself, too.

@mbovel
Copy link
Member Author

mbovel commented Apr 8, 2025

Re-inspecting text sounds harder to maintain as it duplicates knowledge and assumptions about the syntax that need to be kept in sync with the parser.

On the other hand, I hear you about the importance of keeping the happy path pristine.

I don't know; what do you think @hamzaremmal and @odersky? Would that be okay to always save information about application syntax, or would that be better to re-derive this information from source when needed?

@mbovel mbovel closed this Apr 8, 2025
@odersky odersky reopened this Apr 8, 2025
@odersky odersky closed this Apr 8, 2025
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.

Wrong rewrite of implicit arguments passed as { }

3 participants