`mk_init_singleton` failed when using default constructors to initialize non-trivial fields
Opened this issue · 0 comments
thautwarm commented
MWE:
using ObjectOriented
@oodef struct WebSocketClient1
url::String
running:: Ref{Bool}
end
@oodef mutable struct ClientConnect1
client::WebSocketClient1
function startConnect1(self,url)
running = Ref{Bool}(true)
self.client = WebSocketClient1(url,running)
end
end
client = ClientConnect1()
client.startConnect1("aaaaa")
Exception:
ERROR: LoadError: ArgumentError: type does not have a definite number of fields
Stacktrace:
[1] fieldcount(t::Any)
@ Base .\reflection.jl:814
[2] fieldtypes(T::Type)
@ Base .\reflection.jl:841
[3] mk_init_singleton(t::Any)
@ ObjectOriented.RunTime C:\Users\Taine\.julia\packages\ObjectOriented\MfFaY\src\runtime.jl:152
[4] map(f::typeof(ObjectOriented.RunTime.mk_init_singleton), t::Tuple{DataType, DataType})
@ Base .\tuple.jl:274
[5] mk_init_singleton(t::Any)
@ ObjectOriented.RunTime C:\Users\Taine\.julia\packages\ObjectOriented\MfFaY\src\runtime.jl:152
[6] _construct(type_default_initializers::Type, T::Type, args::Tuple{})
@ ObjectOriented.RunTime C:\Users\Taine\.julia\packages\ObjectOriented\MfFaY\src\runtime.jl:203
[7] #s15#4
@ C:\Users\Taine\.julia\packages\ObjectOriented\MfFaY\src\runtime.jl:213 [inlined]
[8] var"#s15#4"(T::Any, ::Any, default_initializers::Any, #unused#::Any, args::Any)
@ ObjectOriented.RunTime .\none:0
[9] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
@ Core .\boot.jl:602
[10] ClientConnect1()
...
The generated function stub is trying to analyze the field count of Ref{Bool}
.