Nim
Nim copied to clipboard
Compiler crash: "object" as proc arg type
type MyProc* = proc (arg: object)
var test: MyProc = nil
(object was a typo) Produces:
Error: internal error: getTypeDescAux(tyBuiltInTypeClass)
No stack traceback available
To create a stacktrace, rerun compilation with ./koch temp c <file>
Still an issue.
This is not only a problem with object. Basically any generic argument or concept causes weird internal errors. I tried also with SomeInteger and typedesc instead of object. SomeInteger has the exact same crash. typedesc compiles in this simple example, but when you actually want to assign a function to test, it will crash.
To fix this, function pointers may not have any generic arguments left anymore. I tried to fix it, but I could not find a practicaly way to distinguis these usages from correct usages like: proc new*[T](a: var ref T, finalizer: proc (x: ref T) {.nimcall.})
now type mismatch error in devel f8b5464f31834bf97e7f9023644e255f2e9b6485
t7851.nim(3, 20) Error: type mismatch:
got <MyProc> [proc declared in t7851.nim(2, 6)]
but expected 'MyProc = proc (arg: object): int{.closure.}' [proc declared in t7851.nim(2, 6)]