I want to call 2 different iterators conditionally:
    
    
    import os
    
    type FsOrTest* = object
      case kind: bool
      of true: dir: string
      of false: testFiles: seq[string]
    
    iterator walk*(dir: FsOrTest): string =
      case dir.kind
      of true: dir.dir.walkDirRec()
      of false: dir.testSources.items()
    
    
    Run

But it seems like the compiler doesn't like the types:
    
    
    /home/xxx/dev/playground/nim/weblang/src/example.nim(10, 19) Error: 
attempting to call routine: 'walkDirRec'
      found os.walkDirRec(dir: string, yieldFilter: set[PathComponent], 
followFilter: set[PathComponent], relative: bool, checkDir: bool) [iterator 
declared in /home/xxx/.choosenim/toolchains/nim-1.6.12/lib/pure/os.nim(2371, 
10)]
    
    
    Run

Is there any way to make this work or do I have to use a macro? 

Reply via email to