type
      StoreInt = ref object of RootObj
        val: int
        dep : seq[StoreKind]
        req : seq[StoreKind]
      StoreFloat = ref object of RootObj
        val : float
        dep : seq[StoreKind]
        req : seq[StoreKind]
      StoreString = ref object of RootObj
        val : string
        dep : seq[StoreKind]
        req : seq[StoreKind]
      
      StoreKind = StoreInt|StoreFloat|StoreString
    var a = StoreInt(val : 5, dep: @[], req: @[])
    

This code gives me the error invalid type 'StoreKind' in this context: 
'StoreInt'

I know the code below works.
    
    
    StoreVariable = ref object of RootObj
      case kind : NodeKind
      of nkInt: intVal: int
      of nkFloat: floatVal: float
      of nkString: strVal: string
      dep : seq[StoreVariable]
      req : seq[StoreVariable]
    

but I wanted to use it with a converter like so
    
    
    converter toInt(x: StoreInt): int = x.val
    

Reply via email to