Skip to content

Type parameter currying doesn't work with Tuple #57933

@MasonProtter

Description

@MasonProtter

Regular type parameters can be 'curried':

julia> struct Foo{T, U, V, W} end

julia> Foo
Foo

julia> ans{1}
Foo{1}

julia> ans{2}
Foo{1, 2}

julia> ans{3}
Foo{1, 2, 3}

julia> ans{4}
Foo{1, 2, 3, 4}

But not Tuple:

julia> Tuple
Tuple

julia> ans{Int}
Tuple{Int64}

julia> ans{String}
ERROR: TypeError: in Type{...} expression, expected UnionAll, got Type{Tuple{Int64}}
Stacktrace:
 [1] top-level scope
   @ REPL[37]:1

This is a kinda annoying limitation sometimes when one wants to construct types iteratively, and Tuple is the most natural type to want to do that with, but the only one where it doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    types and dispatchTypes, subtyping and method dispatch

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions