Skip to content

Crash when compiling invalid generic instantiation #25231

@nocturn9x

Description

@nocturn9x

Nim Version

Nim Compiler Version 2.2.4 [Linux: amd64]
Compiled at 2025-04-22
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: f7145dd
active boot switches: -d:release

Description

The compiler crashes when compiling code such as SomeType[] instead of reporting an error.

Example:

type Test[T: auto] = object

discard Test[]

Current Output

Error: internal error: expr(nkBracketExpr, tyGenericBody)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp compile <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details

Expected Output

A compilation error

Known Workarounds

No response

Additional Information

No response

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