Skip to content

FSI Mutable Struct Field Pretty Printing #1382

@ghost

Description

Structs that contain mutable fields do not render in FSI, the data is still there, and everything is fine if we try to access the field via FSI, it is only the presentation in FSI that seems to be inconsistent. Unsure if bug or limitation.

Repro steps

// Firstly, define the mutable struct.
[<Struct>]
type t = val mutable x : int
// create a reference to it
let mutable t = t()
// set the field
t.x<-1
// now try to access the pretty representation of the struct
t;;
// prints val it : t = FSI_0094+t

Further, if we define a normal ctor'd struct with initialised values and a mutable field, we get a ghost field:

[<Struct>]
type test2 = 
    val x : int
    val mutable y : int
    new (x) = {x=x; y = 1 }

let t2 = test2(1)
t2;;
// val it : test2 = FSI_0097+test2 {x = 1;}

Expected behavior

Expected behaviour is that a mutable struct prettyprints itself in the same manner as a non mutable struct.

Related information

Provide any related information

  • Latest F# via Visual Studio 2015 update 3

Edit:made struct attributes consistent

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FSIBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.good first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions