scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.89k stars 1.06k forks source link

TastyInspector sometimes return `EmptyTree` for tasty files #12669

Open BarkingBad opened 3 years ago

BarkingBad commented 3 years ago

https://github.com/BarkingBad/tasty-bug

sbt:scala3-simple> run
[info] running Main$package 
Class Name:
src/main/resources/tasties/B_rename.tasty
AST:
class dotty.tools.dotc.ast.Trees$PackageDef

Class Name:
src/main/resources/tasties/A.tasty
AST:
class dotty.tools.dotc.ast.Trees$PackageDef

How many Array.tasty files are there:
8
How many Array.tasty files with different size are there: 
1
Class Name:
src/main/resources/tasties/Array.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

Class Name:
src/main/resources/tasties/scala/Array.tasty
AST:
class dotty.tools.dotc.ast.Trees$PackageDef  // <--------------------- The only correct read of Array.tasty file

Class Name:
src/main/resources/tasties/scala/Array11.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

Class Name:
src/main/resources/tasties/dir/Array.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

Class Name:
src/main/resources/tasties/dir/scala/Array.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

Class Name:
src/main/resources/tasties/dir/scala/Array11.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

Class Name:
src/main/resources/tasties/dir/Array11.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

Class Name:
src/main/resources/tasties/Array11.tasty
AST:
class dotty.tools.dotc.ast.Trees$EmptyTree

TastyInspector correctly loads A and B tasty files, though they are at resources/tasties/ path

TastyInspector incorrectly loads many combinations of Array.tasty stdlib tasty file unless it is exactly at scala/Array.tasty path suffix with companion .class file. Otherwise, it returns EmptyTree

It's worth noting that A and B files load correctly even with

scala-center-bot commented 2 years ago

This issue was picked for the Issue Spree No. 24 of 29 November 2022 which takes place in a week from now. @issackurian, @rjolly will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

scala-center-bot commented 1 year ago

This issue was picked for the Issue Spree No. 25 of 24 January 2023 which takes place in a week from now. @issackurian, @mbovel will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

mbovel commented 1 year ago

@issackurian, @rjolly: I see that you already worked on this issue during a previous Spree. What was the status?

issackurian commented 1 year ago

@mbovel Yes, we worked on this with Nicholas Stucki. I was supposed to make a pull request, but unfortunately wasn't able to do it yet. I'll work on that and submit it by the end of this week.

Should I join the spree in that case, I think it might be useful to get another pair of eyes , since this is my first scala PR.

On Tue, Jan 24, 2023, 08:03 Matt Bovel @.***> wrote:

@issackurian https://github.com/issackurian, @rjolly https://github.com/rjolly: I see that you already worked on this issue during a previous Spree. What was the status?

— Reply to this email directly, view it on GitHub https://github.com/lampepfl/dotty/issues/12669#issuecomment-1401913967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGKSIROI5YGVOLMBL2FTODWT7HITANCNFSM454PT3ZQ . You are receiving this because you were mentioned.Message ID: @.***>

mbovel commented 1 year ago

I see. Yes we can work on this PR together ~along with @rjolly~ (my bad, I see @rjolly will work on 16250 today) during tonight's spree.

I made a branch that adds the test case in the description as a Dotty test in case it might be useful: https://github.com/dotty-staging/dotty/commit/ca1201d866ccf23433db3c07ffc2a6f167a4c37b.

See you tonight!