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

Print full path / truncated path of a path-dependent type? #44

Closed
Tracked by #110
tribbloid opened this issue Feb 1, 2021 · 2 comments
Closed
Tracked by #110

Print full path / truncated path of a path-dependent type? #44

tribbloid opened this issue Feb 1, 2021 · 2 comments

Comments

@tribbloid
Copy link
Collaborator

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

@tek
Copy link
Owner

tek commented Feb 1, 2021

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.

@tribbloid
Copy link
Collaborator Author

tribbloid commented Oct 4, 2023

"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"

tribbloid added a commit that referenced this issue Oct 12, 2023
* add Vtype-def-position option, guarded by a test suite

* add filterConfigurations to dependencyUpdates, as suggested in this thread: ben-manes/gradle-versions-plugin#816

upgrade a gradle plugin
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

2 participants