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

Don't error (only warn) on symbol literals under -Xsource:3 #9602

Merged
merged 1 commit into from May 7, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 30, 2021

Scala 3 still supports symbol literals even if they require a language
import now (cf scala/scala3#11588), so don't
emit an error if we find one under -Xsource:3 as that could
unnecessarily impede cross-compilation as discovered in
scala/scala-dev#769.

Scala 3 still supports symbol literals even if they require a language
import now (cf scala/scala3#11588), so don't
emit an error if we find one under -Xsource:3 as that could
unnecessarily impede cross-compilation as discovered in
scala/scala-dev#769.
@SethTisue
Copy link
Member

(I won't have time to think about this until next week, but in the meantime I ask it not be merged because I want to think and respond.)

@som-snytt
Copy link
Contributor

Probably it's useful to backport the language import under -Xsource:3.

That sounds baroque, but this conundrum about symbol lits may be where the language import shines.

@SethTisue
Copy link
Member

Probably it's useful to backport the language import under -Xsource:3.

That does sound ideal.

@smarter
Copy link
Member Author

smarter commented Apr 30, 2021

Yeah, but forward bincompat means that likely can't be done without significant custom compiler magic.

@SethTisue
Copy link
Member

The tension here is that -Xsource:3 serves two purposes: 1) it facilitates cross-building, 2) it aids migration by telling you when you're doing something that's going to change or go away.

@SethTisue
Copy link
Member

More thinking out loud: maybe we should be considering using -Xmigration here?

@smarter
Copy link
Member Author

smarter commented Apr 30, 2021

IMO, deprecation warnings already serve purpose 2 well enough.

@som-snytt
Copy link
Contributor

I'm surprised to see the language vals are not marked compileTimeOnly.

The compiler writer's go-to is always "significant custom compiler magic". :) oh, I just used "go-to" in a non-computer sense.

Since anyone using -Xsource:3 doesn't need beginner's help, it would be nice if we let them add their language import for transition purposes; but maybe they will just use conditional compilation.

@SethTisue SethTisue added the prio:hi high priority (used only by core team, only near release time) label May 6, 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.

I'm totally down for this. -Xsource:3 is "Scala 3 lite", not Scala 3 proper, so we can leave Scala 3 to enforce as and when (and/or under what flag) things are hard failures.

@SethTisue
Copy link
Member

deprecation warnings already serve purpose 2 well enough

okay, I'm convinced

not supporting the language import makes me sad, though. I guess that forces cross-builders to add the language import via scalacOptions rather than via import in the code...? is that okay?

@smarter
Copy link
Member Author

smarter commented May 7, 2021

I guess that forces cross-builders to add the language import via scalacOptions rather than via import in the code...?

Yes that's what I had in mind. And maybe the language import can be added in scala 2 later in some fashion.

@dwijnand dwijnand merged commit 991d2ad into scala:2.13.x May 7, 2021
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label May 7, 2021
@lrytz lrytz changed the title Support symbol literals under -Xsource:3 Don't error (only warn) on symbol literals under -Xsource:3 May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio:hi high priority (used only by core team, only near release time) release-notes worth highlighting in next release notes
Projects
None yet
5 participants