Skip to content

Compiler crashes when using generics syntax in type definition #7839

@ghost

Description

When compiling the following code (tested on 0.18.1 windows amd64 (git 3402926) and on nim playground) the compilation fails without an error.
I don't know if the syntax is ok though.

# the following code will break compilation without any error or hint
# `exited with code=3221225725`
type A[I: SomeOrdinal, E] = tuple # same for object
  length: int
 
echo A.sizeof # works without the following proc
 
proc newA*[I: SomeOrdinal, E](): A[I, E] = # works without `SomeOrdinal`
  discard

Update: the problem is solved, if proc newA*[I: SomeOrdinal, E](): A[I, E] is replaced by proc newA*[I: SomeOrdinal, E](): A, so it has nothing to do with someOrdinal as thought before.

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