Skip to content

Compiler or parser hang due to abstract type + reshape specialization #20658

@timholy

Description

@timholy

Copy/paste this into the REPL and you should see a hang:

abstract type AbstractFFTView{T,N} <: AbstractArray{T,N} end

struct FFTView{T,N,A<:AbstractArray} <: AbstractFFTView{T,N}
    parent::A

    function (::Type{FFTView{T,N,A}}){T,N,A}(parent::A)
        new{T,N,A}(parent)
    end
end

Base.reshape{_,N}(F::FFTView{_,N}, ::Type{Val{N}})   = F
Base.reshape{_,M,N}(F::FFTView{_,M}, ::Type{Val{N}}) = FFTView(reshape(parent(F), Val{N}))

If you comment out the part about the abstract type, it's fine. It doesn't hang until the second reshape specialization.

This is a stripped-down version of the FFTViews package.

julia> versioninfo()
Julia Version 0.6.0-dev.2840                                                                                                                                                                 
Commit cb50dee (2017-02-17 08:22 UTC)                                                                                                                                                        
Platform Info:                                                                                                                                                                               
  OS: Linux (x86_64-linux-gnu)                                                                                                                                                               
  CPU: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz                                                                                                                                              
  WORD_SIZE: 64                                                                                                                                                                              
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)                                                                                                                           
  LAPACK: libopenblas64_                                                                                                                                                                     
  LIBM: libopenlibm                                                                                                                                                                          
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)                                                                                                                                                    

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionRegression in behavior compared to a previous versiontypes and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions