Skip to content

Allow running tests within a debugger#25655

Merged
SolalPirelli merged 3 commits intoscala:mainfrom
dotty-staging:solal/tests
Apr 1, 2026
Merged

Allow running tests within a debugger#25655
SolalPirelli merged 3 commits intoscala:mainfrom
dotty-staging:solal/tests

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

Fix #25633

Also add a simple ignored-by-default test to easily run one test case at a time

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

not

How was the solution tested?

duh

|├── def foo(fn: => Int) = bar(fn) [ A.scala:2 ]
|│ ^^^^^^^
|├── def bar(fn: => Int) = fn [ A.scala:4 ]
|│ ^^
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.

idk which change caused this but it seems "better" now since we go from no source to a source, so I didn't look further

private def checkRequirements(f: String, sourceDir: JFile, outDir: String): Unit = {
private def checkRequirements(f: String, sourceDir: JFile, outDir: JFile): Unit = {
require(sourceDir.isDirectory && sourceDir.exists, "passed non-directory to `compileFilesInDir`: " + sourceDir)
require(outDir.last == JFile.separatorChar, "please specify an `outDir` with a trailing file separator")
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.

good example of an assertion that should never need to exist if you use the right data structures


val flags = flags0
.and(scalacOptions*)
.and("-sourceroot", TestSources.rootPath().toAbsolutePath.toString)
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.

required so semanticDB files are emitted in the right place

@SolalPirelli SolalPirelli requested a review from mbovel March 31, 2026 12:42
@SolalPirelli SolalPirelli marked this pull request as ready for review March 31, 2026 12:45
Copy link
Copy Markdown
Member

@mbovel mbovel left a comment

Choose a reason for hiding this comment

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

It seems like Playground.scala has a similar purpose to your new singleTest test. Could we update Playground instead of adding a new test?

Aside: we should also check https://nightly.scala-lang.org/docs/contributing/debugging/ide-debugging.html is up-to-date.

@SolalPirelli
Copy link
Copy Markdown
Contributor Author

Nice, thanks. Done.

Re: the doc, I don't use Metals so idk about that part, but the sentence about IntelliJ is correct.

@mbovel mbovel self-requested a review March 31, 2026 13:16
@SolalPirelli SolalPirelli enabled auto-merge (squash) March 31, 2026 13:53
@SolalPirelli SolalPirelli merged commit 0eabef2 into scala:main Apr 1, 2026
64 checks passed
@SolalPirelli SolalPirelli deleted the solal/tests branch April 1, 2026 18:08
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.

Make testCompilation work from within an IDE debugger

2 participants