Hello,
I found another minor discrepancy between implementation files and signature files.
Repro steps
Consider the following code:
Signature
namespace X
type MyRecord =
{ Level: int }
member Score : unit -> int
AST:
TypeDefnSig
(ComponentInfo
([], [], [], [MyRecord],
PreXmlDoc ((2,13), FSharp.Compiler.XmlDoc+XmlDocCollector),
false, None, tmp.fsi (2,5--2,13) IsSynthetic=false),
Simple
(Record
(None,
[Field
([], false, Some Level,
LongIdent (LongIdentWithDots ([int], [])), false,
PreXmlDoc ((3,11), FSharp.Compiler.XmlDoc+XmlDocCollector),
None, tmp.fsi (3,6--3,16) IsSynthetic=false)],
tmp.fsi (3,4--3,18) IsSynthetic=false),
tmp.fsi (3,4--3,18) IsSynthetic=false),
[Member
(ValSpfn
([], Score, SynValTyparDecls ([], true, []),
Fun
(LongIdent (LongIdentWithDots ([unit], [])),
LongIdent (LongIdentWithDots ([int], [])),
tmp.fsi (4,19--4,30) IsSynthetic=false),
SynValInfo
([[SynArgInfo ([], false, None)]],
SynArgInfo ([], false, None)), false, false,
PreXmlDoc ((4,10), FSharp.Compiler.XmlDoc+XmlDocCollector),
None, None, tmp.fsi (4,4--4,30) IsSynthetic=false),
{ IsInstance = true
IsDispatchSlot = false
IsOverrideOrExplicitImpl = false
IsFinal = false
MemberKind = Member },
tmp.fsi (4,4--4,30) IsSynthetic=false)],
tmp.fsi (3,4--3,18) IsSynthetic=false)
Notice how TypeDefnSig ends on position 3.18.
Implementation
namespace X
type MyRecord =
{ Level: int }
member Score () = 7
AST
TypeDefn
(ComponentInfo
([], [], [], [MyRecord],
PreXmlDoc ((2,13), FSharp.Compiler.XmlDoc+XmlDocCollector),
false, None, tmp.fsx (2,5--2,13) IsSynthetic=false),
Simple
(Record
(None,
[Field
([], false, Some Level,
LongIdent (LongIdentWithDots ([int], [])), false,
PreXmlDoc ((3,11), FSharp.Compiler.XmlDoc+XmlDocCollector),
None, tmp.fsx (3,6--3,16) IsSynthetic=false)],
tmp.fsx (3,4--3,18) IsSynthetic=false),
tmp.fsx (3,4--3,18) IsSynthetic=false),
[Member
(Binding
(None, NormalBinding, false, false, [],
PreXmlDoc ((4,11), FSharp.Compiler.XmlDoc+XmlDocCollector),
SynValData
(Some { IsInstance = true
IsDispatchSlot = false
IsOverrideOrExplicitImpl = false
IsFinal = false
MemberKind = Member },
SynValInfo
([[SynArgInfo ([], false, None)]; []],
SynArgInfo ([], false, None)), None),
LongIdent
(LongIdentWithDots ([Score], []), None, None,
Pats
[Paren
(Const
(Unit,
tmp.fsx (4,17--4,19) IsSynthetic=false),
tmp.fsx (4,17--4,19) IsSynthetic=false)], None,
tmp.fsx (4,11--4,19) IsSynthetic=false), None,
Const (Int32 7, tmp.fsx (4,22--4,23) IsSynthetic=false),
tmp.fsx (4,11--4,19) IsSynthetic=false,
NoDebugPointAtInvisibleBinding),
tmp.fsx (4,4--4,23) IsSynthetic=false)],
tmp.fsx (2,5--4,23) IsSynthetic=false)
TypeDefn ends on position 4,23, including the member.
Expected behavior
The range of both TypeDefnSig and TypeDefn include the members.
Actual behavior
Only TypeDefn contains the member.
Known workarounds
Construct a new range for TypeDefnSig that uses the end position of the last member.
Related information
Provide any related information (optional):
I'm interested in submitting a PR, please confirm my assumption that members should be included in the range.
Hello,
I found another minor discrepancy between implementation files and signature files.
Repro steps
Consider the following code:
Signature
AST:
TypeDefnSig (ComponentInfo ([], [], [], [MyRecord], PreXmlDoc ((2,13), FSharp.Compiler.XmlDoc+XmlDocCollector), false, None, tmp.fsi (2,5--2,13) IsSynthetic=false), Simple (Record (None, [Field ([], false, Some Level, LongIdent (LongIdentWithDots ([int], [])), false, PreXmlDoc ((3,11), FSharp.Compiler.XmlDoc+XmlDocCollector), None, tmp.fsi (3,6--3,16) IsSynthetic=false)], tmp.fsi (3,4--3,18) IsSynthetic=false), tmp.fsi (3,4--3,18) IsSynthetic=false), [Member (ValSpfn ([], Score, SynValTyparDecls ([], true, []), Fun (LongIdent (LongIdentWithDots ([unit], [])), LongIdent (LongIdentWithDots ([int], [])), tmp.fsi (4,19--4,30) IsSynthetic=false), SynValInfo ([[SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), false, false, PreXmlDoc ((4,10), FSharp.Compiler.XmlDoc+XmlDocCollector), None, None, tmp.fsi (4,4--4,30) IsSynthetic=false), { IsInstance = true IsDispatchSlot = false IsOverrideOrExplicitImpl = false IsFinal = false MemberKind = Member }, tmp.fsi (4,4--4,30) IsSynthetic=false)], tmp.fsi (3,4--3,18) IsSynthetic=false)Notice how
TypeDefnSigends on position3.18.Implementation
AST
TypeDefn (ComponentInfo ([], [], [], [MyRecord], PreXmlDoc ((2,13), FSharp.Compiler.XmlDoc+XmlDocCollector), false, None, tmp.fsx (2,5--2,13) IsSynthetic=false), Simple (Record (None, [Field ([], false, Some Level, LongIdent (LongIdentWithDots ([int], [])), false, PreXmlDoc ((3,11), FSharp.Compiler.XmlDoc+XmlDocCollector), None, tmp.fsx (3,6--3,16) IsSynthetic=false)], tmp.fsx (3,4--3,18) IsSynthetic=false), tmp.fsx (3,4--3,18) IsSynthetic=false), [Member (Binding (None, NormalBinding, false, false, [], PreXmlDoc ((4,11), FSharp.Compiler.XmlDoc+XmlDocCollector), SynValData (Some { IsInstance = true IsDispatchSlot = false IsOverrideOrExplicitImpl = false IsFinal = false MemberKind = Member }, SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), LongIdent (LongIdentWithDots ([Score], []), None, None, Pats [Paren (Const (Unit, tmp.fsx (4,17--4,19) IsSynthetic=false), tmp.fsx (4,17--4,19) IsSynthetic=false)], None, tmp.fsx (4,11--4,19) IsSynthetic=false), None, Const (Int32 7, tmp.fsx (4,22--4,23) IsSynthetic=false), tmp.fsx (4,11--4,19) IsSynthetic=false, NoDebugPointAtInvisibleBinding), tmp.fsx (4,4--4,23) IsSynthetic=false)], tmp.fsx (2,5--4,23) IsSynthetic=false)TypeDefnends on position4,23, including the member.Expected behavior
The range of both
TypeDefnSigandTypeDefninclude the members.Actual behavior
Only
TypeDefncontains the member.Known workarounds
Construct a new range for
TypeDefnSigthat uses the end position of the last member.Related information
Provide any related information (optional):
I'm interested in submitting a PR, please confirm my assumption that members should be included in the range.