getTypeImpl crashes (SIGSEGV) on variant types #4526

Closed
nigredo-tori opened this Issue Jul 28, 2016 · 0 comments

Projects

None yet

1 participant

@nigredo-tori
Contributor

The following example:

import macros

macro dumpTypeImpl(t: typed): stmt =
  echo treeRepr(t.getTypeImpl())  
  newStmtList()

type
  Test = object
    case kind: bool
    of true:
      x: int
    else:
      y: string

var t: Test
dumpTypeImpl(t)

fails to compile in current devel branch:

Traceback (most recent call last)
nim.nim(115)             nim
nim.nim(71)              handleCmdLine
main.nim(254)            mainCommand
main.nim(65)             commandCompileToC
modules.nim(250)         compileProject
modules.nim(195)         compileModule
passes.nim(203)          processModule
passes.nim(137)          processTopLevelStmt
sem.nim(488)             myProcess
sem.nim(460)             semStmtAndGenerateGenerics
semstmts.nim(1545)       semStmt
semexprs.nim(873)        semExprNoType
semexprs.nim(2292)       semExpr
semexprs.nim(857)        semDirectOp
semexprs.nim(840)        afterCallActions
sem.nim(365)             semMacroExpr
vm.nim(1621)             evalMacroCall
vm.nim(1214)             rawExecute
vmdeps.nim(303)          opMapTypeImplToAst
vmdeps.nim(92)           mapTypeToAstX
system.nim(343)          mapTypeToAstX
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
FAILURE
@Araq Araq added a commit that closed this issue Aug 4, 2016
@Araq Araq fixes #4526 e8aa6f6
@Araq Araq closed this in e8aa6f6 Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment