Open al6x opened 1 year ago
typedesc
is not a runtime value should error inside typedefinition.
Also, the compilation error message for this code should be improved, currently it prints cryptic error and it's hard to understand what's wrong (the problem is typedesc field in Element):
import std/tables
type Element* = ref object of RootObj
tag*: typedesc
type App* = ref object of RootObj
children*: seq[Element]
type Apps* = ref Table[string, App]
proc build*(apps: Apps): App =
discard
prints
play.nim(13, 12) Error: invalid type: 'Table[system.string, play.App]' in this context: 'proc (apps: Apps): App' for proc
Description
This code would crash compiler
Nim Version
Nim Compiler Version 1.6.12 [MacOSX: amd64] Compiled at 2023-03-10 Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release -d:nimUseLinenoise
Current Output
in playground its