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 -source future, remove existentials in 3.0 #42

Merged
merged 2 commits into from May 26, 2021

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented May 21, 2021

Closes #41

@@ -57,7 +57,8 @@ object TpolecatPlugin extends AutoPlugin {
ScalacOption("-language:experimental.macros", removedIn = Some(V3_0_0)), // Allow macro definition (besides implementation and application)
ScalacOption("-language:higherKinds", removedIn = Some(V3_0_0)), // Allow higher-kinded types
ScalacOption("-language:implicitConversions", removedIn = Some(V3_0_0)), // Allow definition of implicit functions called views
ScalacOption("-language:existentials,experimental.macros,higherKinds,implicitConversions", addedIn = Some(V3_0_0)), // the four options above, dotty style
ScalacOption("-source future", addedIn = Some(V3_0_0)), // Emit warnings for features that are planned to be removed (e.g. extending non-open classes outside their files).
ScalacOption("-language:existentials,experimental.macros,higherKinds,implicitConversions,strictEquality", addedIn = Some(V3_0_0)), // Require CanEqual for equality checks + the four options above, dotty style
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm now wondering if we should split this: if someone wants to opt out of a single option, they need to first remove the whole thing, then add all the other options again. If we split this into separate -language:foo flags, it's much easier to remove only the ones you want removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, I just hit scala/scala3#10850 so I no longer like the strict equality option for now.

@DavidGregory084
Copy link
Member

Sorry @kubukoz I would love to merge this but I'm nervous about defaulting to strictEquality because it will certainly break most people's code at the moment

@kubukoz
Copy link
Member Author

kubukoz commented May 26, 2021

Yeah, after some consideration I'm not a fan. I'll update this to split -language and remove that one.

@kubukoz
Copy link
Member Author

kubukoz commented May 26, 2021

@DavidGregory084 I did the above, turns out the flags were identical as the 2.x ones so there was no need to treat them separately. I removed -language:existentials in Scala 3, as that feature has been dropped (the flag is probably a no-op now).

@DavidGregory084
Copy link
Member

This is great, thanks so much @kubukoz!

@DavidGregory084 DavidGregory084 merged commit f055cd7 into typelevel:master May 26, 2021
@kubukoz kubukoz deleted the scala3-flags branch May 26, 2021 18:48
@kubukoz kubukoz changed the title Add -source future, strictEquality Add -source future, remove existentials in 3.0 May 26, 2021
@2m
Copy link

2m commented May 28, 2021

Just a FYI: I had to add a little filter (2m/ciris-hocon@e61f34a) to not use -source future for a codebase that is still Scala 2 code but just cross compiled with Scala 3 when publishing.

@kubukoz
Copy link
Member Author

kubukoz commented May 28, 2021

Same... I'm not sure how I feel about it.

@2m
Copy link

2m commented May 28, 2021

Yea, its tricky. For projects that actually use Scala 3 syntax -source future makes total sense. But if it is Scala 2 code compiled with Scala 3 compiler then it should not be added. Not sure how to make such decision from sbt.

ScalacOption("-language:experimental.macros"), // Allow macro definition (besides implementation and application)
ScalacOption("-language:higherKinds"), // Allow higher-kinded types
ScalacOption("-language:implicitConversions"), // Allow definition of implicit functions called views
ScalacOption("-source future", addedIn = Some(V3_0_0)), // Emit warnings for features that are planned to be removed (e.g. extending non-open classes outside their files).
Copy link

Choose a reason for hiding this comment

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

-source:future can also be used. And it would not be split across two elements later on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh that's cool!

@kubukoz
Copy link
Member Author

kubukoz commented May 28, 2021

Maybe we can look at crossScalaVersions and see if it had at least one of both?

Also, this probably impacts library authors more than application developers... Nevertheless it'd be nice if we didn't force all the maintainers to make changes in such an update.

@2m
Copy link

2m commented May 28, 2021

Maybe we can look at crossScalaVersions and see if it had at least one of both?

Sometimes -source:future is desirable even when having both versions in crossScalaVersions as Scala 2 can compile Scala 3 code with -Xsource:3 flag.

@kubukoz
Copy link
Member Author

kubukoz commented May 28, 2021

hmm, even with things like the new wildcard imports (*)?

@2m
Copy link

2m commented May 28, 2021

Yup: scala/scala#9582

It seems -source:future needs to be applied depending on whether or not the code is actually Scala 3 code and being compiled with Scala 3.

@DavidGregory084
Copy link
Member

Yes, looking at the PR queue from scala-steward I am a bit undecided on this now 😆 Nobody has come to yell at me yet though!

kubukoz added a commit to kubukoz/sbt-tpolecat that referenced this pull request May 30, 2021
wjoel added a commit to cognitedata/cognite-sdk-scala that referenced this pull request May 31, 2021
wjoel added a commit to cognitedata/cognite-sdk-scala that referenced this pull request May 31, 2021
wjoel added a commit to cognitedata/cognite-sdk-scala that referenced this pull request May 31, 2021
DavidGregory084 added a commit that referenced this pull request Jun 1, 2021
Remove -source future (rolls back part of #42)
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.

Consider adding -source future for Scala 3.x
3 participants