Skip to content

TastyInspector.inspectTastyFilesInJar doesn't inspect jar #11696

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
dos65 opened this issue Mar 10, 2021 · 6 comments
Closed

TastyInspector.inspectTastyFilesInJar doesn't inspect jar #11696

dos65 opened this issue Mar 10, 2021 · 6 comments
Labels
area:tasty-inspector issues relating to the TASTy inspector itype:bug Spree Suitable for a future Spree

Comments

@dos65
Copy link
Contributor

dos65 commented Mar 10, 2021

Compiler version

3.0.0-RC1

Minimized code

I took the code from some files in tests directory.

The only difference is that test files from dotty repo extract jars somehow from classpath.
I tried to run it against local jars.

import scala.quoted.*
import scala.tasty.inspector.*

@main def Test = {
  val inspector = new Inspector {
    def inspect(using Quotes)(tastys: List[Tasty[quotes.type]]): Unit = {
      println("Size:" + tastys.size.toString)
      for tasty <- tastys do
        tasty.ast.show(using quotes.reflect.Printer.TreeStructure)
    }
  }

  val jar = "$any_jar_with_tasty" // for example `cs fetch org.scala-lang:scala3-compiler_3.0.0-RC1:3.0.0-RC1 | grep scala3-compiler`
  TastyInspector.inspectTastyFilesInJar(jar)(inspector)
}

Output

Size: 0

Expectation

scala3-compiler has tasty files so there should be some Tasty passed into inspect

@jodersky
Copy link
Contributor

I came across something similar. I think that TastyInspector.inspectTastyFilesInJar somehow only considers "top-level" entries in the jar. For example, it will find foo.tasty, but not pkg/foo.tasty. In other words, only things in the root package will be seen when reading from a jar.

I don't know if this is intentional, but the current behavior is certainly surprising

@nicolasstucki
Copy link
Contributor

It should be reading tastys within packages.

@jodersky
Copy link
Contributor

Should I create a new issue? I can confirm that under Scala 3.0.0, the tasty inspector only finds tasty files in jars if they are at the top level (i.e. their zip file entry does not contain a slash).

@nicolasstucki
Copy link
Contributor

Yes, we should have another issue

@anatoliykmetyuk anatoliykmetyuk added area:tasty-inspector issues relating to the TASTy inspector Spree Suitable for a future Spree and removed area:ide area:tasty-format issues relating to TASTy as a portable standard labels Jul 20, 2021
@bishabosha
Copy link
Member

is this fixed by #13254 @romanowski ?

@nicolasstucki
Copy link
Contributor

Yes, this was fixed by #13254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tasty-inspector issues relating to the TASTy inspector itype:bug Spree Suitable for a future Spree
Projects
None yet
Development

No branches or pull requests

6 participants