TypeError in typeassert, expected


julia> abstract type AbstractParentType <: Any end

julia> struct Son AbstractParentType
        field1
        end

julia> Son(44)
ERROR: MethodError: no method matching Son(::Int64)
The type `Son` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Son(::Any, ::Any)
   @ Main REPL[11]:1

Stacktrace:
 [1] top-level scope
   @ REPL[12]:1

julia> "In this case, if arg names were printed, the line after Closest candidates are would read:" ;

julia> "Son(AbstractParentType::Any,field1::Any";

julia> "which would be **huge**, telling me that julia thinks that AbstractParentType is a field name,";

julia> "wheras I am thinking it is a type name; fixing that then fixes the problem";

julia> 
1 Like