Skip to content
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

Inference failure in maximum / minimum #43461

Closed
mcabbott opened this issue Dec 18, 2021 · 3 comments · Fixed by #43467
Closed

Inference failure in maximum / minimum #43461

mcabbott opened this issue Dec 18, 2021 · 3 comments · Fixed by #43467

Comments

@mcabbott
Copy link
Contributor

Should this be able to infer the type?

julia> @inferred maximum([1 2; 3 4]; dims=1)
ERROR: return type Matrix{Int64} does not match inferred return type Union{Matrix{Float64}, Matrix{Int64}}

The instability is in Base.reducedim_init(identity, max, [1 2; 3 4], 1)

@N5N3
Copy link
Member

N5N3 commented Dec 18, 2021

Looks like a regression. There's no such instablity on 1.6.4.

@mcabbott
Copy link
Contributor Author

Oh right, this one first appears on 1.7.

My initial example was this, which fails at least from 1.4 onwards:

@inferred Base.reducedim_init(norm, max, [1 2; 3 4], 1)

@N5N3
Copy link
Member

N5N3 commented Dec 18, 2021

eb47275 fix both cases on master.
But still don't know which cause the inference regression...
Edit: Well there's no inference regression, the instability was introduced by #35316.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants