Add introspection macros support for dot syntax #35522
Merged
+90
−8
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.
Fixes #28615, fixes #14637, closes #20620. Actually the last one was already fixed on master it seems, so I only added a test.
Broadcasting
This PR enables using the
code_
macros with dot expressions, like so:This works by wrapping the dot expression in a function and applying the introspection to the created function. In the example above, the newly created function is
Note that the
5 - 7
argument has been transformed into a single argument for the new function, since it is not broadcasted upon.Other introspection macros such as
@which
or@edit
now error with a message pointing the user towardsMeta.@lower
:I also added a small message mentioning
Meta.@lower
in the general error message for the introspection macros because I think it deserves to be there, but let me know what you think of it.getproperty
The dot used for broadcasting and the dot used for
getproperty
have different context so there is no confusion when handling them. When both are present, the outermost dominates (I don't know how to phrase it, but I think it just follows intuition):Finally,
@which
can now handle fully qualified symbols (#14637):