docs.scala-lang icon indicating copy to clipboard operation
docs.scala-lang copied to clipboard

-Yimports documentation entry gives invalid format

Open Daenyth opened this issue 4 years ago • 3 comments

Screen Shot 2021-08-11 at 9 25 50 AM

The documentation displays usage like -Yimports foo,bar, but if you actually use that format, you get a compile error of bad preamble import foo,bar

It needs to be -Yimports:foo,bar

On 2.13.6

Daenyth avatar Aug 11 '21 13:08 Daenyth

note that this is automatically generated so the fix would need to be upstream; see https://github.com/scala/docs.scala-lang/issues/1711 for context

SethTisue avatar Aug 11 '21 18:08 SethTisue

I was just bitten by this in a different context. After 5-10 mins futzing with a test, I really could not believe it. Some options don't care, I think? about whether it's "colonated", some require or don't allow it. Something has to give. Scala 3 has the same syntax.

som-snytt avatar Feb 03 '22 18:02 som-snytt

I don't remember the context of my previous remark, but I just hit it again.

https://github.com/scala/scala/pull/9982

has a commit to accommodate -release 8 and -release:8, and also effectively backports the same for int-valued settings, which was adjusted for Scala 3.

However, that would not handle splitting on comma -Yimports foo,bar. I can't tell if that is a good idea.

A possible fix would be for multi-valued options to take up to the next dash, -Yimports a b -- etc.

Maybe that is a convention.

The ancient code comment says it's trying to handle mixed options and args, scalac source.scala -Vprint:_, so another path is to nail that down and require options first.

som-snytt avatar Mar 31 '22 16:03 som-snytt