scala-dev icon indicating copy to clipboard operation
scala-dev copied to clipboard

Document features conditional on source and target versions

Open adriaanm opened this issue 7 years ago • 9 comments

-Xsource:2.13

  • case classes must have a non-implicit parameter list (https://github.com/scala/scala/pull/5585)
  • empty character literal (use '\'' for single quote) (https://github.com/scala/scala/pull/5727)
  • Only methods can be marked @elidable. (https://github.com/scala/scala/pull/5539)
  • Higher-kinded type variable unification (https://github.com/scala/scala/pull/6069)
  • eta-expansion is changing (TODO: document when changes are in M4)
  • changes to the computation of the parts of the type of an implicit value (https://github.com/scala/scala/pull/5867, https://github.com/scala/scala/pull/6074)

adriaanm avatar Feb 01 '18 10:02 adriaanm

this is for 2.12? where would such documentation go?

SethTisue avatar Mar 01 '18 22:03 SethTisue

Related https://github.com/sbt/sbt/issues/3123

If there were command line entry point that lists out list of flags, -Xsource manuals, latest book recommendations by Scala team, I'd love to surface them as an sbt task scalaHelp.

eed3si9n avatar Mar 01 '18 23:03 eed3si9n

we now have a place to put this stuff: https://github.com/scala/docs.scala-lang/issues/1058

SethTisue avatar May 02 '18 16:05 SethTisue

nowadays, this would be about -Xsource:3.0 instead

SethTisue avatar Oct 29 '20 17:10 SethTisue

I don't know about documenting, but I meant to add 3 to the migration guide. I'm pretty sure it's underused, because otherwise people would be complaining about it. It has, for instance, "infix on the next line." I wish 2.13 were compiled with it.

som-snytt avatar Oct 29 '20 19:10 som-snytt

and nowadays it's -Xsource:3 and people are actually using it prepare to migrate to 3, so it's reeeeeallly time now

SethTisue avatar Oct 22 '21 15:10 SethTisue

It would also be good to document what effect -target has on generated bytecode. (I've updated the issue title accordingly.)

For the most part it just sets the bytecode version number, but I know of one PR where it actually affects code generation, namely: https://github.com/scala/scala/pull/9556 ("Use StringConcatFactory for string concatenation on JDK 9+")

I didn't find anything else like that when prepping through the compiler code, but it's conceivable I missed something.

SethTisue avatar Jan 19 '22 22:01 SethTisue

The pressure to document -Xsource:3 properly is increasing, as seen on e.g. https://github.com/scala/scala-dev/pull/850 (discussion about 2.13.12 release notes). We've seen in the community build that more and more OSS projects are leaving -Xsource:3 enabled in their builds, and each successive recent 2.13.x release has added additional behavior to it.

SethTisue avatar Sep 12 '23 13:09 SethTisue