Add a check for correct Array shape in quotes.reflect.ClassOfConstant #22033
+36
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #21916
I tried to supply the ClassOfConstant with multiple other broken Types, but I was unable to break it beyond the linked issue, so I ended up adding the check for only that one case. This makes sense - the backend (and thus erasure) needs to know if the Array type parameter is a primitive type, but in other cases the erasure phase needs to know only the class, without the type parameters.
It's impossible to call classOf through the quoted code (
'{classOf[t]}
with a boundless t will error out), so we don't need that additional check there.There does appear to be an issue with being able to set
'{List[Array]}
resulting in a crash, but that is beyond the scope of this fix - I will prepare a separate issue for that (edit: reported here).