@@ -168,6 +168,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) ->
168168%type <SynExpr> argExpr
169169%type <SynExpr> declExprBlock
170170%type <SynPat> headBindingPattern
171+ %type <SynType> appTypeNullableInParens
171172%type <SynType> atomTypeNonAtomicDeprecated
172173%type <SynExpr> atomicExprAfterType
173174%type <SynExpr> typedSequentialExprBlock
@@ -2883,27 +2884,35 @@ unionCaseReprElements:
28832884       field :: fields, unionRanges mStar mFields }
28842885
28852886  | unionCaseReprElement %prec prec_toptuptyptail_prefix
2886-      { [$1], rhs parseState 1  }
2887+      { [$1], $1.Range  }
28872888
28882889unionCaseReprElement:
28892890  | ident COLON appTypeNullableInParens
2890-      { let xmlDoc = grabXmlDoc(parseState, [], 1)
2891-        let mWhole = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc
2891+      { let xmlDoc = grabXmlDoc (parseState, [], 1)
2892+        let mId = rhs parseState 1
2893+        let mWhole = unionRanges mId $3.Range |> unionRangeWithXmlDoc xmlDoc
28922894       mkSynNamedField ($1, $3, xmlDoc, mWhole) }
28932895
2896+   | ident COLON recover
2897+      { let xmlDoc = grabXmlDoc (parseState, [], 1)
2898+        let mColon = rhs parseState 2
2899+        let ty = SynType.FromParseError mColon.EndRange
2900+        let mWhole = rhs2 parseState 1 2 |> unionRangeWithXmlDoc xmlDoc
2901+        mkSynNamedField ($1, ty, xmlDoc, mWhole) }
2902+ 
28942903  | appTypeNullableInParens
2895-      { let xmlDoc = grabXmlDoc(parseState, [], 1)
2904+      { let xmlDoc = grabXmlDoc  (parseState, [], 1)
28962905       mkSynAnonField ($1, xmlDoc) }
28972906
28982907  | ident COLON invalidUseOfAppTypeFunction
2899-      { let xmlDoc = grabXmlDoc(parseState, [], 1)
2908+      { let xmlDoc = grabXmlDoc  (parseState, [], 1)
29002909       let mWhole = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc
2901-        reportParseErrorAt ($3  : SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField())
2910+        reportParseErrorAt ($3: SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField  ())
29022911       mkSynNamedField ($1, $3, xmlDoc, mWhole) }
29032912
29042913  | invalidUseOfAppTypeFunction
2905-      { let xmlDoc = grabXmlDoc(parseState, [], 1)
2906-        reportParseErrorAt ($1  : SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField())
2914+      { let xmlDoc = grabXmlDoc  (parseState, [], 1)
2915+        reportParseErrorAt ($1: SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField  ())
29072916       mkSynAnonField ($1, xmlDoc) }
29082917
29092918unionCaseRepr:
@@ -5981,11 +5990,13 @@ invalidUseOfAppTypeFunction:
59815990     { let mArrow = rhs parseState 2
59825991       let m = unionRanges (rhs2 parseState 1 2) $3.Range
59835992       SynType.Fun($1, $3, m, { ArrowRange = mArrow }) }
5993+ 
59845994  | appTypeWithoutNull RARROW recover
59855995     { let mArrow = rhs parseState 2
59865996       let ty = SynType.FromParseError(mArrow.EndRange)
59875997       let m = rhs2 parseState 1 2
59885998       SynType.Fun($1, ty, m, { ArrowRange = mArrow }) }
5999+ 
59896000  | appTypeWithoutNull RARROW RARROW invalidUseOfAppTypeFunction
59906001     { let mArrow1 = rhs parseState 2
59916002       let mArrow2 = rhs parseState 3
@@ -5994,6 +6005,7 @@ invalidUseOfAppTypeFunction:
59946005       let m1 = unionRanges $1.Range $4.Range
59956006       let m2 = unionRanges mArrow2 $4.Range
59966007       SynType.Fun($1, SynType.Fun(ty, $4, m2, { ArrowRange = mArrow2 }), m1, { ArrowRange = mArrow1 }) }
6008+ 
59976009  | appTypeWithoutNull RARROW appTypeWithoutNull
59986010     { let mArrow = rhs parseState 2
59996011       let m = rhs2 parseState 1 3
0 commit comments