CompositeStructs.jl icon indicating copy to clipboard operation
CompositeStructs.jl copied to clipboard

default initialisers in parametric parent types that refer to the type parameter lead to error in constructor call

Open mhinsch opened this issue 1 year ago • 0 comments

MWE:

@kwdef struct Foo{T}
    x :: Int = sizeof(T)
end

@composite @kwdef struct Bar
    Foo{Int}...
end

Calling Bar() errors with "UndefVarError: T not defined".

The problem seems to be that the keyword constructor @composite generates calls Foo(...) instead of Foo{Int}(...).

mhinsch avatar Jun 12 '23 09:06 mhinsch