diff --git a/src/fsharp/CheckComputationExpressions.fs b/src/fsharp/CheckComputationExpressions.fs index ade713ea80f..03816ca3aa0 100644 --- a/src/fsharp/CheckComputationExpressions.fs +++ b/src/fsharp/CheckComputationExpressions.fs @@ -1283,16 +1283,14 @@ let TcComputationExpression cenv env (overallTy: OverallTy) tpenv (mWhole, inter // Build the 'Bind' call Some (transBind q varSpace bindRange "Bind" [mergedSources] consumePat letSpBind innerComp translatedCtxt) - | SynExpr.Match (spMatch, expr, clauses, m) -> - let mMatch = match spMatch with DebugPointAtBinding.Yes mMatch -> mMatch | _ -> m + | SynExpr.Match (mMatch, spMatch, expr, mWith, clauses, m) -> if isQuery then error(Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery(), mMatch)) let clauses = clauses |> List.map (fun (SynMatchClause(pat, cond, arrow, innerComp, patm, sp)) -> SynMatchClause(pat, cond, arrow, transNoQueryOps innerComp, patm, sp)) - Some(translatedCtxt (SynExpr.Match (spMatch, expr, clauses, m))) + Some(translatedCtxt (SynExpr.Match (mMatch, spMatch, expr, mWith, clauses, m))) // 'match! expr with pats ...' --> build.Bind(e1, (function pats ...)) - | SynExpr.MatchBang (spMatch, expr, clauses, m) -> + | SynExpr.MatchBang (mMatch, spMatch, expr, _mWith, clauses, _m) -> let matchExpr = mkSourceExpr expr - let mMatch = match spMatch with DebugPointAtBinding.Yes mMatch -> mMatch | _ -> m if isQuery then error(Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery(), mMatch)) if isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mMatch ad "Bind" builderTy) then @@ -1304,7 +1302,7 @@ let TcComputationExpression cenv env (overallTy: OverallTy) tpenv (mWhole, inter // TODO: consider allowing translation to BindReturn Some(translatedCtxt (mkSynCall "Bind" mMatch [matchExpr; consumeExpr])) - | SynExpr.TryWith (innerComp, _mTryToWith, clauses, _mWithToLast, mTryToLast, spTry, _spWith) -> + | SynExpr.TryWith (_mTry, innerComp, _mTryToWith, _mWith, clauses, _mWithToLast, mTryToLast, spTry, _spWith) -> let mTry = match spTry with DebugPointAtTry.Yes m -> m.NoteDebugPoint(RangeDebugPointKind.Try) | _ -> mTryToLast if isQuery then error(Error(FSComp.SR.tcTryWithMayNotBeUsedInQueries(), mTry)) @@ -1536,7 +1534,7 @@ let TcComputationExpression cenv env (overallTy: OverallTy) tpenv (mWhole, inter and convertSimpleReturnToExpr varSpace innerComp = match innerComp with | SynExpr.YieldOrReturn ((false, _), returnExpr, _) -> Some (returnExpr, None) - | SynExpr.Match (spMatch, expr, clauses, m) -> + | SynExpr.Match (mMatch, spMatch, mWith, expr, clauses, m) -> let clauses = clauses |> List.map (fun (SynMatchClause(pat, cond, arrow, innerComp2, patm, sp)) -> match convertSimpleReturnToExpr varSpace innerComp2 with @@ -1544,7 +1542,7 @@ let TcComputationExpression cenv env (overallTy: OverallTy) tpenv (mWhole, inter | Some (_, Some _) -> None // custom op on branch = failure | Some (innerExpr2, None) -> Some (SynMatchClause(pat, cond, arrow, innerExpr2, patm, sp))) if clauses |> List.forall Option.isSome then - Some (SynExpr.Match (spMatch, expr, (clauses |> List.map Option.get), m), None) + Some (SynExpr.Match (mMatch, spMatch, mWith, expr, (clauses |> List.map Option.get), m), None) else None @@ -1608,10 +1606,10 @@ let TcComputationExpression cenv env (overallTy: OverallTy) tpenv (mWhole, inter isSimpleExpr thenComp && (match elseCompOpt with None -> true | Some c -> isSimpleExpr c) | SynExpr.LetOrUse (_, _, _, innerComp, _) -> isSimpleExpr innerComp | SynExpr.LetOrUseBang _ -> false - | SynExpr.Match (_, _, clauses, _) -> + | SynExpr.Match (clauses=clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = innerComp)) -> isSimpleExpr innerComp) | SynExpr.MatchBang _ -> false - | SynExpr.TryWith (innerComp, _, clauses, _, _, _, _) -> + | SynExpr.TryWith (tryExpr=innerComp; withCases=clauses) -> isSimpleExpr innerComp && clauses |> List.forall (fun (SynMatchClause(resultExpr = clauseComp)) -> isSimpleExpr clauseComp) | SynExpr.YieldOrReturnFrom _ -> false @@ -1870,7 +1868,7 @@ let TcSequenceExpression (cenv: cenv) env tpenv comp (overallTy: OverallTy) m = | SynExpr.LetOrUseBang (range=m) -> error(Error(FSComp.SR.tcUseForInSequenceExpression(), m)) - | SynExpr.Match (spMatch, expr, clauses, _) -> + | SynExpr.Match (_mMatch, spMatch, expr, _mWith, clauses, _m) -> let inputExpr, matchty, tpenv = TcExprOfUnknownType cenv env tpenv expr let tclauses, tpenv = (tpenv, clauses) ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, _, innerComp, _, sp)) -> diff --git a/src/fsharp/CheckDeclarations.fs b/src/fsharp/CheckDeclarations.fs index 1b9a15b2c6f..623ae199e7b 100644 --- a/src/fsharp/CheckDeclarations.fs +++ b/src/fsharp/CheckDeclarations.fs @@ -2383,7 +2383,7 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial bindsm scopem mutRecNSInfo (env let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData let overridesOK = DeclKind.CanOverrideOrImplement declKind members |> List.collect (function - | SynMemberDefn.Interface(ity, defnOpt, _) -> + | SynMemberDefn.Interface(interfaceType=ity; members=defnOpt) -> let _, ty = if tcref.Deref.IsExceptionDecl then [], g.exn_ty else generalizeTyconRef tcref let m = ity.Range if tcref.IsTypeAbbrev then error(Error(FSComp.SR.tcTypeAbbreviationsCannotHaveInterfaceDeclaration(), m)) @@ -3013,7 +3013,7 @@ module TcExceptionDeclarations = let binds3 = AddAugmentationDeclarations.AddGenericEqualityBindings cenv envFinal exnc binds1 @ binds2flat @ binds3, exnc, envFinal - let TcExnSignature cenv envInitial parent tpenv (SynExceptionSig(core, aug, _), scopem) = + let TcExnSignature cenv envInitial parent tpenv (SynExceptionSig(exnRepr=core; members=aug), scopem) = let binds, exnc = TcExnDefnCore cenv envInitial parent core let envMutRec = AddLocalExnDefnAndReport cenv.tcSink scopem (AddLocalTycons cenv.g cenv.amap scopem [exnc] envInitial) exnc let ecref = mkLocalEntityRef exnc @@ -3191,7 +3191,7 @@ module EstablishTypeDefinitionCores = for SynTypeDefn(typeInfo=SynComponentInfo(typeParams=TyparDecls typars; longId=ids); typeRepr=trepr) in typeSpecs do if isNil typars then match trepr with - | SynTypeDefnRepr.ObjectModel(SynTypeDefnKind.Augmentation, _, _) -> () + | SynTypeDefnRepr.ObjectModel(kind=SynTypeDefnKind.Augmentation _) -> () | _ -> yield (List.last ids).idText | _ -> () ] |> set @@ -3201,7 +3201,7 @@ module EstablishTypeDefinitionCores = [ for def in defs do match def with | SynModuleSigDecl.Types (typeSpecs, _) -> - for SynTypeDefnSig(SynComponentInfo(typeParams=TyparDecls typars; longId=ids), _, trepr, extraMembers, _) in typeSpecs do + for SynTypeDefnSig(typeInfo=SynComponentInfo(typeParams=TyparDecls typars; longId=ids); typeRepr=trepr; members=extraMembers) in typeSpecs do if isNil typars then match trepr with | SynTypeDefnSigRepr.Simple(SynTypeDefnSimpleRepr.None _, _) when not (isNil extraMembers) -> () @@ -4081,7 +4081,7 @@ module EstablishTypeDefinitionCores = let abstractSlots = [ for valSpfn, memberFlags in slotsigs do - let (SynValSig(_, _, _, _, _valSynData, _, _, _, _, _, m)) = valSpfn + let (SynValSig(range=m)) = valSpfn CheckMemberFlags None NewSlotsOK OverridesOK memberFlags m @@ -4593,7 +4593,7 @@ module TcDeclarations = declKind, tcref, typars - let private isAugmentationTyconDefnRepr = function SynTypeDefnSimpleRepr.General(SynTypeDefnKind.Augmentation, _, _, _, _, _, _, _) -> true | _ -> false + let private isAugmentationTyconDefnRepr = function SynTypeDefnSimpleRepr.General(kind=SynTypeDefnKind.Augmentation _) -> true | _ -> false let private isAutoProperty = function SynMemberDefn.AutoProperty _ -> true | _ -> false let private isMember = function SynMemberDefn.Member _ -> true | _ -> false let private isImplicitCtor = function SynMemberDefn.ImplicitCtor _ -> true | _ -> false @@ -4669,12 +4669,12 @@ module TcDeclarations = /// body = members /// where members contain methods/overrides, also implicit ctor, inheritCall and local definitions. let rec private SplitTyconDefn (SynTypeDefn(typeInfo=synTyconInfo;typeRepr=trepr; members=extraMembers)) = - let implements1 = List.choose (function SynMemberDefn.Interface (ty, _, _) -> Some(ty, ty.Range) | _ -> None) extraMembers + let implements1 = List.choose (function SynMemberDefn.Interface (interfaceType=ty) -> Some(ty, ty.Range) | _ -> None) extraMembers match trepr with | SynTypeDefnRepr.ObjectModel(kind, cspec, m) -> CheckMembersForm cspec let fields = cspec |> List.choose (function SynMemberDefn.ValField (f, _) -> Some f | _ -> None) - let implements2 = cspec |> List.choose (function SynMemberDefn.Interface (ty, _, _) -> Some(ty, ty.Range) | _ -> None) + let implements2 = cspec |> List.choose (function SynMemberDefn.Interface (interfaceType=ty) -> Some(ty, ty.Range) | _ -> None) let inherits = cspec |> List.choose (function | SynMemberDefn.Inherit (ty, idOpt, m) -> Some(ty, m, idOpt) @@ -4708,7 +4708,7 @@ module TcDeclarations = let attribs = attribs |> List.filter (fun a -> match a.Target with Some t when t.idText = "field" -> true | _ -> false) let mLetPortion = synExpr.Range let fldId = ident (CompilerGeneratedName id.idText, mLetPortion) - let headPat = SynPat.LongIdent (LongIdentWithDots([fldId], []), None, Some noInferredTypars, SynArgPats.Pats [], None, mLetPortion) + let headPat = SynPat.LongIdent (LongIdentWithDots([fldId], []), None, None, Some noInferredTypars, SynArgPats.Pats [], None, mLetPortion) let retInfo = match tyOpt with None -> None | Some ty -> Some (SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range)) let isMutable = match propKind with @@ -4720,7 +4720,7 @@ module TcDeclarations = [(SynMemberDefn.LetBindings ([binding], isStatic, false, mWholeAutoProp))] - | SynMemberDefn.Interface (_, Some membs, _) -> membs |> List.collect preAutoProps + | SynMemberDefn.Interface (members=Some membs) -> membs |> List.collect preAutoProps | SynMemberDefn.LetBindings _ | SynMemberDefn.ImplicitCtor _ | SynMemberDefn.Open _ @@ -4736,7 +4736,7 @@ module TcDeclarations = let attribs = attribs |> List.filter (fun a -> match a.Target with Some t when t.idText = "field" -> false | _ -> true) let fldId = ident (CompilerGeneratedName id.idText, mMemberPortion) let headPatIds = if isStatic then [id] else [ident ("__", mMemberPortion);id] - let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, []), None, Some noInferredTypars, SynArgPats.Pats [], None, mMemberPortion) + let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, []), None, None, Some noInferredTypars, SynArgPats.Pats [], None, mMemberPortion) match propKind, mGetSetOpt with | SynMemberKind.PropertySet, Some m -> errorR(Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSetNotJustSet(), m)) @@ -4761,16 +4761,16 @@ module TcDeclarations = | SynMemberKind.PropertyGetSet -> let setter = let vId = ident("v", mMemberPortion) - let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, []), None, Some noInferredTypars, SynArgPats.Pats [mkSynPatVar None vId], None, mMemberPortion) + let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, []), None, None, Some noInferredTypars, SynArgPats.Pats [mkSynPatVar None vId], None, mMemberPortion) let rhsExpr = mkSynAssign (SynExpr.Ident fldId) (SynExpr.Ident vId) //let retInfo = match tyOpt with None -> None | Some ty -> Some (SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range)) let binding = mkSynBinding (xmlDoc, headPat) (access, false, false, mMemberPortion, DebugPointAtBinding.NoneAtInvisible, None, None, rhsExpr, rhsExpr.Range, [], [], Some (memberFlags SynMemberKind.PropertySet)) SynMemberDefn.Member (binding, mMemberPortion) yield setter | _ -> ()] - | SynMemberDefn.Interface (ty, Some membs, m) -> + | SynMemberDefn.Interface (ty, mWith, Some membs, m) -> let membs' = membs |> List.collect postAutoProps - [SynMemberDefn.Interface (ty, Some membs', m)] + [SynMemberDefn.Interface (ty, mWith, Some membs', m)] | SynMemberDefn.LetBindings _ | SynMemberDefn.ImplicitCtor _ | SynMemberDefn.Open _ @@ -4785,7 +4785,7 @@ module TcDeclarations = let isConcrete = members |> List.exists (function | SynMemberDefn.Member(SynBinding(valData = SynValData(Some memberFlags, _, _)), _) -> not memberFlags.IsDispatchSlot - | SynMemberDefn.Interface (_, defOpt, _) -> Option.isSome defOpt + | SynMemberDefn.Interface (members=defOpt) -> Option.isSome defOpt | SynMemberDefn.LetBindings _ -> true | SynMemberDefn.ImplicitCtor _ -> true | SynMemberDefn.ImplicitInherit _ -> true @@ -5222,10 +5222,10 @@ and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (d let decls = [ MutRecShape.Open (MutRecDataForOpen(target, m, moduleRange, ref [])) ] decls, (openOk, moduleAbbrevOk) - | SynModuleSigDecl.Exception (SynExceptionSig(exnRepr, members, _), _) -> + | SynModuleSigDecl.Exception (exnSig=SynExceptionSig(exnRepr=exnRepr; withKeyword=withKeyword; members=members)) -> let ( SynExceptionDefnRepr(synAttrs, SynUnionCase(_, id, _args, _, _, _), _, doc, vis, m)) = exnRepr let compInfo = SynComponentInfo(synAttrs, None, [], [id], doc, false, vis, id.idRange) - let decls = [ MutRecShape.Tycon(SynTypeDefnSig.SynTypeDefnSig(compInfo, None, SynTypeDefnSigRepr.Exception exnRepr, members, m)) ] + let decls = [ MutRecShape.Tycon(SynTypeDefnSig.SynTypeDefnSig(compInfo, None, SynTypeDefnSigRepr.Exception exnRepr, withKeyword, members, m)) ] decls, (false, false) | SynModuleSigDecl.Val (vspec, _) -> diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index 638bb52d35a..c1276fa0779 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -2428,7 +2428,7 @@ module BindingNormalization = // of available items, to the point that you can't even define a function with the same name as an existing union case. match pat with | SynPat.FromParseError(p, _) -> normPattern p - | SynPat.LongIdent (LongIdentWithDots(longId, _), toolId, tyargs, SynArgPats.Pats args, vis, m) -> + | SynPat.LongIdent (LongIdentWithDots(longId, _), _, toolId, tyargs, SynArgPats.Pats args, vis, m) -> let typars = match tyargs with None -> inferredTyparDecls | Some typars -> typars match memberFlagsOpt with | None -> @@ -4009,7 +4009,7 @@ and TcPseudoMemberSpec cenv newOk env synTypes tpenv memSpfn m = /// Check a value specification, e.g. in a signature, interface declaration or a constraint and TcValSpec cenv env declKind newOk containerInfo memFlagsOpt thisTyOpt tpenv valSpfn attrs = - let (SynValSig(_, id, ValTyparDecls (synTypars, synTyparConstraints, _), ty, valSynInfo, _, _, _, _, _, m)) = valSpfn + let (SynValSig(ident=id; explicitValDecls=ValTyparDecls (synTypars, synTyparConstraints, _); synType=ty; arity=valSynInfo; range=m)) = valSpfn let declaredTypars = TcTyparDecls cenv env synTypars let (ContainerInfo(altActualParent, tcrefContainerInfo)) = containerInfo let enclosingDeclaredTypars, memberContainerInfo, thisTyOpt, declKind = @@ -4962,7 +4962,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p let pats', acc = TcPatterns warnOnUpper cenv env vFlags (tpenv, names, takenNames) (List.map (fun _ -> ty) pats) pats (fun values -> TPat_conjs(List.map (fun f -> f values) pats', m)), acc - | SynPat.LongIdent (LongIdentWithDots(longId, _), _, tyargs, args, vis, m) -> + | SynPat.LongIdent (longDotId=LongIdentWithDots(longId, _); typarDecls=tyargs; argPats=args; accessibility=vis; range=m) -> if Option.isSome tyargs then errorR(Error(FSComp.SR.tcInvalidTypeArgumentUsage(), m)) let warnOnUpperForId = match args with @@ -4994,7 +4994,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p | SynPat.Const (c, m) -> SynExpr.Const (c, m) | SynPat.Named (id, _, None, _) -> SynExpr.Ident id | SynPat.Typed (p, cty, m) -> SynExpr.Typed (convSynPatToSynExpr p, cty, m) - | SynPat.LongIdent (LongIdentWithDots(longId, dotms) as lidwd, _, _tyargs, args, None, m) -> + | SynPat.LongIdent (longDotId=LongIdentWithDots(longId, dotms) as lidwd; argPats=args; accessibility=None; range=m) -> let args = match args with SynArgPats.Pats args -> args | _ -> failwith "impossible: active patterns can be used only with SynConstructorArgs.Pats" let e = if dotms.Length = longId.Length then @@ -5657,7 +5657,7 @@ and TcExprUndelayed cenv (overallTy: OverallTy) env tpenv (synExpr: SynExpr) = | SynExpr.Lambda _ -> TcIteratedLambdas cenv true env overallTy Set.empty tpenv synExpr - | SynExpr.Match (spMatch, synInputExpr, synClauses, _m) -> + | SynExpr.Match (_mMatch, spMatch, synInputExpr, _mWith, synClauses, _m) -> let inputExpr, inputTy, tpenv = TcExprOfUnknownType cenv env tpenv synInputExpr let mInputExpr = inputExpr.Range @@ -5719,7 +5719,7 @@ and TcExprUndelayed cenv (overallTy: OverallTy) env tpenv (synExpr: SynExpr) = TcNewExpr cenv env tpenv objTy (Some synObjTy.Range) superInit arg mNewExpr ) - | SynExpr.ObjExpr (synObjTy, argopt, binds, extraImpls, mNewExpr, m) -> + | SynExpr.ObjExpr (synObjTy, argopt, _mWith, binds, extraImpls, mNewExpr, m) -> TcExprObjectExpr cenv overallTy env tpenv (synObjTy, argopt, binds, extraImpls, mNewExpr, m) | SynExpr.Record (inherits, optOrigExpr, flds, mWholeExpr) -> @@ -5752,7 +5752,7 @@ and TcExprUndelayed cenv (overallTy: OverallTy) env tpenv (synExpr: SynExpr) = | SynExpr.LetOrUse _ -> TcLinearExprs (TcExprThatCanBeCtorBody cenv) cenv env overallTy tpenv false synExpr (fun x -> x) - | SynExpr.TryWith (synBodyExpr, _mTryToWith, synWithClauses, mWithToLast, mTryToLast, spTry, spWith) -> + | SynExpr.TryWith (_mTry, synBodyExpr, _mTryToWith, _mWith, synWithClauses, mWithToLast, mTryToLast, spTry, spWith) -> TcExprTryWith cenv overallTy env tpenv (synBodyExpr, _mTryToWith, synWithClauses, mWithToLast, mTryToLast, spTry, spWith) | SynExpr.TryFinally (synBodyExpr, synFinallyExpr, mTryToLast, spTry, spFinally) -> @@ -5844,7 +5844,7 @@ and TcExprUndelayed cenv (overallTy: OverallTy) env tpenv (synExpr: SynExpr) = | SynExpr.LetOrUseBang (range=m) -> error(Error(FSComp.SR.tcConstructRequiresComputationExpression(), m)) - | SynExpr.MatchBang (_, _, _, m) -> + | SynExpr.MatchBang (range=m) -> error(Error(FSComp.SR.tcConstructRequiresComputationExpression(), m)) | SynExpr.IndexFromEnd (range=m) @@ -5980,7 +5980,7 @@ and TcExprObjectExpr cenv overallTy env tpenv (synObjTy, argopt, binds, extraImp // Work out the type of any interfaces to implement let extraImpls, tpenv = - (tpenv, extraImpls) ||> List.mapFold (fun tpenv (SynInterfaceImpl(synIntfTy, overrides, m)) -> + (tpenv, extraImpls) ||> List.mapFold (fun tpenv (SynInterfaceImpl(synIntfTy, _mWith, overrides, m)) -> let intfTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv synIntfTy if not (isInterfaceTy cenv.g intfTy) then error(Error(FSComp.SR.tcExpectedInterfaceType(), m)) @@ -9620,7 +9620,7 @@ and CheckRecursiveBindingIds binds = match b with | SynPat.Named(id, _, _, _) | SynPat.As(_, SynPat.Named(id, _, _, _), _) - | SynPat.LongIdent(LongIdentWithDots([id], _), _, _, _, _, _) -> id.idText + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _)) -> id.idText | _ -> "" if nm <> "" && not (hashOfBinds.Add nm) then error(Duplicate("value", nm, m)) @@ -11497,7 +11497,7 @@ and TcLetrec overridesOK cenv env tpenv (binds, bindsm, scopem) = let TcAndPublishValSpec (cenv, env, containerInfo: ContainerInfo, declKind, memFlagsOpt, tpenv, valSpfn) = - let (SynValSig (Attributes synAttrs, _, ValTyparDecls (synTypars, _, synCanInferTypars), _, _, isInline, mutableFlag, doc, vis, literalExprOpt, m)) = valSpfn + let (SynValSig (attributes=Attributes synAttrs; explicitValDecls=ValTyparDecls (synTypars, _, synCanInferTypars); isInline=isInline; isMutable=mutableFlag; xmlDoc=doc; accessibility=vis; synExpr=literalExprOpt; range=m)) = valSpfn GeneralizationHelpers.CheckDeclaredTyparsPermitted(memFlagsOpt, synTypars, m) let canInferTypars = GeneralizationHelpers.ComputeCanInferExtraGeneralizableTypars (containerInfo.ParentRef, synCanInferTypars, memFlagsOpt) diff --git a/src/fsharp/SyntaxTree.fs b/src/fsharp/SyntaxTree.fs index 6077a1b35d4..62b405dce90 100644 --- a/src/fsharp/SyntaxTree.fs +++ b/src/fsharp/SyntaxTree.fs @@ -115,9 +115,9 @@ type SynConst = | UInt16s of uint16[] - | Measure of constant: SynConst * constantRange: Range * SynMeasure + | Measure of constant: SynConst * constantRange: range * SynMeasure - | SourceIdentifier of constant: string * value: string * range: Range + | SourceIdentifier of constant: string * value: string * range: range member c.Range dflt = match c with @@ -483,7 +483,7 @@ type SynExpr = | AnonRecd of isStruct: bool * copyInfo:(SynExpr * BlockSeparator) option * - recordFields:(Ident * Range option * SynExpr) list * + recordFields:(Ident * range option * SynExpr) list * range: range | ArrayOrList of @@ -506,6 +506,7 @@ type SynExpr = | ObjExpr of objType: SynType * argOptions:(SynExpr * Ident option) option * + withKeyword: range option * bindings: SynBinding list * extraImpls: SynInterfaceImpl list * newExprRange: range * @@ -520,7 +521,7 @@ type SynExpr = | For of forDebugPoint: DebugPointAtFor * ident: Ident * - equalsRange: Range option * + equalsRange: range option * identBody: SynExpr * direction: bool * toBody: SynExpr * @@ -562,7 +563,7 @@ type SynExpr = fromMethod: bool * inLambdaSeq: bool * args: SynSimplePats * - arrow: Range option * + arrow: range option * body: SynExpr * parsedData: (SynPat list * SynExpr) option * range: range @@ -575,8 +576,10 @@ type SynExpr = range: range | Match of + matchKeyword: range * matchDebugPoint: DebugPointAtBinding * expr: SynExpr * + withKeyword: range * clauses: SynMatchClause list * range: range @@ -612,8 +615,10 @@ type SynExpr = range: range | TryWith of + tryKeywordRange: range * tryExpr: SynExpr * tryRange: range * + withKeywordRange: range * withCases: SynMatchClause list * withRange: range * range: range * @@ -778,15 +783,17 @@ type SynExpr = isUse: bool * isFromSource: bool * pat: SynPat * - equalsRange: Range option * + equalsRange: range option * rhs: SynExpr * andBangs: SynExprAndBang list * body:SynExpr * range: range | MatchBang of + matchKeyword: range * matchDebugPoint: DebugPointAtBinding * expr: SynExpr * + withKeyword: range * clauses: SynMatchClause list * range: range @@ -949,15 +956,15 @@ type SynExprAndBang = isUse: bool * isFromSource: bool * pat: SynPat * - equalsRange: Range * + equalsRange: range * body: SynExpr * - range: Range + range: range [] type SynExprRecordField = | SynExprRecordField of fieldName: RecordFieldName * - equalsRange: Range option * + equalsRange: range option * expr: SynExpr option * blockSeparator: BlockSeparator option @@ -1033,7 +1040,7 @@ type SynArgPats = pats: SynPat list | NamePatPairs of - pats: (Ident * Range * SynPat) list * + pats: (Ident * range * SynPat) list * range: range member x.Patterns = @@ -1083,6 +1090,7 @@ type SynPat = | LongIdent of longDotId: LongIdentWithDots * + propertyKeyword: PropertyKeyword option * extraId: Ident option * // holds additional ident for tooling typarDecls: SynValTyparDecls option * // usually None: temporary used to parse "f<'a> x = x" argPats: SynArgPats * @@ -1104,7 +1112,7 @@ type SynPat = range: range | Record of - fieldPats: ((LongIdent * Ident) * Range * SynPat) list * + fieldPats: ((LongIdent * Ident) * range * SynPat) list * range: range | Null of @@ -1161,10 +1169,16 @@ type SynPat = | SynPat.Paren (range=m) | SynPat.FromParseError (range=m) -> m +[] +type PropertyKeyword = + | With of range + | And of range + [] type SynInterfaceImpl = | SynInterfaceImpl of interfaceTy: SynType * + withKeyword: range option * bindings: SynBinding list * range: range @@ -1173,7 +1187,7 @@ type SynMatchClause = | SynMatchClause of pat: SynPat * whenExpr: SynExpr option * - arrow: Range option * + arrow: range option * resultExpr: SynExpr * range: range * debugPoint: DebugPointAtTarget @@ -1233,7 +1247,7 @@ type SynBinding = valData: SynValData * headPat: SynPat * returnInfo: SynBindingReturnInfo option * - equalsRange: Range option * + equalsRange: range option * expr: SynExpr * range: range * debugPoint: DebugPointAtBinding @@ -1326,7 +1340,7 @@ type SynTypeDefnKind = | Union | Abbrev | Opaque - | Augmentation + | Augmentation of withKeyword: range | IL | Delegate of signature: SynType * signatureInfo: SynValInfo @@ -1389,7 +1403,7 @@ type SynEnumCase = | SynEnumCase of attributes: SynAttributes * ident: Ident * - equalsRange: Range * + equalsRange: range * value: SynConst * valueRange: range * xmlDoc: PreXmlDoc * @@ -1450,8 +1464,9 @@ type SynTypeDefnSig = | SynTypeDefnSig of typeInfo: SynComponentInfo * - equalsRange: Range option * + equalsRange: range option * typeRepr: SynTypeDefnSigRepr * + withKeyword: range option * members: SynMemberSig list * range: range @@ -1500,6 +1515,7 @@ type SynValSig = xmlDoc: PreXmlDoc * accessibility: SynAccess option * synExpr: SynExpr option * + withKeyword: range option * range: range member x.RangeOfId = let (SynValSig(ident=id)) = x in id.idRange @@ -1594,7 +1610,7 @@ type SynTypeDefnRepr = type SynTypeDefn = | SynTypeDefn of typeInfo: SynComponentInfo * - equalsRange: Range option * + equalsRange: range option * typeRepr: SynTypeDefnRepr * members: SynMemberDefns * implicitConstructor: SynMemberDefn option * @@ -1642,6 +1658,7 @@ type SynMemberDefn = | Interface of interfaceType: SynType * + withKeyword: range option * members: SynMemberDefns option * range: range @@ -1668,8 +1685,9 @@ type SynMemberDefn = memberFlags:(SynMemberKind -> SynMemberFlags) * xmlDoc: PreXmlDoc * accessibility: SynAccess option * - equalsRange: Range * + equalsRange: range * synExpr: SynExpr * + withKeyword: range option * getSetRange: range option * range: range @@ -1700,7 +1718,7 @@ type SynModuleDecl = | NestedModule of moduleInfo: SynComponentInfo * isRecursive: bool * - equalsRange: Range option * + equalsRange: range option * decls: SynModuleDecl list * isContinuing: bool * range: range @@ -1767,6 +1785,7 @@ type SynOpenDeclTarget = type SynExceptionSig = | SynExceptionSig of exnRepr: SynExceptionDefnRepr * + withKeyword: range option * members: SynMemberSig list * range: range @@ -1781,7 +1800,7 @@ type SynModuleSigDecl = | NestedModule of moduleInfo: SynComponentInfo * isRecursive: bool * - equalsRange: Range option * + equalsRange: range option * moduleDecls: SynModuleSigDecl list * range: range @@ -1867,8 +1886,8 @@ type SynModuleOrNamespaceSig = [] type ParsedHashDirectiveArgument = - | String of value: string * stringKind: SynStringKind * range: Range - | SourceIdentifier of constant: string * value: string * range: Range + | String of value: string * stringKind: SynStringKind * range: range + | SourceIdentifier of constant: string * value: string * range: range member this.Range = match this with diff --git a/src/fsharp/SyntaxTree.fsi b/src/fsharp/SyntaxTree.fsi index 26d430f456c..36b78e38b29 100644 --- a/src/fsharp/SyntaxTree.fsi +++ b/src/fsharp/SyntaxTree.fsi @@ -155,7 +155,7 @@ type SynConst = /// Source Line, File, and Path Identifiers /// Containing both the original value as the evaluated value. - | SourceIdentifier of constant: string * value: string * range: Range + | SourceIdentifier of constant: string * value: string * range: range /// Gets the syntax range of this construct member Range: dflt: range -> range @@ -587,7 +587,7 @@ type SynExpr = | AnonRecd of isStruct: bool * copyInfo:(SynExpr * BlockSeparator) option * - recordFields:(Ident * Range option * SynExpr) list * + recordFields:(Ident * range option * SynExpr) list * range: range /// F# syntax: [ e1; ...; en ], [| e1; ...; en |] @@ -618,6 +618,7 @@ type SynExpr = | ObjExpr of objType: SynType * argOptions:(SynExpr * Ident option) option * + withKeyword: range option * bindings: SynBinding list * extraImpls: SynInterfaceImpl list * newExprRange: range * @@ -634,7 +635,7 @@ type SynExpr = | For of forDebugPoint: DebugPointAtFor * ident: Ident * - equalsRange: Range option * + equalsRange: range option * identBody: SynExpr * direction: bool * toBody: SynExpr * @@ -692,7 +693,7 @@ type SynExpr = fromMethod: bool * inLambdaSeq: bool * args: SynSimplePats * - arrow: Range option * + arrow: range option * body: SynExpr * parsedData: (SynPat list * SynExpr) option * range: range @@ -707,8 +708,10 @@ type SynExpr = /// F# syntax: match expr with pat1 -> expr | ... | patN -> exprN | Match of + matchKeyword: range * matchDebugPoint: DebugPointAtBinding * expr: SynExpr * + withKeyword: range * clauses: SynMatchClause list * range: range @@ -757,8 +760,10 @@ type SynExpr = /// F# syntax: try expr with pat -> expr | TryWith of + tryKeywordRange: range * tryExpr: SynExpr * tryRange: range * + withKeywordRange: range * withCases: SynMatchClause list * withRange: range * range: range * @@ -967,7 +972,7 @@ type SynExpr = isUse: bool * isFromSource: bool * pat: SynPat * - equalsRange: Range option * + equalsRange: range option * rhs: SynExpr * andBangs: SynExprAndBang list * body:SynExpr * @@ -975,8 +980,10 @@ type SynExpr = /// F# syntax: match! expr with pat1 -> expr | ... | patN -> exprN | MatchBang of + matchKeyword: range * matchDebugPoint: DebugPointAtBinding * expr: SynExpr * + withKeyword: range * clauses: SynMatchClause list * range: range @@ -1062,15 +1069,15 @@ type SynExprAndBang = isUse: bool * isFromSource: bool * pat: SynPat * - equalsRange: Range * + equalsRange: range * body: SynExpr * - range: Range + range: range [] type SynExprRecordField = | SynExprRecordField of fieldName: RecordFieldName * - equalsRange: Range option * + equalsRange: range option * expr: SynExpr option * blockSeparator: BlockSeparator option @@ -1166,7 +1173,7 @@ type SynArgPats = pats: SynPat list | NamePatPairs of - pats: (Ident * Range * SynPat) list * + pats: (Ident * range * SynPat) list * range: range member Patterns: SynPat list @@ -1223,6 +1230,7 @@ type SynPat = /// A long identifier pattern possibly with argument patterns | LongIdent of longDotId: LongIdentWithDots * + propertyKeyword: PropertyKeyword option * extraId: Ident option * // holds additional ident for tooling typarDecls: SynValTyparDecls option * // usually None: temporary used to parse "f<'a> x = x" argPats: SynArgPats * @@ -1248,7 +1256,7 @@ type SynPat = /// A record pattern | Record of - fieldPats: ((LongIdent * Ident) * Range * SynPat) list * + fieldPats: ((LongIdent * Ident) * range * SynPat) list * range: range /// The 'null' pattern @@ -1292,11 +1300,18 @@ type SynPat = /// Gets the syntax range of this construct member Range: range +/// Represents a used keyword for a property member +[] +type PropertyKeyword = + | With of range + | And of range + /// Represents a set of bindings that implement an interface [] type SynInterfaceImpl = | SynInterfaceImpl of interfaceTy: SynType * + withKeyword: range option * bindings: SynBinding list * range: range @@ -1306,7 +1321,7 @@ type SynMatchClause = | SynMatchClause of pat: SynPat * whenExpr: SynExpr option * - arrow: Range option * + arrow: range option * resultExpr: SynExpr * range: range * debugPoint: DebugPointAtTarget @@ -1372,7 +1387,7 @@ type SynBinding = valData: SynValData * headPat: SynPat * returnInfo: SynBindingReturnInfo option * - equalsRange: Range option * + equalsRange: range option * expr: SynExpr * range: range * debugPoint: DebugPointAtBinding @@ -1483,7 +1498,7 @@ type SynTypeDefnKind = | Union | Abbrev | Opaque - | Augmentation + | Augmentation of withKeyword: range | IL | Delegate of signature: SynType * signatureInfo: SynValInfo @@ -1552,7 +1567,7 @@ type SynEnumCase = | SynEnumCase of attributes: SynAttributes * ident: Ident * - equalsRange: Range * + equalsRange: range * value: SynConst * valueRange: range * xmlDoc: PreXmlDoc * @@ -1620,8 +1635,9 @@ type SynTypeDefnSig = /// The information for a type definition in a signature | SynTypeDefnSig of typeInfo: SynComponentInfo * - equalsRange: Range option * + equalsRange: range option * typeRepr: SynTypeDefnSigRepr * + withKeyword: range option * members: SynMemberSig list * range: range @@ -1676,6 +1692,7 @@ type SynValSig = xmlDoc: PreXmlDoc * accessibility: SynAccess option * synExpr: SynExpr option * + withKeyword: range option * range: range member RangeOfId: range @@ -1777,7 +1794,7 @@ type SynTypeDefnRepr = type SynTypeDefn = | SynTypeDefn of typeInfo: SynComponentInfo * - equalsRange: Range option * + equalsRange: range option * typeRepr: SynTypeDefnRepr * members: SynMemberDefns * implicitConstructor: SynMemberDefn option * @@ -1832,6 +1849,7 @@ type SynMemberDefn = /// An interface implementation definition within a class | Interface of interfaceType: SynType * + withKeyword: range option * members: SynMemberDefns option * range: range @@ -1862,8 +1880,9 @@ type SynMemberDefn = memberFlags:(SynMemberKind -> SynMemberFlags) * xmlDoc: PreXmlDoc * accessibility: SynAccess option * - equalsRange: Range * + equalsRange: range * synExpr: SynExpr * + withKeyword: range option * getSetRange: range option * range: range @@ -1886,7 +1905,7 @@ type SynModuleDecl = | NestedModule of moduleInfo: SynComponentInfo * isRecursive: bool * - equalsRange: Range option * + equalsRange: range option * decls: SynModuleDecl list * isContinuing: bool * range: range @@ -1953,6 +1972,7 @@ type SynOpenDeclTarget = type SynExceptionSig = | SynExceptionSig of exnRepr: SynExceptionDefnRepr * + withKeyword: range option * members: SynMemberSig list * range: range @@ -1970,7 +1990,7 @@ type SynModuleSigDecl = | NestedModule of moduleInfo: SynComponentInfo * isRecursive: bool * - equalsRange: Range option * + equalsRange: range option * moduleDecls: SynModuleSigDecl list * range: range @@ -2059,8 +2079,8 @@ type SynModuleOrNamespaceSig = /// Represents a parsed hash directive argument [] type ParsedHashDirectiveArgument = - | String of value: string * stringKind: SynStringKind * range: Range - | SourceIdentifier of constant: string * value: string * range: Range + | String of value: string * stringKind: SynStringKind * range: range + | SourceIdentifier of constant: string * value: string * range: range /// Gets the syntax range of this construct member Range: range diff --git a/src/fsharp/SyntaxTreeOps.fs b/src/fsharp/SyntaxTreeOps.fs index d5802d7226d..10340e8b374 100644 --- a/src/fsharp/SyntaxTreeOps.fs +++ b/src/fsharp/SyntaxTreeOps.fs @@ -97,12 +97,12 @@ let mkSynPatVar vis (id: Ident) = SynPat.Named (id, false, vis, id.idRange) let mkSynThisPatVar (id: Ident) = SynPat.Named (id, true, None, id.idRange) -let mkSynPatMaybeVar lidwd vis m = SynPat.LongIdent (lidwd, None, None, SynArgPats.Pats [], vis, m) +let mkSynPatMaybeVar lidwd vis m = SynPat.LongIdent (lidwd, None, None, None, SynArgPats.Pats [], vis, m) /// Extract the argument for patterns corresponding to the declaration of 'new ... = ...' let (|SynPatForConstructorDecl|_|) x = match x with - | SynPat.LongIdent (LongIdentWithDots([_], _), _, _, SynArgPats.Pats [arg], _, _) -> Some arg + | SynPat.LongIdent (longDotId=LongIdentWithDots([_], _); argPats=SynArgPats.Pats [arg]) -> Some arg | _ -> None /// Recognize the '()' in 'new()' @@ -156,7 +156,7 @@ let rec SimplePatOfPat (synArgNameGenerator: SynArgNameGenerator) p = let m = p.Range let isCompGen, altNameRefCell, id, item = match p with - | SynPat.LongIdent(LongIdentWithDots([id], _), _, None, SynArgPats.Pats [], None, _) -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _); typarDecls=None; argPats=SynArgPats.Pats []; accessibility=None) -> // The pattern is 'V' or some other capitalized identifier. // It may be a real variable, in which case we want to maintain its name. // But it may also be a nullary union case or some other identifier. @@ -181,7 +181,7 @@ let rec SimplePatOfPat (synArgNameGenerator: SynArgNameGenerator) p = Some (fun e -> let clause = SynMatchClause(p, None, None, e, m, DebugPointAtTarget.No) let artificialMatchRange = (unionRanges m e.Range).MakeSynthetic() - SynExpr.Match (DebugPointAtBinding.NoneAtInvisible, item, [clause], artificialMatchRange)) + SynExpr.Match (artificialMatchRange, DebugPointAtBinding.NoneAtInvisible, item, artificialMatchRange, [clause], artificialMatchRange)) SynSimplePat.Id (id, altNameRefCell, isCompGen, false, false, id.idRange), fn @@ -530,12 +530,12 @@ module SynInfo = let infosForExplicitArgs = match pat with - | Some(SynPat.LongIdent(_, _, _, SynArgPats.Pats curriedArgs, _, _)) -> List.map InferSynArgInfoFromPat curriedArgs + | Some(SynPat.LongIdent(argPats=SynArgPats.Pats curriedArgs)) -> List.map InferSynArgInfoFromPat curriedArgs | _ -> [] let explicitArgsAreSimple = match pat with - | Some(SynPat.LongIdent(_, _, _, SynArgPats.Pats curriedArgs, _, _)) -> List.forall isSimplePattern curriedArgs + | Some(SynPat.LongIdent(argPats=SynArgPats.Pats curriedArgs)) -> List.forall isSimplePattern curriedArgs | _ -> true let retInfo = InferSynReturnData retInfo @@ -691,8 +691,8 @@ let rec synExprContainsError inpExpr = let flds = fs |> List.choose (fun (SynExprRecordField(expr=v)) -> v) walkExprs flds - | SynExpr.ObjExpr (_, _, bs, is, _, _) -> - walkBinds bs || walkBinds [ for SynInterfaceImpl(_, bs, _) in is do yield! bs ] + | SynExpr.ObjExpr (bindings=bs; extraImpls=is) -> + walkBinds bs || walkBinds [ for SynInterfaceImpl(bindings=bs) in is do yield! bs ] | SynExpr.ForEach (_, _, _, _, e1, e2, _) | SynExpr.While (_, e1, e2, _) -> @@ -707,13 +707,13 @@ let rec synExprContainsError inpExpr = | SynExpr.Lambda (body = e) -> walkExpr e - | SynExpr.Match (_, e, cl, _) -> + | SynExpr.Match (expr=e; clauses=cl) -> walkExpr e || walkMatchClauses cl | SynExpr.LetOrUse (_, _, bs, e, _) -> walkBinds bs || walkExpr e - | SynExpr.TryWith (e, _, cl, _, _, _, _) -> + | SynExpr.TryWith (tryExpr=e; withCases=cl) -> walkExpr e || walkMatchClauses cl | SynExpr.TryFinally (e1, e2, _, _, _) -> @@ -744,7 +744,7 @@ let rec synExprContainsError inpExpr = | SynExpr.DotNamedIndexedPropertySet (e1, _, e2, e3, _) -> walkExpr e1 || walkExpr e2 || walkExpr e3 - | SynExpr.MatchBang (_, e, cl, _) -> + | SynExpr.MatchBang (expr=e; clauses=cl) -> walkExpr e || walkMatchClauses cl | SynExpr.LetOrUseBang (rhs=e1;body=e2;andBangs=es) -> diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 19d0e6b82a6..f9b5444a58d 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -175,7 +175,7 @@ let idOfPat (parseState:IParseState) m p = | SynPat.Wild r when parseState.LexBuffer.SupportsFeature LanguageFeature.WildCardInForLoop -> mkSynId r "_" | SynPat.Named (id, false, _, _) -> id - | SynPat.LongIdent(LongIdentWithDots([id], _), _, None, SynArgPats.Pats [], None, _) -> id + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _); typarDecls=None; argPats=SynArgPats.Pats []; accessibility=None) -> id | _ -> raiseParseErrorAt m (FSComp.SR.parsIntegerForLoopRequiresSimpleIdentifier()) let checkForMultipleAugmentations m a1 a2 = @@ -327,7 +327,7 @@ let rangeOfLongIdent(lid:LongIdent) = %type atomicExpr %type tyconDefnOrSpfnSimpleRepr %type list> unionTypeRepr -%type tyconDefnAugmentation +%type tyconDefnAugmentation %type exconDefn %type exconCore %type moduleDefnsOrExprPossiblyEmptyOrBlock @@ -812,22 +812,22 @@ moduleSpfn: | opt_attributes opt_declVisibility typeKeyword tyconSpfn tyconSpfnList { if Option.isSome $2 then errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) - let (SynTypeDefnSig (SynComponentInfo (cas, a, cs, b, _xmlDoc, d, d2, d3), equalsRange, typeRepr, members, range)) = $4 + let (SynTypeDefnSig (SynComponentInfo (cas, a, cs, b, _xmlDoc, d, d2, d3), equalsRange, typeRepr, withKeyword, members, range)) = $4 _xmlDoc.MarkAsInvalid() let attrs = $1 @ cas let mTc = let keywordM = rhs parseState 3 (keywordM, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) |> unionRanges range let xmlDoc = grabXmlDoc(parseState, $1, 1) - let tc = (SynTypeDefnSig(SynComponentInfo(attrs, a, cs, b, xmlDoc, d, d2, d3), equalsRange, typeRepr, members, mTc)) + let tc = (SynTypeDefnSig(SynComponentInfo(attrs, a, cs, b, xmlDoc, d, d2, d3), equalsRange, typeRepr, withKeyword, members, mTc)) let m = (mTc, $5) ||> unionRangeWithListBy (fun (a: SynTypeDefnSig) -> a.Range) SynModuleSigDecl.Types (tc :: $5, m) } | opt_attributes opt_declVisibility exconSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) - let (SynExceptionSig(SynExceptionDefnRepr(cas, a, b, c, d, d2), e, f)) = $3 + let (SynExceptionSig(SynExceptionDefnRepr(cas, a, b, c, d, d2), withKeyword, members, range)) = $3 let xmlDoc = grabXmlDoc(parseState, $1, 1) - let ec = SynExceptionSig(SynExceptionDefnRepr($1@cas, a, b, xmlDoc, d, d2), e, f) + let ec = SynExceptionSig(SynExceptionDefnRepr($1@cas, a, b, xmlDoc, d, d2), withKeyword, members, range) SynModuleSigDecl.Exception(ec, rhs parseState 3) } | openDecl @@ -839,7 +839,7 @@ valSpfn: let attr1, attr2, isInline, isMutable, vis2, id, doc, explicitValTyparDecls, (ty, arity), konst = ($1), ($4), ($5), ($6), ($7), ($8), grabXmlDoc(parseState, $1, 1), ($9), ($11), ($12) if not (isNil attr2) then errorR(Deprecated(FSComp.SR.parsAttributesMustComeBeforeVal(), rhs parseState 4)) let m = rhs2 parseState 1 11 - let valSpfn = SynValSig((attr1@attr2), id, explicitValTyparDecls, ty, arity, isInline, isMutable, doc, vis2, konst, m) + let valSpfn = SynValSig((attr1@attr2), id, explicitValTyparDecls, ty, arity, isInline, isMutable, doc, vis2, konst, None, m) SynModuleSigDecl.Val(valSpfn, m) } @@ -876,9 +876,9 @@ tyconSpfnList: { let xmlDoc = grabXmlDoc(parseState, [], 1) let tyconSpfn = if xmlDoc.IsEmpty then $2 else - let (SynTypeDefnSig(SynComponentInfo (a, typars, c, lid, _xmlDoc, fixity, vis, rangeOfLid), equalsRange, typeRepr, members, range)) = $2 + let (SynTypeDefnSig(SynComponentInfo (a, typars, c, lid, _xmlDoc, fixity, vis, rangeOfLid), equalsRange, typeRepr, withKeyword, members, range)) = $2 _xmlDoc.MarkAsInvalid() - SynTypeDefnSig(SynComponentInfo (a, typars, c, lid, xmlDoc, fixity, vis, rangeOfLid), equalsRange, typeRepr, members, range) + SynTypeDefnSig(SynComponentInfo (a, typars, c, lid, xmlDoc, fixity, vis, rangeOfLid), equalsRange, typeRepr, withKeyword, members, range) tyconSpfn :: $3 } | @@ -892,7 +892,8 @@ tyconSpfn: let mEquals = rhs parseState 2 $3 lhsm $1 (Some mEquals) } | typeNameInfo opt_classSpfn - { SynTypeDefnSig($1, None, SynTypeDefnSigRepr.Simple (SynTypeDefnSimpleRepr.None (lhs parseState), lhs parseState), $2, lhs parseState) } + { let mWithKwd, members = $2 + SynTypeDefnSig($1, None, SynTypeDefnSigRepr.Simple (SynTypeDefnSimpleRepr.None (lhs parseState), lhs parseState), mWithKwd, members, lhs parseState) } /* The right-hand-side of a type definition in a signature */ @@ -908,12 +909,14 @@ tyconSpfnRhsBlock: | OBLOCKBEGIN tyconSpfnRhs opt_OBLOCKSEP classSpfnMembers opt_classSpfn oblockend opt_classSpfn { let m = lhs parseState (fun lhsm nameInfo mEquals -> - $2 lhsm nameInfo mEquals (checkForMultipleAugmentations m ($4 @ $5) $7)) } + let members = $4 @ (snd $5) + $2 lhsm nameInfo mEquals (checkForMultipleAugmentations m members (snd $7))) } | tyconSpfnRhs opt_classSpfn { let m = lhs parseState - (fun lhsm nameInfo mEquals -> - $1 lhsm nameInfo mEquals $2) } + (fun lhsm nameInfo mEquals -> + let _, members = $2 + $1 lhsm nameInfo mEquals members) } /* The right-hand-side of a type definition in a signature */ @@ -922,7 +925,7 @@ tyconSpfnRhs: { (fun lhsm nameInfo mEquals augmentation -> let declRange = unionRanges lhsm $1.Range let mWhole = (declRange, augmentation) ||> unionRangeWithListBy (fun (mem: SynMemberSig) -> mem.Range) - SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.Simple ($1, $1.Range), augmentation, mWhole)) } + SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.Simple ($1, $1.Range), None, augmentation, mWhole)) } | tyconClassSpfn { let objectModelRange = lhs parseState @@ -933,16 +936,16 @@ tyconSpfnRhs: let declRange = unionRanges nameRange objectModelRange let mWhole = (declRange, augmentation) ||> unionRangeWithListBy (fun (mem: SynMemberSig) -> mem.Range) - SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.ObjectModel (kind, decls, objectModelRange), augmentation, mWhole)) } + SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.ObjectModel (kind, decls, objectModelRange), None, augmentation, mWhole)) } | DELEGATE OF topType { let m = lhs parseState let ty, arity = $3 - let invoke = SynMemberSig.Member(SynValSig([], mkSynId m "Invoke", inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, m), AbstractMemberFlags SynMemberKind.Member, m) + let invoke = SynMemberSig.Member(SynValSig([], mkSynId m "Invoke", inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, None, m), AbstractMemberFlags SynMemberKind.Member, m) (fun nameRange nameInfo mEquals augmentation -> if not (isNil augmentation) then raiseParseErrorAt m (FSComp.SR.parsAugmentationsIllegalOnDelegateType()) let mWhole = unionRanges nameRange m - SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.ObjectModel (SynTypeDefnKind.Delegate (ty, arity), [invoke], m), [], mWhole)) } + SynTypeDefnSig(nameInfo, mEquals, SynTypeDefnSigRepr.ObjectModel (SynTypeDefnKind.Delegate (ty, arity), [invoke], m), None, [], mWhole)) } /* The right-hand-side of an object type definition in a signature */ @@ -1011,7 +1014,7 @@ classMemberSpfn: | opt_attributes opt_declVisibility memberSpecFlags opt_inline opt_access nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet optLiteralValueSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) let isInline, doc, vis2, id, explicitValTyparDecls, (ty, arity), optLiteralValue = $4, grabXmlDoc(parseState, $1, 1), $5, $6, $7, $9, $11 - let getSetRangeOpt, getSet = $10 + let mWith, getSetRangeOpt, getSet = $10 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet let wholeRange = let m = rhs parseState 3 @@ -1019,7 +1022,7 @@ classMemberSpfn: | None -> unionRanges m ty.Range | Some m2 -> unionRanges m m2 |> fun m -> (m, $1) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, optLiteralValue, wholeRange) + let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, optLiteralValue, mWith, wholeRange) let _, flags = $3 SynMemberSig.Member(valSpfn, flags (getSetAdjuster arity), wholeRange) } @@ -1050,24 +1053,27 @@ classMemberSpfn: { let vis, doc, (ty, valSynInfo) = $2, grabXmlDoc(parseState, $1, 1), $5 let m = unionRanges (rhs parseState 1) ty.Range let isInline = false - let valSpfn = SynValSig ($1, mkSynId (rhs parseState 3) "new", noInferredTypars, ty, valSynInfo, isInline, false, doc, vis, None, m) + let valSpfn = SynValSig ($1, mkSynId (rhs parseState 3) "new", noInferredTypars, ty, valSynInfo, isInline, false, doc, vis, None, None, m) SynMemberSig.Member(valSpfn, CtorMemberFlags, m) } /* The optional "with get, set" on a member in a signature */ classMemberSpfnGetSet: | /* EMPTY */ - { None, SynMemberKind.Member } + { None, None, SynMemberKind.Member } | WITH classMemberSpfnGetSetElements - { Some (rhs2 parseState 1 2), $2 } + { let mWith = rhs parseState 1 + Some mWith, Some (rhs2 parseState 1 2), $2 } | OWITH classMemberSpfnGetSetElements OEND - { Some (rhs2 parseState 1 2), $2 } + { let mWith = rhs parseState 1 + Some mWith, Some (rhs2 parseState 1 2), $2 } | OWITH classMemberSpfnGetSetElements error - { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedWith()) - Some (rhs2 parseState 1 2), $2 } + { let mWith = rhs parseState 1 + reportParseErrorAt mWith (FSComp.SR.parsUnmatchedWith()) + Some mWith, Some (rhs2 parseState 1 2), $2 } /* The "get, set" on a property member in a signature */ @@ -1094,16 +1100,18 @@ memberSpecFlags: /* Part of an exception definition in a signature file */ exconSpfn: | exconCore opt_classSpfn - { SynExceptionSig($1, $2, lhs parseState) } + { let mWithKwd, members = $2 + SynExceptionSig($1, mWithKwd, members, lhs parseState) } /* The optional augmentation on a type definition in a signature */ opt_classSpfn: | WITH classSpfnBlock declEnd - { $2 } + { let mWithKwd = rhs parseState 1 + (Some mWithKwd), $2 } | /* EMPTY */ - { [] } + { None, [] } /*--------------------------------------------------------------------------*/ @@ -1431,7 +1439,8 @@ wrappedNamedModuleDefn: tyconDefnAugmentation: | WITH classDefnBlock declEnd - { $2 } + { let mWithKwd = rhs parseState 1 + mWithKwd, $2 } /* An optional list of custom attributes */ @@ -1558,8 +1567,9 @@ tyconDefn: SynTypeDefn($1, $2, tcDefRepr, members, None, mWhole) } | typeNameInfo tyconDefnAugmentation - { let m = (rhs parseState 1, $2) ||> unionRangeWithListBy (fun mem -> mem.Range) - SynTypeDefn($1, None, SynTypeDefnRepr.ObjectModel(SynTypeDefnKind.Augmentation, [], m), $2, None, m) } + { let mWithKwd, classDefns = $2 + let m = (rhs parseState 1, classDefns) ||> unionRangeWithListBy (fun mem -> mem.Range) + SynTypeDefn($1, None, SynTypeDefnRepr.ObjectModel(SynTypeDefnKind.Augmentation mWithKwd, [], m), classDefns, None, m) } | typeNameInfo opt_attributes opt_declVisibility opt_HIGH_PRECEDENCE_APP simplePatterns optAsSpec EQUALS tyconDefnRhsBlock { let vis, spats, az = $3, $5, $6 @@ -1628,7 +1638,7 @@ tyconDefnRhs: { let m = lhs parseState let ty, arity = $3 (fun nameRange augmentation -> - let valSpfn = SynValSig([], mkSynId m "Invoke", inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, m) + let valSpfn = SynValSig([], mkSynId m "Invoke", inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, None, m) let invoke = SynMemberDefn.AbstractSlot(valSpfn, AbstractMemberFlags SynMemberKind.Member, m) if not (isNil augmentation) then raiseParseErrorAt m (FSComp.SR.parsAugmentationsIllegalOnDelegateType()) SynTypeDefnRepr.ObjectModel (SynTypeDefnKind.Delegate (ty, arity), [invoke], m), []) } @@ -1701,7 +1711,7 @@ classDefnMembers: classDefnMembersAtLeastOne: | classDefnMember opt_seps classDefnMembers { match $1, $3 with - | [ SynMemberDefn.Interface (_, Some [], m) ], nextMember :: _ -> + | [ SynMemberDefn.Interface (members=Some []; range=m) ], nextMember :: _ -> warning(IndentationProblem(FSComp.SR.lexfltTokenIsOffsideOfContextStartedEarlier(warningStringOfPos m.Start), nextMember.Range)) | _ -> () $1 @ $3 } @@ -1710,14 +1720,17 @@ classDefnMembersAtLeastOne: /* The "with get, set" part of a member definition */ classDefnMemberGetSet: | WITH classDefnMemberGetSetElements - { $2 } + { let mWithKwd = rhs parseState 1 + mWithKwd, $2 } | OWITH classDefnMemberGetSetElements OEND - { $2 } + { let mWithKwd = rhs parseState 1 + mWithKwd, $2 } | OWITH classDefnMemberGetSetElements error - { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedWith()) - $2 } + { let mWithKwd = rhs parseState 1 + reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedWith()) + mWithKwd, $2 } /* The "get, set" part of a member definition */ classDefnMemberGetSetElements: @@ -1751,7 +1764,8 @@ memberCore: /* Properties with explicit get/set, also indexer properties */ | opt_inline bindingPattern opt_topReturnTypeWithTypeConstraints classDefnMemberGetSet - { let mWhole = (rhs parseState 2, $4) ||> unionRangeWithListBy (fun (_, _, _, _, _, _, m2) -> m2) + { let mWith, classDefnMemberGetSetElements = $4 + let mWhole = (rhs parseState 2, classDefnMemberGetSetElements) ||> unionRangeWithListBy (fun (_, _, _, _, _, _, m2) -> m2) let propertyNameBindingBuilder, _ = $2 let optPropertyType = $3 let isMutable = false @@ -1759,182 +1773,188 @@ memberCore: let mutable hasGet = false let mutable hasSet = false let xmlDoc = grabXmlDocAtRangeStart(parseState, attrs, rangeStart) + + let tryMkSynMemberDefnMember + (withPropertyKeyword: PropertyKeyword option) + (optInline, (optAttrs: SynAttributeList list), (bindingBuilder, mBindLhs), optReturnType, mEquals, expr, exprm) + = + let optInline = $1 || optInline + // optional attributes are only applied to getters and setters + // the "top level" attrs will be applied to both + let optAttrs = + optAttrs |> List.map (fun attrList -> + { attrList with Attributes = attrList.Attributes |> List.map (fun a -> { a with AppliesToGetterAndSetter = true } ) }) + + let attrs = attrs @ optAttrs + + let binding = (bindingBuilder xmlDoc) (visNoLongerUsed, optInline, isMutable, mBindLhs, DebugPointAtBinding.NoneAtInvisible, optReturnType, None, expr, exprm, [], attrs, Some (memFlagsBuilder SynMemberKind.Member)) + let (SynBinding (vis, _, isInline, _, attrs, doc, valSynData, pv, _, _, _, mBindLhs, spBind)) = binding + let memberKind = + let getset = + let rec go p = + match p with + | SynPat.LongIdent (longDotId=LongIdentWithDots([id], _)) -> id.idText + | SynPat.Named (nm, _, _, _) | SynPat.As (_, SynPat.Named (nm, _, _, _), _) -> nm.idText + | SynPat.Typed (p, _, _) -> go p + | SynPat.Attrib (p, _, _) -> go p + | _ -> raiseParseErrorAt mBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) + go pv + if getset = "get" then + if hasGet then + reportParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) + None + else + hasGet <- true + Some SynMemberKind.PropertyGet + else if getset = "set" then + if hasSet then + reportParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) + None + else + hasSet <- true + Some SynMemberKind.PropertySet + else + raiseParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) + + match memberKind with + | None -> None + | Some memberKind -> + + // REVIEW: It's hard not to ignore the optPropertyType type annotation for 'set' properties. To apply it, + // we should apply it to the last argument, but at this point we've already pushed the patterns that + // make up the arguments onto the RHS. So we just always give a warning. + + begin match optPropertyType with + | Some _ -> errorR(Error(FSComp.SR.parsTypeAnnotationsOnGetSet(), mBindLhs)) + | None -> () + end + + let optReturnType = + match (memberKind, optReturnType) with + | SynMemberKind.PropertySet, _ -> optReturnType + | _, None -> optPropertyType + | _ -> optReturnType + + // REDO with the correct member kind + let binding = (bindingBuilder PreXmlDoc.Empty) (vis, isInline, isMutable, mBindLhs, DebugPointAtBinding.NoneAtInvisible, optReturnType, mEquals, expr, exprm, [], attrs, Some(memFlagsBuilder memberKind)) + + let (SynBinding (vis, _, isInline, _, attrs, doc, valSynData, pv, rhsRetInfo, mEquals, rhsExpr, mBindLhs, spBind)) = binding + let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) + + let (SynValData(_, valSynInfo, _)) = valSynData + + // Setters have all arguments tupled in their internal TAST form, though they don't appear to be + // tupled from the syntax + let memFlags : SynMemberFlags = memFlagsBuilder memberKind + + let valSynInfo = + let adjustValueArg valueArg = + match valueArg with + | [_] -> valueArg + | _ -> SynInfo.unnamedTopArg + + match memberKind, valSynInfo, memFlags.IsInstance with + | SynMemberKind.PropertyGet, SynValInfo ([], _ret), false + | SynMemberKind.PropertyGet, SynValInfo ([_], _ret), true -> + raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterMustHaveAtLeastOneArgument()) + + | SynMemberKind.PropertyGet, SynValInfo (thisArg :: indexOrUnitArgs :: rest, ret), true -> + if not rest.IsEmpty then + reportParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) + SynValInfo ([thisArg; indexOrUnitArgs], ret) + + | SynMemberKind.PropertyGet, SynValInfo (indexOrUnitArgs :: rest, ret), false -> + if not rest.IsEmpty then + reportParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) + SynValInfo ([indexOrUnitArgs], ret) + + | SynMemberKind.PropertySet, SynValInfo ([thisArg;valueArg], ret), true -> + SynValInfo ([thisArg; adjustValueArg valueArg], ret) + + | SynMemberKind.PropertySet, SynValInfo (thisArg :: indexArgs :: valueArg :: rest, ret), true -> + if not rest.IsEmpty then + reportParseErrorAt mWholeBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) + SynValInfo ([thisArg; indexArgs @ adjustValueArg valueArg], ret) + + | SynMemberKind.PropertySet, SynValInfo ([valueArg], ret), false -> + SynValInfo ([adjustValueArg valueArg], ret) + + | SynMemberKind.PropertySet, SynValInfo (indexArgs :: valueArg :: rest, ret), _ -> + if not rest.IsEmpty then + reportParseErrorAt mWholeBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) + SynValInfo ([indexArgs @ adjustValueArg valueArg], ret) + + | _ -> + // should be unreachable, cover just in case + raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidProperty ()) + + let valSynData = SynValData(Some(memFlags), valSynInfo, None) + + // Fold together the information from the first lambda pattern and the get/set binding + // This uses the 'this' variable from the first and the patterns for the get/set binding, + // replacing the get/set identifier. A little gross. + + let bindingPatAdjusted, xmlDocAdjusted = + + let bindingOuter = (propertyNameBindingBuilder xmlDoc) (vis, optInline, isMutable, mWholeBindLhs, spBind, optReturnType, mEquals, expr, exprm, [], attrs, Some(memFlagsBuilder SynMemberKind.Member)) + + let (SynBinding (_, _, _, _, _, doc2, _, bindingPatOuter, _, _, _, _, _)) = bindingOuter + + let lidOuter, lidVisOuter = + match bindingPatOuter with + | SynPat.LongIdent (lid, _, None, None, SynArgPats.Pats [], lidVisOuter, m) -> lid, lidVisOuter + | SynPat.Named (id, _, visOuter, m) | SynPat.As(_, SynPat.Named (id, _, visOuter, m), _) -> LongIdentWithDots([id], []), visOuter + | p -> raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) + + // Merge the visibility from the outer point with the inner point, e.g. + // member this.Size with get () = m_size + + let mergeLidVisOuter lidVisInner = + match lidVisInner, lidVisOuter with + | None, None -> None + | Some lidVisInner, None | None, Some lidVisInner -> Some lidVisInner + | Some _, Some _ -> + errorR(Error(FSComp.SR.parsMultipleAccessibilitiesForGetSet(), mWholeBindLhs)) + lidVisInner + + // Replace the "get" or the "set" with the right name + let rec go p = + match p with + | SynPat.LongIdent (longDotId=LongIdentWithDots([id], _); typarDecls=tyargs; argPats=SynArgPats.Pats args; accessibility=lidVisInner; range=m) -> + // Setters have all arguments tupled in their internal form, though they don't + // appear to be tupled from the syntax. Somewhat unfortunate + let args = + if id.idText = "set" then + match args with + | [SynPat.Paren(SynPat.Tuple (false, indexPats, _), indexPatRange);valuePat] when id.idText = "set" -> + [SynPat.Tuple(false, indexPats@[valuePat], unionRanges indexPatRange valuePat.Range)] + | [indexPat;valuePat] -> + [SynPat.Tuple(false, args, unionRanges indexPat.Range valuePat.Range)] + | [valuePat] -> + [valuePat] + | _ -> + raiseParseErrorAt m (FSComp.SR.parsSetSyntax()) + else + args + SynPat.LongIdent (lidOuter, withPropertyKeyword, Some(id), tyargs, SynArgPats.Pats args, mergeLidVisOuter lidVisInner, m) + | SynPat.Named (nm, _, lidVisInner, m) + | SynPat.As (_, SynPat.Named (nm, _, lidVisInner, m), _) -> SynPat.LongIdent (lidOuter, None, None, None, SynArgPats.Pats [], mergeLidVisOuter lidVisInner, m) + | SynPat.Typed (p, ty, m) -> SynPat.Typed(go p, ty, m) + | SynPat.Attrib (p, attribs, m) -> SynPat.Attrib(go p, attribs, m) + | SynPat.Wild(m) -> SynPat.Wild(m) + | _ -> raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) + + go pv, PreXmlDoc.Merge doc2 doc + + let binding = SynBinding (vis, SynBindingKind.Normal, isInline, isMutable, attrs, xmlDocAdjusted, valSynData, bindingPatAdjusted, rhsRetInfo, mEquals, rhsExpr, mWholeBindLhs, spBind) + let memberRange = unionRanges rangeStart mWhole + Some (SynMemberDefn.Member (binding, memberRange)) // Iterate over 1 or 2 'get'/'set' entries - $4 |> List.choose (fun (optInline, optAttrs, (bindingBuilder, mBindLhs), optReturnType, mEquals, expr, exprm) -> - - let optInline = $1 || optInline - // optional attributes are only applied to getters and setters - // the "top level" attrs will be applied to both - let optAttrs = - optAttrs |> List.map (fun attrList -> - { attrList with Attributes = attrList.Attributes |> List.map (fun a -> { a with AppliesToGetterAndSetter = true } ) }) - - let attrs = attrs @ optAttrs - - let binding = (bindingBuilder xmlDoc) (visNoLongerUsed, optInline, isMutable, mBindLhs, DebugPointAtBinding.NoneAtInvisible, optReturnType, None, expr, exprm, [], attrs, Some (memFlagsBuilder SynMemberKind.Member)) - let (SynBinding (vis, _, isInline, _, attrs, doc, valSynData, pv, _, _, _, mBindLhs, spBind)) = binding - let memberKind = - let getset = - let rec go p = - match p with - | SynPat.LongIdent (LongIdentWithDots([id], _), _, _, _, _, _) -> id.idText - | SynPat.Named (nm, _, _, _) | SynPat.As (_, SynPat.Named (nm, _, _, _), _) -> nm.idText - | SynPat.Typed (p, _, _) -> go p - | SynPat.Attrib (p, _, _) -> go p - | _ -> raiseParseErrorAt mBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) - go pv - if getset = "get" then - if hasGet then - reportParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) - None - else - hasGet <- true - Some SynMemberKind.PropertyGet - else if getset = "set" then - if hasSet then - reportParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) - None - else - hasSet <- true - Some SynMemberKind.PropertySet - else - raiseParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) - - match memberKind with - | None -> None - | Some memberKind -> - - // REVIEW: It's hard not to ignore the optPropertyType type annotation for 'set' properties. To apply it, - // we should apply it to the last argument, but at this point we've already pushed the patterns that - // make up the arguments onto the RHS. So we just always give a warning. - - begin match optPropertyType with - | Some _ -> errorR(Error(FSComp.SR.parsTypeAnnotationsOnGetSet(), mBindLhs)) - | None -> () - end - - let optReturnType = - match (memberKind, optReturnType) with - | SynMemberKind.PropertySet, _ -> optReturnType - | _, None -> optPropertyType - | _ -> optReturnType - - // REDO with the correct member kind - let binding = (bindingBuilder PreXmlDoc.Empty) (vis, isInline, isMutable, mBindLhs, DebugPointAtBinding.NoneAtInvisible, optReturnType, mEquals, expr, exprm, [], attrs, Some(memFlagsBuilder memberKind)) - - let (SynBinding (vis, _, isInline, _, attrs, doc, valSynData, pv, rhsRetInfo, mEquals, rhsExpr, mBindLhs, spBind)) = binding - let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) - - let (SynValData(_, valSynInfo, _)) = valSynData - - // Setters have all arguments tupled in their internal TAST form, though they don't appear to be - // tupled from the syntax - let memFlags : SynMemberFlags = memFlagsBuilder memberKind - - let valSynInfo = - let adjustValueArg valueArg = - match valueArg with - | [_] -> valueArg - | _ -> SynInfo.unnamedTopArg - - match memberKind, valSynInfo, memFlags.IsInstance with - | SynMemberKind.PropertyGet, SynValInfo ([], _ret), false - | SynMemberKind.PropertyGet, SynValInfo ([_], _ret), true -> - raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterMustHaveAtLeastOneArgument()) - - | SynMemberKind.PropertyGet, SynValInfo (thisArg :: indexOrUnitArgs :: rest, ret), true -> - if not rest.IsEmpty then - reportParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) - SynValInfo ([thisArg; indexOrUnitArgs], ret) - - | SynMemberKind.PropertyGet, SynValInfo (indexOrUnitArgs :: rest, ret), false -> - if not rest.IsEmpty then - reportParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) - SynValInfo ([indexOrUnitArgs], ret) - - | SynMemberKind.PropertySet, SynValInfo ([thisArg;valueArg], ret), true -> - SynValInfo ([thisArg; adjustValueArg valueArg], ret) - - | SynMemberKind.PropertySet, SynValInfo (thisArg :: indexArgs :: valueArg :: rest, ret), true -> - if not rest.IsEmpty then - reportParseErrorAt mWholeBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) - SynValInfo ([thisArg; indexArgs @ adjustValueArg valueArg], ret) - - | SynMemberKind.PropertySet, SynValInfo ([valueArg], ret), false -> - SynValInfo ([adjustValueArg valueArg], ret) - - | SynMemberKind.PropertySet, SynValInfo (indexArgs :: valueArg :: rest, ret), _ -> - if not rest.IsEmpty then - reportParseErrorAt mWholeBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) - SynValInfo ([indexArgs @ adjustValueArg valueArg], ret) - - | _ -> - // should be unreachable, cover just in case - raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidProperty ()) - - let valSynData = SynValData(Some(memFlags), valSynInfo, None) - - // Fold together the information from the first lambda pattern and the get/set binding - // This uses the 'this' variable from the first and the patterns for the get/set binding, - // replacing the get/set identifier. A little gross. - - let bindingPatAdjusted, xmlDocAdjusted = - - let bindingOuter = (propertyNameBindingBuilder xmlDoc) (vis, optInline, isMutable, mWholeBindLhs, spBind, optReturnType, mEquals, expr, exprm, [], attrs, Some(memFlagsBuilder SynMemberKind.Member)) - - let (SynBinding (_, _, _, _, _, doc2, _, bindingPatOuter, _, _, _, _, _)) = bindingOuter - - let lidOuter, lidVisOuter = - match bindingPatOuter with - | SynPat.LongIdent (lid, None, None, SynArgPats.Pats [], lidVisOuter, m) -> lid, lidVisOuter - | SynPat.Named (id, _, visOuter, m) | SynPat.As(_, SynPat.Named (id, _, visOuter, m), _) -> LongIdentWithDots([id], []), visOuter - | p -> raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) - - // Merge the visibility from the outer point with the inner point, e.g. - // member this.Size with get () = m_size - - let mergeLidVisOuter lidVisInner = - match lidVisInner, lidVisOuter with - | None, None -> None - | Some lidVisInner, None | None, Some lidVisInner -> Some lidVisInner - | Some _, Some _ -> - errorR(Error(FSComp.SR.parsMultipleAccessibilitiesForGetSet(), mWholeBindLhs)) - lidVisInner - - // Replace the "get" or the "set" with the right name - let rec go p = - match p with - | SynPat.LongIdent (LongIdentWithDots([id], _), _, tyargs, SynArgPats.Pats args, lidVisInner, m) -> - // Setters have all arguments tupled in their internal form, though they don't - // appear to be tupled from the syntax. Somewhat unfortunate - let args = - if id.idText = "set" then - match args with - | [SynPat.Paren(SynPat.Tuple (false, indexPats, _), indexPatRange);valuePat] when id.idText = "set" -> - [SynPat.Tuple(false, indexPats@[valuePat], unionRanges indexPatRange valuePat.Range)] - | [indexPat;valuePat] -> - [SynPat.Tuple(false, args, unionRanges indexPat.Range valuePat.Range)] - | [valuePat] -> - [valuePat] - | _ -> - raiseParseErrorAt m (FSComp.SR.parsSetSyntax()) - else - args -// let idTool : Ident list = lidOuter |> List.map (fun (li:Ident) -> ident(li.idText, id.idRange)) |> List.rev |> List.take 1 - SynPat.LongIdent (lidOuter, Some(id), tyargs, SynArgPats.Pats args, mergeLidVisOuter lidVisInner, m) - | SynPat.Named (nm, _, lidVisInner, m) - | SynPat.As (_, SynPat.Named (nm, _, lidVisInner, m), _) -> SynPat.LongIdent (lidOuter, None, None, SynArgPats.Pats [], mergeLidVisOuter lidVisInner, m) - | SynPat.Typed (p, ty, m) -> SynPat.Typed(go p, ty, m) - | SynPat.Attrib (p, attribs, m) -> SynPat.Attrib(go p, attribs, m) - | SynPat.Wild(m) -> SynPat.Wild(m) - | _ -> raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) - - go pv, PreXmlDoc.Merge doc2 doc - - let binding = SynBinding (vis, SynBindingKind.Normal, isInline, isMutable, attrs, xmlDocAdjusted, valSynData, bindingPatAdjusted, rhsRetInfo, mEquals, rhsExpr, mWholeBindLhs, spBind) - let memberRange = unionRanges rangeStart mWhole - Some (SynMemberDefn.Member (binding, memberRange)))) + match classDefnMemberGetSetElements with + | [ h ] -> List.choose id [ tryMkSynMemberDefnMember (Some (PropertyKeyword.With mWith)) h ] + | [ g ; s ] -> List.choose id [ tryMkSynMemberDefnMember (Some (PropertyKeyword.With mWith)) g ; tryMkSynMemberDefnMember None s ] + | _ -> []) } @@ -1963,17 +1983,16 @@ classDefnMember: | opt_attributes opt_declVisibility interfaceMember appType opt_interfaceImplDefn { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesAreNotPermittedOnInterfaceImplementations(), rhs parseState 1)) if Option.isSome $2 then errorR(Error(FSComp.SR.parsInterfacesHaveSameVisibilityAsEnclosingType(), rhs parseState 3)) - let members = Option.map fst $5 - let mWhole = + let mWithKwd, members, mWhole = match $5 with - | None -> rhs2 parseState 1 4 - | Some (_, m) -> unionRanges (rhs2 parseState 1 4) m - [ SynMemberDefn.Interface ($4, members, mWhole) ] } + | None -> None, None, rhs2 parseState 1 4 + | Some (mWithKwd, members, m) -> Some mWithKwd, Some members, unionRanges (rhs2 parseState 1 4) m + [ SynMemberDefn.Interface ($4, mWithKwd, members, mWhole) ] } | opt_attributes opt_declVisibility abstractMemberFlags opt_inline nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet opt_ODECLEND { let ty, arity = $8 let isInline, doc, id, explicitValTyparDecls = $4, grabXmlDoc(parseState, $1, 1), $5, $6 - let getSetRangeOpt, getSet = $9 + let mWith, getSetRangeOpt, getSet = $9 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet let wholeRange = let m = rhs parseState 1 @@ -1981,7 +2000,7 @@ classDefnMember: | None -> unionRanges m ty.Range | Some m2 -> unionRanges m m2 if Option.isSome $2 then errorR(Error(FSComp.SR.parsAccessibilityModsIllegalForAbstract(), wholeRange)) - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, wholeRange) + let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, mWith, wholeRange) [ SynMemberDefn.AbstractSlot(valSpfn, AbstractMemberFlags (getSetAdjuster arity), wholeRange) ] } | opt_attributes opt_declVisibility inheritsDefn @@ -2013,7 +2032,7 @@ classDefnMember: let expr = $7 let valSynData = SynValData (Some CtorMemberFlags, SynValInfo([SynInfo.InferSynArgInfoFromPat $4], SynInfo.unnamedRetVal), $5) let vis = $2 - let declPat = SynPat.LongIdent (LongIdentWithDots([mkSynId (rhs parseState 3) "new"], []), None, Some noInferredTypars, SynArgPats.Pats [$4], vis, rhs parseState 3) + let declPat = SynPat.LongIdent (LongIdentWithDots([mkSynId (rhs parseState 3) "new"], []), None, None, Some noInferredTypars, SynArgPats.Pats [$4], vis, rhs parseState 3) // Check that 'SynPatForConstructorDecl' matches this correctly assert (match declPat with SynPatForConstructorDecl _ -> true | _ -> false) [ SynMemberDefn.Member(SynBinding (None, SynBindingKind.Normal, false, false, $1, grabXmlDoc(parseState, $1, 1), valSynData, declPat, None, Some mEquals, expr, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible), m) ] } @@ -2038,14 +2057,14 @@ valDefnDecl: /* An auto-property definition in an object type definition */ autoPropsDefnDecl: | VAL opt_mutable opt_access ident opt_typ EQUALS typedSequentialExprBlock classMemberSpfnGetSet - { let mGetSetOpt, getSet = $8 + { let mWith, mGetSetOpt, getSet = $8 let mEquals = rhs parseState 6 if $2 then errorR (Error (FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 3)) (fun attribs isStatic flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart(parseState, attribs, rangeStart) let memberRange = unionRanges rangeStart $7.Range - [ SynMemberDefn.AutoProperty(attribs, isStatic, $4, $5, getSet, flags, xmlDoc, $3, mEquals, $7, mGetSetOpt, memberRange) ]) } + [ SynMemberDefn.AutoProperty(attribs, isStatic, $4, $5, getSet, flags, xmlDoc, $3, mEquals, $7, mWith, mGetSetOpt, memberRange) ]) } /* An optional type on an auto-property definition */ @@ -2107,12 +2126,14 @@ opt_declVisibility: opt_interfaceImplDefn: | WITH objectImplementationBlock declEnd - { let members = $2 + { let mWithKwd = rhs parseState 1 + let members = $2 let m = (rhs parseState 1, members) ||> unionRangeWithListBy (fun (mem:SynMemberDefn) -> mem.Range) - Some (members, m) } + Some (mWithKwd, members, m) } | WITH - { Some ([], rhs parseState 1) } + { let mWithKwd = rhs parseState 1 + Some (mWithKwd, [], mWithKwd) } | /* EMPTY */ { None } @@ -2721,7 +2742,7 @@ cPrototype: SynExpr.Const (SynConst.String("extern was not given a DllImport attribute", SynStringKind.Regular, rhs parseState 8), rhs parseState 8), mRhs) (fun attrs _ -> - let bindingId = SynPat.LongIdent (LongIdentWithDots([nm], []), None, Some noInferredTypars, SynArgPats.Pats [SynPat.Tuple(false, args, argsm)], vis, nmm) + let bindingId = SynPat.LongIdent (LongIdentWithDots([nm], []), None, None, Some noInferredTypars, SynArgPats.Pats [SynPat.Tuple(false, args, argsm)], vis, nmm) let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) let xmlDoc = grabXmlDoc(parseState, attrs, 1) let binding = mkSynBinding @@ -3087,7 +3108,7 @@ headBindingPattern: { SynPat.Or($1, $3, rhs2 parseState 1 3) } | headBindingPattern COLON_COLON headBindingPattern - { SynPat.LongIdent (LongIdentWithDots(mkSynCaseName (rhs parseState 2) opNameCons, []), None, None, SynArgPats.Pats [SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3)], None, lhs parseState) } + { SynPat.LongIdent (LongIdentWithDots(mkSynCaseName (rhs parseState 2) opNameCons, []), None, None, None, SynArgPats.Pats [SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3)], None, lhs parseState) } | tuplePatternElements %prec pat_tuple { SynPat.Tuple(false, List.rev $1, lhs parseState) } @@ -3127,43 +3148,43 @@ namePatPair: constrPattern: | atomicPatternLongIdent explicitValTyparDecls { let vis, lid = $1 - SynPat.LongIdent (lid, None, Some $2, SynArgPats.Pats [], vis, lhs parseState) } + SynPat.LongIdent (lid, None, None, Some $2, SynArgPats.Pats [], vis, lhs parseState) } | atomicPatternLongIdent explicitValTyparDecls atomicPatsOrNamePatPairs %prec pat_app { let vis, lid = $1 let args, argsM = $3 let m = unionRanges (rhs2 parseState 1 2) argsM - SynPat.LongIdent (lid, None, Some $2, args, vis, m) } + SynPat.LongIdent (lid, None, None, Some $2, args, vis, m) } | atomicPatternLongIdent explicitValTyparDecls HIGH_PRECEDENCE_PAREN_APP atomicPatsOrNamePatPairs { let vis, lid = $1 let args, argsM = $4 let m = unionRanges (rhs2 parseState 1 2) argsM - SynPat.LongIdent (lid, None, Some $2, args, vis, m) } + SynPat.LongIdent (lid, None, None, Some $2, args, vis, m) } | atomicPatternLongIdent explicitValTyparDecls HIGH_PRECEDENCE_BRACK_APP atomicPatsOrNamePatPairs { let vis, lid = $1 let args, argsM = $4 let m = unionRanges (rhs2 parseState 1 2) argsM - SynPat.LongIdent (lid, None, Some $2, args, vis, m) } + SynPat.LongIdent (lid, None, None, Some $2, args, vis, m) } | atomicPatternLongIdent atomicPatsOrNamePatPairs %prec pat_app { let vis, lid = $1 let args, argsM = $2 let m = unionRanges (rhs parseState 1) argsM - SynPat.LongIdent (lid, None, None, args, vis, m) } + SynPat.LongIdent (lid, None, None, None, args, vis, m) } | atomicPatternLongIdent HIGH_PRECEDENCE_PAREN_APP atomicPatsOrNamePatPairs { let vis, lid = $1 let args, argsM = $3 let m = unionRanges (rhs parseState 1) argsM - SynPat.LongIdent (lid, None, None, args, vis, m) } + SynPat.LongIdent (lid, None, None, None, args, vis, m) } | atomicPatternLongIdent HIGH_PRECEDENCE_BRACK_APP atomicPatsOrNamePatPairs { let vis, lid = $1 let args, argsM = $3 let m = unionRanges (rhs parseState 1) argsM - SynPat.LongIdent (lid, None, None, args, vis, m) } + SynPat.LongIdent (lid, None, None, None, args, vis, m) } | COLON_QMARK atomTypeOrAnonRecdType %prec pat_isinst { SynPat.IsInst($2, lhs parseState) } @@ -3325,7 +3346,7 @@ parenPattern: SynPat.Attrib($2, $1, lhsm) } | parenPattern COLON_COLON parenPattern - { SynPat.LongIdent (LongIdentWithDots(mkSynCaseName (rhs parseState 2) opNameCons, []), None, None, SynArgPats.Pats [ SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3) ], None, lhs parseState) } + { SynPat.LongIdent (LongIdentWithDots(mkSynCaseName (rhs parseState 2) opNameCons, []), None, None, None, SynArgPats.Pats [ SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3) ], None, lhs parseState) } | constrPattern { $1 } @@ -3499,7 +3520,7 @@ declExpr: { let mMatch = rhs parseState 1 let mWith, (clauses, mLast) = $3 let spBind = DebugPointAtBinding.Yes(unionRanges mMatch mWith) - SynExpr.Match (spBind, $2, clauses, unionRanges mMatch mLast) } + SynExpr.Match (mMatch, spBind, $2, mWith, clauses, unionRanges mMatch mLast) } | MATCH typedSequentialExpr recover %prec expr_match { if not $3 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedEndOfFileMatch()) @@ -3510,7 +3531,7 @@ declExpr: { let mMatch = (rhs parseState 1) let mWith, (clauses, mLast) = $3 let spBind = DebugPointAtBinding.Yes(unionRanges mMatch mWith) - SynExpr.MatchBang (spBind, $2, clauses, unionRanges mMatch mLast) } + SynExpr.MatchBang (mMatch, spBind, $2, mWith, clauses, unionRanges mMatch mLast) } | MATCH_BANG typedSequentialExpr recover %prec expr_match { if not $3 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedEndOfFileMatch()) @@ -3525,7 +3546,7 @@ declExpr: let mTryToWith = unionRanges mTry mWith let mWithToLast = unionRanges mWith mLast let mTryToLast = unionRanges mTry mLast - SynExpr.TryWith ($2, mTryToWith, clauses, mWithToLast, mTryToLast, spTry, spWith) } + SynExpr.TryWith (mTry, $2, mTryToWith, mWith, clauses, mWithToLast, mTryToLast, spTry, spWith) } | TRY typedSequentialExprBlockR recover %prec expr_try { // Produce approximate expression during error recovery @@ -4746,16 +4767,17 @@ objExpr: | objExprBaseCall objExprBindings opt_OBLOCKSEP opt_objExprInterfaces { let mNewExpr = rhs parseState 1 let fullRange = match $4 with [] -> (rhs parseState 1) | _ -> (rhs2 parseState 1 4) - fullRange, (fun m -> let (a, b) = $1 in SynExpr.ObjExpr (a, b, $2, $4, mNewExpr, m)) } + let mWithKwd, bindings = $2 + fullRange, (fun m -> let (a, b) = $1 in SynExpr.ObjExpr (a, b, Some mWithKwd, bindings, $4, mNewExpr, m)) } | objExprBaseCall opt_OBLOCKSEP objExprInterfaces { let mNewExpr = rhs parseState 1 let fullRange = match $3 with [] -> (rhs parseState 1) | _ -> (rhs2 parseState 1 3) - fullRange, (fun m -> let (a, b) = $1 in SynExpr.ObjExpr (a, b, [], $3, mNewExpr, m)) } + fullRange, (fun m -> let (a, b) = $1 in SynExpr.ObjExpr (a, b, None, [], $3, mNewExpr, m)) } | NEW atomTypeNonAtomicDeprecated { let mNewExpr = rhs parseState 1 - (rhs2 parseState 1 2), (fun m -> let (a, b) = $2, None in SynExpr.ObjExpr (a, b, [], [], mNewExpr, m)) } + (rhs2 parseState 1 2), (fun m -> let (a, b) = $2, None in SynExpr.ObjExpr (a, b, None, [], [], mNewExpr, m)) } objExprBaseCall: | NEW atomTypeNonAtomicDeprecated opt_HIGH_PRECEDENCE_APP atomicExprAfterType baseSpec @@ -4771,28 +4793,31 @@ objExprBaseCall: opt_objExprBindings: | objExprBindings - { $1 } + { let mWithKwd, b = $1 in Some mWithKwd, b } | /* EMPTY */ - { [] } + { None, [] } objExprBindings: | WITH localBindings { let mWithKwd = (rhs parseState 1) let _localBindingsLastRange, localBindingsBuilder = $2 - localBindingsBuilder PreXmlDoc.Empty [] None mWithKwd } + mWithKwd, localBindingsBuilder PreXmlDoc.Empty [] None mWithKwd } | OWITH localBindings OEND { let mWithKwd = (rhs parseState 1) let _localBindingsLastRange, localBindingsBuilder = $2 - localBindingsBuilder PreXmlDoc.Empty [] None mWithKwd } + mWithKwd, localBindingsBuilder PreXmlDoc.Empty [] None mWithKwd } | WITH objectImplementationBlock opt_declEnd - { $2 |> - (List.choose (function - | SynMemberDefn.Member(b, m) -> Some b - | SynMemberDefn.AutoProperty(range = m) -> errorR(Error(FSComp.SR.parsIllegalMemberVarInObjectImplementation(), m)); None - | x -> errorR(Error(FSComp.SR.parsMemberIllegalInObjectImplementation(), x.Range)); None)) } + { let mWithKwd = rhs parseState 1 + let bindings = + $2 |> + (List.choose (function + | SynMemberDefn.Member(b, m) -> Some b + | SynMemberDefn.AutoProperty(range = m) -> errorR(Error(FSComp.SR.parsIllegalMemberVarInObjectImplementation(), m)); None + | x -> errorR(Error(FSComp.SR.parsMemberIllegalInObjectImplementation(), x.Range)); None)) + mWithKwd, bindings } objExprInterfaces: | objExprInterface opt_objExprInterfaces { $1 :: $2 } @@ -4809,7 +4834,8 @@ opt_objExprInterfaces: objExprInterface: | interfaceMember appType opt_objExprBindings opt_declEnd opt_OBLOCKSEP - { SynInterfaceImpl($2, $3, lhs parseState) } + { let mWithKwd, bindings = $3 + SynInterfaceImpl($2, mWithKwd, bindings, lhs parseState) } braceBarExpr: | STRUCT braceBarExprCore diff --git a/src/fsharp/service/FSharpParseFileResults.fs b/src/fsharp/service/FSharpParseFileResults.fs index 0103aeb19bc..96676603bca 100644 --- a/src/fsharp/service/FSharpParseFileResults.fs +++ b/src/fsharp/service/FSharpParseFileResults.fs @@ -226,7 +226,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | Some expr -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.Match (_, expr, clauses, range) when rangeContainsPos range pos -> + | SynExpr.Match (expr=expr; clauses=clauses; range=range) when rangeContainsPos range pos -> if rangeContainsPos expr.Range pos then getIdentRangeForFuncExprInApp traverseSynExpr expr pos else @@ -446,7 +446,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, let isFunction = Option.isSome memFlagsOpt || match synPat with - | SynPat.LongIdent (_, _, _, SynArgPats.Pats args, _, _) when not (List.isEmpty args) -> true + | SynPat.LongIdent (argPats=SynArgPats.Pats args) when not (List.isEmpty args) -> true | _ -> false if not isFunction then yield! walkBindSeqPt spInfo @@ -588,12 +588,12 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | None -> () yield! walkExprs (fs |> List.map (fun (_, _, e) -> e)) - | SynExpr.ObjExpr (_, args, bs, is, _, _) -> + | SynExpr.ObjExpr (argOptions=args; bindings=bs; extraImpls=is) -> match args with | None -> () | Some (arg, _) -> yield! walkExpr false arg yield! walkBinds bs - for SynInterfaceImpl(_, bs, _) in is do yield! walkBinds bs + for SynInterfaceImpl(bindings=bs) in is do yield! walkBinds bs | SynExpr.While (spWhile, e1, e2, _) -> yield! walkWhileSeqPt spWhile @@ -624,7 +624,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynExpr.Lambda (body = bodyExpr) -> yield! walkExpr true bodyExpr - | SynExpr.Match (spBind, inpExpr, cl, _) -> + | SynExpr.Match (matchDebugPoint=spBind; expr=inpExpr; clauses=cl) -> yield! walkBindSeqPt spBind yield! walkExpr false inpExpr for SynMatchClause(_, whenExpr, _, tgtExpr, _, _) in cl do @@ -635,7 +635,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, yield! walkBinds binds yield! walkExpr true bodyExpr - | SynExpr.TryWith (tryExpr, _, cl, _, _, spTry, spWith) -> + | SynExpr.TryWith (tryExpr=tryExpr; withCases=cl; tryDebugPoint=spTry; withDebugPoint=spWith) -> yield! walkTrySeqPt spTry yield! walkWithSeqPt spWith yield! walkExpr true tryExpr @@ -687,7 +687,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, yield! walkExpr true eAndBang yield! walkExpr true e2 - | SynExpr.MatchBang (spBind, e, cl, _) -> + | SynExpr.MatchBang (matchDebugPoint=spBind; expr=e; clauses=cl) -> yield! walkBindSeqPt spBind yield! walkExpr false e for SynMatchClause(_, whenExpr, _, e, _, _) in cl do @@ -713,7 +713,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynMemberDefn.AutoProperty(synExpr=synExpr) -> yield! walkExpr true synExpr | SynMemberDefn.ImplicitCtor(_, _, _, _, _, m) -> yield! checkRange m | SynMemberDefn.Member(bind, _) -> yield! walkBind bind - | SynMemberDefn.Interface(_, Some membs, _) -> for m in membs do yield! walkMember m + | SynMemberDefn.Interface(members=Some membs) -> for m in membs do yield! walkMember m | SynMemberDefn.Inherit(_, _, m) -> // can break on the "inherit" clause yield! checkRange m diff --git a/src/fsharp/service/ServiceInterfaceStubGenerator.fs b/src/fsharp/service/ServiceInterfaceStubGenerator.fs index ac821a230e9..bbd1d284f9a 100644 --- a/src/fsharp/service/ServiceInterfaceStubGenerator.fs +++ b/src/fsharp/service/ServiceInterfaceStubGenerator.fs @@ -503,7 +503,7 @@ module InterfaceStubGenerator = GetInterfaceMembers entity |> Seq.isEmpty let internal (|LongIdentPattern|_|) = function - | SynPat.LongIdent(LongIdentWithDots(xs, _), _, _, _, _, _) -> + | SynPat.LongIdent(longDotId=LongIdentWithDots(xs, _)) -> // let (name, range) = xs |> List.map (fun x -> x.idText, x.idRange) |> List.last let last = List.last xs Some(last.idText, last.idRange) @@ -729,7 +729,7 @@ module InterfaceStubGenerator = None | SynMemberDefn.AutoProperty(synExpr=expr) -> walkExpr expr - | SynMemberDefn.Interface(interfaceType, members, _range) -> + | SynMemberDefn.Interface(interfaceType=interfaceType; members=members) -> if rangeContainsPos interfaceType.Range pos then Some(InterfaceData.Interface(interfaceType, members)) else @@ -776,13 +776,13 @@ module InterfaceStubGenerator = | SynExpr.New (_, _synType, synExpr, _range) -> walkExpr synExpr - | SynExpr.ObjExpr (ty, baseCallOpt, binds, ifaces, _range1, _range2) -> + | SynExpr.ObjExpr (objType=ty; argOptions=baseCallOpt; bindings=binds; extraImpls=ifaces) -> match baseCallOpt with | None -> if rangeContainsPos ty.Range pos then Some (InterfaceData.ObjExpr(ty, binds)) else - ifaces |> List.tryPick (fun (SynInterfaceImpl(ty, binds, range)) -> + ifaces |> List.tryPick (fun (SynInterfaceImpl(interfaceTy=ty; bindings=binds; range=range)) -> if rangeContainsPos range pos then Some (InterfaceData.ObjExpr(ty, binds)) else None) @@ -807,7 +807,7 @@ module InterfaceStubGenerator = | SynExpr.MatchLambda (_isExnMatch, _argm, synMatchClauseList, _spBind, _wholem) -> synMatchClauseList |> List.tryPick (fun (SynMatchClause(resultExpr = e)) -> walkExpr e) - | SynExpr.Match (_sequencePointInfoForBinding, synExpr, synMatchClauseList, _range) -> + | SynExpr.Match (expr=synExpr; clauses=synMatchClauseList) -> walkExpr synExpr |> Option.orElse (synMatchClauseList |> List.tryPick (fun (SynMatchClause(resultExpr = e)) -> walkExpr e)) @@ -827,7 +827,7 @@ module InterfaceStubGenerator = | SynExpr.LetOrUse (_, _, synBindingList, synExpr, _range) -> Option.orElse (List.tryPick walkBinding synBindingList) (walkExpr synExpr) - | SynExpr.TryWith (synExpr, _range, _synMatchClauseList, _range2, _range3, _sequencePointInfoForTry, _sequencePointInfoForWith) -> + | SynExpr.TryWith (tryExpr=synExpr) -> walkExpr synExpr | SynExpr.TryFinally (synExpr1, synExpr2, _range, _sequencePointInfoForTry, _sequencePointInfoForFinally) -> diff --git a/src/fsharp/service/ServiceNavigation.fs b/src/fsharp/service/ServiceNavigation.fs index 650f2786294..21e2e515a7a 100755 --- a/src/fsharp/service/ServiceNavigation.fs +++ b/src/fsharp/service/ServiceNavigation.fs @@ -158,7 +158,7 @@ module NavigationImpl = | hd :: _ -> (lid, hd.idRange) | _ -> (lid, m) [ createMemberLid(lidShow, kind, icon, unionRanges rangeMerge m, enclosingEntityKind, isAbstract, access) ] - | SynPat.LongIdent(LongIdentWithDots(lid,_), _, _, _, access, _), _ -> + | SynPat.LongIdent(longDotId=LongIdentWithDots(lid,_); accessibility=access), _ -> [ createMemberLid(lid, NavigationItemKind.Field, FSharpGlyph.Field, unionRanges (List.head lid).idRange m, enclosingEntityKind, isAbstract, access) ] | SynPat.Named (id, _, access, _), _ | SynPat.As(_, SynPat.Named (id, _, access, _), _), _ -> let glyph = if isMember then FSharpGlyph.Method else FSharpGlyph.Field @@ -233,15 +233,15 @@ module NavigationImpl = [ createMember(rcid, NavigationItemKind.Field, FSharpGlyph.Field, range, enclosingEntityKind, false, access) ] | SynMemberDefn.AutoProperty(ident=id; accessibility=access) -> [ createMember(id, NavigationItemKind.Field, FSharpGlyph.Field, id.idRange, enclosingEntityKind, false, access) ] - | SynMemberDefn.AbstractSlot(SynValSig(_, id, _, ty, _, _, _, _, access, _, _), _, _) -> + | SynMemberDefn.AbstractSlot(SynValSig(ident=id; synType=ty; accessibility=access), _, _) -> [ createMember(id, NavigationItemKind.Method, FSharpGlyph.OverridenMethod, ty.Range, enclosingEntityKind, true, access) ] | SynMemberDefn.NestedType _ -> failwith "tycon as member????" //processTycon tycon - | SynMemberDefn.Interface(_, Some(membs), _) -> + | SynMemberDefn.Interface(members=Some(membs)) -> processMembers membs enclosingEntityKind |> snd | _ -> [] // can happen if one is a getter and one is a setter - | [SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(lid1, Some(info1),_,_,_,_)) as binding1) - SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(lid2, Some(info2),_,_,_,_)) as binding2)] -> + | [SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(longDotId=lid1; extraId=Some(info1))) as binding1) + SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(longDotId=lid2; extraId=Some(info2))) as binding2)] -> // ensure same long id assert((lid1.Lid,lid2.Lid) ||> List.forall2 (fun x y -> x.idText = y.idText)) // ensure one is getter, other is setter @@ -343,7 +343,7 @@ module NavigationImpl = // Exception declaration [ createDecl(baseName, id, NavigationItemKind.Exception, FSharpGlyph.Exception, m, fldspecRange fldspec, nested, NavigationEntityKind.Exception, false, access) ] - and processExnSig baseName (SynExceptionSig(repr, memberSigs, _)) = + and processExnSig baseName (SynExceptionSig(exnRepr=repr; members=memberSigs)) = let nested = processSigMembers memberSigs processExnRepr baseName nested repr @@ -392,7 +392,7 @@ module NavigationImpl = and processSigMembers (members: SynMemberSig list): list = [ for memb in members do match memb with - | SynMemberSig.Member(SynValSig.SynValSig(_, id, _, _, _, _, _, _, access, _, m), _, _) -> + | SynMemberSig.Member(SynValSig.SynValSig(ident=id; accessibility=access; range=m), _, _) -> yield createMember(id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Class, false, access) | SynMemberSig.ValField(SynField(_, _, Some(rcid), ty, _, _, access, _), _) -> yield createMember(rcid, NavigationItemKind.Field, FSharpGlyph.Field, ty.Range, NavigationEntityKind.Class, false, access) @@ -400,7 +400,7 @@ module NavigationImpl = // Process declarations in a module that belong to the right drop-down (let bindings) let processNestedSigDeclarations decls = decls |> List.collect (function - | SynModuleSigDecl.Val(SynValSig.SynValSig(_, id, _, _, _, _, _, _, access, _, m), _) -> + | SynModuleSigDecl.Val(SynValSig.SynValSig(ident=id; accessibility=access; range=m), _) -> [ createMember(id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Module, false, access) ] | _ -> [] ) @@ -540,7 +540,7 @@ module NavigateTo = | _ -> () { Type = containerType; Name = formatLongIdent lid } - let addValSig kind (SynValSig(_, id, _, _, _, _, _, _, _, _, _)) isSig container = + let addValSig kind (SynValSig(ident=id)) isSig container = addIdent kind id isSig container let addField(SynField(_, _, id, _, _, _, _, _)) isSig container = @@ -574,10 +574,10 @@ module NavigateTo = | _ -> NavigableItemKind.ModuleValue match headPat with - | SynPat.LongIdent(LongIdentWithDots([_; id], _), _, _, _, _access, _) -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([_; id], _)) -> // instance members addIdent kind id false container - | SynPat.LongIdent(LongIdentWithDots([id], _), _, _, _, _, _) -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _)) -> // functions addIdent kind id false container | SynPat.Named (id, _, _, _) | SynPat.As(_, SynPat.Named (id, _, _, _), _) -> @@ -607,7 +607,7 @@ module NavigateTo = match decl with | SynModuleSigDecl.ModuleAbbrev(lhs, _, _range) -> addModuleAbbreviation lhs true container - | SynModuleSigDecl.Exception(SynExceptionSig(representation, _, _), _) -> + | SynModuleSigDecl.Exception(exnSig=SynExceptionSig(exnRepr=representation)) -> addExceptionRepr representation true container |> ignore | SynModuleSigDecl.NamespaceFragment fragment -> walkSynModuleOrNamespaceSig fragment container @@ -725,7 +725,7 @@ module NavigateTo = addMember synValSig memberFlags false container | SynMemberDefn.AutoProperty(ident=id) -> addIdent NavigableItemKind.Property id false container - | SynMemberDefn.Interface(_, members, _) -> + | SynMemberDefn.Interface(members=members) -> match members with | Some members -> for m in members do diff --git a/src/fsharp/service/ServiceParseTreeWalk.fs b/src/fsharp/service/ServiceParseTreeWalk.fs index dd6be78f4d7..78b4df62902 100755 --- a/src/fsharp/service/ServiceParseTreeWalk.fs +++ b/src/fsharp/service/ServiceParseTreeWalk.fs @@ -383,10 +383,10 @@ module SyntaxTraversal = ] |> pick expr | SynExpr.New (_, _synType, synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.ObjExpr (ty,baseCallOpt,binds,ifaces,_range1,_range2) -> + | SynExpr.ObjExpr (objType=ty; argOptions=baseCallOpt; bindings=binds; extraImpls=ifaces) -> let result = ifaces - |> Seq.map (fun (SynInterfaceImpl(ty, _, _)) -> ty) + |> Seq.map (fun (SynInterfaceImpl(interfaceTy=ty)) -> ty) |> Seq.tryPick (fun ty -> visitor.VisitInterfaceSynMemberDefnType(path, ty)) if result.IsSome then @@ -401,7 +401,7 @@ module SyntaxTraversal = | _ -> () for b in binds do yield dive b b.RangeOfBindingWithRhs (traverseSynBinding path) - for SynInterfaceImpl(_ty, binds, _range) in ifaces do + for SynInterfaceImpl(bindings=binds) in ifaces do for b in binds do yield dive b b.RangeOfBindingWithRhs (traverseSynBinding path) ] |> pick expr @@ -456,7 +456,7 @@ module SyntaxTraversal = |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path)) |> pick expr - | SynExpr.Match (_sequencePointInfoForBinding, synExpr, synMatchClauseList, _range) -> + | SynExpr.Match (expr=synExpr; clauses=synMatchClauseList) -> [yield dive synExpr synExpr.Range traverseSynExpr yield! synMatchClauseList |> List.map (fun x -> dive x x.RangeOfGuardAndRhs (traverseSynMatchClause path))] |> pick expr @@ -487,7 +487,7 @@ module SyntaxTraversal = yield dive synExpr synExpr.Range traverseSynExpr] |> pick expr - | SynExpr.TryWith (synExpr, _range, synMatchClauseList, _range2, _range3, _sequencePointInfoForTry, _sequencePointInfoForWith) -> + | SynExpr.TryWith (tryExpr=synExpr; withCases=synMatchClauseList) -> [yield dive synExpr synExpr.Range traverseSynExpr yield! synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path))] |> pick expr @@ -601,7 +601,7 @@ module SyntaxTraversal = ] |> pick expr - | SynExpr.MatchBang (_sequencePointInfoForBinding, synExpr, synMatchClauseList, _range) -> + | SynExpr.MatchBang (expr=synExpr; clauses=synMatchClauseList) -> [yield dive synExpr synExpr.Range traverseSynExpr yield! synMatchClauseList |> List.map (fun x -> dive x x.RangeOfGuardAndRhs (traverseSynMatchClause path))] |> pick expr @@ -634,7 +634,7 @@ module SyntaxTraversal = | SynPat.Tuple (_, ps, _) | SynPat.ArrayOrList (_, ps, _) -> ps |> List.tryPick (traversePat path) | SynPat.Attrib (p, _, _) -> traversePat path p - | SynPat.LongIdent(_, _, _, args, _, _) -> + | SynPat.LongIdent(argPats=args) -> match args with | SynArgPats.Pats ps -> ps |> List.tryPick (traversePat path) | SynArgPats.NamePatPairs (ps, _) -> @@ -766,7 +766,7 @@ module SyntaxTraversal = | Some x -> Some x | None -> synBindingList |> List.map (fun x -> dive x x.RangeOfBindingWithRhs (traverseSynBinding path)) |> pick m | SynMemberDefn.AbstractSlot(_synValSig, _memberFlags, _range) -> None - | SynMemberDefn.Interface(synType, synMemberDefnsOption, _range) -> + | SynMemberDefn.Interface(interfaceType=synType; members=synMemberDefnsOption) -> match visitor.VisitInterfaceSynMemberDefnType(path, synType) with | None -> match synMemberDefnsOption with diff --git a/src/fsharp/service/ServiceParsedInputOps.fs b/src/fsharp/service/ServiceParsedInputOps.fs index 93c6fa25c88..7e5177af5af 100644 --- a/src/fsharp/service/ServiceParsedInputOps.fs +++ b/src/fsharp/service/ServiceParsedInputOps.fs @@ -487,7 +487,7 @@ module ParsedInput = | SynPat.Typed(pat, t, _) -> walkPat pat |> Option.orElseWith (fun () -> walkType t) | SynPat.Attrib(pat, Attributes attrs, _) -> walkPat pat |> Option.orElseWith (fun () -> List.tryPick walkAttribute attrs) | SynPat.Or(pat1, pat2, _) -> List.tryPick walkPat [pat1; pat2] - | SynPat.LongIdent(_, _, typars, ConstructorPats pats, _, r) -> + | SynPat.LongIdent(typarDecls=typars; argPats=ConstructorPats pats; range=r) -> ifPosInRange r (fun _ -> kind) |> Option.orElseWith (fun () -> typars @@ -513,7 +513,7 @@ module ParsedInput = | Some (SynBindingReturnInfo (t, _, _)) -> walkType t | None -> None) - and walkInterfaceImpl (SynInterfaceImpl(_, bindings, _)) = + and walkInterfaceImpl (SynInterfaceImpl(bindings=bindings)) = List.tryPick walkBinding bindings and walkType = function @@ -559,7 +559,7 @@ module ParsedInput = ifPosInRange r (fun _ -> fields |> List.tryPick (fun (SynExprRecordField(expr=e)) -> e |> Option.bind (walkExprWithKind parentKind))) | SynExpr.New (_, t, e, _) -> walkExprWithKind parentKind e |> Option.orElseWith (fun () -> walkType t) - | SynExpr.ObjExpr (ty, _, bindings, ifaces, _, _) -> + | SynExpr.ObjExpr (objType=ty; bindings=bindings; extraImpls=ifaces) -> walkType ty |> Option.orElseWith (fun () -> List.tryPick walkBinding bindings) |> Option.orElseWith (fun () -> List.tryPick walkInterfaceImpl ifaces) @@ -571,7 +571,7 @@ module ParsedInput = | SynExpr.Lambda (body = e) -> walkExprWithKind parentKind e | SynExpr.MatchLambda (_, _, synMatchClauseList, _, _) -> List.tryPick walkClause synMatchClauseList - | SynExpr.Match (_, e, synMatchClauseList, _) -> + | SynExpr.Match (expr=e; clauses=synMatchClauseList) -> walkExprWithKind parentKind e |> Option.orElseWith (fun () -> List.tryPick walkClause synMatchClauseList) | SynExpr.Do (e, _) -> walkExprWithKind parentKind e | SynExpr.Assert (e, _) -> walkExprWithKind parentKind e @@ -579,7 +579,7 @@ module ParsedInput = | SynExpr.TypeApp (e, _, tys, _, _, _, _) -> walkExprWithKind (Some EntityKind.Type) e |> Option.orElseWith (fun () -> List.tryPick walkType tys) | SynExpr.LetOrUse (_, _, bindings, e, _) -> List.tryPick walkBinding bindings |> Option.orElseWith (fun () -> walkExprWithKind parentKind e) - | SynExpr.TryWith (e, _, clauses, _, _, _, _) -> walkExprWithKind parentKind e |> Option.orElseWith (fun () -> List.tryPick walkClause clauses) + | SynExpr.TryWith (tryExpr=e; withCases=clauses) -> walkExprWithKind parentKind e |> Option.orElseWith (fun () -> List.tryPick walkClause clauses) | SynExpr.TryFinally (e1, e2, _, _, _) -> List.tryPick (walkExprWithKind parentKind) [e1; e2] | SynExpr.Lazy (e, _) -> walkExprWithKind parentKind e | Sequentials es -> List.tryPick (walkExprWithKind parentKind) es @@ -603,8 +603,8 @@ module ParsedInput = | SynExpr.JoinIn (e1, _, e2, _) -> List.tryPick (walkExprWithKind parentKind) [e1; e2] | SynExpr.YieldOrReturn (_, e, _) -> walkExprWithKind parentKind e | SynExpr.YieldOrReturnFrom (_, e, _) -> walkExprWithKind parentKind e - | SynExpr.Match (_, e, synMatchClauseList, _) - | SynExpr.MatchBang (_, e, synMatchClauseList, _) -> + | SynExpr.Match (expr=e; clauses=synMatchClauseList) + | SynExpr.MatchBang (expr=e; clauses=synMatchClauseList) -> walkExprWithKind parentKind e |> Option.orElseWith (fun () -> List.tryPick walkClause synMatchClauseList) | SynExpr.LetOrUseBang(rhs=e1; andBangs=es; body=e2) -> [ @@ -632,7 +632,7 @@ module ParsedInput = and walkField (SynField(Attributes attrs, _, _, t, _, _, _, _)) = List.tryPick walkAttribute attrs |> Option.orElseWith (fun () -> walkType t) - and walkValSig (SynValSig(Attributes attrs, _, _, t, _, _, _, _, _, _, _)) = + and walkValSig (SynValSig(attributes=Attributes attrs; synType=t)) = List.tryPick walkAttribute attrs |> Option.orElseWith (fun () -> walkType t) and walkMemberSig = function @@ -652,7 +652,7 @@ module ParsedInput = List.tryPick walkAttribute attrs |> Option.orElseWith (fun () -> List.tryPick walkSimplePat simplePats) | SynMemberDefn.ImplicitInherit(t, e, _, _) -> walkType t |> Option.orElseWith (fun () -> walkExpr e) | SynMemberDefn.LetBindings(bindings, _, _, _) -> List.tryPick walkBinding bindings - | SynMemberDefn.Interface(t, members, _) -> + | SynMemberDefn.Interface(interfaceType=t; members=members) -> walkType t |> Option.orElseWith (fun () -> members |> Option.bind (List.tryPick walkMember)) | SynMemberDefn.Inherit(t, _, _) -> walkType t | SynMemberDefn.ValField(field, _) -> walkField field @@ -1000,7 +1000,7 @@ module ParsedInput = | SynPat.LongIdent(longDotId = lidwd) when rangeContainsPos lidwd.Range pos -> // let fo|o x = () Some CompletionContext.Invalid - | SynPat.LongIdent(_, _, _, ctorArgs, _, _) -> + | SynPat.LongIdent(argPats=ctorArgs) -> match ctorArgs with | SynArgPats.Pats pats -> pats |> List.tryPick (fun (SkipFromParseErrorPat pat) -> @@ -1211,7 +1211,7 @@ module ParsedInput = List.iter walkAttribute attrs | SynPat.As (pat1, pat2, _) | SynPat.Or (pat1, pat2, _) -> List.iter walkPat [pat1; pat2] - | SynPat.LongIdent (ident, _, typars, ConstructorPats pats, _, _) -> + | SynPat.LongIdent (longDotId=ident; typarDecls=typars; argPats=ConstructorPats pats) -> addLongIdentWithDots ident typars |> Option.iter (fun (ValTyparDecls (typars, constraints, _)) -> @@ -1231,7 +1231,7 @@ module ParsedInput = walkExpr e returnInfo |> Option.iter (fun (SynBindingReturnInfo (t, _, _)) -> walkType t) - and walkInterfaceImpl (SynInterfaceImpl(_, bindings, _)) = List.iter walkBinding bindings + and walkInterfaceImpl (SynInterfaceImpl(bindings=bindings)) = List.iter walkBinding bindings and walkType = function | SynType.Array (_, t, _) @@ -1292,7 +1292,7 @@ module ParsedInput = addLongIdentWithDots ident e |> Option.iter walkExpr) | SynExpr.Ident ident -> addIdent ident - | SynExpr.ObjExpr (ty, argOpt, bindings, ifaces, _, _) -> + | SynExpr.ObjExpr (objType=ty; argOptions=argOpt; bindings=bindings; extraImpls=ifaces) -> argOpt |> Option.iter (fun (e, ident) -> walkExpr e ident |> Option.iter addIdent) @@ -1308,14 +1308,14 @@ module ParsedInput = List.iter walkExpr [e1; e2] | SynExpr.MatchLambda (_, _, synMatchClauseList, _, _) -> List.iter walkClause synMatchClauseList - | SynExpr.Match (_, e, synMatchClauseList, _) -> + | SynExpr.Match (expr=e; clauses=synMatchClauseList) -> walkExpr e List.iter walkClause synMatchClauseList | SynExpr.TypeApp (e, _, tys, _, _, _, _) -> List.iter walkType tys; walkExpr e | SynExpr.LetOrUse (_, _, bindings, e, _) -> List.iter walkBinding bindings; walkExpr e - | SynExpr.TryWith (e, _, clauses, _, _, _, _) -> + | SynExpr.TryWith (tryExpr=e; withCases=clauses) -> List.iter walkClause clauses; walkExpr e | SynExpr.IfThenElse (_, _, e1, _, e2, _, e3, _, _, _, _) -> List.iter walkExpr [e1; e2] @@ -1387,7 +1387,7 @@ module ParsedInput = List.iter walkAttribute attrs walkType t - and walkValSig (SynValSig(Attributes attrs, _, _, t, SynValInfo(argInfos, argInfo), _, _, _, _, _, _)) = + and walkValSig (SynValSig(attributes=Attributes attrs; synType=t; arity=SynValInfo(argInfos, argInfo))) = List.iter walkAttribute attrs walkType t argInfo :: (argInfos |> List.concat) @@ -1404,7 +1404,7 @@ module ParsedInput = match repr with | SynTypeDefnSigRepr.Simple(SynTypeDefnSimpleRepr.TypeAbbrev _, _) | SynTypeDefnSigRepr.ObjectModel(SynTypeDefnKind.Abbrev, _, _) - | SynTypeDefnSigRepr.ObjectModel(SynTypeDefnKind.Augmentation, _, _) -> true + | SynTypeDefnSigRepr.ObjectModel(kind=SynTypeDefnKind.Augmentation _) -> true | _ -> false walkComponentInfo isTypeExtensionOrAlias info walkTypeDefnSigRepr repr @@ -1419,7 +1419,7 @@ module ParsedInput = List.iter walkSimplePat simplePats | SynMemberDefn.ImplicitInherit (t, e, _, _) -> walkType t; walkExpr e | SynMemberDefn.LetBindings (bindings, _, _, _) -> List.iter walkBinding bindings - | SynMemberDefn.Interface (t, members, _) -> + | SynMemberDefn.Interface (interfaceType=t; members=members) -> walkType t members |> Option.iter (List.iter walkMember) | SynMemberDefn.Inherit (t, _, _) -> walkType t @@ -1469,7 +1469,7 @@ module ParsedInput = and walkTypeDefn (SynTypeDefn (typeInfo=info; typeRepr=repr; members=members; implicitConstructor=implicitCtor)) = let isTypeExtensionOrAlias = match repr with - | SynTypeDefnRepr.ObjectModel (SynTypeDefnKind.Augmentation, _, _) + | SynTypeDefnRepr.ObjectModel (kind=SynTypeDefnKind.Augmentation _) | SynTypeDefnRepr.ObjectModel (SynTypeDefnKind.Abbrev, _, _) | SynTypeDefnRepr.Simple (SynTypeDefnSimpleRepr.TypeAbbrev _, _) -> true | _ -> false diff --git a/src/fsharp/service/ServiceStructure.fs b/src/fsharp/service/ServiceStructure.fs index 1977b9482ba..01e423d2a9c 100644 --- a/src/fsharp/service/ServiceStructure.fs +++ b/src/fsharp/service/ServiceStructure.fs @@ -270,8 +270,8 @@ module Structure = | SynExpr.LetOrUse (_, _, bindings, body, _) -> parseBindings bindings parseExpr body - | SynExpr.Match (seqPointAtBinding, _expr, clauses, r) - | SynExpr.MatchBang (seqPointAtBinding, _expr, clauses, r) -> + | SynExpr.Match (matchDebugPoint=seqPointAtBinding; clauses=clauses; range=r) + | SynExpr.MatchBang (matchDebugPoint=seqPointAtBinding; clauses=clauses; range=r) -> match seqPointAtBinding with | DebugPointAtBinding.Yes sr -> let collapse = Range.endToEnd sr r @@ -309,7 +309,7 @@ module Structure = parseExpr e | SynExpr.ComputationExpr (_, e, _r) as _c -> parseExpr e - | SynExpr.ObjExpr (_, argOpt, bindings, extraImpls, newRange, wholeRange) as _objExpr -> + | SynExpr.ObjExpr (argOptions=argOpt; bindings=bindings; extraImpls=extraImpls; newExprRange=newRange; range=wholeRange) as _objExpr -> match argOpt with | Some (args, _) -> let collapse = Range.endToEnd args.Range wholeRange @@ -319,7 +319,7 @@ module Structure = rcheck Scope.ObjExpr Collapse.Below wholeRange collapse parseBindings bindings parseExprInterfaces extraImpls - | SynExpr.TryWith (e, _, matchClauses, _, wholeRange, tryPoint, withPoint) -> + | SynExpr.TryWith (tryExpr=e; withCases=matchClauses; range=wholeRange; tryDebugPoint=tryPoint; withDebugPoint=withPoint) -> match tryPoint, withPoint with | DebugPointAtTry.Yes tryRange, DebugPointAtWith.Yes withRange -> let fullrange = Range.startToEnd tryRange wholeRange @@ -456,7 +456,7 @@ module Structure = and parseBindings sqs = for bind in sqs do parseBinding bind - and parseExprInterface (SynInterfaceImpl(synType, bindings, range)) = + and parseExprInterface (SynInterfaceImpl(interfaceTy=synType; bindings=bindings; range=range)) = let collapse = Range.endToEnd synType.Range range |> Range.modEnd -1 rcheck Scope.Interface Collapse.Below range collapse parseBindings bindings @@ -491,7 +491,7 @@ module Structure = parseBinding binding | SynMemberDefn.LetBindings (bindings, _, _, _) -> parseBindings bindings - | SynMemberDefn.Interface (tp, iMembers, r) -> + | SynMemberDefn.Interface (interfaceType=tp; members=iMembers; range=r) -> rcheck Scope.Interface Collapse.Below d.Range (Range.endToEnd tp.Range d.Range) match iMembers with | Some members -> List.iter (parseSynMemberDefn r) members @@ -539,7 +539,7 @@ module Structure = match objectModel with | SynTypeDefnRepr.ObjectModel (defnKind, objMembers, r) -> match defnKind with - | SynTypeDefnKind.Augmentation -> + | SynTypeDefnKind.Augmentation _ -> rcheck Scope.TypeExtension Collapse.Below fullrange collapse | _ -> rcheck Scope.Type Collapse.Below fullrange collapse @@ -765,7 +765,7 @@ module Structure = List.iter parseSynMemberDefnSig objMembers let fullrange, collapse = makeRanges objMembers rcheck Scope.Type Collapse.Below fullrange collapse - | SynTypeDefnSigRepr.ObjectModel (SynTypeDefnKind.Augmentation, objMembers, _) -> + | SynTypeDefnSigRepr.ObjectModel (kind=SynTypeDefnKind.Augmentation _; memberSigs=objMembers) -> let fullrange, collapse = makeRanges objMembers rcheck Scope.TypeExtension Collapse.Below fullrange collapse List.iter parseSynMemberDefnSig objMembers @@ -823,7 +823,7 @@ module Structure = let rec parseModuleSigDeclaration (decl: SynModuleSigDecl) = match decl with - | SynModuleSigDecl.Val (SynValSig(attrs, ident, _, _, _, _, _, _, _, _, valrange), r) -> + | SynModuleSigDecl.Val (SynValSig(attributes=attrs; ident=ident; range=valrange), r) -> let collapse = Range.endToEnd ident.idRange valrange rcheck Scope.Val Collapse.Below r collapse parseAttributes attrs diff --git a/src/fsharp/service/ServiceXmlDocParser.fs b/src/fsharp/service/ServiceXmlDocParser.fs index 5e35ce23751..8ff09483550 100644 --- a/src/fsharp/service/ServiceXmlDocParser.fs +++ b/src/fsharp/service/ServiceXmlDocParser.fs @@ -24,7 +24,7 @@ module XmlDocParsing = | SynPat.Named (id,_isTheThisVar,_access,_range) -> [id.idText] | SynPat.Typed(pat,_type,_range) -> digNamesFrom pat | SynPat.Attrib(pat,_attrs,_range) -> digNamesFrom pat - | SynPat.LongIdent(_lid,_idOpt,_typDeclsOpt,ConstructorPats pats,_access,_range) -> + | SynPat.LongIdent(argPats=ConstructorPats pats) -> pats |> List.collect digNamesFrom | SynPat.Tuple(_,pats,_range) -> pats |> List.collect digNamesFrom | SynPat.Paren(pat,_range) -> digNamesFrom pat @@ -122,7 +122,7 @@ module XmlDocParsing = let paramNames = digNamesFrom synPat [XmlDocable(line,indent,paramNames)] else [] - | SynMemberDefn.AbstractSlot(SynValSig(synAttributes, _, _, _, synValInfo, _, _, preXmlDoc, _, _, _), _, range) -> + | SynMemberDefn.AbstractSlot(SynValSig(attributes=synAttributes; arity=synValInfo; xmlDoc=preXmlDoc), _, range) -> if isEmptyXmlDoc preXmlDoc then let fullRange = synAttributes |> List.fold (fun r a -> unionRanges r a.Range) range let line = fullRange.StartLine @@ -130,7 +130,7 @@ module XmlDocParsing = let paramNames = synValInfo.ArgNames [XmlDocable(line,indent,paramNames)] else [] - | SynMemberDefn.Interface(_synType, synMemberDefnsOption, _range) -> + | SynMemberDefn.Interface(members=synMemberDefnsOption) -> match synMemberDefnsOption with | None -> [] | Some(x) -> x |> List.collect getXmlDocablesSynMemberDefn diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index 49201d40170..d19284b9197 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -5651,6 +5651,25 @@ FSharp.Compiler.Syntax.PrettyNaming: System.String FormatAndOtherOverloadsString FSharp.Compiler.Syntax.PrettyNaming: System.String FsiDynamicModulePrefix FSharp.Compiler.Syntax.PrettyNaming: System.String NormalizeIdentifierBackticks(System.String) FSharp.Compiler.Syntax.PrettyNaming: System.String get_FsiDynamicModulePrefix() +FSharp.Compiler.Syntax.PropertyKeyword +FSharp.Compiler.Syntax.PropertyKeyword+And: FSharp.Compiler.Text.Range Item +FSharp.Compiler.Syntax.PropertyKeyword+And: FSharp.Compiler.Text.Range get_Item() +FSharp.Compiler.Syntax.PropertyKeyword+Tags: Int32 And +FSharp.Compiler.Syntax.PropertyKeyword+Tags: Int32 With +FSharp.Compiler.Syntax.PropertyKeyword+With: FSharp.Compiler.Text.Range Item +FSharp.Compiler.Syntax.PropertyKeyword+With: FSharp.Compiler.Text.Range get_Item() +FSharp.Compiler.Syntax.PropertyKeyword: Boolean IsAnd +FSharp.Compiler.Syntax.PropertyKeyword: Boolean IsWith +FSharp.Compiler.Syntax.PropertyKeyword: Boolean get_IsAnd() +FSharp.Compiler.Syntax.PropertyKeyword: Boolean get_IsWith() +FSharp.Compiler.Syntax.PropertyKeyword: FSharp.Compiler.Syntax.PropertyKeyword NewAnd(FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.PropertyKeyword: FSharp.Compiler.Syntax.PropertyKeyword NewWith(FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.PropertyKeyword: FSharp.Compiler.Syntax.PropertyKeyword+And +FSharp.Compiler.Syntax.PropertyKeyword: FSharp.Compiler.Syntax.PropertyKeyword+Tags +FSharp.Compiler.Syntax.PropertyKeyword: FSharp.Compiler.Syntax.PropertyKeyword+With +FSharp.Compiler.Syntax.PropertyKeyword: Int32 Tag +FSharp.Compiler.Syntax.PropertyKeyword: Int32 get_Tag() +FSharp.Compiler.Syntax.PropertyKeyword: System.String ToString() FSharp.Compiler.Syntax.QualifiedNameOfFile FSharp.Compiler.Syntax.QualifiedNameOfFile: FSharp.Compiler.Syntax.Ident Id FSharp.Compiler.Syntax.QualifiedNameOfFile: FSharp.Compiler.Syntax.Ident Item @@ -6133,13 +6152,15 @@ FSharp.Compiler.Syntax.SynExceptionDefnRepr: System.String ToString() FSharp.Compiler.Syntax.SynExceptionSig FSharp.Compiler.Syntax.SynExceptionSig: FSharp.Compiler.Syntax.SynExceptionDefnRepr exnRepr FSharp.Compiler.Syntax.SynExceptionSig: FSharp.Compiler.Syntax.SynExceptionDefnRepr get_exnRepr() -FSharp.Compiler.Syntax.SynExceptionSig: FSharp.Compiler.Syntax.SynExceptionSig NewSynExceptionSig(FSharp.Compiler.Syntax.SynExceptionDefnRepr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExceptionSig: FSharp.Compiler.Syntax.SynExceptionSig NewSynExceptionSig(FSharp.Compiler.Syntax.SynExceptionDefnRepr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExceptionSig: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExceptionSig: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExceptionSig: Int32 Tag FSharp.Compiler.Syntax.SynExceptionSig: Int32 get_Tag() FSharp.Compiler.Syntax.SynExceptionSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig] get_members() FSharp.Compiler.Syntax.SynExceptionSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig] members +FSharp.Compiler.Syntax.SynExceptionSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynExceptionSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynExceptionSig: System.String ToString() FSharp.Compiler.Syntax.SynExpr FSharp.Compiler.Syntax.SynExpr+AddressOf: Boolean get_isByref() @@ -6464,16 +6485,24 @@ FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Syntax.DebugPointAtBinding FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Syntax.DebugPointAtBinding matchDebugPoint FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Syntax.SynExpr get_expr() +FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Text.Range get_matchKeyword() FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Text.Range get_withKeyword() +FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Text.Range matchKeyword FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+Match: FSharp.Compiler.Text.Range withKeyword FSharp.Compiler.Syntax.SynExpr+Match: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause] clauses FSharp.Compiler.Syntax.SynExpr+Match: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause] get_clauses() FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Syntax.DebugPointAtBinding get_matchDebugPoint() FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Syntax.DebugPointAtBinding matchDebugPoint FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Syntax.SynExpr get_expr() +FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Text.Range get_matchKeyword() FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Text.Range get_withKeyword() +FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Text.Range matchKeyword FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+MatchBang: FSharp.Compiler.Text.Range withKeyword FSharp.Compiler.Syntax.SynExpr+MatchBang: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause] clauses FSharp.Compiler.Syntax.SynExpr+MatchBang: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause] get_clauses() FSharp.Compiler.Syntax.SynExpr+MatchLambda: Boolean get_isExnMatch() @@ -6514,6 +6543,8 @@ FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Collections.FSharpList` FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] get_bindings() FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynInterfaceImpl] extraImpls FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynInterfaceImpl] get_extraImpls() +FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Syntax.SynExpr,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident]]] argOptions FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Syntax.SynExpr,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident]]] get_argOptions() FSharp.Compiler.Syntax.SynExpr+Paren: FSharp.Compiler.Syntax.SynExpr expr @@ -6658,10 +6689,14 @@ FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Syntax.DebugPointAtWith FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Syntax.SynExpr get_tryExpr() FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Syntax.SynExpr tryExpr FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range get_tryKeywordRange() FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range get_tryRange() +FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range get_withKeywordRange() FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range get_withRange() FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range tryKeywordRange FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range tryRange +FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range withKeywordRange FSharp.Compiler.Syntax.SynExpr+TryWith: FSharp.Compiler.Text.Range withRange FSharp.Compiler.Syntax.SynExpr+TryWith: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause] get_withCases() FSharp.Compiler.Syntax.SynExpr+TryWith: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause] withCases @@ -6898,13 +6933,13 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyUni FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyUnionCaseFieldSet(FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], Int32, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLongIdent(Boolean, FSharp.Compiler.Syntax.LongIdentWithDots, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpRef`1[FSharp.Compiler.Syntax.SynSimplePatAlternativeIdInfo]], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLongIdentSet(FSharp.Compiler.Syntax.LongIdentWithDots, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewMatch(FSharp.Compiler.Syntax.DebugPointAtBinding, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewMatchBang(FSharp.Compiler.Syntax.DebugPointAtBinding, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewMatch(FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtBinding, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewMatchBang(FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtBinding, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewMatchLambda(Boolean, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Syntax.DebugPointAtBinding, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewNamedIndexedPropertySet(FSharp.Compiler.Syntax.LongIdentWithDots, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewNew(Boolean, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewNull(FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewObjExpr(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Syntax.SynExpr,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident]]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynInterfaceImpl], FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewObjExpr(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Syntax.SynExpr,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident]]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynInterfaceImpl], FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewParen(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewQuote(FSharp.Compiler.Syntax.SynExpr, Boolean, FSharp.Compiler.Syntax.SynExpr, Boolean, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewRecord(Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`5[FSharp.Compiler.Syntax.SynType,FSharp.Compiler.Syntax.SynExpr,FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]],FSharp.Compiler.Text.Range]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Syntax.SynExpr,System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExprRecordField], FSharp.Compiler.Text.Range) @@ -6913,7 +6948,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSequentialOrIm FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTraitCall(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypar], FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryFinally(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtFinally) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryWith(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtWith) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryWith(FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtWith) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTypeApp(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTypeTest(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) @@ -7051,7 +7086,7 @@ FSharp.Compiler.Syntax.SynField: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Com FSharp.Compiler.Syntax.SynField: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynField: System.String ToString() FSharp.Compiler.Syntax.SynInterfaceImpl -FSharp.Compiler.Syntax.SynInterfaceImpl: FSharp.Compiler.Syntax.SynInterfaceImpl NewSynInterfaceImpl(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynInterfaceImpl: FSharp.Compiler.Syntax.SynInterfaceImpl NewSynInterfaceImpl(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynInterfaceImpl: FSharp.Compiler.Syntax.SynType get_interfaceTy() FSharp.Compiler.Syntax.SynInterfaceImpl: FSharp.Compiler.Syntax.SynType interfaceTy FSharp.Compiler.Syntax.SynInterfaceImpl: FSharp.Compiler.Text.Range get_range() @@ -7060,6 +7095,8 @@ FSharp.Compiler.Syntax.SynInterfaceImpl: Int32 Tag FSharp.Compiler.Syntax.SynInterfaceImpl: Int32 get_Tag() FSharp.Compiler.Syntax.SynInterfaceImpl: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] bindings FSharp.Compiler.Syntax.SynInterfaceImpl: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] get_bindings() +FSharp.Compiler.Syntax.SynInterfaceImpl: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynInterfaceImpl: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynInterfaceImpl: System.String ToString() FSharp.Compiler.Syntax.SynInterpolatedStringPart FSharp.Compiler.Syntax.SynInterpolatedStringPart+FillExpr: FSharp.Compiler.Syntax.SynExpr fillExpr @@ -7213,6 +7250,8 @@ FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpO FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType] typeOpt FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] getSetRange FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_getSetRange() +FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynMemberDefn+ImplicitCtor: FSharp.Compiler.Syntax.SynSimplePats ctorArgs FSharp.Compiler.Syntax.SynMemberDefn+ImplicitCtor: FSharp.Compiler.Syntax.SynSimplePats get_ctorArgs() FSharp.Compiler.Syntax.SynMemberDefn+ImplicitCtor: FSharp.Compiler.Text.Range get_range() @@ -7243,6 +7282,8 @@ FSharp.Compiler.Syntax.SynMemberDefn+Interface: FSharp.Compiler.Syntax.SynType g FSharp.Compiler.Syntax.SynMemberDefn+Interface: FSharp.Compiler.Syntax.SynType interfaceType FSharp.Compiler.Syntax.SynMemberDefn+Interface: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynMemberDefn+Interface: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynMemberDefn+Interface: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynMemberDefn+Interface: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynMemberDefn+Interface: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberDefn]] get_members() FSharp.Compiler.Syntax.SynMemberDefn+Interface: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberDefn]] members FSharp.Compiler.Syntax.SynMemberDefn+LetBindings: Boolean get_isRecursive() @@ -7305,11 +7346,11 @@ FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsNestedType() FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsOpen() FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsValField() FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAbstractSlot(FSharp.Compiler.Syntax.SynValSig, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAutoProperty(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberKind, Microsoft.FSharp.Core.FSharpFunc`2[FSharp.Compiler.Syntax.SynMemberKind,FSharp.Compiler.Syntax.SynMemberFlags], FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAutoProperty(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberKind, Microsoft.FSharp.Core.FSharpFunc`2[FSharp.Compiler.Syntax.SynMemberKind,FSharp.Compiler.Syntax.SynMemberFlags], FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewImplicitCtor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynSimplePats, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewImplicitInherit(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewInherit(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewInterface(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberDefn]], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewInterface(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberDefn]], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewLetBindings(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], Boolean, Boolean, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewMember(FSharp.Compiler.Syntax.SynBinding, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewNestedType(FSharp.Compiler.Syntax.SynTypeDefn, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) @@ -7803,6 +7844,8 @@ FSharp.Compiler.Syntax.SynPat+LongIdent: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynPat+LongIdent: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] extraId FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] get_extraId() +FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.PropertyKeyword] get_propertyKeyword() +FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.PropertyKeyword] propertyKeyword FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynPat+LongIdent: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynValTyparDecls] get_typarDecls() @@ -7922,7 +7965,7 @@ FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewDeprecatedCharRa FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewFromParseError(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewInstanceMember(FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewIsInst(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewLongIdent(FSharp.Compiler.Syntax.LongIdentWithDots, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynValTyparDecls], FSharp.Compiler.Syntax.SynArgPats, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewLongIdent(FSharp.Compiler.Syntax.LongIdentWithDots, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.PropertyKeyword], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynValTyparDecls], FSharp.Compiler.Syntax.SynArgPats, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewNamed(FSharp.Compiler.Syntax.Ident, Boolean, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewNull(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewOptionalVal(FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Text.Range) @@ -8533,6 +8576,8 @@ FSharp.Compiler.Syntax.SynTypeDefn: Microsoft.FSharp.Core.FSharpOption`1[FSharp. FSharp.Compiler.Syntax.SynTypeDefn: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_equalsRange() FSharp.Compiler.Syntax.SynTypeDefn: System.String ToString() FSharp.Compiler.Syntax.SynTypeDefnKind +FSharp.Compiler.Syntax.SynTypeDefnKind+Augmentation: FSharp.Compiler.Text.Range get_withKeyword() +FSharp.Compiler.Syntax.SynTypeDefnKind+Augmentation: FSharp.Compiler.Text.Range withKeyword FSharp.Compiler.Syntax.SynTypeDefnKind+Delegate: FSharp.Compiler.Syntax.SynType get_signature() FSharp.Compiler.Syntax.SynTypeDefnKind+Delegate: FSharp.Compiler.Syntax.SynType signature FSharp.Compiler.Syntax.SynTypeDefnKind+Delegate: FSharp.Compiler.Syntax.SynValInfo get_signatureInfo() @@ -8571,10 +8616,10 @@ FSharp.Compiler.Syntax.SynTypeDefnKind: Boolean get_IsStruct() FSharp.Compiler.Syntax.SynTypeDefnKind: Boolean get_IsUnion() FSharp.Compiler.Syntax.SynTypeDefnKind: Boolean get_IsUnspecified() FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Abbrev -FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Augmentation FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Class FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind IL FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Interface +FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind NewAugmentation(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind NewDelegate(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo) FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Opaque FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Record @@ -8582,7 +8627,6 @@ FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind S FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Union FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind Unspecified FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Abbrev() -FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Augmentation() FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Class() FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_IL() FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Interface() @@ -8591,6 +8635,7 @@ FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind g FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Struct() FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Union() FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind get_Unspecified() +FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind+Augmentation FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind+Delegate FSharp.Compiler.Syntax.SynTypeDefnKind: FSharp.Compiler.Syntax.SynTypeDefnKind+Tags FSharp.Compiler.Syntax.SynTypeDefnKind: Int32 Tag @@ -8633,7 +8678,7 @@ FSharp.Compiler.Syntax.SynTypeDefnRepr: System.String ToString() FSharp.Compiler.Syntax.SynTypeDefnSig FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Syntax.SynComponentInfo get_typeInfo() FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Syntax.SynComponentInfo typeInfo -FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Syntax.SynTypeDefnSig NewSynTypeDefnSig(FSharp.Compiler.Syntax.SynComponentInfo, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Syntax.SynTypeDefnSigRepr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Syntax.SynTypeDefnSig NewSynTypeDefnSig(FSharp.Compiler.Syntax.SynComponentInfo, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Syntax.SynTypeDefnSigRepr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Syntax.SynTypeDefnSigRepr get_typeRepr() FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Syntax.SynTypeDefnSigRepr typeRepr FSharp.Compiler.Syntax.SynTypeDefnSig: FSharp.Compiler.Text.Range Range @@ -8646,6 +8691,8 @@ FSharp.Compiler.Syntax.SynTypeDefnSig: Microsoft.FSharp.Collections.FSharpList`1 FSharp.Compiler.Syntax.SynTypeDefnSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberSig] members FSharp.Compiler.Syntax.SynTypeDefnSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] equalsRange FSharp.Compiler.Syntax.SynTypeDefnSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_equalsRange() +FSharp.Compiler.Syntax.SynTypeDefnSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynTypeDefnSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynTypeDefnSig: System.String ToString() FSharp.Compiler.Syntax.SynTypeDefnSigRepr FSharp.Compiler.Syntax.SynTypeDefnSigRepr+Exception: FSharp.Compiler.Syntax.SynExceptionDefnRepr get_repr() @@ -8855,7 +8902,7 @@ FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo SynInfo FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo arity FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo get_SynInfo() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo get_arity() -FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSig NewSynValSig(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Syntax.SynValTyparDecls, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo, Boolean, Boolean, FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSig NewSynValSig(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Syntax.SynValTyparDecls, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo, Boolean, Boolean, FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValTyparDecls explicitValDecls FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValTyparDecls get_explicitValDecls() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Text.Range RangeOfId @@ -8872,6 +8919,8 @@ FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Co FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr] get_synExpr() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr] synExpr +FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_withKeyword() +FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] withKeyword FSharp.Compiler.Syntax.SynValSig: System.String ToString() FSharp.Compiler.Syntax.SynValTyparDecls FSharp.Compiler.Syntax.SynValTyparDecls: Boolean canInfer @@ -10547,4 +10596,4 @@ FSharp.Compiler.Xml.XmlDoc: System.String GetXmlText() FSharp.Compiler.Xml.XmlDoc: System.String[] GetElaboratedXmlLines() FSharp.Compiler.Xml.XmlDoc: System.String[] UnprocessedLines FSharp.Compiler.Xml.XmlDoc: System.String[] get_UnprocessedLines() -FSharp.Compiler.Xml.XmlDoc: Void .ctor(System.String[], FSharp.Compiler.Text.Range) +FSharp.Compiler.Xml.XmlDoc: Void .ctor(System.String[], FSharp.Compiler.Text.Range) \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg103.bsl b/tests/fsharp/typecheck/sigs/neg103.bsl index d2a0cc1220d..bd0e3db1a8a 100644 --- a/tests/fsharp/typecheck/sigs/neg103.bsl +++ b/tests/fsharp/typecheck/sigs/neg103.bsl @@ -19,7 +19,7 @@ neg103.fs(21,7,21,9): typecheck error FS0001: This expression was expected to ha but here has type 'int' -neg103.fs(20,5,20,29): typecheck error FS0025: Incomplete pattern matches on this expression. +neg103.fs(20,5,20,11): typecheck error FS0025: Incomplete pattern matches on this expression. neg103.fs(25,11,25,19): typecheck error FS0001: This expression was expected to have type 'int' diff --git a/tests/fsharp/typecheck/sigs/neg103.vsbsl b/tests/fsharp/typecheck/sigs/neg103.vsbsl index d2a0cc1220d..bd0e3db1a8a 100644 --- a/tests/fsharp/typecheck/sigs/neg103.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg103.vsbsl @@ -19,7 +19,7 @@ neg103.fs(21,7,21,9): typecheck error FS0001: This expression was expected to ha but here has type 'int' -neg103.fs(20,5,20,29): typecheck error FS0025: Incomplete pattern matches on this expression. +neg103.fs(20,5,20,11): typecheck error FS0025: Incomplete pattern matches on this expression. neg103.fs(25,11,25,19): typecheck error FS0001: This expression was expected to have type 'int' diff --git a/tests/fsharp/typecheck/sigs/neg104.vsbsl b/tests/fsharp/typecheck/sigs/neg104.vsbsl index 87d4a4e89db..89206431139 100644 --- a/tests/fsharp/typecheck/sigs/neg104.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg104.vsbsl @@ -23,9 +23,9 @@ neg104.fs(8,9,8,30): typecheck error FS0750: This construct may only be used wit neg104.fs(10,9,10,30): typecheck error FS0750: This construct may only be used within computation expressions -neg104.fs(20,9,20,22): typecheck error FS0025: Incomplete pattern matches on this expression. +neg104.fs(20,9,20,15): typecheck error FS0025: Incomplete pattern matches on this expression. -neg104.fs(23,9,23,22): typecheck error FS0025: Incomplete pattern matches on this expression. +neg104.fs(23,9,23,15): typecheck error FS0025: Incomplete pattern matches on this expression. neg104.fs(32,21,32,26): typecheck error FS0003: This value is not a function and cannot be applied. diff --git a/tests/fsharp/typecheck/sigs/neg59.bsl b/tests/fsharp/typecheck/sigs/neg59.bsl index c4f55d1e06b..fc509efa297 100644 --- a/tests/fsharp/typecheck/sigs/neg59.bsl +++ b/tests/fsharp/typecheck/sigs/neg59.bsl @@ -21,9 +21,9 @@ neg59.fs(49,15,49,27): typecheck error FS3090: An if/then/else expression may no neg59.fs(56,15,56,27): typecheck error FS3090: An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead. -neg59.fs(63,15,63,27): typecheck error FS3163: 'match' expressions may not be used in queries +neg59.fs(63,15,63,20): typecheck error FS3163: 'match' expressions may not be used in queries -neg59.fs(69,15,69,27): typecheck error FS3163: 'match' expressions may not be used in queries +neg59.fs(69,15,69,20): typecheck error FS3163: 'match' expressions may not be used in queries neg59.fs(76,15,76,18): typecheck error FS3146: 'try/with' expressions may not be used in queries diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs index 9152801f873..7066abe0da6 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs @@ -1,6 +1,6 @@ // #Conformance #DataExpressions #Query #Regression // DevDiv:196007, this used to throw -//'match' expressions may not be used in queries$ +//'match' expressions may not be used in queries$ let x = query { diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs index 66be1818bac..bc4e2a0280a 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs @@ -1,5 +1,5 @@ // #Conformance #DataExpressions #Query #Regression -//'match' expressions may not be used in queries$ +//'match' expressions may not be used in queries$ let q10 = query { for i in [1..10] do diff --git a/tests/service/ParserTests.fs b/tests/service/ParserTests.fs index e90888280b8..a53ec060ab6 100644 --- a/tests/service/ParserTests.fs +++ b/tests/service/ParserTests.fs @@ -52,7 +52,7 @@ match () with | x """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (_, _, _, SynExpr.ArbitraryAfterError _, _, _) ], _) -> () + | SynExpr.Match (clauses=[ SynMatchClause (resultExpr=SynExpr.ArbitraryAfterError _) ]) -> () | _ -> failwith "Unexpected tree" @@ -64,7 +64,7 @@ match () with """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (_, _, _, SynExpr.ArbitraryAfterError _, _, _) ], _) -> () + | SynExpr.Match (clauses=[ SynMatchClause (resultExpr=SynExpr.ArbitraryAfterError _) ]) -> () | _ -> failwith "Unexpected tree" [] @@ -76,7 +76,7 @@ match () with """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (_, _, _, SynExpr.ArbitraryAfterError _, _, _); _ ], _) -> () + | SynExpr.Match (clauses=[ SynMatchClause (resultExpr=SynExpr.ArbitraryAfterError _); _ ]) -> () | _ -> failwith "Unexpected tree" [] @@ -88,7 +88,7 @@ match () with """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (SynPat.Or _, _, _, SynExpr.Const _, _, _) ], _) -> () + | SynExpr.Match (clauses=[ SynMatchClause (SynPat.Or _, _, _, SynExpr.Const _, _, _) ]) -> () | _ -> failwith "Unexpected tree" [] @@ -100,8 +100,8 @@ match () with """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (_, _, _, SynExpr.ArbitraryAfterError _, _, _) - SynMatchClause (_, _, _, SynExpr.Const _, _, _) ], _) -> () + | SynExpr.Match (clauses=[ SynMatchClause (resultExpr=SynExpr.ArbitraryAfterError _) + SynMatchClause (resultExpr=SynExpr.Const _) ]) -> () | _ -> failwith "Unexpected tree" [] @@ -113,7 +113,7 @@ match () with """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (pat = pat) ], _) -> + | SynExpr.Match (clauses=[ SynMatchClause (pat=pat) ]) -> match pat with | SynPat.FromParseError (SynPat.Paren (SynPat.Or (SynPat.Named _, SynPat.Named _, _), _), _) -> () | _ -> failwith "Unexpected pattern" @@ -128,7 +128,7 @@ match () with """ match getSingleExprInModule parseResults with - | SynExpr.Match (_, _, [ SynMatchClause (pat = pat) ], _) -> + | SynExpr.Match (clauses=[ SynMatchClause (pat=pat) ]) -> match pat with | SynPat.Or (SynPat.FromParseError (SynPat.Paren (SynPat.FromParseError (SynPat.Wild _, _), _), _), @@ -158,7 +158,7 @@ let f (x match getSingleDeclInModule parseResults with | SynModuleDecl.Let (_, [ SynBinding (headPat = headPat) ], _) -> match headPat with - | SynPat.LongIdent (_, _, _, SynArgPats.Pats [ SynPat.FromParseError (SynPat.Paren (SynPat.Named _, _), _) ], _, _) -> () + | SynPat.LongIdent (argPats=SynArgPats.Pats [ SynPat.FromParseError (SynPat.Paren (SynPat.Named _, _), _) ]) -> () | _ -> failwith "Unexpected tree" | _ -> failwith "Unexpected tree" @@ -171,7 +171,7 @@ let f (x, y match getSingleDeclInModule parseResults with | SynModuleDecl.Let (_, [ SynBinding (headPat = headPat) ], _) -> match headPat with - | SynPat.LongIdent (_, _, _, SynArgPats.Pats [ SynPat.FromParseError (SynPat.Paren (SynPat.Tuple _, _), _) ], _, _) -> () + | SynPat.LongIdent (argPats=SynArgPats.Pats [ SynPat.FromParseError (SynPat.Paren (SynPat.Tuple _, _), _) ]) -> () | _ -> failwith "Unexpected tree" | _ -> failwith "Unexpected tree" diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index d1d753904d6..2c3bf311292 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -453,6 +453,152 @@ type Person(name : string, age : int) = assertRange (5, 20) (5, 21) mEquals | _ -> Assert.Fail "Could not get valid AST" + [] + let ``SynTypeDefn with Augmentation contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Int32 with + member _.Zero = 0 +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(kind=SynTypeDefnKind.Augmentation mWithKeyword)) ] + ) + ]) ])) -> + assertRange (2, 11) (2, 15) mWithKeyword + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynMemberDefn.Interface contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + interface Bar with + member Meh () = () + interface Other +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members=[ SynMemberDefn.ImplicitCtor _ + SynMemberDefn.Interface(withKeyword=Some mWithKeyword) + SynMemberDefn.Interface(withKeyword=None) ])) ] + ) + ]) ])) -> + assertRange (3, 18) (3, 22) mWithKeyword + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynTypeDefn with AutoProperty contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + member val AutoProperty = autoProp with get, set + member val AutoProperty2 = autoProp +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ + SynMemberDefn.AutoProperty(withKeyword=Some mWith) + SynMemberDefn.AutoProperty(withKeyword=None)])) ] + ) + ]) ])) -> + assertRange (3, 39) (3, 43) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynTypeDefn with AbstractSlot contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + abstract member Bar : int with get,set +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(members = [_ + SynMemberDefn.AbstractSlot(slotSig=SynValSig(withKeyword=Some mWith))])) ] + ) + ]) ])) -> + assertRange (3, 30) (3, 34) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``read-only property in SynMemberDefn.Member contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + // A read-only property. + member this.MyReadProperty with get () = myInternalValue +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = + SynTypeDefnRepr.ObjectModel(members=[ _ + SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(propertyKeyword=Some(PropertyKeyword.With mWith)))) ]) + ) ]) + ]) ])) -> + assertRange (4, 31) (4, 35) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``write-only property in SynMemberDefn.Member contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + // A write-only property. + member this.MyWriteOnlyProperty with set (value) = myInternalValue <- value +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = + SynTypeDefnRepr.ObjectModel(members=[ _ + SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(propertyKeyword=Some(PropertyKeyword.With mWith)))) ]) + ) ]) + ]) ])) -> + assertRange (4, 36) (4, 40) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``read/write property in SynMemberDefn.Member contains the range of the with keyword`` () = + let parseResults = + getParseResults + """ +type Foo() = + // A read-write property. + member this.MyReadWriteProperty + with get () = myInternalValue + and set (value) = myInternalValue <- value +""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Types( + typeDefns = [ SynTypeDefn(typeRepr = + SynTypeDefnRepr.ObjectModel(members=[ _ + SynMemberDefn.Member(memberDefn=SynBinding(headPat=SynPat.LongIdent(propertyKeyword=Some(PropertyKeyword.With mWith)))) + SynMemberDefn.Member _ ]) + ) ]) + ]) ])) -> + assertRange (5, 8) (5, 12) mWith + | _ -> Assert.Fail "Could not get valid AST" + module SyntaxExpressions = [] let ``SynExpr.Do contains the range of the do keyword`` () = @@ -617,6 +763,91 @@ for i = 1 to 10 do assertRange (2, 6) (2, 7) mEquals | _ -> Assert.Fail "Could not get valid AST" + [] + let ``SynExpr.TryWith contains the range of the try and with keyword`` () = + let ast = + """ +try + x +with +| ex -> y +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.DoExpr(expr = + SynExpr.TryWith(tryKeywordRange=mTry; withKeywordRange=mWith)) + ]) + ])) -> + assertRange (2, 0) (2, 3) mTry + assertRange (4, 0) (4, 4) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynExpr.Match contains the range of the match and with keyword`` () = + let ast = + """ +match x with +| y -> z +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.DoExpr(expr = + SynExpr.Match(matchKeyword=mMatch; withKeyword=mWith)) + ]) + ])) -> + assertRange (2, 0) (2, 5) mMatch + assertRange (2, 8) (2, 12) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynExpr.MatchBang contains the range of the match and with keyword`` () = + let ast = + """ +match! x with +| y -> z +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.DoExpr(expr = + SynExpr.MatchBang(matchKeyword=mMatch; withKeyword=mWith)) + ]) + ])) -> + assertRange (2, 0) (2, 6) mMatch + assertRange (2, 9) (2, 13) mWith + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynExpr.ObjExpr contains the range of with keyword`` () = + let ast = + """ +{ new obj() with + member x.ToString() = "INotifyEnumerableInternal" + interface INotifyEnumerableInternal<'T> + interface IEnumerable<_> with + member x.GetEnumerator() = null } +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.DoExpr(expr = + SynExpr.ObjExpr(withKeyword=Some mWithObjExpr; extraImpls=[ SynInterfaceImpl(withKeyword=None); SynInterfaceImpl(withKeyword=Some mWithSynInterfaceImpl) ])) + ]) + ])) -> + assertRange (2, 12) (2, 16) mWithObjExpr + assertRange (5, 27) (5, 31) mWithSynInterfaceImpl + | _ -> Assert.Fail "Could not get valid AST" + module Strings = let getBindingExpressionValue (parseResults: ParsedInput) = match parseResults with @@ -1121,6 +1352,67 @@ type Shape = assertRange (4, 11) (4, 12) mEquals | _ -> Assert.Fail "Could not get valid AST" + [] + let ``SynTypeDefnSig should contains the range of the with keyword`` () = + let parseResults = + getParseResultsOfSignatureFile + """ +namespace X + +type Foo with + member Meh : unit -> unit +""" + + match parseResults with + | ParsedInput.SigFile (ParsedSigFileInput (modules =[ SynModuleOrNamespaceSig(decls =[ + SynModuleSigDecl.Types( + types=[ SynTypeDefnSig(typeRepr=SynTypeDefnSigRepr.Simple _ + withKeyword=Some mWithKeyword) ] + ) + ]) ])) -> + assertRange (4, 9) (4, 13) mWithKeyword + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``SynExceptionSig should contains the range of the with keyword`` () = + let parseResults = + getParseResultsOfSignatureFile + """ +namespace X + +exception Foo with + member Meh : unit -> unit +""" + + match parseResults with + | ParsedInput.SigFile (ParsedSigFileInput (modules = [ SynModuleOrNamespaceSig(decls = [ + SynModuleSigDecl.Exception( + exnSig=SynExceptionSig(withKeyword = Some mWithKeyword) + ) + ]) ])) -> + assertRange (4, 14) (4, 18) mWithKeyword + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``memberSig of SynMemberSig.Member should contains the range of the with keyword`` () = + let parseResults = + getParseResultsOfSignatureFile + """ +namespace X + +type Foo = + abstract member Bar : int with get,set +""" + + match parseResults with + | ParsedInput.SigFile (ParsedSigFileInput (modules = [ SynModuleOrNamespaceSig(decls = [ + SynModuleSigDecl.Types( + types=[ SynTypeDefnSig(typeRepr=SynTypeDefnSigRepr.ObjectModel(memberSigs=[SynMemberSig.Member(memberSig=SynValSig(withKeyword=Some mWithKeyword))])) ] + ) + ]) ])) -> + assertRange (5, 30) (5, 34) mWithKeyword + | _ -> Assert.Fail "Could not get valid AST" + module SynMatchClause = [] let ``Range of single SynMatchClause`` () = diff --git a/vsintegration/src/FSharp.Editor/Common/FSharpCodeAnalysisExtensions.fs b/vsintegration/src/FSharp.Editor/Common/FSharpCodeAnalysisExtensions.fs index 1224200fbcb..02029e11f21 100644 --- a/vsintegration/src/FSharp.Editor/Common/FSharpCodeAnalysisExtensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/FSharpCodeAnalysisExtensions.fs @@ -20,7 +20,7 @@ type FSharpParseFileResults with else // Check if it's an operator match pat with - | SynPat.LongIdent(LongIdentWithDots([id], _), _, _, _, _, _) when id.idText.StartsWith("op_") -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _)) when id.idText.StartsWith("op_") -> if Position.posEq id.idRange.Start pos then Some binding.RangeOfBindingWithRhs else