TASTy error on irrelevant stale files
Reproduction steps
Scala version: 2.13.8
➜ scalac -d /tmp -Xlint t12591.scala
error: error while loading A, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in ./A.class', required by ./A.class
t12591.scala:2: warning: type parameter A defined in trait Context shadows class A defined in package <empty>. You may want to rename your type parameter, or possibly remove it.
trait Context[A]
^
t12591.scala:5: warning: type parameter A defined in method g shadows class A defined in package <empty>. You may want to rename your type parameter, or possibly remove it.
def g[A: Context] = f
^
2 warnings
1 error
Problem
This is the "stale class file" problem combined with the "random files in current directory" problem.
I've got a self-contained example program, please just compile it. Don't read other files you don't need. Don't eagerly suck up everything on what you assume is the class path.
It's just a coincidence here that the files from a Scala 3 example include A and I have a type parameter A in my example.
➜ ls *.class *.tasty
'A$$anon$2.class' A.tasty 'C$$anon$1.class' 'C$E$.class' 'Givens$.class'
A.class B.class C.class C.tasty 'Givens$cOrdering$.class'
'A$.class' B.tasty 'C$E.class' Givens.class Givens.tasty
I think it's too late to change the default class path for command-line scalac (to not include .), but if someone wants to make this more robust and/or improve the error message, that would be welcome.
fyi @bishabosha
Maybe the error could be a warning. It's nice to know that it couldn't load A, but if I don't care about that, please don't refuse to compile my code.