Skip to content

Concepts: invalid type in this context for var #13046

Open
@mratsim

Description

@mratsim

The following doesn't compile and gives invalid type in this context for var

Error: invalid type: 'Queue[module_name.FooWrapper]' in this context: 'FooWrapper' for var
type
  Foo = ptr object
    next: Foo

  Enqueueable = concept x, type T
    x is ptr
    x.next is T

  FooWrapper = ptr object
    next: FooWrapper
    foo: Foo
    queue: Queue[FooWrapper]

  Queue[T: Enqueueable] = object
    count: int
    back: T

# Ok so far
var q: Queue[Foo]


# ------------------------------

static: echo FooWrapper is Enqueueable
var fw: FooWrapper

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions