Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/Compiler/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,13 @@ moduleSpfn:
if isRec then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsInvalidUseOfRec())
let info = SynComponentInfo($1 @ attribs2, None, [], path, xmlDoc, false, vis, rhs parseState 3)
if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2))
let m = (rhs2 parseState 1 4, $5)
let decls, mOptEnd = $5
let m = (rhs2 parseState 1 4, decls)
||> unionRangeWithListBy (fun (d: SynModuleSigDecl) -> d.Range)
|> unionRangeWithXmlDoc xmlDoc
let m = match mOptEnd with | None -> m | Some mEnd -> unionRanges m mEnd
let trivia: SynModuleSigDeclNestedModuleTrivia = { ModuleKeyword = Some mModule; EqualsRange = $4 }
SynModuleSigDecl.NestedModule(info, isRec, $5, m, trivia) }
SynModuleSigDecl.NestedModule(info, isRec, decls, m, trivia) }

| opt_attributes opt_access moduleIntro error
{ let mModule, isRec, path, vis, attribs2 = $3
Expand Down Expand Up @@ -743,15 +745,17 @@ moduleSpecBlock:

/* #light-syntax, with no sig/end or begin/end */
| OBLOCKBEGIN moduleSpfns oblockend
{ $2 }
{ $2, None }

/* #light-syntax, with sig/end or begin/end */
| OBLOCKBEGIN sigOrBegin moduleSpfnsPossiblyEmpty END oblockend
{ $3 }
{ let mEnd = rhs parseState 4
$3, Some mEnd }

/* non-#light-syntax, with sig/end or begin/end */
| sigOrBegin moduleSpfnsPossiblyEmpty END
{ $2 }
{ let mEnd = rhs parseState 3
$2, Some mEnd }


tyconSpfnList:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace X

module Y =
begin
val a: int
type B = string
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SigFile
(ParsedSigFileInput
("/root/NestedModule/NestedModuleWithBeginEndAndDecls.fsi",
QualifiedNameOfFile NestedModuleWithBeginEndAndDecls, [], [],
[SynModuleOrNamespaceSig
([X], false, DeclaredNamespace,
[NestedModule
(SynComponentInfo
([], None, [], [Y],
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), false,
None, (3,0--3,8)), false,
[Val
(SynValSig
([], SynIdent (a, None), SynValTyparDecls (None, true),
LongIdent (SynLongIdent ([int], [], [None])),
SynValInfo ([], SynArgInfo ([], false, None)), false, false,
PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector),
None, None, (5,8--5,18), { LeadingKeyword = Val (5,8--5,11)
InlineKeyword = None
WithKeyword = None
EqualsRange = None }),
(5,8--5,18));
Types
([SynTypeDefnSig
(SynComponentInfo
([], None, [], [B],
PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector),
false, None, (6,13--6,14)),
Simple
(TypeAbbrev
(Ok, LongIdent (SynLongIdent ([string], [], [None])),
(6,17--6,23)), (6,17--6,23)), [], (6,13--6,23),
{ LeadingKeyword = Type (6,8--6,12)
EqualsRange = Some (6,15--6,16)
WithKeyword = None })], (6,8--6,23))], (3,0--7,7),
{ ModuleKeyword = Some (3,0--3,6)
EqualsRange = Some (3,9--3,10) })], PreXmlDocEmpty, [], None,
(1,0--7,7), { LeadingKeyword = Namespace (1,0--1,9) })],
{ ConditionalDirectives = []
CodeComments = [] }, set []))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace X

module Y =
begin end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SigFile
(ParsedSigFileInput
("/root/NestedModule/RangeOfBeginEnd.fsi",
QualifiedNameOfFile RangeOfBeginEnd, [], [],
[SynModuleOrNamespaceSig
([X], false, DeclaredNamespace,
[NestedModule
(SynComponentInfo
([], None, [], [Y],
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), false,
None, (3,0--3,8)), false, [], (3,0--4,13),
{ ModuleKeyword = Some (3,0--3,6)
EqualsRange = Some (3,9--3,10) })], PreXmlDocEmpty, [], None,
(1,0--4,13), { LeadingKeyword = Namespace (1,0--1,9) })],
{ ConditionalDirectives = []
CodeComments = [] }, set []))