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

Type inference issues on Julia master (v1.6) #138

Closed
jipolanco opened this issue Oct 21, 2020 · 2 comments
Closed

Type inference issues on Julia master (v1.6) #138

jipolanco opened this issue Oct 21, 2020 · 2 comments

Comments

@jipolanco
Copy link
Contributor

The following is not inferred on Julia master (but works correctly on 1.5):

x = rand(2, 5)
@code_warntype ApplyArray(vcat, x)

# Output:
Variables
  #self#::Type{ApplyArray}
  f::Core.Const(vcat)
  factors::Tuple{Matrix{Float64}}

Body::Vcat{Float64, _A, Tuple{Matrix{Float64}}} where _A
1%1 = Core.tuple(f)::Core.Const((vcat,))
│   %2 = Core._apply_iterate(Base.iterate, LazyArrays.applied, %1, factors)::Applied{LazyArrays.DefaultArrayApplyStyle, typeof(vcat), Tuple{Matrix{Float64}}}%3 = LazyArrays.ApplyArray(%2)::Vcat{Float64, _A, Tuple{Matrix{Float64}}} where _A
└──      return %3

The critical step seems to be around here:

M = applied(vcat, x)
@inferred ApplyArray(M)                       # fails
@inferred ApplyArray{eltype(M)}(M)            # fails
@inferred ApplyArray{eltype(M), ndims(M)}(M)  # works

I'll make a PR with a workaround that seems to fix this issue.

@dlfivefifty
Copy link
Member

A PR is great. These type-inferrence issues are a bit delicate though in the past they got better so it may be a regression in master.

I tend not to support master until release candidate stage.

@jipolanco
Copy link
Contributor Author

I'm closing this because inference regression is fixed on Julia master (JuliaLang/julia#38240).

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