diff --git a/src/fsharp/CheckComputationExpressions.fs b/src/fsharp/CheckComputationExpressions.fs index becdcbaf562..062156e3ec4 100644 --- a/src/fsharp/CheckComputationExpressions.fs +++ b/src/fsharp/CheckComputationExpressions.fs @@ -244,7 +244,7 @@ let TcComputationExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (mWhol | args -> SynExpr.Paren (SynExpr.Tuple (false, args, [], m), range0, None, m) let builderVal = mkSynIdGet m builderValName - mkSynApp1 (SynExpr.DotGet (builderVal, range0, LongIdentWithDots([mkSynId m nm], []), m)) args m + mkSynApp1 (SynExpr.DotGet (builderVal, range0, LongIdentWithDots([mkSynId m nm], [], None), m)) args m let hasMethInfo nm = TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad nm builderTy |> isNil |> not diff --git a/src/fsharp/CheckDeclarations.fs b/src/fsharp/CheckDeclarations.fs index 888119cddb1..cbfb5b8125c 100644 --- a/src/fsharp/CheckDeclarations.fs +++ b/src/fsharp/CheckDeclarations.fs @@ -3182,7 +3182,7 @@ module EstablishTypeDefinitionCores = let private (|TyconCoreAbbrevThatIsReallyAUnion|_|) (hasMeasureAttr, envinner: TcEnv, id: Ident) synTyconRepr = match synTyconRepr with - | SynTypeDefnSimpleRepr.TypeAbbrev(_, StripParenTypes (SynType.LongIdent(LongIdentWithDots([unionCaseName], _))), m) + | SynTypeDefnSimpleRepr.TypeAbbrev(_, StripParenTypes (SynType.LongIdent(LongIdentWithDots([unionCaseName], _, _))), m) when (not hasMeasureAttr && (isNil (LookupTypeNameInEnvNoArity OpenQualified unionCaseName.idText envinner.NameEnv) || @@ -3531,9 +3531,9 @@ module EstablishTypeDefinitionCores = /// Get the items on the r.h.s. of a 'type X = ABC<...>' definition let private TcTyconDefnCore_GetGenerateDeclaration_Rhs (StripParenTypes rhsType) = match rhsType with - | SynType.App (StripParenTypes (SynType.LongIdent(LongIdentWithDots(tc, _))), _, args, _commas, _, _postfix, m) -> Some(tc, args, m) - | SynType.LongIdent (LongIdentWithDots(tc, _) as lidwd) -> Some(tc, [], lidwd.Range) - | SynType.LongIdentApp (StripParenTypes (SynType.LongIdent (LongIdentWithDots(tc, _))), LongIdentWithDots(longId, _), _, args, _commas, _, m) -> Some(tc@longId, args, m) + | SynType.App (StripParenTypes (SynType.LongIdent(LongIdentWithDots(tc, _, _))), _, args, _commas, _, _postfix, m) -> Some(tc, args, m) + | SynType.LongIdent (LongIdentWithDots(tc, _, _) as lidwd) -> Some(tc, [], lidwd.Range) + | SynType.LongIdentApp (StripParenTypes (SynType.LongIdent (LongIdentWithDots(tc, _, _))), LongIdentWithDots(longId, _, _), _, args, _commas, _, m) -> Some(tc@longId, args, m) | _ -> None /// Check whether 'type X = ABC<...>' is a generative provided type definition @@ -4831,7 +4831,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, None, Some noInferredTypars, SynArgPats.Pats [], None, mLetPortion) + let headPat = SynPat.LongIdent (LongIdentWithDots([fldId], [], None), 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 @@ -4859,7 +4859,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, None, Some noInferredTypars, SynArgPats.Pats [], None, mMemberPortion) + let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, [], None), None, None, Some noInferredTypars, SynArgPats.Pats [], None, mMemberPortion) match propKind, mGetSetOpt with | SynMemberKind.PropertySet, Some m -> errorR(Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSetNotJustSet(), m)) @@ -4884,7 +4884,7 @@ module TcDeclarations = | SynMemberKind.PropertyGetSet -> let setter = let vId = ident("v", mMemberPortion) - let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, []), None, None, Some noInferredTypars, SynArgPats.Pats [mkSynPatVar None vId], None, mMemberPortion) + let headPat = SynPat.LongIdent (LongIdentWithDots(headPatIds, [], None), 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, rhsExpr, rhsExpr.Range, [], [], Some (memberFlags SynMemberKind.PropertySet), SynBindingTrivia.Zero) @@ -5069,7 +5069,7 @@ module TcDeclarations = memberFlags.MemberKind=SynMemberKind.Constructor && // REVIEW: This is a syntactic approximation (match valSpfn.SynType, valSpfn.SynInfo.CurriedArgInfos with - | StripParenTypes (SynType.Fun (StripParenTypes (SynType.LongIdent (LongIdentWithDots([id], _))), _, _)), [[_]] when id.idText = "unit" -> true + | StripParenTypes (SynType.Fun (StripParenTypes (SynType.LongIdent (LongIdentWithDots([id], _, _))), _, _)), [[_]] when id.idText = "unit" -> true | _ -> false) | _ -> false) diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index 5d068c251c9..85370cab797 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -918,7 +918,7 @@ let TranslateTopArgSynInfo isArg m tcAttributes (SynArgInfo(Attributes attrs, is // Synthesize an artificial "OptionalArgument" attribute for the parameter let optAttrs = if isOpt then - [ ( { TypeName=LongIdentWithDots(pathToSynLid m ["Microsoft";"FSharp";"Core";"OptionalArgument"], []) + [ ( { TypeName=LongIdentWithDots(pathToSynLid m ["Microsoft";"FSharp";"Core";"OptionalArgument"], [], None) ArgExpr=mkSynUnit m Target=None AppliesToGetterAndSetter=false @@ -2473,7 +2473,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 -> @@ -2598,7 +2598,7 @@ module EventDeclarationNormalization = match rhsExpr with // Detect 'fun () -> e' which results from the compilation of a property getter | SynExpr.Lambda (args=SynSimplePats.SimplePats([], _); body=trueRhsExpr; range=m) -> - let rhsExpr = mkSynApp1 (SynExpr.DotGet (SynExpr.Paren (trueRhsExpr, range0, None, m), range0, LongIdentWithDots([ident(target, m)], []), m)) (SynExpr.Ident (ident(argName, m))) m + let rhsExpr = mkSynApp1 (SynExpr.DotGet (SynExpr.Paren (trueRhsExpr, range0, None, m), range0, LongIdentWithDots([ident(target, m)], [], None), m)) (SynExpr.Ident (ident(argName, m))) m // reconstitute rhsExpr let bindingRhs = NormalizedBindingRhs([], None, rhsExpr) @@ -3153,12 +3153,12 @@ let (|SimpleEqualsExpr|_|) e = /// Detect a named argument at a callsite let TryGetNamedArg e = match e with - | SimpleEqualsExpr(LongOrSingleIdent(isOpt, LongIdentWithDots([a], _), None, _), b) -> Some(isOpt, a, b) + | SimpleEqualsExpr(LongOrSingleIdent(isOpt, LongIdentWithDots([a], _, _), None, _), b) -> Some(isOpt, a, b) | _ -> None let inline IsNamedArg e = match e with - | SimpleEqualsExpr(LongOrSingleIdent(_, LongIdentWithDots([_], _), None, _), _) -> true + | SimpleEqualsExpr(LongOrSingleIdent(_, LongIdentWithDots([_], _, _), None, _), _) -> true | _ -> false /// Get the method arguments at a callsite, taking into account named and optional arguments @@ -4313,11 +4313,11 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: UnscopedTyparEnv let g = cenv.g match ty with - | SynType.LongIdent(LongIdentWithDots([], _)) -> + | SynType.LongIdent(LongIdentWithDots([], _, _)) -> // special case when type name is absent - i.e. empty inherit part in type declaration g.obj_ty, tpenv - | SynType.LongIdent(LongIdentWithDots(tc, _) as lidwd) -> + | SynType.LongIdent(LongIdentWithDots(tc, _, _) as lidwd) -> let m = lidwd.Range let ad = env.eAccessRights let tinstEnclosing, tcref = ForceRaise(ResolveTypeLongIdent cenv.tcSink cenv.nameResolver occ OpenQualified env.NameEnv ad tc TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No) @@ -4333,7 +4333,7 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: UnscopedTyparEnv | _, TyparKind.Type -> TcTypeApp cenv newOk checkCxs occ env tpenv m tcref tinstEnclosing [] - | SynType.App (StripParenTypes (SynType.LongIdent(LongIdentWithDots(tc, _))), _, args, _commas, _, postfix, m) -> + | SynType.App (StripParenTypes (SynType.LongIdent(LongIdentWithDots(tc, _, _))), _, args, _commas, _, postfix, m) -> let ad = env.eAccessRights let tinstEnclosing, tcref = @@ -4364,7 +4364,7 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: UnscopedTyparEnv errorR(Error(FSComp.SR.tcUnitsOfMeasureInvalidInTypeConstructor(), m)) NewErrorType (), tpenv - | SynType.LongIdentApp (ltyp, LongIdentWithDots(longId, _), _, args, _commas, _, m) -> + | SynType.LongIdentApp (ltyp, LongIdentWithDots(longId, _, _), _, args, _commas, _, m) -> let ad = env.eAccessRights let ltyp, tpenv = TcType cenv newOk checkCxs occ env tpenv ltyp match ltyp with @@ -4628,7 +4628,7 @@ and TcStaticConstantParameter cenv (env: TcEnv) tpenv kind (StripParenTypes v) i and CrackStaticConstantArgs cenv env tpenv (staticParameters: Tainted[], args: SynType list, container, containerName, m) = let args = args |> List.map (function - | StripParenTypes (SynType.StaticConstantNamed(StripParenTypes (SynType.LongIdent(LongIdentWithDots([id], _))), v, _)) -> Some id, v + | StripParenTypes (SynType.StaticConstantNamed(StripParenTypes (SynType.LongIdent(LongIdentWithDots([id], _, _))), v, _)) -> Some id, v | v -> None, v) let unnamedArgs = args |> Seq.takeWhile (fst >> Option.isNone) |> Seq.toArray |> Array.map snd @@ -5168,11 +5168,11 @@ and ConvSynPatToSynExpr x = | 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 (longDotId=LongIdentWithDots(longId, dotms) as lidwd; argPats=args; accessibility=None; range=m) -> + | SynPat.LongIdent (longDotId=LongIdentWithDots(longId, dotms, operatorName) 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 - let e = SynExpr.LongIdent (false, LongIdentWithDots(longId, List.truncate (dotms.Length - 1) dotms), None, m) + let e = SynExpr.LongIdent (false, LongIdentWithDots(longId, List.truncate (dotms.Length - 1) dotms, operatorName), None, m) SynExpr.DiscardAfterMissingQualificationAfterDot (e, unionRanges e.Range (List.last dotms)) else SynExpr.LongIdent (false, lidwd, None, m) List.fold (fun f x -> mkSynApp1 f (ConvSynPatToSynExpr x) m) e args @@ -5194,7 +5194,7 @@ and IsNameOf (cenv: cenv) (env: TcEnv) ad m (id: Ident) = /// Check a long identifier in a pattern and TcPatLongIdent warnOnUpper cenv env ad topValInfo vFlags (tpenv, names, takenNames) ty (longDotId, tyargs, args, vis, m) = - let (LongIdentWithDots(longId, _)) = longDotId + let (LongIdentWithDots(longId, _, _)) = longDotId if tyargs.IsSome then errorR(Error(FSComp.SR.tcInvalidTypeArgumentUsage(), m)) @@ -5636,7 +5636,7 @@ and TcExprThen cenv (overallTy: OverallTy) env tpenv isArg synExpr delayed = // Check to see if pattern translation decided to use an alternative identifier. match altNameRefCellOpt with | Some {contents = SynSimplePatAlternativeIdInfo.Decided altId} -> - TcExprThen cenv overallTy env tpenv isArg (SynExpr.LongIdent (isOpt, LongIdentWithDots([altId], []), None, mLongId)) delayed + TcExprThen cenv overallTy env tpenv isArg (SynExpr.LongIdent (isOpt, LongIdentWithDots([altId], [], None), None, mLongId)) delayed | _ -> TcLongIdentThen cenv overallTy env tpenv longId delayed // f x @@ -5681,7 +5681,7 @@ and TcExprThen cenv (overallTy: OverallTy) env tpenv isArg synExpr delayed = // e1.id1 // e1.id1.id2 // etc. - | SynExpr.DotGet (e1, _, LongIdentWithDots(longId, _), _) -> + | SynExpr.DotGet (e1, _, LongIdentWithDots(longId, _, _), _) -> TcNonControlFlowExpr env <| fun env -> TcExprThen cenv overallTy env tpenv false e1 ((DelayedDotLookup (longId, synExpr.RangeWithoutAnyExtraDot)) :: delayed) @@ -5879,7 +5879,7 @@ and TcExprUndelayed cenv (overallTy: OverallTy) env tpenv (synExpr: SynExpr) = TcExpr cenv overallTy env tpenv expr2 | SynExpr.DotIndexedGet _ | SynExpr.DotIndexedSet _ - | SynExpr.TypeApp _ | SynExpr.Ident _ | SynExpr.LongIdent _ | SynExpr.App _ | SynExpr.DotGet _ -> error(Error(FSComp.SR.tcExprUndelayed(), synExpr.Range)) + | SynExpr.TypeApp _ | SynExpr.Ident _ | SynExpr.OperatorName _ | SynExpr.LongIdent _ | SynExpr.App _ | SynExpr.DotGet _ -> error(Error(FSComp.SR.tcExprUndelayed(), synExpr.Range)) | SynExpr.Const (SynConst.String (s, _, m), _) -> TcNonControlFlowExpr env <| fun env -> @@ -6401,7 +6401,7 @@ and TcExprStaticOptimization cenv overallTy env tpenv (constraints, e2, e3, m) = /// e1.longId <- e2 and TcExprDotSet cenv overallTy env tpenv (e1, lidwd, e2, mStmt) = - let (LongIdentWithDots(longId, _)) = lidwd + let (LongIdentWithDots(longId, _, _)) = lidwd if lidwd.ThereIsAnExtraDotAtTheEnd then // just drop rhs on the floor @@ -6413,7 +6413,7 @@ and TcExprDotSet cenv overallTy env tpenv (e1, lidwd, e2, mStmt) = /// e1.longId(e2) <- e3, very rarely used named property setters and TcExprDotNamedIndexedPropertySet cenv overallTy env tpenv (e1, lidwd, e2, e3, mStmt) = - let (LongIdentWithDots(longId, _)) = lidwd + let (LongIdentWithDots(longId, _, _)) = lidwd if lidwd.ThereIsAnExtraDotAtTheEnd then // just drop rhs on the floor let mExprAndDotLookup = unionRanges e1.Range (rangeOfLid longId) @@ -7608,7 +7608,7 @@ and TcConstExpr cenv (overallTy: OverallTy) env m tpenv c = else match ccuOfTyconRef mref with | Some ccu when ccuEq ccu g.fslibCcu -> - SynExpr.Typed (expr, SynType.LongIdent(LongIdentWithDots(pathToSynLid m ["System";"Numerics";"BigInteger"], [])), m) + SynExpr.Typed (expr, SynType.LongIdent(LongIdentWithDots(pathToSynLid m ["System";"Numerics";"BigInteger"], [], None)), m) | _ -> expr @@ -8237,7 +8237,7 @@ and TcNameOfExpr cenv env tpenv (synArg: SynExpr) = let m = cleanSynArg.Range let rec check overallTyOpt resultOpt expr (delayed: DelayedItem list) = match expr with - | LongOrSingleIdent (false, LongIdentWithDots(longId, _), _, _) -> + | LongOrSingleIdent (false, LongIdentWithDots(longId, _, _), _, _) -> let ad = env.eAccessRights let result = defaultArg resultOpt (List.last longId) @@ -8317,7 +8317,7 @@ and TcNameOfExpr cenv env tpenv (synArg: SynExpr) = check overallTyOpt resultOpt hd (DelayedTypeApp(types, m, m) :: delayed) // expr.ID allowed - | SynExpr.DotGet (hd, _, LongIdentWithDots(longId, _), _) -> + | SynExpr.DotGet (hd, _, LongIdentWithDots(longId, _, _), _) -> let result = defaultArg resultOpt (List.last longId) check overallTyOpt (Some result) hd ((DelayedDotLookup (longId, expr.RangeWithoutAnyExtraDot)) :: delayed) @@ -8473,7 +8473,7 @@ and GetLongIdentTypeNameInfo delayed = | _ -> TypeNameResolutionInfo.Default -and TcLongIdentThen cenv (overallTy: OverallTy) env tpenv (LongIdentWithDots(longId, _)) delayed = +and TcLongIdentThen cenv (overallTy: OverallTy) env tpenv (LongIdentWithDots(longId, _, _)) delayed = let ad = env.eAccessRights let typeNameResInfo = GetLongIdentTypeNameInfo delayed @@ -8864,6 +8864,7 @@ and TcImplicitOpItemThen cenv overallTy env id sln tpenv mItem delayed = | SynExpr.InterpolatedString _ | SynExpr.Null _ | SynExpr.Ident _ + | SynExpr.OperatorName _ | SynExpr.Const _ | SynExpr.LongIdent _ -> true @@ -10102,7 +10103,7 @@ and CheckRecursiveBindingIds binds = match b with | SynPat.Named(id, _, _, _) | SynPat.As(_, SynPat.Named(id, _, _, _), _) - | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _)) -> id.idText + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _, _)) -> id.idText | _ -> "" if nm <> "" && not (hashOfBinds.Add nm) then error(Duplicate("value", nm, m)) @@ -10629,7 +10630,7 @@ and TcAttributeEx canFail cenv (env: TcEnv) attrTgt attrEx (synAttr: SynAttribut let g = cenv.g - let (LongIdentWithDots(tycon, _)) = synAttr.TypeName + let (LongIdentWithDots(tycon, _, _)) = synAttr.TypeName let arg = synAttr.ArgExpr let targetIndicator = synAttr.Target let isAppliedToGetterOrSetter = synAttr.AppliesToGetterAndSetter @@ -10647,7 +10648,7 @@ and TcAttributeEx canFail cenv (env: TcEnv) attrTgt attrEx (synAttr: SynAttribut let ad = env.eAccessRights match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad tycon TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No with | Exception err -> raze err - | _ -> success(TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInAttribute env tpenv (SynType.App(SynType.LongIdent(LongIdentWithDots(tycon, [])), None, [], [], None, false, mAttr)) ) + | _ -> success(TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInAttribute env tpenv (SynType.App(SynType.LongIdent(LongIdentWithDots(tycon, [], None)), None, [], [], None, false, mAttr)) ) ForceRaise ((try1 (tyid.idText + "Attribute")) |> otherwise (fun () -> (try1 tyid.idText))) let ad = env.eAccessRights diff --git a/src/fsharp/SyntaxTree.fs b/src/fsharp/SyntaxTree.fs index 28262270dfc..93e116d9d88 100644 --- a/src/fsharp/SyntaxTree.fs +++ b/src/fsharp/SyntaxTree.fs @@ -18,29 +18,47 @@ type Ident (text: string, range: range) = type LongIdent = Ident list +[] +type OperatorName = + | ActivePattern of lpr: range * id: Ident * rpr: range + | PartialActivePattern of lpr: range * id: Ident * rpr: range + | Operator of lpr: range * id: Ident * rpr: range + member this.Range: range = + match this with + | OperatorName.ActivePattern(lpr=lpr; rpr=rpr) + | OperatorName.PartialActivePattern(lpr=lpr; rpr=rpr) + | OperatorName.Operator(lpr=lpr; rpr=rpr) -> unionRanges lpr rpr + + member this.Ident: Ident = + match this with + | OperatorName.ActivePattern(id=id) + | OperatorName.PartialActivePattern(id=id) + | OperatorName.Operator(id=id) -> id + type LongIdentWithDots = - | LongIdentWithDots of id: LongIdent * dotRanges: range list + | LongIdentWithDots of id: LongIdent * dotRanges: range list * operatorName: OperatorName option member this.Range = match this with - | LongIdentWithDots([], _) -> failwith "rangeOfLidwd" - | LongIdentWithDots([id], []) -> id.idRange - | LongIdentWithDots([id], [m]) -> unionRanges id.idRange m - | LongIdentWithDots(h :: t, []) -> unionRanges h.idRange (List.last t).idRange - | LongIdentWithDots(h :: t, dotRanges) -> unionRanges h.idRange (List.last t).idRange |> unionRanges (List.last dotRanges) + | LongIdentWithDots([], _, _) -> failwith "rangeOfLidwd" + | LongIdentWithDots([id], [], _) -> id.idRange + | LongIdentWithDots([id], [m], _) -> unionRanges id.idRange m + | LongIdentWithDots(h :: t, [], _) -> unionRanges h.idRange (List.last t).idRange + | LongIdentWithDots(h :: t, dotRanges, _) -> unionRanges h.idRange (List.last t).idRange |> unionRanges (List.last dotRanges) - member this.Lid = match this with LongIdentWithDots(lid, _) -> lid + member this.Lid = match this with LongIdentWithDots(lid, _, _) -> lid - member this.ThereIsAnExtraDotAtTheEnd = match this with LongIdentWithDots(lid, dots) -> lid.Length = dots.Length + member this.ThereIsAnExtraDotAtTheEnd = match this with LongIdentWithDots(lid, dots, _) -> lid.Length = dots.Length member this.RangeWithoutAnyExtraDot = match this with - | LongIdentWithDots([], _) -> failwith "rangeOfLidwd" - | LongIdentWithDots([id], _) -> id.idRange - | LongIdentWithDots(h :: t, dotRanges) -> + | LongIdentWithDots([], _, _) -> failwith "rangeOfLidwd" + | LongIdentWithDots([id], _, _) -> id.idRange + | LongIdentWithDots(h :: t, dotRanges, _) -> let nonExtraDots = if dotRanges.Length = t.Length then dotRanges else List.truncate t.Length dotRanges unionRanges h.idRange (List.last t).idRange |> unionRanges (List.last nonExtraDots) + [] type ParserDetail = | Ok @@ -859,6 +877,8 @@ type SynExpr = debugPoint: DebugPointAtLeafExpr * isControlFlow: bool * innerExpr: SynExpr + + | OperatorName of operatorName: OperatorName member e.Range = match e with @@ -931,6 +951,7 @@ type SynExpr = | SynExpr.InterpolatedString (range=m) -> m | SynExpr.Ident id -> id.idRange | SynExpr.DebugPoint (_, _, innerExpr) -> innerExpr.Range + | SynExpr.OperatorName(opName) -> opName.Range member e.RangeWithoutAnyExtraDot = match e with @@ -1542,6 +1563,7 @@ type SynValSig = | SynValSig of attributes: SynAttributes * ident: Ident * + operatorName: OperatorName option * explicitValDecls: SynValTyparDecls * synType: SynType * arity: SynValInfo * diff --git a/src/fsharp/SyntaxTree.fsi b/src/fsharp/SyntaxTree.fsi index 63c4625056f..0b081204ef8 100644 --- a/src/fsharp/SyntaxTree.fsi +++ b/src/fsharp/SyntaxTree.fsi @@ -13,7 +13,19 @@ type Ident = new: text: string * range: range -> Ident member idText: string member idRange: range - + +/// Represents an operator identifier in F# code +[] +type OperatorName = + /// (|A|B|) + | ActivePattern of lpr: range * id: Ident * rpr: range + /// (|A|_|) + | PartialActivePattern of lpr: range * id: Ident * rpr: range + /// (>=>) + | Operator of lpr: range * id: Ident * rpr: range + member Range: range + member Ident: Ident + /// Represents a long identifier e.g. 'A.B.C' type LongIdent = Ident list @@ -24,9 +36,11 @@ type LongIdent = Ident list /// if dotRanges.Length = lid.Length, then the parser must have reported an error, so the typechecker is allowed /// more freedom about typechecking these expressions. /// LongIdent can be empty list - it is used to denote that name of some AST element is absent (i.e. empty type name in inherit) +/// +/// The `operatorName` is duplication information of one of the idents of id, if it indeed is an operator name. type LongIdentWithDots = | //[] - LongIdentWithDots of id: LongIdent * dotRanges: range list + LongIdentWithDots of id: LongIdent * dotRanges: range list * operatorName: OperatorName option /// Gets the syntax range of this construct member Range: range @@ -1056,6 +1070,9 @@ type SynExpr = isControlFlow: bool * innerExpr: SynExpr + /// Operator, Active pattern or Partial Active pattern + | OperatorName of operatorName: OperatorName + /// Gets the syntax range of this construct member Range: range @@ -1696,6 +1713,7 @@ type SynValSig = | SynValSig of attributes: SynAttributes * ident: Ident * + operatorName: OperatorName option * explicitValDecls: SynValTyparDecls * synType: SynType * arity: SynValInfo * diff --git a/src/fsharp/SyntaxTreeOps.fs b/src/fsharp/SyntaxTreeOps.fs index 3a147cdd273..36f0dedf224 100644 --- a/src/fsharp/SyntaxTreeOps.fs +++ b/src/fsharp/SyntaxTreeOps.fs @@ -46,12 +46,12 @@ let mkSynIdGet m n = SynExpr.Ident (mkSynId m n) let mkSynLidGet m path n = let lid = pathToSynLid m path @ [mkSynId m n] let dots = List.replicate (lid.Length - 1) m - SynExpr.LongIdent (false, LongIdentWithDots(lid, dots), None, m) + SynExpr.LongIdent (false, LongIdentWithDots(lid, dots, None), None, m) let mkSynIdGetWithAlt m id altInfo = match altInfo with | None -> SynExpr.Ident id - | _ -> SynExpr.LongIdent (false, LongIdentWithDots([id], []), altInfo, m) + | _ -> SynExpr.LongIdent (false, LongIdentWithDots([id], [], None), altInfo, m) let mkSynSimplePatVar isOpt id = SynSimplePat.Id (id, None, false, false, isOpt, id.idRange) @@ -61,19 +61,21 @@ let mkSynCompGenSimplePatVar id = SynSimplePat.Id (id, None, true, false, false, let (|LongOrSingleIdent|_|) inp = match inp with | SynExpr.LongIdent (isOpt, lidwd, altId, _m) -> Some (isOpt, lidwd, altId, lidwd.RangeWithoutAnyExtraDot) - | SynExpr.Ident id -> Some (false, LongIdentWithDots([id], []), None, id.idRange) + | SynExpr.Ident id -> Some (false, LongIdentWithDots([id], [], None), None, id.idRange) + | SynExpr.OperatorName operatorName -> Some (false, LongIdentWithDots([operatorName.Ident], [], Some operatorName), None, operatorName.Ident.idRange) | _ -> None let (|SingleIdent|_|) inp = match inp with - | SynExpr.LongIdent (false, LongIdentWithDots([id], _), None, _) -> Some id + | SynExpr.LongIdent (false, LongIdentWithDots([id], _,_), None, _) -> Some id | SynExpr.Ident id -> Some id + | SynExpr.OperatorName operatorName -> Some operatorName.Ident | _ -> None let (|SynBinOp|_|) input = match input with - | SynExpr.App (ExprAtomicFlag.NonAtomic, false, SynExpr.App (ExprAtomicFlag.NonAtomic, true, SynExpr.Ident synId, x1, _m1), x2, _m2) -> - Some (synId, x1, x2) + | SynExpr.App (ExprAtomicFlag.NonAtomic, false, SynExpr.App (ExprAtomicFlag.NonAtomic, true, SynExpr.OperatorName operatorName, x1, _m1), x2, _m2) -> + Some (operatorName.Ident, x1, x2) | _ -> None let (|SynPipeRight|_|) input = @@ -170,7 +172,7 @@ let mkSynPatMaybeVar lidwd vis m = SynPat.LongIdent (lidwd, None, None, None, S /// Extract the argument for patterns corresponding to the declaration of 'new ... = ...' let (|SynPatForConstructorDecl|_|) x = match x with - | SynPat.LongIdent (longDotId=LongIdentWithDots([_], _); argPats=SynArgPats.Pats [arg]) -> Some arg + | SynPat.LongIdent (longDotId=LongIdentWithDots([_], _, _); argPats=SynArgPats.Pats [arg]) -> Some arg | _ -> None /// Recognize the '()' in 'new()' @@ -224,7 +226,7 @@ let rec SimplePatOfPat (synArgNameGenerator: SynArgNameGenerator) p = let m = p.Range let isCompGen, altNameRefCell, id, item = match p with - | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _); typarDecls=None; argPats=SynArgPats.Pats []; accessibility=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. @@ -413,26 +415,41 @@ let mkSynAssign (l: SynExpr) (r: SynExpr) = let mkSynDot dotm m l r = match l with - | SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots), None, _) -> + | SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots, operatorName), None, _) -> // REVIEW: MEMORY PERFORMANCE: This list operation is memory intensive (we create a lot of these list nodes) - SynExpr.LongIdent (isOpt, LongIdentWithDots(lid@[r], dots@[dotm]), None, m) + SynExpr.LongIdent (isOpt, LongIdentWithDots(lid@[r], dots@[dotm], operatorName), None, m) | SynExpr.Ident id -> - SynExpr.LongIdent (false, LongIdentWithDots([id;r], [dotm]), None, m) - | SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots), _) -> + SynExpr.LongIdent (false, LongIdentWithDots([id;r], [dotm], None), None, m) + | SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots, operatorName), _) -> // REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) - SynExpr.DotGet (e, dm, LongIdentWithDots(lid@[r], dots@[dotm]), m) + SynExpr.DotGet (e, dm, LongIdentWithDots(lid@[r], dots@[dotm], operatorName), m) | expr -> - SynExpr.DotGet (expr, dotm, LongIdentWithDots([r], []), m) + SynExpr.DotGet (expr, dotm, LongIdentWithDots([r], [], None), m) + +// TODO: should this raise a parsing error when we have something like `(<>).(++)`? + +let mkSynDotWithOperatorName dotm m l (operatorName: OperatorName) = + match l with + | SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots, None), None, _) -> + // REVIEW: MEMORY PERFORMANCE: This list operation is memory intensive (we create a lot of these list nodes) + SynExpr.LongIdent (isOpt, LongIdentWithDots(lid@[operatorName.Ident], dots@[dotm], Some operatorName), None, m) + | SynExpr.Ident id -> + SynExpr.LongIdent (false, LongIdentWithDots([id;operatorName.Ident], [dotm], Some operatorName), None, m) + | SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots, None), _) -> + // REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) + SynExpr.DotGet (e, dm, LongIdentWithDots(lid@[operatorName.Ident], dots@[dotm], Some operatorName), m) + | expr -> + SynExpr.DotGet (expr, dotm, LongIdentWithDots([operatorName.Ident], [], Some operatorName), m) let mkSynDotMissing dotm m l = match l with - | SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots), None, _) -> + | SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots, operatorName), None, _) -> // REVIEW: MEMORY PERFORMANCE: This list operation is memory intensive (we create a lot of these list nodes) - SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots@[dotm]), None, m) + SynExpr.LongIdent (isOpt, LongIdentWithDots(lid, dots@[dotm], operatorName), None, m) | SynExpr.Ident id -> - SynExpr.LongIdent (false, LongIdentWithDots([id], [dotm]), None, m) - | SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots), _) -> - SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots@[dotm]), m)// REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) + SynExpr.LongIdent (false, LongIdentWithDots([id], [dotm], None), None, m) + | SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots, operatorName), _) -> + SynExpr.DotGet (e, dm, LongIdentWithDots(lid, dots@[dotm], operatorName), m)// REVIEW: MEMORY PERFORMANCE: This is memory intensive (we create a lot of these list nodes) | expr -> SynExpr.DiscardAfterMissingQualificationAfterDot (expr, m) @@ -762,6 +779,7 @@ let rec synExprContainsError inpExpr = | SynExpr.LibraryOnlyStaticOptimization _ | SynExpr.Null _ | SynExpr.Ident _ + | SynExpr.OperatorName _ | SynExpr.ImplicitZero _ | SynExpr.Const _ -> false diff --git a/src/fsharp/SyntaxTreeOps.fsi b/src/fsharp/SyntaxTreeOps.fsi index ab17675469f..6b438779d73 100644 --- a/src/fsharp/SyntaxTreeOps.fsi +++ b/src/fsharp/SyntaxTreeOps.fsi @@ -144,6 +144,8 @@ val mkSynAssign: l:SynExpr -> r:SynExpr -> SynExpr val mkSynDot: dotm:range -> m:range -> l:SynExpr -> r:Ident -> SynExpr +val mkSynDotWithOperatorName: dotm:range -> m:range -> l:SynExpr -> operatorName:OperatorName -> SynExpr + val mkSynDotMissing: dotm:range -> m:range -> l:SynExpr -> SynExpr val mkSynFunMatchLambdas: synArgNameGenerator:SynArgNameGenerator -> isMember:bool -> wholem:range -> ps:SynPat list -> arrow:Range option -> e:SynExpr -> SynExpr diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 2f330d55ec0..3614c840370 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1838,7 +1838,7 @@ type internal FsiDynamicCompiler member _.CreateDebuggerBreak (m: range) = let breakPath = ["System";"Diagnostics";"Debugger";"Break"] let dots = List.replicate (breakPath.Length - 1) m - let methCall = SynExpr.LongIdent (false, LongIdentWithDots(List.map (mkSynId m) breakPath, dots), None, m) + let methCall = SynExpr.LongIdent (false, LongIdentWithDots(List.map (mkSynId m) breakPath, dots, None), None, m) let args = SynExpr.Const (SynConst.Unit, m) let breakStatement = SynExpr.App (ExprAtomicFlag.Atomic, false, methCall, args, m) SynModuleDecl.Expr(breakStatement, m) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 2d42da3aebe..dfc63a8cfa6 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -52,7 +52,7 @@ let rebindRanges first fields lastSep = | (f, m) :: xs -> run f xs (SynExprRecordField(name, mEquals, value, m) :: acc) run first fields [] -let mkUnderscoreRecdField m = LongIdentWithDots([ident("_", m)], []), false +let mkUnderscoreRecdField m = LongIdentWithDots([ident("_", m)], [], None), false let mkRecdField lidwd = lidwd, true @@ -189,7 +189,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(longDotId=LongIdentWithDots([id], _); typarDecls=None; argPats=SynArgPats.Pats []; accessibility=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 = @@ -855,12 +855,12 @@ moduleSpfn: { SynModuleSigDecl.Open($1, (rhs parseState 1)) } valSpfn: - | opt_attributes opt_declVisibility VAL opt_attributes opt_inline opt_mutable opt_access nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints optLiteralValueSpfn + | opt_attributes opt_declVisibility VAL opt_attributes opt_inline opt_mutable opt_access identOrOp opt_explicitValTyparDecls COLON topTypeWithTypeConstraints optLiteralValueSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) - 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) + let attr1, attr2, isInline, isMutable, vis2, (id, operatorName), 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 |> unionRangeWithXmlDoc doc - let valSpfn = SynValSig((attr1@attr2), id, explicitValTyparDecls, ty, arity, isInline, isMutable, doc, vis2, konst, None, m) + let valSpfn = SynValSig((attr1@attr2), id, operatorName, explicitValTyparDecls, ty, arity, isInline, isMutable, doc, vis2, konst, None, m) SynModuleSigDecl.Val(valSpfn, m) } @@ -983,7 +983,7 @@ tyconSpfnRhs: | 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, None, m), AbstractMemberFlags SynMemberFlagsTrivia.Zero SynMemberKind.Member, m) + let invoke = SynMemberSig.Member(SynValSig([], mkSynId m "Invoke", None, inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, None, m), AbstractMemberFlags SynMemberFlagsTrivia.Zero SynMemberKind.Member, m) (fun nameRange nameInfo mEquals augmentation -> if not (isNil augmentation) then raiseParseErrorAt m (FSComp.SR.parsAugmentationsIllegalOnDelegateType()) let mWhole = unionRanges nameRange m @@ -1053,9 +1053,9 @@ classSpfnMembersAtLeastOne: /* A object member in a signature */ classMemberSpfn: - | opt_attributes opt_declVisibility memberSpecFlags opt_inline opt_access nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet optLiteralValueSpfn + | opt_attributes opt_declVisibility memberSpecFlags opt_inline opt_access identOrOp 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 isInline, doc, vis2, (id, operatorName), explicitValTyparDecls, (ty, arity), optLiteralValue = $4, grabXmlDoc(parseState, $1, 1), $5, $6, $7, $9, $11 let mWith, getSetRangeOpt, getSet = $10 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet let wholeRange = @@ -1065,7 +1065,7 @@ classMemberSpfn: | Some m2 -> unionRanges m m2 |> fun m -> (m, $1) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) |> unionRangeWithXmlDoc doc - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, optLiteralValue, mWith, wholeRange) + let valSpfn = SynValSig($1, id, operatorName, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, optLiteralValue, mWith, wholeRange) let _, flags = $3 SynMemberSig.Member(valSpfn, flags (getSetAdjuster arity), wholeRange) } @@ -1099,7 +1099,7 @@ classMemberSpfn: { let vis, doc, (ty, valSynInfo) = $2, grabXmlDoc(parseState, $1, 1), $5 let m = unionRanges (rhs parseState 1) ty.Range |> unionRangeWithXmlDoc doc let isInline = false - let valSpfn = SynValSig ($1, mkSynId (rhs parseState 3) "new", noInferredTypars, ty, valSynInfo, isInline, false, doc, vis, None, None, m) + let valSpfn = SynValSig ($1, mkSynId (rhs parseState 3) "new", None, noInferredTypars, ty, valSynInfo, isInline, false, doc, vis, None, None, m) SynMemberSig.Member(valSpfn, CtorMemberFlags SynMemberFlagsTrivia.Zero, m) } @@ -1124,16 +1124,17 @@ classMemberSpfnGetSet: /* The "get, set" on a property member in a signature */ classMemberSpfnGetSetElements: - | nameop - { (let (id:Ident) = $1 + | ident + { let (id:Ident) = $1 if id.idText = "get" then SynMemberKind.PropertyGet - else if id.idText = "set" then SynMemberKind.PropertySet - else raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsGetOrSetRequired())) } - - | nameop COMMA nameop - { let (id:Ident) = $1 - if not ((id.idText = "get" && $3.idText = "set") || - (id.idText = "set" && $3.idText = "get")) then + elif id.idText = "set" then SynMemberKind.PropertySet + else raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsGetOrSetRequired()) } + + | ident COMMA ident + { let (id:Ident) = $1 + let (id2:Ident) = $3 + if not ((id.idText = "get" && (id2.idText) = "set") || + (id.idText = "set" && (id2.idText) = "get")) then raiseParseErrorAt (rhs2 parseState 1 3) (FSComp.SR.parsGetOrSetRequired()) SynMemberKind.PropertyGetSet } @@ -1458,7 +1459,7 @@ namedModuleDefnBlock: // However in that case we do use type name lookup to make the resolution. match $2 with - | [ SynModuleDecl.Expr (LongOrSingleIdent(false, LongIdentWithDots(path, _), None, _), _) ] -> + | [ SynModuleDecl.Expr (LongOrSingleIdent(false, LongIdentWithDots(path, _, _), None, _), _) ] -> Choice1Of2 path | _ -> Choice2Of2 $2 @@ -1722,7 +1723,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, None, m) + let valSpfn = SynValSig([], mkSynId m "Invoke", None, inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, None, m) let invoke = SynMemberDefn.AbstractSlot(valSpfn, AbstractMemberFlags SynMemberFlagsTrivia.Zero SynMemberKind.Member, m) if not (isNil augmentation) then raiseParseErrorAt m (FSComp.SR.parsAugmentationsIllegalOnDelegateType()) SynTypeDefnRepr.ObjectModel (SynTypeDefnKind.Delegate (ty, arity), [invoke], m), []) } @@ -1880,7 +1881,7 @@ memberCore: let getset = let rec go p = match p with - | SynPat.LongIdent (longDotId=LongIdentWithDots([id], _)) -> id.idText + | 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 @@ -1992,7 +1993,7 @@ memberCore: 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 + | SynPat.Named (id, _, visOuter, m) | SynPat.As(_, SynPat.Named (id, _, visOuter, m), _) -> LongIdentWithDots([id], [], None), visOuter | p -> raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) // Merge the visibility from the outer point with the inner point, e.g. @@ -2009,7 +2010,7 @@ memberCore: // 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) -> + | 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 = @@ -2083,9 +2084,9 @@ classDefnMember: | 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 + | opt_attributes opt_declVisibility abstractMemberFlags opt_inline identOrOp opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet opt_ODECLEND { let ty, arity = $8 - let isInline, doc, id, explicitValTyparDecls = $4, grabXmlDoc(parseState, $1, 1), $5, $6 + let isInline, doc, (id, operatorName) , explicitValTyparDecls = $4, grabXmlDoc(parseState, $1, 1), $5, $6 let mWith, getSetRangeOpt, getSet = $9 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet let wholeRange = @@ -2095,7 +2096,7 @@ classDefnMember: | Some m2 -> unionRanges m m2 |> unionRangeWithXmlDoc doc if Option.isSome $2 then errorR(Error(FSComp.SR.parsAccessibilityModsIllegalForAbstract(), wholeRange)) - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, mWith, wholeRange) + let valSpfn = SynValSig($1, id, operatorName, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, mWith, wholeRange) [ SynMemberDefn.AbstractSlot(valSpfn, AbstractMemberFlags $3 (getSetAdjuster arity), wholeRange) ] } | opt_attributes opt_declVisibility inheritsDefn @@ -2128,7 +2129,7 @@ classDefnMember: let expr = $7 let valSynData = SynValData (Some (CtorMemberFlags SynMemberFlagsTrivia.Zero), SynValInfo([SynInfo.InferSynArgInfoFromPat $4], SynInfo.unnamedRetVal), $5) let vis = $2 - let declPat = SynPat.LongIdent (LongIdentWithDots([mkSynId (rhs parseState 3) "new"], []), None, None, Some noInferredTypars, SynArgPats.Pats [$4], vis, rhs parseState 3) + let declPat = SynPat.LongIdent (LongIdentWithDots([mkSynId (rhs parseState 3) "new"], [], None), None, None, Some noInferredTypars, SynArgPats.Pats [$4], vis, rhs parseState 3) // Check that 'SynPatForConstructorDecl' matches this correctly assert (match declPat with SynPatForConstructorDecl _ -> true | _ -> false) let synBindingTrivia: SynBindingTrivia = { LetKeyword = None; EqualsRange = Some mEquals } @@ -2174,12 +2175,12 @@ atomicPatternLongIdent: | UNDERSCORE DOT pathOp { if not (parseState.LexBuffer.SupportsFeature LanguageFeature.SingleUnderscorePattern) then raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolDot()) - let (LongIdentWithDots(lid, dotms)) = $3 - (None, LongIdentWithDots(ident("_", rhs parseState 1)::lid, rhs parseState 2::dotms)) } + let (LongIdentWithDots(lid, dotms, operatorName)) = $3 + (None, LongIdentWithDots(ident("_", rhs parseState 1)::lid, rhs parseState 2::dotms, operatorName)) } | GLOBAL DOT pathOp - { let (LongIdentWithDots(lid, dotms)) = $3 - (None, LongIdentWithDots(ident(MangledGlobalName, rhs parseState 1) :: lid, rhs parseState 2 :: dotms)) } + { let (LongIdentWithDots(lid, dotms, operatorName)) = $3 + (None, LongIdentWithDots(ident(MangledGlobalName, rhs parseState 1) :: lid, rhs parseState 2 :: dotms, operatorName)) } | pathOp { (None, $1) } @@ -2187,8 +2188,8 @@ atomicPatternLongIdent: | access UNDERSCORE DOT pathOp { if not (parseState.LexBuffer.SupportsFeature LanguageFeature.SingleUnderscorePattern) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedSymbolDot()) - let (LongIdentWithDots(lid, dotms)) = $4 - (Some($1), LongIdentWithDots(ident("_", rhs parseState 2)::lid, rhs parseState 3::dotms)) } + let (LongIdentWithDots(lid, dotms, operatorName)) = $4 + (Some($1), LongIdentWithDots(ident("_", rhs parseState 2)::lid, rhs parseState 3::dotms, operatorName)) } | access pathOp { (Some($1), $2) } @@ -2258,7 +2259,7 @@ inheritsDefn: | INHERIT ends_coming_soon_or_recover { let mDecl = (rhs parseState 1) if not $2 then errorR(Error(FSComp.SR.parsTypeNameCannotBeEmpty(), mDecl)) - SynMemberDefn.Inherit(SynType.LongIdent(LongIdentWithDots([], [])), None, mDecl) } + SynMemberDefn.Inherit(SynType.LongIdent(LongIdentWithDots([], [], None)), None, mDecl) } optAsSpec: | asSpec @@ -2629,7 +2630,7 @@ attrUnionCaseDecl: /* The name of a union case */ unionCaseName: - | nameop + | ident { $1 } | LPAREN COLON_COLON rparen @@ -2882,7 +2883,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 bindingPat = SynPat.LongIdent (LongIdentWithDots([nm], []), None, None, Some noInferredTypars, SynArgPats.Pats [SynPat.Tuple(false, args, argsm)], vis, nmm) + let bindingPat = SynPat.LongIdent (LongIdentWithDots([nm], [], None), 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 = @@ -2927,19 +2928,19 @@ cType: | cType opt_HIGH_PRECEDENCE_APP LBRACK RBRACK { let m = lhs parseState - SynType.App(SynType.LongIdent(LongIdentWithDots([ident("[]", m)], [])), None, [$1], [], None, true, m) } + SynType.App(SynType.LongIdent(LongIdentWithDots([ident("[]", m)], [], None)), None, [$1], [], None, true, m) } | cType STAR { let m = lhs parseState - SynType.App(SynType.LongIdent(LongIdentWithDots([ident("nativeptr", m)], [])), None, [$1], [], None, true, m) } + SynType.App(SynType.LongIdent(LongIdentWithDots([ident("nativeptr", m)], [], None)), None, [$1], [], None, true, m) } | cType AMP { let m = lhs parseState - SynType.App(SynType.LongIdent(LongIdentWithDots([ident("byref", m)], [])), None, [$1], [], None, true, m) } + SynType.App(SynType.LongIdent(LongIdentWithDots([ident("byref", m)], [], None)), None, [$1], [], None, true, m) } | VOID STAR { let m = lhs parseState - SynType.App(SynType.LongIdent(LongIdentWithDots([ident("nativeint", m)], [])), None, [], [], None, true, m) } + SynType.App(SynType.LongIdent(LongIdentWithDots([ident("nativeint", m)], [], None)), None, [], [], None, true, m) } /* A return type in an 'extern' DllImport function definition */ @@ -2949,7 +2950,7 @@ cRetType: | opt_attributes VOID { let m = rhs parseState 2 - SynReturnInfo((SynType.App(SynType.LongIdent(LongIdentWithDots([ident("unit", m)], [])), None, [], [], None, false, m), SynArgInfo($1, false, None)), m) } + SynReturnInfo((SynType.App(SynType.LongIdent(LongIdentWithDots([ident("unit", m)], [], None)), None, [], [], None, false, m), SynArgInfo($1, false, None)), m) } localBindings: @@ -3254,7 +3255,7 @@ headBindingPattern: SynPat.Or($1, $3, rhs2 parseState 1 3, { BarRange = mBar }) } | headBindingPattern COLON_COLON headBindingPattern - { 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) } + { SynPat.LongIdent (LongIdentWithDots(mkSynCaseName (rhs parseState 2) opNameCons, [], None), 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) } @@ -3493,7 +3494,7 @@ parenPattern: SynPat.Attrib($2, $1, lhsm) } | parenPattern COLON_COLON parenPattern - { 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) } + { SynPat.LongIdent (LongIdentWithDots(mkSynCaseName (rhs parseState 2) opNameCons, [], None), None, None, None, SynArgPats.Pats [ SynPat.Tuple (false, [$1;$3], rhs2 parseState 1 3) ], None, lhs parseState) } | constrPattern { $1 } @@ -4439,8 +4440,9 @@ atomicExpr: { let arg1 = SynExpr.Ident (ident("base", rhs parseState 1)) $3 arg1 (lhs parseState) (rhs parseState 2), false } - | QMARK nameop - { SynExpr.LongIdent (true, LongIdentWithDots([$2], []), None, rhs parseState 2), false } + | QMARK identOrOp + { let (ident, operatorName) = $2 + SynExpr.LongIdent (true, LongIdentWithDots([ident], [], operatorName), None, rhs parseState 2), false } | atomicExpr QMARK dynamicArg { let arg1, hpa1 = $1 @@ -4483,9 +4485,10 @@ atomicExpr: { $1, false } atomicExprQualification: - | identOrOp - { let idm = rhs parseState 1 - (fun e lhsm dotm -> mkSynDot dotm lhsm e $1) } + | opName + { fun e lhsm dotm -> mkSynDotWithOperatorName dotm lhsm e $1 } + | ident + { fun e lhsm dotm -> mkSynDot dotm lhsm e $1 } | GLOBAL { (fun e lhsm dotm -> @@ -4814,7 +4817,7 @@ recdExpr: | INHERIT atomTypeNonAtomicDeprecated opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType recdExprBindings opt_seps_recd { let arg = match $4 with None -> mkSynUnit (lhs parseState) | Some e -> e let l = List.rev $5 - let dummyField = mkRecdField (LongIdentWithDots([], [])) // dummy identifier, it will be discarded + let dummyField = mkRecdField (LongIdentWithDots([], [], None)) // dummy identifier, it will be discarded let l = rebindRanges (dummyField, None, None) l $6 let (SynExprRecordField(_, _, _, inheritsSep)) = List.head l let bindings = List.tail l @@ -4826,7 +4829,7 @@ recdExpr: recdExprCore: | appExpr EQUALS declExprBlock recdExprBindings opt_seps_recd { match $1 with - | LongOrSingleIdent(false, (LongIdentWithDots(_, _) as f), None, m) -> + | LongOrSingleIdent(false, (LongIdentWithDots _ as f), None, m) -> let f = mkRecdField f let mEquals = rhs parseState 2 let l = List.rev $4 @@ -5029,8 +5032,8 @@ braceBarExprCore: { let orig, flds = $2 let flds = flds |> List.choose (function - | SynExprRecordField((LongIdentWithDots([id], _), _), mEquals, Some e, _) -> Some (id, mEquals, e) - | SynExprRecordField((LongIdentWithDots([id], _), _), mEquals, None, _) -> Some (id, mEquals, arbExpr("anonField", id.idRange)) + | SynExprRecordField((LongIdentWithDots([id], _, _), _), mEquals, Some e, _) -> Some (id, mEquals, e) + | SynExprRecordField((LongIdentWithDots([id], _, _), _), mEquals, None, _) -> Some (id, mEquals, arbExpr("anonField", id.idRange)) | _ -> reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsInvalidAnonRecdType()); None) let m = rhs2 parseState 1 3 (fun isStruct -> SynExpr.AnonRecd (isStruct, orig, flds, m)) } @@ -5040,8 +5043,8 @@ braceBarExprCore: let orig, flds = $2 let flds = flds |> List.choose (function - | SynExprRecordField((LongIdentWithDots([id], _), _), mEquals, Some e, _) -> Some (id, mEquals, e) - | SynExprRecordField((LongIdentWithDots([id], _), _), mEquals, None, _) -> Some (id, mEquals, arbExpr("anonField", id.idRange)) + | SynExprRecordField((LongIdentWithDots([id], _, _), _), mEquals, Some e, _) -> Some (id, mEquals, e) + | SynExprRecordField((LongIdentWithDots([id], _, _), _), mEquals, None, _) -> Some (id, mEquals, arbExpr("anonField", id.idRange)) | _ -> reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsInvalidAnonRecdType()); None) let m = rhs2 parseState 1 2 (fun isStruct -> SynExpr.AnonRecd (isStruct, orig, flds, m)) } @@ -5166,7 +5169,7 @@ topTupleTypeElements: topAppType: | attributes appType COLON appType { match $2 with - | SynType.LongIdent(LongIdentWithDots([id], _)) -> $4, SynArgInfo($1, false, Some id) + | SynType.LongIdent(LongIdentWithDots([id], _, _)) -> $4, SynArgInfo($1, false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } | attributes QMARK ident COLON appType @@ -5177,7 +5180,7 @@ topAppType: | appType COLON appType { match $1 with - | SynType.LongIdent(LongIdentWithDots([id], _)) -> $3, SynArgInfo([], false, Some id) + | SynType.LongIdent(LongIdentWithDots([id], _, _)) -> $3, SynArgInfo([], false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } | QMARK ident COLON appType @@ -5487,7 +5490,7 @@ dummyTypeArg: | /* EMPTY */ { let m = rhs parseState 1 let dummyStatVal = SynType.StaticConstant(SynConst.Int32(0), m) - let dummyName = SynType.LongIdent(LongIdentWithDots([ident("", m)], [])) + let dummyName = SynType.LongIdent(LongIdentWithDots([ident("", m)], [], None)) let dummyTypeArg = SynType.StaticConstantNamed(dummyName, dummyStatVal, m) dummyTypeArg } @@ -5565,39 +5568,53 @@ ident: /* A A.B.C path used to an identifier */ path: | GLOBAL - { LongIdentWithDots([ident(MangledGlobalName, rhs parseState 1)], []) } + { LongIdentWithDots([ident(MangledGlobalName, rhs parseState 1)], [], None) } | ident - { LongIdentWithDots([$1], []) } + { LongIdentWithDots([$1], [], None) } | path DOT ident - { let (LongIdentWithDots(lid, dotms)) = $1 in LongIdentWithDots(lid @ [$3], dotms @ [rhs parseState 2]) } + { let (LongIdentWithDots(lid, dotms, operatorName)) = $1 in LongIdentWithDots(lid @ [$3], dotms @ [rhs parseState 2], operatorName) } | path DOT ends_coming_soon_or_recover { if not $3 then reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsExpectedNameAfterToken()) - let (LongIdentWithDots(lid, dotms)) = $1 in LongIdentWithDots(lid, dotms @ [rhs parseState 2]) } + let (LongIdentWithDots(lid, dotms, operatorName)) = $1 in LongIdentWithDots(lid, dotms @ [rhs parseState 2], operatorName) } /* An operator name, with surrounnding parentheses */ opName: | LPAREN operatorName rparen - { ident(CompileOpName $2, rhs parseState 2) } + { let ident = ident(CompileOpName $2, rhs parseState 2) + OperatorName.Operator(rhs parseState 1, ident, rhs parseState 3) } | LPAREN error rparen - { reportParseErrorAt (lhs parseState) (FSComp.SR.parsErrorParsingAsOperatorName()); ident(CompileOpName "****", rhs parseState 2) } + { reportParseErrorAt (lhs parseState) (FSComp.SR.parsErrorParsingAsOperatorName()) + let ident = ident(CompileOpName "****", rhs parseState 2) + OperatorName.Operator(rhs parseState 1, ident, rhs parseState 3) } | LPAREN_STAR_RPAREN - { ident(CompileOpName "*", rhs parseState 1) } + { let m= rhs parseState 1 + let lpr = mkFileIndexRange m.FileIndex m.Start m.Start + let mStar = mkFileIndexRange m.FileIndex (mkPos m.StartLine (m.StartColumn + 1)) (mkPos m.EndLine (m.EndColumn - 1)) + let ident = ident(CompileOpName "*", mStar) + let rpr = mkFileIndexRange m.FileIndex m.End m.End + OperatorName.Operator(lpr, ident, rpr) } /* active pattern name */ | LPAREN activePatternCaseNames BAR rparen - { let text = ("|" + String.concat "|" (List.rev $2) + "|") - ident(text, rhs2 parseState 2 3) } + { let lpr = rhs parseState 1 + let text = ("|" + String.concat "|" (List.rev $2) + "|") + let ident = ident(text, rhs2 parseState 2 3) + let rpr = rhs parseState 4 + OperatorName.ActivePattern(lpr, ident, rpr) } /* partial active pattern name */ | LPAREN activePatternCaseNames BAR UNDERSCORE BAR rparen - { let text = ("|" + String.concat "|" (List.rev $2) + "|_|" ) - ident(text, rhs2 parseState 2 5) } + { let lpr = rhs parseState 1 + let text = ("|" + String.concat "|" (List.rev $2) + "|_|" ) + let ident = ident(text, rhs2 parseState 2 5) + let rpr = rhs parseState 6 + OperatorName.PartialActivePattern(lpr, ident, rpr) } /* An operator name, without surrounding parentheses */ operatorName: @@ -5702,40 +5719,33 @@ activePatternCaseNames: /* A single item that is an identifier or operator name */ identOrOp: | ident - { $1 } + { $1, None } | opName - { $1 } + { let operatorName: OperatorName = $1 + operatorName.Ident, Some operatorName } /* An A.B.C path ending in an identifier or operator name */ /* Note, only used in atomicPatternLongIdent */ pathOp: | ident - { LongIdentWithDots([$1], []) } + { LongIdentWithDots([$1], [], None) } | opName - { LongIdentWithDots([$1], []) } + { LongIdentWithDots([$1.Ident], [], Some $1) } | ident DOT pathOp - { let (LongIdentWithDots(lid, dotms)) = $3 in LongIdentWithDots($1 :: lid, rhs parseState 2 :: dotms) } + { let (LongIdentWithDots(lid, dotms, operatorName)) = $3 in LongIdentWithDots($1 :: lid, rhs parseState 2 :: dotms, operatorName) } | ident DOT error - { (* silent recovery *) LongIdentWithDots([$1], [rhs parseState 2]) } - - -/* nameop is identOrOp not used as part of a path */ -nameop: - | identOrOp { $1 } + { (* silent recovery *) LongIdentWithDots([$1], [rhs parseState 2], None) } identExpr: | ident { SynExpr.Ident($1) } | opName - { let m = lhs parseState - let mLparen = mkFileIndexRange m.FileIndex m.Start (mkPos m.StartLine (m.StartColumn + 1)) - let mRparen = mkFileIndexRange m.FileIndex (mkPos m.EndLine (m.EndColumn - 1)) m.End - SynExpr.Paren(SynExpr.Ident($1), mLparen, Some mRparen, m) } + { SynExpr.OperatorName($1) } topSeparator: | SEMICOLON { } diff --git a/src/fsharp/service/FSharpParseFileResults.fs b/src/fsharp/service/FSharpParseFileResults.fs index 9c7e6695efb..118ae1b4fe9 100644 --- a/src/fsharp/service/FSharpParseFileResults.fs +++ b/src/fsharp/service/FSharpParseFileResults.fs @@ -137,11 +137,12 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, SyntaxTraversal.Traverse(pos, input, { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.App (_, _, SynExpr.App(_, true, SynExpr.Ident ident, _, _), argExpr, _) when rangeContainsPos argExpr.Range pos -> + | SynExpr.App (_, _, SynExpr.App(_, true, SynExpr.OperatorName operatorName, _, _), argExpr, _) when rangeContainsPos argExpr.Range pos -> match argExpr with | SynExpr.App(_, _, _, SynExpr.Paren(expr, _, _, _), _) when rangeContainsPos expr.Range pos -> None | _ -> + let ident = operatorName.Ident if ident.idText = "op_PipeRight" then Some (ident, 1) elif ident.idText = "op_PipeRight2" then @@ -172,6 +173,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, let rec getIdentRangeForFuncExprInApp traverseSynExpr expr pos = match expr with | SynExpr.Ident ident -> Some ident.idRange + + | SynExpr.OperatorName operatorName -> Some operatorName.Ident.idRange | SynExpr.LongIdent (_, _, _, range) -> Some range @@ -497,6 +500,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynExpr.LibraryOnlyStaticOptimization _ | SynExpr.Null _ | SynExpr.Ident _ + | SynExpr.OperatorName _ | SynExpr.ImplicitZero _ | SynExpr.Const _ -> () diff --git a/src/fsharp/service/ServiceInterfaceStubGenerator.fs b/src/fsharp/service/ServiceInterfaceStubGenerator.fs index a4bda5f44d1..0e45d39e465 100644 --- a/src/fsharp/service/ServiceInterfaceStubGenerator.fs +++ b/src/fsharp/service/ServiceInterfaceStubGenerator.fs @@ -125,7 +125,7 @@ type InterfaceData = Some ("'" + s.idText) | TyparStaticReq.HeadType -> Some ("^" + s.idText) - | SynType.LongIdent(LongIdentWithDots(xs, _)) -> + | SynType.LongIdent(LongIdentWithDots(xs, _, _)) -> xs |> Seq.map (fun x -> x.idText) |> String.concat "." |> Some | SynType.App(t, _, ts, _, _, isPostfix, _) -> match t, ts with @@ -503,7 +503,7 @@ module InterfaceStubGenerator = GetInterfaceMembers entity |> Seq.isEmpty let internal (|LongIdentPattern|_|) = function - | SynPat.LongIdent(longDotId=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) @@ -853,6 +853,9 @@ module InterfaceStubGenerator = | SynExpr.Ident _ident -> None + | SynExpr.OperatorName _ -> + None + | SynExpr.LongIdent (_, _longIdent, _altNameRefCell, _range) -> None diff --git a/src/fsharp/service/ServiceNavigation.fs b/src/fsharp/service/ServiceNavigation.fs index 321d1ff50cb..b47965f6726 100755 --- a/src/fsharp/service/ServiceNavigation.fs +++ b/src/fsharp/service/ServiceNavigation.fs @@ -142,7 +142,7 @@ module NavigationImpl = | _ -> synExpr.Range match synPat, memberOpt with - | SynPat.LongIdent(longDotId=LongIdentWithDots(lid,_); accessibility=access), Some(flags) when isMember -> + | SynPat.LongIdent(longDotId=LongIdentWithDots(lid,_, _); accessibility=access), Some(flags) when isMember -> let icon, kind = match flags.MemberKind with | SynMemberKind.ClassConstructor @@ -158,7 +158,7 @@ module NavigationImpl = | hd :: _ -> (lid, hd.idRange) | _ -> (lid, m) [ createMemberLid(lidShow, kind, icon, unionRanges rangeMerge m, enclosingEntityKind, isAbstract, access) ] - | SynPat.LongIdent(longDotId=LongIdentWithDots(lid,_); accessibility=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 @@ -574,10 +574,10 @@ module NavigateTo = | _ -> NavigableItemKind.ModuleValue match headPat with - | SynPat.LongIdent(longDotId=LongIdentWithDots([_; id], _)) -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([_; id], _, _)) -> // instance members addIdent kind id false container - | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _)) -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _, _)) -> // functions addIdent kind id false container | SynPat.Named (id, _, _, _) | SynPat.As(_, SynPat.Named (id, _, _, _), _) -> diff --git a/src/fsharp/service/ServiceParamInfoLocations.fs b/src/fsharp/service/ServiceParamInfoLocations.fs index b9bfc6a2b76..6f530465760 100755 --- a/src/fsharp/service/ServiceParamInfoLocations.fs +++ b/src/fsharp/service/ServiceParamInfoLocations.fs @@ -59,8 +59,9 @@ module internal ParameterLocationsImpl = // we found it, dig out ident match synExpr with | SynExpr.Ident id -> Some ([id.idText], id.idRange) - | SynExpr.LongIdent (_, LongIdentWithDots(lid, _), _, lidRange) - | SynExpr.DotGet (_, _, LongIdentWithDots(lid, _), lidRange) -> Some (pathOfLid lid, lidRange) + | SynExpr.OperatorName operatorName -> Some ([operatorName.Ident.idText], operatorName.Range) + | SynExpr.LongIdent (_, LongIdentWithDots(lid, _, _), _, lidRange) + | SynExpr.DotGet (_, _, LongIdentWithDots(lid, _, _), lidRange) -> Some (pathOfLid lid, lidRange) | SynExpr.TypeApp (synExpr, _, _synTypeList, _commas, _, _, _range) -> digOutIdentFromFuncExpr synExpr | SynExpr.Paren(expr = expr) -> digOutIdentFromFuncExpr expr | _ -> None @@ -71,8 +72,8 @@ module internal ParameterLocationsImpl = let digOutIdentFromStaticArg (StripParenTypes synType) = match synType with - | SynType.StaticConstantNamed(SynType.LongIdent(LongIdentWithDots([id], _)), _, _) -> Some id.idText - | SynType.LongIdent(LongIdentWithDots([id], _)) -> Some id.idText // NOTE: again, not a static constant, but may be a prefix of a Named in incomplete code + | SynType.StaticConstantNamed(SynType.LongIdent(LongIdentWithDots([id], _, _)), _, _) -> Some id.idText + | SynType.LongIdent(LongIdentWithDots([id], _, _)) -> Some id.idText // NOTE: again, not a static constant, but may be a prefix of a Named in incomplete code | _ -> None let getNamedParamName e = @@ -88,13 +89,13 @@ module internal ParameterLocationsImpl = | SynExpr.App (ExprAtomicFlag.NonAtomic, _, SynExpr.App (ExprAtomicFlag.NonAtomic, true, SynExpr.Ident op, - SynExpr.LongIdent (true(*isOptional*), LongIdentWithDots([n], _), _ref, _lidrange), _range), + SynExpr.LongIdent (true(*isOptional*), LongIdentWithDots([n], _, _), _ref, _lidrange), _range), _, _) when op.idText="op_Equality" -> Some n.idText | _ -> None let getTypeName synType = match synType with - | SynType.LongIdent(LongIdentWithDots(ids, _)) -> ids |> pathOfLid + | SynType.LongIdent(LongIdentWithDots(ids, _, _)) -> ids |> pathOfLid | _ -> [""] // TODO type name for other cases, see also unit test named "ParameterInfo.LocationOfParams.AfterQuicklyTyping.CallConstructorViaLongId.Bug94333" let handleSingleArg traverseSynExpr (pos, synExpr, parenRange, rpRangeOpt : _ option) = @@ -169,7 +170,7 @@ module internal ParameterLocationsImpl = let (|StaticParameters|_|) pos (StripParenTypes synType) = match synType with - | SynType.App(StripParenTypes (SynType.LongIdent(LongIdentWithDots(lid, _) as lidwd)), Some(openm), args, commas, closemOpt, _pf, wholem) -> + | SynType.App(StripParenTypes (SynType.LongIdent(LongIdentWithDots(lid, _, _) as lidwd)), Some(openm), args, commas, closemOpt, _pf, wholem) -> let lidm = lidwd.Range let betweenTheBrackets = mkRange wholem.FileName openm.Start wholem.End if SyntaxTraversal.rangeContainsPosEdgesExclusive betweenTheBrackets pos && args |> List.forall isStaticArg then diff --git a/src/fsharp/service/ServiceParseTreeWalk.fs b/src/fsharp/service/ServiceParseTreeWalk.fs index c736c4543a8..ce336f6b694 100755 --- a/src/fsharp/service/ServiceParseTreeWalk.fs +++ b/src/fsharp/service/ServiceParseTreeWalk.fs @@ -437,7 +437,7 @@ module SyntaxTraversal = | _ -> false let ok = match isPartOfArrayOrList, synExpr with - | false, SynExpr.Ident ident -> visitor.VisitRecordField(path, None, Some (LongIdentWithDots([ident], []))) + | false, SynExpr.Ident ident -> visitor.VisitRecordField(path, None, Some (LongIdentWithDots([ident], [], None))) | false, SynExpr.LongIdent (false, lidwd, _, _) -> visitor.VisitRecordField(path, None, Some lidwd) | _ -> None if ok.IsSome then ok @@ -519,6 +519,8 @@ module SyntaxTraversal = | SynExpr.Ident _ident -> None + | SynExpr.OperatorName _ -> None + | SynExpr.LongIdent (_, _longIdent, _altNameRefCell, _range) -> None | SynExpr.LongIdentSet (_longIdent, synExpr, _range) -> traverseSynExpr synExpr diff --git a/src/fsharp/service/ServiceParsedInputOps.fs b/src/fsharp/service/ServiceParsedInputOps.fs index b945de135a7..86253cd42b8 100644 --- a/src/fsharp/service/ServiceParsedInputOps.fs +++ b/src/fsharp/service/ServiceParsedInputOps.fs @@ -215,16 +215,16 @@ module ParsedInput = member _.VisitExpr(_path, traverseSynExpr, defaultTraverse, expr) = let expr = expr // fix debugger locals match expr with - | SynExpr.LongIdent (_, LongIdentWithDots(longIdent, _), _altNameRefCell, _range) -> + | SynExpr.LongIdent (_, LongIdentWithDots(longIdent, _, _), _altNameRefCell, _range) -> let _, r = CheckLongIdent longIdent Some r - | SynExpr.LongIdentSet (LongIdentWithDots(longIdent, _), synExpr, _range) -> + | SynExpr.LongIdentSet (LongIdentWithDots(longIdent, _, _), synExpr, _range) -> if SyntaxTraversal.rangeContainsPosLeftEdgeInclusive synExpr.Range pos then traverseSynExpr synExpr else let _, r = CheckLongIdent longIdent Some r - | SynExpr.DotGet (synExpr, _dotm, LongIdentWithDots(longIdent, _), _range) -> + | SynExpr.DotGet (synExpr, _dotm, LongIdentWithDots(longIdent, _, _), _range) -> if SyntaxTraversal.rangeContainsPosLeftEdgeInclusive synExpr.Range pos then traverseSynExpr synExpr else @@ -241,7 +241,7 @@ module ParsedInput = traverseSynExpr synExpr2 else Some range - | SynExpr.DotSet (synExpr, LongIdentWithDots(longIdent, _), synExpr2, _range) -> + | SynExpr.DotSet (synExpr, LongIdentWithDots(longIdent, _, _), synExpr2, _range) -> if SyntaxTraversal.rangeContainsPosLeftEdgeInclusive synExpr.Range pos then traverseSynExpr synExpr elif SyntaxTraversal.rangeContainsPosLeftEdgeInclusive synExpr2.Range pos then @@ -257,7 +257,7 @@ module ParsedInput = // ---- synExpr.Range has this value // ------ we want this value Some (unionRanges synExpr.Range r) - | SynExpr.DotNamedIndexedPropertySet (synExpr, LongIdentWithDots(longIdent, _), synExpr2, synExpr3, _range) -> + | SynExpr.DotNamedIndexedPropertySet (synExpr, LongIdentWithDots(longIdent, _, _), synExpr2, synExpr3, _range) -> if SyntaxTraversal.rangeContainsPosLeftEdgeInclusive synExpr.Range pos then traverseSynExpr synExpr elif SyntaxTraversal.rangeContainsPosLeftEdgeInclusive synExpr2.Range pos then @@ -308,9 +308,9 @@ module ParsedInput = match expr with | SynExpr.Paren (e, _, _, _) when foundCandidate -> TryGetExpression foundCandidate e - | SynExpr.LongIdent (_isOptional, LongIdentWithDots(lid, _), _altNameRefCell, _m) -> + | SynExpr.LongIdent (_isOptional, LongIdentWithDots(lid, _, _), _altNameRefCell, _m) -> getLidParts lid |> Some - | SynExpr.DotGet (leftPart, _, LongIdentWithDots(lid, _), _) when (rangeContainsPos (rangeOfLid lid) pos) || foundCandidate -> + | SynExpr.DotGet (leftPart, _, LongIdentWithDots(lid, _, _), _) when (rangeContainsPos (rangeOfLid lid) pos) || foundCandidate -> // requested position is at the lid part of the DotGet // process left part and append result to the result of processing lid let leftPartResult = TryGetExpression true leftPart @@ -370,7 +370,7 @@ module ParsedInput = // the cursor location. None else - let rec traverseLidOrElse (optExprIfLeftOfLongId : SynExpr option) (LongIdentWithDots(lid, dots) as lidwd) = + let rec traverseLidOrElse (optExprIfLeftOfLongId : SynExpr option) (LongIdentWithDots(lid, dots, _) as lidwd) = let resultIfLeftOfLongId = match optExprIfLeftOfLongId with | None -> None @@ -548,7 +548,7 @@ module ParsedInput = |> Option.orElseWith (fun () -> Option.bind walkExpr e1) and walkExprWithKind (parentKind: EntityKind option) = function - | SynExpr.LongIdent (_, LongIdentWithDots(_, dotRanges), _, r) -> + | SynExpr.LongIdent (_, LongIdentWithDots(_, dotRanges, _), _, r) -> match dotRanges with | [] when isPosInRange r -> parentKind |> Option.orElseWith (fun () -> Some (EntityKind.FunctionOrValue false)) | firstDotRange :: _ -> @@ -737,7 +737,7 @@ module ParsedInput = | Some EntityKind.Attribute -> Some CompletionContext.AttributeApplication | _ -> - let parseLid (LongIdentWithDots(lid, dots)) = + let parseLid (LongIdentWithDots(lid, dots, _)) = let rec collect plid (parts : Ident list) (dots : range list) = match parts, dots with | [], _ -> Some (plid, None) @@ -773,7 +773,7 @@ module ParsedInput = let (|Class|Interface|Struct|Unknown|Invalid|) synAttributes = let (|SynAttr|_|) name (attr : SynAttribute) = match attr with - | {TypeName = LongIdentWithDots([x], _)} when x.idText = name -> Some () + | {TypeName = LongIdentWithDots([x], _, _)} when x.idText = name -> Some () | _ -> None let rec getKind isClass isInterface isStruct = @@ -826,8 +826,8 @@ module ParsedInput = let (|Operator|_|) name e = match e with - | SynExpr.App (ExprAtomicFlag.NonAtomic, false, SynExpr.App (ExprAtomicFlag.NonAtomic, true, SynExpr.Ident ident, lhs, _), rhs, _) - when ident.idText = name -> Some (lhs, rhs) + | SynExpr.App (ExprAtomicFlag.NonAtomic, false, SynExpr.App (ExprAtomicFlag.NonAtomic, true, SynExpr.OperatorName operatorName, lhs, _), rhs, _) + when operatorName.Ident.idText = name -> Some (lhs, rhs) | _ -> None // checks if we are in a range operator @@ -1211,7 +1211,7 @@ module ParsedInput = for ident in longIdent do identsByEndPos[ident.idRange.End] <- longIdent - let addLongIdentWithDots (LongIdentWithDots (longIdent, lids) as value) = + let addLongIdentWithDots (LongIdentWithDots (longIdent, lids, _) as value) = match longIdent with | [] -> () | [_] as idents -> identsByEndPos[value.Range.End] <- idents diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index 6ade8fd9dbd..9e92b6dad9a 100644 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -2794,7 +2794,7 @@ type FSharpOpenDeclaration(target: SynOpenDeclTarget, range: range option, modul | SynOpenDeclTarget.Type(synType, _) -> let rec get ty = match ty with - | SynType.LongIdent (LongIdentWithDots(lid, _)) -> lid + | SynType.LongIdent (LongIdentWithDots(lid, _, _)) -> lid | SynType.App (ty2, _, _, _, _, _, _) -> get ty2 | SynType.LongIdentApp (ty2, _, _, _, _, _, _) -> get ty2 | SynType.Paren (ty2, _) -> get ty2 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 dc585930c99..07b083ce677 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -3442,10 +3442,10 @@ FSharp.Compiler.EditorServices.ParameterLocations FSharp.Compiler.EditorServices.ParameterLocations: Boolean IsThereACloseParen FSharp.Compiler.EditorServices.ParameterLocations: Boolean get_IsThereACloseParen() FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.EditorServices.TupledArgumentLocation[] ArgumentLocations +FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.EditorServices.TupledArgumentLocation[] get_ArgumentLocations() FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.Text.Position LongIdEndLocation FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.Text.Position LongIdStartLocation FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.Text.Position OpenParenLocation -FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.EditorServices.TupledArgumentLocation[] get_ArgumentLocations() FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.Text.Position get_LongIdEndLocation() FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.Text.Position get_LongIdStartLocation() FSharp.Compiler.EditorServices.ParameterLocations: FSharp.Compiler.Text.Position get_OpenParenLocation() @@ -4911,6 +4911,7 @@ FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSh FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue] get_EventForFSharpProperty() FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpType] FullTypeSafe FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpType] get_FullTypeSafe() +FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.TaggedText[]] GetReturnTypeLayout(FSharp.Compiler.Symbols.FSharpDisplayContext) FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue]] GetOverloads(Boolean) FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[System.Object] LiteralValue FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[System.Object] get_LiteralValue() @@ -4925,7 +4926,6 @@ FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.Collections.Generi FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpGenericParameter] get_GenericParameters() FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.Collections.Generic.IList`1[System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpParameter]] CurriedParameterGroups FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.Collections.Generic.IList`1[System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpParameter]] get_CurriedParameterGroups() -FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.TaggedText[]] GetReturnTypeLayout(FSharp.Compiler.Symbols.FSharpDisplayContext) FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.String CompiledName FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.String DisplayName FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue: System.String LogicalName @@ -5417,7 +5417,7 @@ FSharp.Compiler.Syntax.Ident: Void .ctor(System.String, FSharp.Compiler.Text.Ran FSharp.Compiler.Syntax.LongIdentWithDots FSharp.Compiler.Syntax.LongIdentWithDots: Boolean ThereIsAnExtraDotAtTheEnd FSharp.Compiler.Syntax.LongIdentWithDots: Boolean get_ThereIsAnExtraDotAtTheEnd() -FSharp.Compiler.Syntax.LongIdentWithDots: FSharp.Compiler.Syntax.LongIdentWithDots NewLongIdentWithDots(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.Syntax.LongIdentWithDots: FSharp.Compiler.Syntax.LongIdentWithDots NewLongIdentWithDots(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.OperatorName]) FSharp.Compiler.Syntax.LongIdentWithDots: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.LongIdentWithDots: FSharp.Compiler.Text.Range RangeWithoutAnyExtraDot FSharp.Compiler.Syntax.LongIdentWithDots: FSharp.Compiler.Text.Range get_Range() @@ -5430,7 +5430,51 @@ FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Collections.FSharpLis FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident] id FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] dotRanges FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] get_dotRanges() +FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.OperatorName] get_operatorName() +FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.OperatorName] operatorName FSharp.Compiler.Syntax.LongIdentWithDots: System.String ToString() +FSharp.Compiler.Syntax.OperatorName +FSharp.Compiler.Syntax.OperatorName+ActivePattern: FSharp.Compiler.Syntax.Ident get_id() +FSharp.Compiler.Syntax.OperatorName+ActivePattern: FSharp.Compiler.Syntax.Ident id +FSharp.Compiler.Syntax.OperatorName+ActivePattern: FSharp.Compiler.Text.Range get_lpr() +FSharp.Compiler.Syntax.OperatorName+ActivePattern: FSharp.Compiler.Text.Range get_rpr() +FSharp.Compiler.Syntax.OperatorName+ActivePattern: FSharp.Compiler.Text.Range lpr +FSharp.Compiler.Syntax.OperatorName+ActivePattern: FSharp.Compiler.Text.Range rpr +FSharp.Compiler.Syntax.OperatorName+Operator: FSharp.Compiler.Syntax.Ident get_id() +FSharp.Compiler.Syntax.OperatorName+Operator: FSharp.Compiler.Syntax.Ident id +FSharp.Compiler.Syntax.OperatorName+Operator: FSharp.Compiler.Text.Range get_lpr() +FSharp.Compiler.Syntax.OperatorName+Operator: FSharp.Compiler.Text.Range get_rpr() +FSharp.Compiler.Syntax.OperatorName+Operator: FSharp.Compiler.Text.Range lpr +FSharp.Compiler.Syntax.OperatorName+Operator: FSharp.Compiler.Text.Range rpr +FSharp.Compiler.Syntax.OperatorName+PartialActivePattern: FSharp.Compiler.Syntax.Ident get_id() +FSharp.Compiler.Syntax.OperatorName+PartialActivePattern: FSharp.Compiler.Syntax.Ident id +FSharp.Compiler.Syntax.OperatorName+PartialActivePattern: FSharp.Compiler.Text.Range get_lpr() +FSharp.Compiler.Syntax.OperatorName+PartialActivePattern: FSharp.Compiler.Text.Range get_rpr() +FSharp.Compiler.Syntax.OperatorName+PartialActivePattern: FSharp.Compiler.Text.Range lpr +FSharp.Compiler.Syntax.OperatorName+PartialActivePattern: FSharp.Compiler.Text.Range rpr +FSharp.Compiler.Syntax.OperatorName+Tags: Int32 ActivePattern +FSharp.Compiler.Syntax.OperatorName+Tags: Int32 Operator +FSharp.Compiler.Syntax.OperatorName+Tags: Int32 PartialActivePattern +FSharp.Compiler.Syntax.OperatorName: Boolean IsActivePattern +FSharp.Compiler.Syntax.OperatorName: Boolean IsOperator +FSharp.Compiler.Syntax.OperatorName: Boolean IsPartialActivePattern +FSharp.Compiler.Syntax.OperatorName: Boolean get_IsActivePattern() +FSharp.Compiler.Syntax.OperatorName: Boolean get_IsOperator() +FSharp.Compiler.Syntax.OperatorName: Boolean get_IsPartialActivePattern() +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.Ident Ident +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.Ident get_Ident() +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName NewActivePattern(FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName NewOperator(FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName NewPartialActivePattern(FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName+ActivePattern +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName+Operator +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName+PartialActivePattern +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Syntax.OperatorName+Tags +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.OperatorName: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Syntax.OperatorName: Int32 Tag +FSharp.Compiler.Syntax.OperatorName: Int32 get_Tag() +FSharp.Compiler.Syntax.OperatorName: System.String ToString() FSharp.Compiler.Syntax.ParsedHashDirective FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Syntax.ParsedHashDirective NewParsedHashDirective(System.String, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.ParsedHashDirectiveArgument], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Text.Range get_range() @@ -6603,6 +6647,8 @@ FSharp.Compiler.Syntax.SynExpr+ObjExpr: Microsoft.FSharp.Core.FSharpOption`1[FSh 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+OperatorName: FSharp.Compiler.Syntax.OperatorName get_operatorName() +FSharp.Compiler.Syntax.SynExpr+OperatorName: FSharp.Compiler.Syntax.OperatorName operatorName FSharp.Compiler.Syntax.SynExpr+Paren: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+Paren: FSharp.Compiler.Syntax.SynExpr get_expr() FSharp.Compiler.Syntax.SynExpr+Paren: FSharp.Compiler.Text.Range get_leftParenRange() @@ -6704,6 +6750,7 @@ FSharp.Compiler.Syntax.SynExpr+Tags: Int32 NamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 New FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Null FSharp.Compiler.Syntax.SynExpr+Tags: Int32 ObjExpr +FSharp.Compiler.Syntax.SynExpr+Tags: Int32 OperatorName FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Paren FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Quote FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Record @@ -6863,6 +6910,7 @@ FSharp.Compiler.Syntax.SynExpr: Boolean IsNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr: Boolean IsNew FSharp.Compiler.Syntax.SynExpr: Boolean IsNull FSharp.Compiler.Syntax.SynExpr: Boolean IsObjExpr +FSharp.Compiler.Syntax.SynExpr: Boolean IsOperatorName FSharp.Compiler.Syntax.SynExpr: Boolean IsParen FSharp.Compiler.Syntax.SynExpr: Boolean IsQuote FSharp.Compiler.Syntax.SynExpr: Boolean IsRecord @@ -6930,6 +6978,7 @@ FSharp.Compiler.Syntax.SynExpr: Boolean get_IsNamedIndexedPropertySet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsNew() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsNull() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsObjExpr() +FSharp.Compiler.Syntax.SynExpr: Boolean get_IsOperatorName() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsParen() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsQuote() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsRecord() @@ -6996,6 +7045,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewNamedIndexedPr 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.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMemberDefn], 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 NewOperatorName(FSharp.Compiler.Syntax.OperatorName) 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) @@ -7062,6 +7112,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+NamedIndexedPrope FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+New FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Null FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+ObjExpr +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+OperatorName FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Paren FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Quote FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Record @@ -7548,14 +7599,14 @@ FSharp.Compiler.Syntax.SynModuleDecl+Attributes: FSharp.Compiler.Text.Range get_ FSharp.Compiler.Syntax.SynModuleDecl+Attributes: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynModuleDecl+Attributes: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes FSharp.Compiler.Syntax.SynModuleDecl+Attributes: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() -FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Syntax.SynExpr expr -FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Syntax.SynExpr get_expr() -FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Text.Range get_range() -FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynModuleDecl+Exception: FSharp.Compiler.Syntax.SynExceptionDefn exnDefn FSharp.Compiler.Syntax.SynModuleDecl+Exception: FSharp.Compiler.Syntax.SynExceptionDefn get_exnDefn() FSharp.Compiler.Syntax.SynModuleDecl+Exception: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynModuleDecl+Exception: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Syntax.SynExpr expr +FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Syntax.SynExpr get_expr() +FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynModuleDecl+Expr: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynModuleDecl+HashDirective: FSharp.Compiler.Syntax.ParsedHashDirective get_hashDirective() FSharp.Compiler.Syntax.SynModuleDecl+HashDirective: FSharp.Compiler.Syntax.ParsedHashDirective hashDirective FSharp.Compiler.Syntax.SynModuleDecl+HashDirective: FSharp.Compiler.Text.Range get_range() @@ -7591,8 +7642,8 @@ FSharp.Compiler.Syntax.SynModuleDecl+Open: FSharp.Compiler.Syntax.SynOpenDeclTar FSharp.Compiler.Syntax.SynModuleDecl+Open: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynModuleDecl+Open: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 Attributes -FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 Expr FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 Exception +FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 Expr FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 HashDirective FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 Let FSharp.Compiler.Syntax.SynModuleDecl+Tags: Int32 ModuleAbbrev @@ -7605,8 +7656,8 @@ FSharp.Compiler.Syntax.SynModuleDecl+Types: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynModuleDecl+Types: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeDefn] get_typeDefns() FSharp.Compiler.Syntax.SynModuleDecl+Types: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeDefn] typeDefns FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsAttributes -FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsExpr FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsException +FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsExpr FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsHashDirective FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsLet FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsModuleAbbrev @@ -7615,8 +7666,8 @@ FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsNestedModule FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsOpen FSharp.Compiler.Syntax.SynModuleDecl: Boolean IsTypes FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsAttributes() -FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsExpr() FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsException() +FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsExpr() FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsHashDirective() FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsLet() FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsModuleAbbrev() @@ -7625,8 +7676,8 @@ FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsNestedModule() FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsOpen() FSharp.Compiler.Syntax.SynModuleDecl: Boolean get_IsTypes() FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewAttributes(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewException(FSharp.Compiler.Syntax.SynExceptionDefn, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewHashDirective(FSharp.Compiler.Syntax.ParsedHashDirective, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewLet(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewModuleAbbrev(FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Text.Range) @@ -7635,8 +7686,8 @@ FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewNe FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewOpen(FSharp.Compiler.Syntax.SynOpenDeclTarget, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl NewTypes(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeDefn], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+Attributes -FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+Expr FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+Exception +FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+Expr FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+HashDirective FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+Let FSharp.Compiler.Syntax.SynModuleDecl: FSharp.Compiler.Syntax.SynModuleDecl+ModuleAbbrev @@ -8962,7 +9013,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], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], 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, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.OperatorName], 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 @@ -8975,6 +9026,8 @@ FSharp.Compiler.Syntax.SynValSig: Int32 Tag FSharp.Compiler.Syntax.SynValSig: Int32 get_Tag() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() +FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.OperatorName] get_operatorName() +FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.OperatorName] operatorName FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility 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() diff --git a/tests/service/InteractiveCheckerTests.fs b/tests/service/InteractiveCheckerTests.fs index b5b74134bd5..e35fbebd8a4 100644 --- a/tests/service/InteractiveCheckerTests.fs +++ b/tests/service/InteractiveCheckerTests.fs @@ -18,7 +18,7 @@ open FSharp.Compiler.Text.Range let internal longIdentToString (longIdent: LongIdent) = String.Join(".", longIdent |> List.map (fun ident -> ident.ToString())) -let internal longIdentWithDotsToString (LongIdentWithDots (longIdent, _)) = longIdentToString longIdent +let internal longIdentWithDotsToString (LongIdentWithDots (longIdent, _, _)) = longIdentToString longIdent let internal posToTuple (pos: pos) = (pos.Line, pos.Column) let internal rangeToTuple (range: range) = (posToTuple range.Start, posToTuple range.End) diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 44011924776..9e67ab73c1e 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -3795,3 +3795,198 @@ let x = assertRange (7, 4) (7, 27) m3 | _ -> Assert.Fail "Could not get valid AST" + +module OperatorName = + [] + let ``operator as function`` () = + let ast = """ +(+) 3 4 +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Expr (expr = SynExpr.App(funcExpr = SynExpr.App(funcExpr = SynExpr.OperatorName(OperatorName.Operator(lpr, ident, rpr))))) + ]) + ])) -> + assertRange (2, 0) (2, 1) lpr + Assert.AreEqual("op_Addition", ident.idText) + assertRange (2, 2) (2, 3) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``active pattern as function `` () = + let ast = """ +(|Odd|Even|) 4 +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Expr (expr = SynExpr.App(funcExpr = SynExpr.OperatorName(OperatorName.ActivePattern(lpr, ident, rpr)))) + ]) + ])) -> + assertRange (2, 0) (2, 1) lpr + Assert.AreEqual("|Odd|Even|", ident.idText) + assertRange (2, 11) (2, 12) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``partial active pattern as function `` () = + let ast = """ +(|Odd|_|) 4 +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Expr (expr = SynExpr.App(funcExpr = SynExpr.OperatorName(OperatorName.PartialActivePattern(lpr, ident, rpr)))) + ]) + ])) -> + assertRange (2, 0) (2, 1) lpr + Assert.AreEqual("|Odd|_|", ident.idText) + assertRange (2, 8) (2, 9) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``custom operator definition`` () = + let ast = """ +let (+) a b = a + b +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [SynBinding(headPat=SynPat.LongIdent(longDotId=LongIdentWithDots(operatorName=Some(OperatorName.Operator(lpr, ident, rpr)))))]) + + ]) + ])) -> + assertRange (2, 4) (2, 5) lpr + Assert.AreEqual("op_Addition", ident.idText) + assertRange (2, 6) (2, 7) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``active pattern definition`` () = + let ast = """ +let (|Odd|Even|) (a: int) = if a % 2 = 0 then Even else Odd +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [SynBinding(headPat=SynPat.LongIdent(longDotId=LongIdentWithDots(operatorName=Some(OperatorName.ActivePattern(lpr, ident, rpr)))))]) + + ]) + ])) -> + assertRange (2, 4) (2, 5) lpr + Assert.AreEqual("|Odd|Even|", ident.idText) + assertRange (2, 15) (2, 16) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``partial active pattern definition`` () = + let ast = """ +let (|Int32Const|_|) (a: SynConst) = match a with SynConst.Int32 _ -> Some a | _ -> None +""" + |> getParseResults + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [SynBinding(headPat=SynPat.LongIdent(longDotId=LongIdentWithDots(operatorName=Some(OperatorName.PartialActivePattern(lpr, ident, rpr)))))]) + + ]) + ])) -> + assertRange (2, 4) (2, 5) lpr + Assert.AreEqual("|Int32Const|_|", ident.idText) + assertRange (2, 19) (2, 20) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``operator name in SynValSig`` () = + let ast = """ +module IntrinsicOperators + +val (&): e1: bool -> e2: bool -> bool +""" + |> getParseResultsOfSignatureFile + + match ast with + | ParsedInput.SigFile(ParsedSigFileInput(modules = [ + SynModuleOrNamespaceSig(decls = [ + SynModuleSigDecl.Val(valSig = SynValSig(operatorName=Some(OperatorName.Operator(lpr, ident, rpr)))) + ]) + ])) -> + assertRange (4, 4) (4, 5) lpr + Assert.AreEqual("op_Amp", ident.idText) + assertRange (4, 6) (4, 7) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + [] + let ``operator name in val constraint`` () = + let ast = + getParseResultsOfSignatureFile """ + [] + module Operators + + /// Overloaded unary negation. + /// + /// The value to negate. + /// + /// The result of the operation. + /// + /// + /// + val inline (~-): n: ^T -> ^T when ^T: (static member ( ~- ): ^T -> ^T) and default ^T: int +""" + + match ast with + | ParsedInput.SigFile(ParsedSigFileInput(modules = [ + SynModuleOrNamespaceSig(decls = [ + SynModuleSigDecl.Val(valSig = SynValSig(synType=SynType.WithGlobalConstraints(constraints=[ + SynTypeConstraint.WhereTyparSupportsMember(memberSig=SynMemberSig.Member(memberSig=SynValSig(operatorName=Some(OperatorName.Operator(lpr, ident, rpr))))) + SynTypeConstraint.WhereTyparDefaultsToType _ + ]))) + ]) + ])) -> + assertRange (13, 57) (13, 58) lpr + Assert.AreEqual("op_UnaryNegation", ident.idText) + assertRange (13, 62) (13, 63) rpr + | _ -> + Assert.Fail "Could not get valid AST" + + // TODO: should this also contain SynExpr.OperatorName + // Ident was compiled and this information is now lost + + [] + [] + let ``named parameter`` () = + let ast = getParseResults """ +f(x=4) +""" + + match ast with + | ParsedInput.ImplFile(ParsedImplFileInput(modules = [ + SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Expr(expr = SynExpr.App(argExpr = SynExpr.Paren(expr = SynExpr.App(funcExpr= + SynExpr.App(funcExpr=SynExpr.OperatorName(OperatorName.Operator(lpr, ident, rpr))))))) + ]) + ])) -> + assertRange (2, 1) (2, 2) lpr + Assert.AreEqual("op_Equality", ident.idText) + assertRange (2, 5) (2, 6) rpr + | _ -> + Assert.Fail $"Could not get valid AST, got {ast}" \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/Common/FSharpCodeAnalysisExtensions.fs b/vsintegration/src/FSharp.Editor/Common/FSharpCodeAnalysisExtensions.fs index 02029e11f21..73060926150 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(longDotId=LongIdentWithDots([id], _)) when id.idText.StartsWith("op_") -> + | SynPat.LongIdent(longDotId=LongIdentWithDots([id], _, Some (OperatorName.Operator _))) -> if Position.posEq id.idRange.Start pos then Some binding.RangeOfBindingWithRhs else