Skip to content

Conversation

@som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Nov 9, 2021

Fixes #13887

@som-snytt
Copy link
Contributor Author

Did not yet investigate how to set up an automated test.

➜  snips ~/projects/dotty/bin/scalac -Wconf:cat=configuration:s -Werror -Werror -d /tmp ok.scala

@dwijnand
Copy link
Member

dwijnand commented Nov 10, 2021

Are all the configuration messages about such trivial matters like setting the flag twice? If so, then I agree this is the right change. But if there are any that are more concerning, then I think it would be wrong to hide them away by default.

@dwijnand
Copy link
Member

For instance, setting the output flag twice is by-default warning worthy imo. If I set -d foo but it's last-option-wins and something else is appending after me, I'd like to at least get a warning about it by default. WDYT?

@som-snytt
Copy link
Contributor Author

Yes, my first thought was to distinguish --deprecation --deprecation from --deprecation --deprecation:false. There is trivial redundancy, conflicting replication, and probably more complex settings that in tandem don't make sense.

In Scala 2, there was discussion around "last setting wins" semantics. But really a warning is warranted, especially because the context is not a command line in a script, where you might want to just make a best effort, but possibly multiple plugins adding options.

dwijnand
dwijnand previously approved these changes Nov 22, 2021
Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

LGTM. Ready for this to be merged, @som-snytt?

@som-snytt
Copy link
Contributor Author

Overall, I thought -configuration would not pull its weight, but now I think it may be helpful, with -Wconf:cat=configuration:s escape hatch.

A few observations, it warns on -Vprint:typer -Vprint:parser -Vprint:typer

Setting -Vprint set to typer redundantly

but not -Vprint:typer,parser,typer.

The flag warning sounds flippant. On -deprecation -deprecation:false:

Boolean flag -deprecation flipped

It does not warn on -d /tmp -d /tmp/out.jar which is the use case you were enthusiastic about. Also the Version and Option cases. Worth nailing that down, which I will do.

@dwijnand dwijnand dismissed their stale review November 29, 2021 10:03

Let's warn on multiple output dirs

@som-snytt
Copy link
Contributor Author

Rebased and added warning on multiple outputs. Also implicit Releasable to make Using pleasant.

@som-snytt
Copy link
Contributor Author

[info] Checking out Scala.js source version 1.7.1
[info] compiling 5 Scala sources to C:\actions-runner2\_work\dotty\dotty\tests\sjs-junit\..\out\bootstrap\sjsJUnitTests\scala-3.1.3-RC1-bin-SNAPSHOT-nonbootstrapped\classes ...
[warn] -- Warning: C:\actions-runner2\_work\dotty\dotty\tests\sjs-junit\..\out\bootstrap\sjsJUnitTests\scala-3.1.3-RC1-bin-SNAPSHOT-nonbootstrapped\src_managed\main\BuildInfo.scala:6:0 
[warn] 6 |val hasSourceMaps = false
[warn]   |^
[warn]   |Line is indented too far to the left, or a `}` is missing

@som-snytt
Copy link
Contributor Author

Rebased hoping to duck spurious test failures.

@som-snytt
Copy link
Contributor Author

Accidentally used jdk 11 Path.of in test.

@som-snytt
Copy link
Contributor Author

Rebased hoping never to have to rebase again. Conflict in settings, of course.

Now that I know about -release and how useful it is, why would I ever suffer the indignity of using Path.of (see last comment).

There is a separate effort for tests to respect javaVersion, it should also use -release and default to 8. That would require -no-exec to be very useful.

I saw in the settings conflict that -release has an alias.

@som-snytt
Copy link
Contributor Author

Also, may you live in interesting times.

 Error:  -- [E134] Type Error: C:\actions-runner2\_work\dotty\dotty\compiler\test\dotty\tools\dotc\SettingsTests.scala:188:4 
