@@ -321,7 +321,7 @@ let rangeOfLongIdent(lid:LongIdent) =
321321%type <ParsedScriptInteraction> interaction
322322%type <Ident> ident
323323%type <SynType> typ typEOF
324- %type <SynTypeDefnSig list> tyconSpfns
324+ %type <SynTypeDefnSig list> tyconSpfnList
325325%type <SynExpr> patternResult
326326%type <SynExpr> declExpr
327327%type <SynExpr> minusExpr
@@ -810,18 +810,21 @@ moduleSpfn:
810810 let m = (rhs2 parseState 1 4, $5) ||> unionRangeWithListBy (fun (d: SynModuleSigDecl) -> d.Range)
811811 SynModuleSigDecl.NestedModule(info, isRec, $5, m) }
812812
813- | opt_attributes opt_declVisibility tyconSpfns
814- { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2))
815- let (SynTypeDefnSig(SynComponentInfo(cas, a, cs, b, c, d, d2, d3), e, f, g)), rest =
816- match $3 with
817- | [] -> raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedEmptyModuleDefn())
818- | h :: t -> h, t
819- let attrs = $1@cas
820- let mTc = (g, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range)
821- let tc = (SynTypeDefnSig(SynComponentInfo(attrs, a, cs, b, c, d, d2, d3), e, f, mTc))
822- let lastType = List.tryLast rest |> Option.defaultValue tc |> fun t -> t.Range
823- let m = mkRange lastType.FileName mTc.Start lastType.End
824- SynModuleSigDecl.Types (tc :: rest, m) }
813+ | opt_attributes opt_declVisibility typeKeyword tyconSpfnList
814+ { if Option.isSome $2 then
815+ errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2))
816+
817+ match $4 with
818+ | [] -> raiseParseErrorAt (rhs2 parseState 3 4) (FSComp.SR.parsUnexpectedEmptyModuleDefn ())
819+ | SynTypeDefnSig (SynComponentInfo (cas, a, cs, b, c, d, d2, d3), e, f, g) :: tail ->
820+ let attrs = $1 @ cas
821+ let mTc =
822+ let keywordM = rhs parseState 3
823+ (keywordM, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) |> unionRanges g
824+ let tc = (SynTypeDefnSig(SynComponentInfo(attrs, a, cs, b, c, d, d2, d3), e, f, mTc))
825+ let m = (mTc, tail) ||> unionRangeWithListBy (fun (a: SynTypeDefnSig) -> a.Range)
826+
827+ SynModuleSigDecl.Types (tc :: tail, m) }
825828
826829 | opt_attributes opt_declVisibility exconSpfn
827830 { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2))
@@ -870,12 +873,6 @@ moduleSpecBlock:
870873 { $2 }
871874
872875
873- /* A group of type definitions in a signature */
874- tyconSpfns:
875- | typeKeyword tyconSpfnList
876- { $2 }
877-
878-
879876tyconSpfnList:
880877 | tyconSpfn AND tyconSpfnList
881878 { $1 :: $3 }
0 commit comments