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

Update TASTy reader to support Scala 3.1 #9791

Merged
merged 5 commits into from Oct 27, 2021

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented Oct 25, 2021

As well as implementing changes for TASTy in Scala 3.1.0, also implements a few fixes:

  • fix reading of singleton enum values in non-static inner class
  • do not force annotations unnecessarily
  • add existential flag to wildcard symbols

@scala-jenkins scala-jenkins added this to the 2.13.7 milestone Oct 25, 2021
@bishabosha bishabosha marked this pull request as draft October 25, 2021 18:54
@bishabosha
Copy link
Member Author

Open question: should we support @experimental annotation checks, so that you can't depend on a definition marked @experimental unless you are in also an experimental scope?

@SethTisue SethTisue added the prio:blocker release blocker (used only by core team, only near release time) label Oct 25, 2021
@SethTisue
Copy link
Member

SethTisue commented Oct 26, 2021

@bishabosha I don't seem to have permission to push to your branch, but it needs

diff --git src/compiler/scala/tools/nsc/tasty/bridge/TreeOps.scala src/compiler/scala/tools/nsc/tasty/bridge/TreeOps.scala
index 5a82115d65..82d82af03a 100644
--- src/compiler/scala/tools/nsc/tasty/bridge/TreeOps.scala
+++ src/compiler/scala/tools/nsc/tasty/bridge/TreeOps.scala
@@ -12,7 +12,7 @@
 
 package scala.tools.nsc.tasty.bridge
 
-import scala.tools.nsc.tasty.{TastyUniverse, TastyModes, ForceKinds}, TastyModes._, ForceKinds._
+import scala.tools.nsc.tasty.{TastyUniverse, TastyModes}, TastyModes._
 
 import scala.tools.tasty.TastyName
 import scala.reflect.internal.Flags

to remove unused imports. You can test this locally with set every fatalWarnings := true, which we normally only have enabled in CI.

@SethTisue
Copy link
Member

Open question: should we support @experimental annotation checks, so that you can't depend on a definition marked @experimental unless you are in also an experimental scope?

That seems desirable to me (but not a blocker for 2.13.7, of course).

@SethTisue
Copy link
Member

otherwise LGTM, but perhaps @lrytz would like to give it a once-over

@timothyklim
Copy link

@bishabosha

fix reading of singleton enum values in non-static inner class

Can it read opaque type from a package? For example:

package a
opaque type A = Byte
object A:
  def apply(value: Byte): A = value

In Scala 2.13.6 opaque type must be inside object A otherwise compile error.

@bishabosha
Copy link
Member Author

Can it read opaque type from a package? For example:

package a
opaque type A = Byte
object A:
  def apply(value: Byte): A = value

In Scala 2.13.6 opaque type must be inside object A otherwise compile error.

@timothyklim currently in 2.13, top level definitions from Scala 3 can only be used from their wrapper object, e.g. if that code was in a/A.scala then we need to import a.A$package.A

@lrytz
Copy link
Member

lrytz commented Oct 27, 2021

LGTM too

@SethTisue SethTisue marked this pull request as ready for review October 27, 2021 14:27
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Oct 27, 2021
@SethTisue SethTisue merged commit 8ee33bb into scala:2.13.x Oct 27, 2021
@bishabosha
Copy link
Member Author

I realised now that 7833232 is still forcing the annotation class (to get primaryConstructor), just not explicitly - it's still not causing an issue but something to note.

@SethTisue SethTisue changed the title Tasty reader update for scala 3.1.0 Update TASTy reader to support Scala 3.1 Oct 29, 2021
@SethTisue SethTisue removed the prio:blocker release blocker (used only by core team, only near release time) label Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
6 participants