Dear Julia community,
I get a “too many parameters for type” error that I cannot really understand.
Luckily, I have been able (after some effort) to isolate the issue to a very small reproducer:
module AAA
abstract type IterCellValue{R} end
abstract type Map{S,M,T,N} end
const IterCellMap{S,M,T,N,R} = IterCellValue{R} where R <:Map{S,M,T,N}
const Foo{S,T,N,R} = IterCellMap{S,1,T,N,R}
struct Bar{S,T,N,R} <: Foo{S,T,N,R} end # error here, help please!!
end # module
I would say that Foo
has 4 type parameters. What I am missing?
Thanks in advance for your help!
============= EDIT ==============
I found myself the solution. Replace the first const declaration by an abstract type declaration. Namely:
module AAA
abstract type IterCellValue{R} end
abstract type Map{S,M,T,N} end
abstract type IterCellMap{S,M,T,N,R<:Map{S,M,T,N}} <: IterCellValue{R} end
const Foo{S,T,N,R} = IterCellMap{S,1,T,N,R}
struct Bar{S,T,N,R} <: Foo{S,T,N,R} end # works!
end # module
However, I would like to know if it is the expected behavior the error I got in the first version.
Thanks for helping!