Slightly generalize _compute_sparam elision#48144
Merged
Conversation
vtjnash
reviewed
Jan 5, 2023
vtjnash
reviewed
Jan 5, 2023
vtjnash
reviewed
Jan 5, 2023
Comment on lines
+830
to
+836
| length(applyTbody.parameters) == length(arg.parameters) || return nothing | ||
| for i = 1:length(applyTbody.parameters) | ||
| if applyTbody.parameters[i] === applyTvar && arg.parameters[i] === tvar | ||
| return LiftedValue(argdef.args[3]) | ||
| end | ||
| end |
Member
There was a problem hiding this comment.
I wonder if it it may be clearer (and more extensible later) if written this way:
Suggested change
| length(applyTbody.parameters) == length(arg.parameters) || return nothing | |
| for i = 1:length(applyTbody.parameters) | |
| if applyTbody.parameters[i] === applyTvar && arg.parameters[i] === tvar | |
| return LiftedValue(argdef.args[3]) | |
| end | |
| end | |
| # find a possible parameter number we are extracting when matching with `tvar` | |
| i = findfirst(===(tvar), arg.parameters) | |
| # determine if we can find the apply_type for that parameter | |
| if applyTvar === applyTbody.parameters[i] | |
| return LiftedValue(argdef.args[3]) | |
| end |
Member
Author
There was a problem hiding this comment.
I'm not sure whether we want to look at all the parameters or just the first one. We can probably look at the first one in applyTbody, but I think arg might potentially have multiple instances.
Member
There was a problem hiding this comment.
First is indeed probably the most common to extract
To catch a case that occurs in FuncPipelines.jl and was causing precision issues in #48066.
aviatesk
approved these changes
Jan 6, 2023
Comment on lines
+808
to
+809
| isa(arg, DataType) || return nothing | ||
| isType(arg) || return nothing |
Member
There was a problem hiding this comment.
Suggested change
| isa(arg, DataType) || return nothing | |
| isType(arg) || return nothing | |
| isType(arg) || return nothing |
isType(x) includes isa(x, DataType).
Keno
added a commit
that referenced
this pull request
Jan 7, 2023
Member
Member
Author
|
I'd prefer not to. It's possible there further commits afterwards that are required |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To catch a case that occurs in FuncPipelines.jl and was causing precision issues in #48066.