Skip to content

Relax typer position assert in interactive mode#26130

Open
SolalPirelli wants to merge 3 commits into
scala:mainfrom
dotty-staging:solal/repl-completions
Open

Relax typer position assert in interactive mode#26130
SolalPirelli wants to merge 3 commits into
scala:mainfrom
dotty-staging:solal/repl-completions

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

@SolalPirelli SolalPirelli commented May 21, 2026

Fixes #25890

This is fixing a symptom, but we already liberally check for interactive mode in the codebase to accept dubious trees. And it fixes a regression; perhaps we can have an issue to remove as many of those interactive checks as possible at some point...

I also added a clearer indication that something went wrong when completions throw an exception.

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

Not at all

How was the solution tested?

New automated testing

Also manually tested: buildQuick then run bin/replQ with the issue's reproducer and see that it works

@bishabosha
Copy link
Copy Markdown
Member

is there a repl completion test suite?

@SolalPirelli
Copy link
Copy Markdown
Contributor Author

Yes, there is, thanks for calling me out on my laziness :)

@SolalPirelli SolalPirelli requested a review from tgodzik May 21, 2026 12:44
case (name, CompletionDenotation(denots, site)) if matches0(name) =>
def isAccessible(denot: SingleDenotation): Boolean =
site.map(denot.symbol.isAccessibleFrom(_)).getOrElse(true)
site.forall(denot.symbol.isAccessibleFrom(_))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first 2 files are minor cleanups I noticed along the way (well, IntelliJ noticed)

*/
def withMonitoringCtrlC[T](handler: () => Unit)(block: => T): T = {
// If you change Ctrl+C handling in any way, make sure you manually check that
// If you change Ctrl-C handling in any way, make sure you manually check that
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every other instance in the file uses a hyphen

@SolalPirelli SolalPirelli requested a review from mbovel May 22, 2026 12:29
@SolalPirelli SolalPirelli force-pushed the solal/repl-completions branch from 6c2cd08 to dbe969c Compare May 26, 2026 09:21
Comment thread compiler/src/dotty/tools/dotc/typer/Typer.scala Outdated
@SolalPirelli SolalPirelli requested a review from Gedochao May 27, 2026 07:18
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.

assertion failure in Typer during tab completion on NamedTuple in repl

2 participants