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

map(a -> zip(a...), itr) inference imprecision #33634

Closed
tpapp opened this issue Oct 22, 2019 · 3 comments
Closed

map(a -> zip(a...), itr) inference imprecision #33634

tpapp opened this issue Oct 22, 2019 · 3 comments
Labels
compiler:inference Type inference

Comments

@tpapp
Copy link
Contributor

tpapp commented Oct 22, 2019

julia> versioninfo()
Julia Version 1.3.0-rc4.1
Commit 8c4656b97a (2019-10-15 14:08 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_CMDSTAN_HOME = /home/tamas/src/cmdstan/

MWE condensed from discussion:

using Test

# wrapper is pretty much irrelevant for the problem, just to make an MWE
@inline wrapper(itrs) = sum(prod(first.(i)) for i in Iterators.product(itrs...))

zipped1(pairs) = wrapper(map(pair -> zip(pair...), pairs))

zipped2(pairs) = wrapper(map(pair -> zip(pair[1], pair[2]), pairs))

pairs = (1:5 => 1:5, 2:3 => 2:3)

@inferred zipped1(pairs) # ERROR: return type Int64 does not match inferred return type Any
@inferred zipped2(pairs) # inferred correctly

I found some similar-looking issues, but this did not look like a duplicate of any of them.

@JeffBezanson JeffBezanson changed the title map(a -> zip(a...), itr) does not infer correctly map(a -> zip(a...), itr) inference imprecision Oct 29, 2019
@JeffBezanson JeffBezanson added the compiler:inference Type inference label Oct 29, 2019
@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 15, 2020

Duplicate of #29114

@vtjnash vtjnash marked this as a duplicate of #29114 Mar 15, 2020
@vtjnash vtjnash closed this as completed Mar 15, 2020
@Keno
Copy link
Member

Keno commented Jul 17, 2020

This wasn't quite a duplicate of #29114 (which was mostly about inlining not inference). But in any case, it got fixed by the recent inference precision enhancements.

@Keno Keno marked this as not a duplicate of #29114 Jul 17, 2020
@tpapp
Copy link
Contributor Author

tpapp commented Jul 18, 2020

Indeed, it is fixed now. Thanks for the clarification.

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

No branches or pull requests

4 participants