-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix #20458: do not expose ClassInfo in quotes reflect widenTermRefByName #20468
Conversation
Previously ClassInfo could be easily be exposed with calls like `TypeRepr.of[T].termRef.widenTermRefByName`.
This doesn't seem like the right fix. The term reference for the Any companion object has an underlying Any companion module class (with nothing interesting). Widening the term to that class info is correct. The original issue just seems invalid. Don't call asType on a term type. Perhaps the user wanted to call def namedType(using Context): NamedType =
if (isType) typeRef else termRef |
I see where you are coming from, but there is a conscious effort in the design of the quotes reflect API to never expose ClassInfo to users. At this point, there are no tools there for users to be able to work with ClassInfo. Here, since ClassInfo is not supported, we will instead return a TermRef reference to a symbol of that class (which users can work on and analyze with the tools provided to them). Additionally, calling any.termRef (like in the minimization) will give us About the original issue minimization itself, usually with the typeRepr.widen methods (like widen, widenByName, and widenTermRefByName), we would expect them to either widen, or if that is not possible, stay the same. Because of this, they can be a little overused, like what I imagine happened in the original issue minimisation (after this fix, in practice, the type stays the same - TermRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any), since it is not possible to widen it in the quotes reflect API). |
In processing
I could get behind something like that, but that's not what your patch is doing. |
Previously ClassInfo could easily be exposed with calls like
TypeRepr.of[T].termRef.widenTermRefByName
.Fixes #20458