Print full path / truncated path of a path-dependent type?
Here is a simple example:
class Example {
type VV
}
val e1 = new Example {
type VV <: Int
}
implicitly[e1.VV =:= String]
The error message is (I have set keepmodules to 2 for better demonstraction):
[Error] /....../Spec.scala:61: implicit error;
!I e (Cannot prove that e1.VV =:= String.): e1.VV scala.=:= java.lang.String
So what exactly is e1? It is clearly not global, so if there are many variables e1 scattered around the code. How to find it? An option similar to keepmodules should theoretically solve this problem, by partially displaying preceding package/module/path of a path-dependent type. Or if necessary, display the line of code of which such variable is created.
I haven't played with the scala reflection library for path-dependent type, so I don't know if it is physically possible. If you think this could be helpful, I'll definitely spend more time on it to figure it out
I would expect that if that's feasible, it should be possible at the point where you would implement your feature from the other issue, where you should have access to the value's class. Since you're considering this, I would definitely call it helpful!
With a bit of luck it could be very simple to do.
"by partially displaying preceding package/module/path of a path-dependent type" - this should be fixed, most test ground truths now contains the enclosing package/module/path:
!I e: Diff.e1.VV =:= String
Cannot prove that Diff.e1.VV =:= String.
"Or if necessary, display the line of code of which such variable is created" - this is totally possible, but should be enabled by a plugin setting, I'm thinking of "Vtype-def-position"