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

A code using given does not compile with -source:3.0-migration option #15905

Open
OndrejSpanel opened this issue Aug 24, 2022 · 3 comments
Open

Comments

@OndrejSpanel
Copy link
Member

Compiler version

Tested 3.0.2 and 3.1.3, both with option -source:3.0-migration, see https://scastie.scala-lang.org/04ztVOx5QuqycanJXlZQkg

Minimized code

object EnumOf {
  inline given [E](using ct: scala.reflect.ClassTag[E]): AnyRef = ???
}

Note: the code is extracted from https://github.com/theiterators/kebs/blob/master/macro-utils/src/main/scala-3/pl/iterators/kebs/macros/enums/EnumEntryMacros.scala

Output

inline must be followed by an if or a match

Expectation

Valid Scala 3 code should still compile in migration mode, or if this is not intended, the documentation should be changed. The documentation says:

option makes the compiler forgiving on most of the dropped features

There is nothing about Scala 3 features not being supported.

@OndrejSpanel OndrejSpanel added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 24, 2022
@bishabosha bishabosha added itype:enhancement area:documentation and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 24, 2022
@bishabosha
Copy link
Member

bishabosha commented Aug 24, 2022

we should update the docs to say given is not supported in 3.0-migration

@OndrejSpanel
Copy link
Member Author

we should update the docs to say given is not supported i

I searched internet and did not find a single mention about this. Could someone provide some link where this behaviour is discussed or described? What is the reason for it?

@bishabosha
Copy link
Member

bishabosha commented Aug 25, 2022

the biggest discussion around everything is in issue 8571: #8700, #8571

from a historical point of view, 3.0-migration used to be called Scala2Compat, as seen in #8571, originally it was meant to be for compiling the same source file under either scala 2.13 or 3.0.0, however it wasn't perfect so now there is room for a hypothetical 2x3 mode for that.

However with all of -source:3.0-migration -old-syntax -no-indent the result is pretty close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants