Skip to content

Textual error message when printing Vec #6

@fnzr

Description

@fnzr

When using printfn to print a member of Vec, the message "Error: Index was outside the bounds of the array" is shown. There's no actual error occuring.
Example:

let main argv =
    let vec1 = Vec.ofSeq ['a'; 'b'; 'c']
    printfn "%A" vec1 //error
    Vec.iter (printfn "%A") vec1 //ok
    let vec2, _ = vec1.Pop ()
    printfn "%A" vec2 //error
    printfn "%A" [vec2.[0];vec2.[1]] //ok
    0

Output:

Error: Index was outside the bounds of the array.
'a'
'b'
'c'
Error: Index was outside the bounds of the array.
['a'; 'b']

Expected output (or similar):

['a'; 'b'; 'c']
'a'
'b'
'c'
['a'; 'b']
['a'; 'b']

I cloned the most recent version, commit 2983d02

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions