-
Notifications
You must be signed in to change notification settings - Fork 3
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 inference for fix(::Type, ...) #7
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,11 @@ using Test | |
@inferred a1(1.0) | ||
end | ||
|
||
@testset "fix(::Type, ...)" begin | ||
f = @inferred fix(CartesianIndex, nothing, Some(1)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its good to have this test. While this does not go wrong in master it is something that one can imagine going wrong. So this test makes future refactoring easier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering what could go wrong that would make this test fail. I agree the test should stay. |
||
@test @inferred(f(2)) === CartesianIndex(2, 1) | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess if a type occurs in the fixed arguments, inference will fail? We could add a broken test for that (not sure whats the best way to spell out a broken There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Positional arguments are inferrable after JuliaLang/julia#35980 (Julia >= 1.6) because the field type of I think the only remaining problem is when a type is specified through a keyword argument. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's great that this works for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. I added a broken test for keyword argumets in c63b9e7. |
||
@testset "Fix.jl" begin | ||
|
||
#= | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, I was not aware, that one can do this.