Skip to content

Nullable with subtype #94

@andrewcooke

Description

@andrewcooke

I am having a problem when I assign a value to a Nullable which it a sub-type of the type contained by the Nullable. This works in 0.4, but not with Compat.

Here is the problem:

julia> abstract Parent

julia> immutable Child <: Parent end

julia> type Container x::Nullable{Parent} end

julia> c = Container(Child())
ERROR: `convert` has no method matching convert(::Type{Nullable{Parent}}, ::Child)
 in Container at no file

However, I have no idea how you solve this because:

julia> convert{T,S<:T}(::Type{Nullable{T}}, s::S) = Nullable{T}(s)
ERROR: T not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions