Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Compiler crash: "object" as proc arg type

Open geotre opened this issue 7 years ago • 3 comments
trafficstars

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>

geotre avatar May 11 '18 22:05 geotre

Still an issue.

Araq avatar Jan 13 '19 16:01 Araq

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.})

krux02 avatar Jan 14 '19 21:01 krux02

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)]

bung87 avatar Oct 30 '22 17:10 bung87