Error:  188 |    assertThrows[AssertionError](_.getMessage.contains("missing argument for option -foo"))(check(List("-foo")))
Error:      |    ^^^^^^^^^^^^
Error:      |None of the overloaded alternatives of method assertThrows in object Assert with types
Error:      | [T <: Throwable]
Error:      |  (x$0: String, x$1: Class[T], x$2: org.junit.function.ThrowingRunnable): T
Error:      | [T <: Throwable](x$0: Class[T], x$1: org.junit.function.ThrowingRunnable): T
Error:      |match type arguments [AssertionError] and arguments (<?> => <?>)
Error:  one error found
Error:  (scala3-compiler / Test / compileIncremental) Compilation failed
Error:  Total time: 10 s, completed Mar 26, 2022 5:46:12 AM

and come to know interesting people.

@smarter
Copy link
Member

smarter commented Apr 27, 2022

It looks like this is ready but waiting on a final look by @dwijnand ? I've assigned him and given @som-snytt write privileges in this repo so he can assign people himself.

@smarter smarter assigned dwijnand and unassigned som-snytt Apr 27, 2022
@som-snytt
Copy link
Contributor Author

Apologies in advance, Dale. I see a few style nits, so I will take a quick pass over it.

I already checked my white privilege. Oh, it says "write" privilege.

@smarter smarter added this to the 3.2.0-RC1 milestone May 4, 2022
Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

LGTM, except the option name...

@som-snytt som-snytt marked this pull request as draft October 20, 2025 17:51
@som-snytt som-snytt force-pushed the issue/13887 branch 2 times, most recently from 27cdc6d to 76f6d86 Compare October 22, 2025 19:42
@som-snytt
Copy link
Contributor Author

@KacperFKorban Maybe you have time to review the refactor of Settings that improves the remaining arguments in the setting state when erroring. There were a couple of fixes in August when I rebased (tweak arg handling in MainGenericRunner/Compiler).

The original feature was to add a category for diagnostics about options, i.e., configuration. That would be useful in a project build, to make sure settings look right (are not set twice, etc). With -Wconf the warnings can be made to error or (if desired) silenced.

@som-snytt som-snytt marked this pull request as ready for review October 22, 2025 23:52
Copy link
Contributor

@Gedochao Gedochao left a comment

Choose a reason for hiding this comment

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

LGTM

@som-snytt
Copy link
Contributor Author

@Gedochao Thank-you! I was listening to entertainment media while adding the "deprecated aliases" commit. Would you care to comment? Or I could move it to a separate PR. I also cleaned up the test per review.

Copy link
Contributor

@Gedochao Gedochao left a comment

Choose a reason for hiding this comment

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

About the actual alias deprecations.

@Gedochao
Copy link
Contributor

Gedochao commented Nov 7, 2025

@Gedochao Thank-you! I was listening to entertainment media while adding the "deprecated aliases" commit. Would you care to comment? Or I could move it to a separate PR. I also cleaned up the test per review.

Yup, separate PR would be preferable.
Also, as noted above, let's wait with deprecating -usejavacp until 3.10.0 (so that one in a separate-separate PR 😉)

@Gedochao Gedochao added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Nov 7, 2025
@Gedochao Gedochao added this to the 3.8.0 milestone Nov 7, 2025
@Gedochao
Copy link
Contributor

Gedochao commented Nov 7, 2025

@WojciechMazur we'd need to backport this to 3.8 if we'd backport #24359
Which I suppose we could. 🤷

@som-snytt som-snytt enabled auto-merge (rebase) November 7, 2025 08:47
@som-snytt som-snytt merged commit 1cace88 into scala:main Nov 7, 2025
47 checks passed
@som-snytt som-snytt deleted the issue/13887 branch November 7, 2025 09:09
WojciechMazur added a commit that referenced this pull request Nov 12, 2025
Backports #13915 to the 3.8.0-RC1.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:done This PR was successfully backported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Xfatal-warnings applied to flags passed to scalac itself (inconsistent with Scala 2 behavior)

7 participants