Skip to content

DuckType Return Asserts #27

Description

@mrufsvold

Right now, any return type annotations on behaviors are turned into ordinary return type annotations. However, if the user wants to assert that the return type is a DuckType, this won't work.

For example, you might want to declare

@duck_type struct Container{T, N}
    function similar(This, ::Int...)::Container{T, Any)
end

But similar won't return a literal `Container`. It will return some AbstractArray which fails a naive type assert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions