Expose API for checking corrupted class symbols #17850
giiita
started this conversation in
Feature Requests
Replies: 0 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
c.typecheck and c.parse have been lost.
The scalatest assertCompile and others can certainly achieve something similar by calling compiletime.testing.typeChecks directly at test time.
However, there may be cases in other libraries where typechecks are desperately needed.
The goal is to avoid a compile error due to typecheck failure.
For example, Symbol in ScalaTestAntTask 1 in scalatest refers to org.apache.tools, but since it is not bundled in scalatest, the compilation will fail when you access it with symbol.tree or something similar.
If you want to test this dynamically, there is no way to do so because compiletime.test.typeChecks cannot be used.
As a general approach, Class.forName(name) can be used for checking, but the legitimacy of the symbol itself could not be checked because ClassNotFoundException is raised for module class or object.
https://contributors.scala-lang.org/t/how-to-check-for-broken-symbols-in-macro/5117
Beta Was this translation helpful? Give feedback.
All reactions