Skip to content

type is int crashes the compiler #22850

@ggb-sw

Description

@ggb-sw

Description

#!/usr/bin/env -S nim c

# Nim Compiler Version 2.0.0 [Linux: amd64]

template isNotNumber(num: type) : bool =
    not(type is SomeNumber)

echo "Type: ", type("abc"), " isNotNumber? ", type("abc").isNotNumber
echo "Type: ", type(20), " isNotNumber? ", type(20).isNotNumber

Nim Version

Nim Compiler Version 2.0.0 [Linux: amd64]
Compiled at 2023-08-01
Copyright (c) 2006-2023 by Andreas Rumpf

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

Current Output

Hint: used config file '/home/ggb/.choosenim/toolchains/nim-2.0.0/config/nim.cfg' [Conf]
Hint: used config file '/home/ggb/.choosenim/toolchains/nim-2.0.0/config/config.nims' [Conf]
Hint: used config file '/home/ggb/Temp/nim/tests/config.nims' [Conf]
......................................................................
/home/ggb/Temp/nim/tests/test5.nim(6, 14) Error: internal error: genMagicExpr: mIs
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-c

Expected Output

No response

Possible Solution

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