Nim
Nim copied to clipboard
echo repr(nil) compiler crash (refc only)
What happened?
echo repr(nil)
works with arc and orc, but not refc.
refc output:
Error: internal error: genTypeInfoV1(tyNil)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp r <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details
orc and arc:
nil
Nim Version
Nim Compiler Version 1.6.6 [Linux: amd64]
Compiled at 2022-05-05
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 0565a70eab02122ce278b98181c7d1170870865c
active boot switches: -d:release
Current Standard Output Logs
No response
Expected Standard Output Logs
No response
Possible Solution
Have a check for a nil
literal, or isNil
inside of repr
.
Additional Information
No response
The issue is that just the nil
literal by itself without type information uses a compiler internal type which repr
doesn't handle. These work.
echo repr(pointer(nil))
echo repr((ref int)(nil))
notnil
should be made default, with opt-out cli flag.