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

TASTy issues when compiling with Scala 2.13.6 #1182

Closed
keynmol opened this issue May 24, 2021 · 4 comments
Closed

TASTy issues when compiling with Scala 2.13.6 #1182

keynmol opened this issue May 24, 2021 · 4 comments

Comments

@keynmol
Copy link

keynmol commented May 24, 2021

I'm not even sure where this problem will end up living long term.

❯ cat test-ammonite-issue.sc
import scala.util.Try

❯ cs --help
Coursier 2.0.16
Usage: cs [options] [command] [command-options]

Available commands: bootstrap, channel, complete, fetch, get, install, java, java-home, launch, list, publish, resolve, setup, uninstall, update, search

Type  cs command --help  for help on an individual command

❯ cs launch ammonite --scala-version 2.13.6 -- test-ammonite-issue.sc
Compiling /private/var/folders/m1/3py6pkgs3l1dvt3jpdht11nc0000gn/T/tmp.wbzaIVko/test-ammonite-issue.sc
error while loading NotGiven, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in <...>/Library/Caches/Coursier/v1/https/repo1.  maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)', required by <...>/Library/Caches/Coursier/v  1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)
error while loading FromDigits, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in <...>/Library/Caches/Coursier/v1/https/repo  1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/FromDigits.class)', required by <...>/Library/Caches/Coursi  er/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/FromDigits.class)
error while loading CommandLineParser, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in <...>/Library/Caches/Coursier/v1/htt  ps/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/CommandLineParser.class)', required by <...>/Library  /Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/CommandLineParser.class)
error while loading LowPriorityNotGiven, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in <...>/Library/Caches/Coursier/v1/h  ttps/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/LowPriorityNotGiven.class)', required by <...>/Lib  rary/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/LowPriorityNotGiven.class  )
Compilation Failed

Seems like a regression, perhaps related to #1150?

As a side note, I noticed this issue running the following docker container:

FROM openjdk:11

RUN apt install curl git

# https://get-coursier.io/docs/cli-overview.html#installation
RUN curl -Lo /usr/local/bin/coursier "https://github.com/coursier/coursier/releases/download/v2.0.16/coursier" \
  && chmod +x /usr/local/bin/coursier \
  && coursier --help

ENV PATH="$PATH:/root/.local/share/coursier/bin"

RUN coursier install sbt ammonite

And the default installation of ammonite (for 2.13.6, latest) breaks on my scripts.

mpollmeier added a commit to joernio/joern that referenced this issue Jun 16, 2021
until com-lihaoyi/Ammonite#1182 is fixed, or
we find a way to specify that scalac option to ammonite.Main
mpollmeier added a commit to joernio/joern that referenced this issue Jun 17, 2021
* Revert "Revert "upgrade cpg (#546)""

This reverts commit f48189a.

* downgrade scala to 2.13.5

until com-lihaoyi/Ammonite#1182 is fixed, or
we find a way to specify that scalac option to ammonite.Main

* wip

* Revert "wip"

This reverts commit 3e9b2b3.

* Revert "downgrade scala to 2.13.5"

This reverts commit 5a5c560.

* WIP

* comment

* released cpg
@rtyley
Copy link

rtyley commented Sep 8, 2021

One thing I don't get about this bug is that it's giving this "Add -Ytasty-reader to scalac options to parse the TASTy in..." error, and the -Ytasty-reader flag was introduced with scala/scala#9293, which was merged and part of Scala 2.13.4. So why does this issue only occur when running with Scala 2.13.6, not 2.13.5 or 2.13.4?

So:

$ cs launch ammonite --scala-version 2.13.5 -- script.sc

...succeeds, but:

$ cs launch ammonite --scala-version 2.13.6 -- script.sc

...fails. I guess scala/scala#9617 was released in Scala 2.13.6, though I don't immediately see how that would trigger the issue.

@adriaanm-da
Copy link

Since your compiler interface pulls in Scala 3 dependencies (see cs resolve -t com.lihaoyi:ammonite-compiler-interface_2.13.6:2.4.0), you have to make sure a compiler that has to compile against those has the tasty reader enabled (-Ytasty-reader).

@adriaanm-da
Copy link

This issue is resolved by the 2.4.1 release.

@mpollmeier
Copy link
Contributor

I can confirm that 2.4.1 works, thanks @adriaanm-da!

@lihaoyi lihaoyi closed this as completed Nov 15, 2021
max-leuthaeuser pushed a commit to joernio/joern that referenced this issue Jul 29, 2022
* Revert "Revert "upgrade cpg (#546)""

This reverts commit f48189a.

* downgrade scala to 2.13.5

until com-lihaoyi/Ammonite#1182 is fixed, or
we find a way to specify that scalac option to ammonite.Main

* wip

* Revert "wip"

This reverts commit 3e9b2b3.

* Revert "downgrade scala to 2.13.5"

This reverts commit 5a5c560.

* WIP

* comment

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

No branches or pull requests

5 participants