Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scala 3 compiler settings test #1484

Merged
merged 6 commits into from
May 13, 2024

Conversation

carlosrogue
Copy link
Contributor

@carlosrogue carlosrogue commented May 5, 2024

Official Compiler Flags documentation do not mention how to set settings for scala 3 compiler.

Maybe adding a comment like this in 2.12?:

@ // Disabling default Scala imports

@ List(1, 2, 3) + "lol"
res0: String = "List(1, 2, 3)lol"

@ interp.configureCompiler(_.settings.noimports.value = true)

@ // interp.preConfigureCompiler(ctx => ctx.setSetting(ctx.settings.YnoImports, true)) // Dotty

Fixes #1192

@carlosrogue
Copy link
Contributor Author

@lefou should I also add also this hint comment to 2.12:

@ // interp.preConfigureCompiler(ctx => ctx.setSetting(ctx.settings.YnoImports, true)) // Dotty

@lefou
Copy link
Member

lefou commented May 8, 2024

@lefou should I also add also this hint comment to 2.12:

@ // interp.preConfigureCompiler(ctx => ctx.setSetting(ctx.settings.YnoImports, true)) // Dotty

I've no idea.

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

This look good to me. Thank you!

Do you know or have an idea why the test isn't configured for Scala 2.13? Also newer Scala 2.12 version aren't covered?

@carlosrogue
Copy link
Contributor Author

@lefou there is a note regarding this test not working on 2.13:

      // not sure why that one doesn't pass in 2.13
      // even disabling the noimports and imports settings instead of setting noimports to false
      // doesn't seem to reinstate imports
      def sv = scala.util.Properties.versionNumberString
      // In 2.12.13, I would have expected things like
      //   interp.configureCompiler(_.settings.Wconf.tryToSet(List("any:wv", "cat=unchecked:ws")))
      // to re-instate the expected warning below, to no avail :|

I could check this later and verify if we can at least add newer 2.12 versions as part of other MR.

@@ -143,7 +143,7 @@ object BuiltinTests extends TestSuite {
// In 2.12.13, I would have expected things like
// interp.configureCompiler(_.settings.Wconf.tryToSet(List("any:wv", "cat=unchecked:ws")))
// to re-instate the expected warning below, to no avail :|
if (TestUtils.scala2_12 && sv.stripPrefix("2.12.").toInt <= 12) {
if (TestUtils.scala2_12 && sv.stripPrefix("2.12.").toInt <= 19) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you know or have an idea why the test isn't configured for Scala 2.13? Also newer Scala 2.12 version aren't covered?

@lefou after covering until 2.12.19 this was successful: mill 'amm.repl[2.12.{13,14,15,16,17,18,19}].test.testOnly' -- 'ammonite.session.BuiltinTests.settings'.

Copy link
Member

Choose a reason for hiding this comment

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

Great!

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you!

@lefou lefou merged commit 48eb976 into com-lihaoyi:main May 13, 2024
31 checks passed
@lefou lefou added this to the 3.0.0-M2 milestone May 13, 2024
@carlosrogue carlosrogue deleted the scala3-compiler-settings branch July 4, 2024 20:47
lefou pushed a commit that referenced this pull request Jul 17, 2024
Enable settings tests for any 2.12 versions.

This is a follow up of this conversation
#1484 (review)
I had previously with @lefou.

Tested with `mill -i -w
'amm.repl[{2.12.19,2.13.14,3.4.2}].test.testOnly' --
'ammonite.session.BuiltinTests.settings'` so all `2.12`, `2.13` and `3`
latest versions are passing.

Pull request: #1516
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.4.0: value settings is not a member of dotty.tools.dotc.Compiler
2 participants