Skip to content

Command line option aliases ("abbreviations") not understood by scalac #10810

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

Closed
griggt opened this issue Dec 15, 2020 · 5 comments
Closed

Command line option aliases ("abbreviations") not understood by scalac #10810

griggt opened this issue Dec 15, 2020 · 5 comments
Assignees

Comments

@griggt
Copy link
Contributor

griggt commented Dec 15, 2020

The aliases ("abbreviations") given to command line options in dotty/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala by withAbbreviation do not appear to be understood when specified on the command line.

I believe this is the cause of the community build test failures in #10733.

This also means that any such aliases added for backward compatibility as part of the recent compiler flags cleanup (#10236) may not be functional.

A couple of examples:

https://github.com/lampepfl/dotty/blob/bbd092b7f6ceeb7959e304a16219a040a4db1001/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala#L27

$ scalac -version
Scala compiler version 3.0.0-M3-bin-SNAPSHOT-git-bbd092b -- Copyright 2002-2020, LAMP/EPFL

$ scalac --version
bad option '--version' was ignored
Usage: scalac <options> <source files>
      ... help text elided ...

https://github.com/lampepfl/dotty/blob/bbd092b7f6ceeb7959e304a16219a040a4db1001/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala#L103

$ ls -l
total 8
-rw-r--r-- 1 tgrigg tgrigg 282 Dec 15 13:25 Test.class
-rw-r--r-- 1 tgrigg tgrigg 259 Dec 15 13:25 Test.tasty

$ dotc -from-tasty Test.tasty
$ ls -l
total 8
-rw-r--r-- 1 tgrigg tgrigg 282 Dec 15 13:26 Test.class
-rw-r--r-- 1 tgrigg tgrigg 259 Dec 15 13:26 Test.tasty

$ dotc --from-tasty Test.tasty
bad option '--from-tasty' was ignored
-- [E080] Syntax Error: Test.tasty:1:0 -----------------------------------------
1 |\������]��������������ASTs��<empty>��Test��<init>��java��lang������Object����?�����Unit��scala��SourceFile��annotation������internal����������String����?������Test.scala��Positions��Comments����6��������p�Uu�6����)u�6� ��u�6���p�U3�@��������������ؠƆ���
  |^^^
  |Expected a toplevel definition
-- Error: Test.tasty:1:6 -------------------------------------------------------
1 |\������]��������������ASTs��<empty>��Test��<init>��java��lang������Object����?�����Unit��scala��SourceFile��annotation������internal����������String����?������Test.scala��Positions��Comments����6��������p�Uu�6����)u�6� ��u�6���p�U3�@��������������ؠƆ���
  |      ^
  |      illegal character '\u0000'

    ... more errors elided ...
@tgodzik
Copy link
Contributor

tgodzik commented Dec 21, 2020

This is particularly important, because recently the semanticdb flag was changed from -Ysemanticdb to -Xsemanticdb without any kind of notification for the Metals team. As the abbreviations are broken this caused a number of issues both in Bloop and sbt. That flag is only really used by Metals and the lack of communication is something that is really becoming a problem for us. It has become a pattern that changes are being done, especially the ones related to parsing and Metals, without any notification.

Please, let us know when something might change that is related either to Metals or syntax, as it would help us avoid any kind of surprise as we had with the 3.0.0-M3 release.

@dwijnand
Copy link
Member

Also hit this in MiMa, where I found -cp didn't work despite how the code reads (I switched to -classpath).

@smarter
Copy link
Member

smarter commented Dec 21, 2020

@tgodzik the best way to avoid regressions like this would be to get metals in our community build: https://github.com/lampepfl/dotty/tree/master/community-build, it's a bit trickier than other projects since I assume only some of the subprojects can be compiled with dotty and the rest have to be compiled with scala 2 due to dependencies on scalameta, but it should be doable.

@tgodzik
Copy link
Contributor

tgodzik commented Dec 22, 2020

We've been actually talking with @romanowski about it and we would also need to at least run a subset of tests related to Scala 3. We'll probably look into it next year.

@sjrd
Copy link
Member

sjrd commented Dec 22, 2020

This is particularly important, because recently the semanticdb flag was changed from -Ysemanticdb to -Xsemanticdb without any kind of notification for the Metals team. As the abbreviations are broken this caused a number of issues both in Bloop and sbt. That flag is only really used by Metals and the lack of communication is something that is really becoming a problem for us. It has become a pattern that changes are being done, especially the ones related to parsing and Metals, without any notification.

I take full blame for this one. I apologize for how it happened. I was the one to perform the changes, and blindly trusted the abbreviation mechanism not to break tools, including Metals. Then I didn't make a particular effort to communicate the change nor to make sure it appeared in the release notes. I'm sorry.

odersky added a commit to dotty-staging/dotty that referenced this issue Dec 23, 2020
We gave misleading diagnostic before in the case where no extension
method was found since a TypeError was thrown.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 23, 2020
We gave misleading diagnostic before in the case where no extension
method was found since a TypeError was thrown.
bishabosha added a commit to dotty-staging/dotty that referenced this issue Dec 23, 2020
bishabosha added a commit that referenced this issue Dec 24, 2020
fix #10810: pass aliases to setting constructor
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 28, 2020
We gave misleading diagnostic before in the case where no extension
method was found since a TypeError was thrown.
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

6 participants