I think I've found the source of the problem, but I also think that there is a 
problem with error that is being reported.

This is a minimal example that reproduces the issue:
    
    
    # std imports
    import sequtils
    
    # External imports
    import docopt       # Command line parser (adds pcre64.dll dependency)
    import plotly
    import chroma
    
    
    proc main() =
        let num_signals: int = 2
        var data_length: uint = 0
        
        var data_samples = newSeqWith(num_signals, newSeq[int16](data_length))
        
        var d = Trace[int](mode: PlotMode.Lines, `type`: PlotType.Scatter)
        d.ys = data_samples[0]
        
        var layout = Layout(title: "testing", width: 1200, height: 400,
                            xaxis: Axis(title:"my x-axis"),
                            yaxis: Axis(title: "y-axis too"),
                            autosize: false)
        var p = Plot[int](layout:layout, traces: @[d])
        p.show()
    
    
    main()
    
    
    Run

Compiling this program (saved as plot.nim, and using the plotly and docopt 
libraries) I get the following strange error:

> plot.nim(17, 24) Error: type mismatch: got <End> but expected 'seq[int]'

If I remove the "import doctopt" line (which in this minimum example is 
unnecessary, but is needed in the real program) this is what is left:
    
    
    # std imports
    import sequtils
    
    # External imports
    import plotly
    import chroma
    
    
    proc main() =
        let num_signals: int = 2
        var data_length: uint = 0
        
        var data_samples = newSeqWith(num_signals, newSeq[int16](data_length))
        
        var d = Trace[int](mode: PlotMode.Lines, `type`: PlotType.Scatter)
        d.ys = data_samples[0]
        
        var layout = Layout(title: "testing", width: 1200, height: 400,
                            xaxis: Axis(title:"my x-axis"),
                            yaxis: Axis(title: "y-axis too"),
                            autosize: false)
        var p = Plot[int](layout:layout, traces: @[d])
        p.show()
    
    
    main()
    
    
    
    Run

Compiling this new version I get a different, much better error that points out 
to the real problem:

> plot.nim(16, 24) Error: type mismatch: got <seq[int16]> but expected 
> 'seq[int]'

So the root cause of the error was that I was mixing int16 and int sequences. 
However, the error message is wrong, so this seems like a compiler error or a 
weird problem with the docopt library which is not doing anything in this small 
example? 

Reply via email to