diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md index 14fdea1517b..204727757db 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -26,6 +26,7 @@ ### Changed * Use `errorR` instead of `error` in `CheckDeclarations.fs` when possible. ([PR #18645](https://github.com/dotnet/fsharp/pull/18645)) +* Parser: Capture named fields block separators. ([PR #18857](https://github.com/dotnet/fsharp/pull/18857)) * Type checker: use inner expr range in upcast constraints errors ([PR #18850](https://github.com/dotnet/fsharp/pull/18850)) ### Breaking Changes diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index 9665bfd2463..b7ad664fc6f 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -457,7 +457,13 @@ and TcPatArrayOrList warnOnUpper cenv env vFlags patEnv ty isArray args m = phase2, acc and TcRecordPat warnOnUpper (cenv: cenv) env vFlags patEnv ty fieldPats m = - let fieldPats = fieldPats |> List.map (fun (fieldId, _, fieldPat) -> fieldId, fieldPat) + let fieldPats = + fieldPats + |> List.map (fun (NamePatPairField(fieldName = fieldLid; pat = pat)) -> + match fieldLid.LongIdent with + | [id] -> ([], id), pat + | lid -> List.frontAndBack lid, pat) + match BuildFieldMap cenv env false ty fieldPats m with | None -> (fun _ -> TPat_error m), patEnv | Some(tinst, tcref, fldsmap, _fldsList) -> @@ -503,7 +509,9 @@ and CheckNoArgsForLiteral args m = and GetSynArgPatterns args = match args with | SynArgPats.Pats args -> args - | SynArgPats.NamePatPairs (pats = pairs) -> List.map (fun (_, _, pat) -> pat) pairs + | SynArgPats.NamePatPairs (pats = pairs) -> + pairs + |> List.map _.Pattern and TcArgPats warnOnUpper (cenv: cenv) env vFlags patEnv args = let g = cenv.g @@ -657,7 +665,11 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m let result = Array.zeroCreate numArgTys let extraPatterns = List () - for id, _, pat in pairs do + for NamePatPairField(fieldName = fieldLid; pat = pat) in pairs do + let id = + match fieldLid.LongIdent with + | [id] -> id + | lid -> snd (List.frontAndBack lid) match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.Id.idText) with | None -> extraPatterns.Add pat diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index 97fd2e3d987..efa1b935fc8 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -622,20 +622,9 @@ let visitPat (p: SynPat) : FileContentEntry list = let continuations = List.map visit elementPats Continuation.concatenate continuations continuation | SynPat.Record(fieldPats, _) -> - let pats = List.map (fun (_, _, p) -> p) fieldPats - - let lids = - [ - for (l, _), _, _ in fieldPats do - yield! visitLongIdent l - ] - + let pats = fieldPats |> List.map (fun f -> f.Pattern) let continuations = List.map visit pats - - let finalContinuation nodes = - [ yield! List.concat nodes; yield! lids ] |> continuation - - Continuation.sequence continuations finalContinuation + Continuation.concatenate continuations continuation | SynPat.Null _ -> continuation [] | SynPat.OptionalVal _ -> continuation [] | SynPat.IsInst(t, _) -> continuation (visitSynType t) @@ -650,8 +639,8 @@ let visitSynArgPats (argPat: SynArgPats) = | SynArgPats.Pats args -> List.collect visitPat args | SynArgPats.NamePatPairs(pats = pats) -> [ - for _, _, p in pats do - yield! visitPat p + for p in pats do + yield! visitPat p.Pattern ] let visitSynSimplePat (pat: SynSimplePat) = diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index da7f1aaadc2..133df625a8a 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -772,7 +772,7 @@ module SyntaxTraversal = | SynPat.Ands(ps, _) | SynPat.Tuple(elementPats = ps) | SynPat.ArrayOrList(_, ps, _) -> ps |> List.tryPick (traversePat path) - | SynPat.Record(fieldPats = fieldPats) -> fieldPats |> List.tryPick (fun (_, _, p) -> traversePat path p) + | SynPat.Record(fieldPats = fieldPats) -> fieldPats |> List.tryPick (fun x -> traversePat path x.Pattern) | SynPat.Attrib(p, attributes, m) -> match traversePat path p with | None -> attributeApplicationDives path attributes |> pick m attributes @@ -780,7 +780,7 @@ module SyntaxTraversal = | SynPat.LongIdent(argPats = args) -> match args with | SynArgPats.Pats ps -> ps |> List.tryPick (traversePat path) - | SynArgPats.NamePatPairs(pats = ps) -> ps |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat path) + | SynArgPats.NamePatPairs(pats = ps) -> ps |> List.tryPick (fun x -> traversePat path x.Pattern) | SynPat.Typed(p, ty, _) -> match traversePat path p with | None -> traverseSynType path ty diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 4b5e3cf9028..583c7c0f992 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -613,7 +613,7 @@ module ParsedInput = let (|ConstructorPats|) pats = match pats with | SynArgPats.Pats ps -> ps - | SynArgPats.NamePatPairs(pats = xs) -> List.map (fun (_, _, pat) -> pat) xs + | SynArgPats.NamePatPairs(pats = xs) -> xs |> List.map _.Pattern let inline isPosInRange range = rangeContainsPos range pos @@ -1120,6 +1120,8 @@ module ParsedInput = let last = List.last lid.LongIdent last.idRange.End + let lastIdentOfSynLongIdent (lid: SynLongIdent) = List.last lid.LongIdent + let endOfClosingTokenOrLastIdent (mClosing: range option) (lid: SynLongIdent) = match mClosing with | Some m -> m.End @@ -1293,18 +1295,24 @@ module ParsedInput = rangeContainsPos m pos -> pats - |> List.tryPick (fun (fieldId, _, pat) -> - if rangeContainsPos fieldId.idRange pos then - let referencedFields = pats |> List.map (fun (id, _, _) -> id.idText) + |> List.tryPick (fun field -> + if rangeContainsPos field.FieldName.Range pos then + let referencedFields = + pats |> List.map (fun f -> (lastIdentOfSynLongIdent f.FieldName).idText) + Some(CompletionContext.Pattern(PatternContext.UnionCaseFieldIdentifier(referencedFields, caseId.Range))) else - let context = Some(PatternContext.NamedUnionCaseField(fieldId.idText, caseId.Range)) - TryGetCompletionContextInPattern suppressIdentifierCompletions pat context pos) + let lastId = lastIdentOfSynLongIdent field.FieldName + let context = Some(PatternContext.NamedUnionCaseField(lastId.idText, caseId.Range)) + + TryGetCompletionContextInPattern suppressIdentifierCompletions field.Pattern context pos) |> Option.orElseWith (fun () -> // Last resort - check for fun (Case (item1 = a; | )) -> // That is, pos is after the last pair and still within parentheses if rangeBeforePos mPairs pos then - let referencedFields = pats |> List.map (fun (id, _, _) -> id.idText) + let referencedFields = + pats |> List.map (fun f -> (lastIdentOfSynLongIdent f.FieldName).idText) + Some(CompletionContext.Pattern(PatternContext.UnionCaseFieldIdentifier(referencedFields, caseId.Range))) else None) @@ -1335,9 +1343,17 @@ module ParsedInput = |> List.tryPick (fun pat -> TryGetCompletionContextInPattern false pat None pos) | SynPat.Record(fieldPats = pats; range = m) when rangeContainsPos m pos -> pats - |> List.tryPick (fun ((_, fieldId), _, pat) -> - if rangeContainsPos fieldId.idRange pos then - let referencedFields = pats |> List.map (fun ((_, x), _, _) -> x.idText, x.idRange) + |> List.tryPick (fun f -> + let fieldId = f.FieldName + let pat = f.Pattern + + if rangeContainsPos fieldId.Range pos then + let referencedFields = + pats + |> List.map (fun f -> + let lastId = lastIdentOfSynLongIdent f.FieldName + lastId.idText, lastId.idRange) + Some(CompletionContext.Pattern(PatternContext.RecordFieldIdentifier referencedFields)) elif rangeContainsPos pat.Range pos then TryGetCompletionContextInPattern false pat None pos @@ -1348,13 +1364,22 @@ module ParsedInput = // That is, pos is after the last field and still within braces if pats - |> List.forall (fun (_, mEquals, pat) -> - match mEquals, pat with + |> List.forall (fun f -> + let mEqualsOpt = + match f with + | NamePatPairField(equalsRange = m) -> m + + match mEqualsOpt, f.Pattern with | Some mEquals, SynPat.Wild mPat -> rangeBeforePos mEquals pos && mPat.StartColumn <> mPat.EndColumn | Some mEquals, _ -> rangeBeforePos mEquals pos | _ -> false) then - let referencedFields = pats |> List.map (fun ((_, x), _, _) -> x.idText, x.idRange) + let referencedFields = + pats + |> List.map (fun f -> + let lastId = lastIdentOfSynLongIdent f.FieldName + lastId.idText, lastId.idRange) + Some(CompletionContext.Pattern(PatternContext.RecordFieldIdentifier referencedFields)) else Some(CompletionContext.Pattern PatternContext.Other)) @@ -1870,7 +1895,7 @@ module ParsedInput = let (|ConstructorPats|) pats = match pats with | SynArgPats.Pats ps -> ps - | SynArgPats.NamePatPairs(pats = xs) -> List.map (fun (_, _, pat) -> pat) xs + | SynArgPats.NamePatPairs(pats = xs) -> xs |> List.map _.Pattern /// Returns all `Ident`s and `LongIdent`s found in an untyped AST. let getLongIdents (parsedInput: ParsedInput) : IDictionary = diff --git a/src/Compiler/Service/ServiceXmlDocParser.fs b/src/Compiler/Service/ServiceXmlDocParser.fs index 1c1e7ef4184..e77ba1cbab9 100644 --- a/src/Compiler/Service/ServiceXmlDocParser.fs +++ b/src/Compiler/Service/ServiceXmlDocParser.fs @@ -16,7 +16,7 @@ module XmlDocParsing = let (|ConstructorPats|) = function | SynArgPats.Pats ps -> ps - | SynArgPats.NamePatPairs(pats = xs) -> List.map (fun (_, _, pat) -> pat) xs + | SynArgPats.NamePatPairs(pats = xs) -> xs |> List.map _.Pattern let rec digNamesFrom pat = match pat with diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index ca71014c79c..c41e483e27a 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -920,16 +920,37 @@ type SynSimplePats = match x with | SynSimplePats.SimplePats(range = range) -> range +[] +type NamePatPairField = + | NamePatPairField of + fieldName: SynLongIdent * + equalsRange: range option * + range: range * + pat: SynPat * + blockSeparator: BlockSeparator option + + member this.FieldName = + match this with + | NamePatPairField(fieldName = n) -> n + + member this.Range = + match this with + | NamePatPairField(range = m) -> m + + member this.Pattern = + match this with + | NamePatPairField(pat = pat) -> pat + [] type SynArgPats = | Pats of pats: SynPat list - | NamePatPairs of pats: (Ident * range option * SynPat) list * range: range * trivia: SynArgPatsNamePatPairsTrivia + | NamePatPairs of pats: NamePatPairField list * range: range * trivia: SynArgPatsNamePatPairsTrivia member x.Patterns = match x with | Pats pats -> pats - | NamePatPairs(pats = pats) -> pats |> List.map (fun (_, _, pat) -> pat) + | NamePatPairs(pats = pats) -> pats |> List.map _.Pattern [] type SynPat = @@ -966,7 +987,7 @@ type SynPat = | ArrayOrList of isArray: bool * elementPats: SynPat list * range: range - | Record of fieldPats: ((LongIdent * Ident) * range option * SynPat) list * range: range + | Record of fieldPats: NamePatPairField list * range: range | Null of range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 131c8f6f056..819b0b384f2 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1046,12 +1046,36 @@ type SynSimplePats = member Range: range +/// Represents a single named argument pattern a pair of the form `name = pattern`. +[] +type NamePatPairField = + | NamePatPairField of + /// The identifier of the named field/parameter. + fieldName: SynLongIdent * + /// The range of the equals sign in `name = pattern`, if present. + equalsRange: range option * + /// The overall range of this name–pattern pair. Starts with `fieldName`'s range and ends with `pat`s range. + range: range * + /// The pattern associated with the named field. + pat: SynPat * + /// The separator trivia that follows this pair (e.g., semicolon or block separator), if any. + blockSeparator: BlockSeparator option + + /// Gets the identifier of the named field/parameter. + member FieldName: SynLongIdent + + /// Gets the overall range of this name–pattern pair, if available. + member Range: range + + /// Gets the pattern associated with the named field. + member Pattern: SynPat + /// Represents a syntax tree for arguments patterns [] type SynArgPats = | Pats of pats: SynPat list - | NamePatPairs of pats: (Ident * range option * SynPat) list * range: range * trivia: SynArgPatsNamePatPairsTrivia + | NamePatPairs of pats: NamePatPairField list * range: range * trivia: SynArgPatsNamePatPairsTrivia member Patterns: SynPat list @@ -1105,7 +1129,7 @@ type SynPat = | ArrayOrList of isArray: bool * elementPats: SynPat list * range: range /// A record pattern - | Record of fieldPats: ((LongIdent * Ident) * range option * SynPat) list * range: range + | Record of fieldPats: NamePatPairField list * range: range /// The 'null' pattern | Null of range: range diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 99da176d18e..172bd9683e3 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -3658,15 +3658,24 @@ conjPatternElements: { $3 :: $1 :: [] } namePatPairs: - | namePatPair opt_seps - { [$1] } - - | namePatPair seps namePatPairs - { $1 :: $3 } - - | namePatPair seps seps namePatPairs + | namePatPair opt_seps_block + { let (id: Ident), mEq, (pat: SynPat) = $1 + let m = unionRanges id.idRange pat.Range + let lid = SynLongIdent([id], [], [None]) + [ NamePatPairField(lid, mEq, m, pat, $2) ] } + + | namePatPair seps_block namePatPairs + { let (id: Ident), mEq, (pat: SynPat) = $1 + let m = unionRanges id.idRange pat.Range + let lid = SynLongIdent([id], [], [None]) + NamePatPairField(lid, mEq, m, pat, Some $2) :: $3 } + + | namePatPair seps_block seps_block namePatPairs { reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsExpectingPattern ()) - ($1 :: $4) } + let (id: Ident), mEq, (pat: SynPat) = $1 + let m = unionRanges id.idRange pat.Range + let lid = SynLongIdent([id], [], [None]) + NamePatPairField(lid, mEq, m, pat, Some $2) :: $4 } namePatPair: | ident EQUALS parenPattern @@ -3999,28 +4008,33 @@ conjParenPatternElements: { $3 :: $1 :: [] } recordPatternElementsAux: - | recordPatternElement opt_seps - { [$1] } + | recordPatternElement opt_seps_block + { let (lid: SynLongIdent), mEq, (pat: SynPat) = $1 + let m = unionRanges lid.Range pat.Range + [ NamePatPairField(lid, mEq, m, pat, $2) ] } - | recordPatternElement seps recordPatternElementsAux - { $1 :: $3 } + | recordPatternElement seps_block recordPatternElementsAux + { let (lid: SynLongIdent), mEq, (pat: SynPat) = $1 + let m = unionRanges lid.Range pat.Range + NamePatPairField(lid, mEq, m, pat, Some $2) :: $3 } + + | recordPatternElement seps_block seps_block recordPatternElementsAux + { reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsExpectingPattern ()) + let (lid: SynLongIdent), mEq, (pat: SynPat) = $1 + let m = unionRanges lid.Range pat.Range + NamePatPairField(lid, mEq, m, pat, Some $2) :: $4 } recordPatternElement: | path EQUALS parenPattern - { let mPath = $1.Range - let mEquals = rhs parseState 2 - let mPat = $3.Range - List.frontAndBack $1.LongIdent, Some mEquals, $3 } + { let mEquals = rhs parseState 2 + $1, Some mEquals, $3 } | path EQUALS recover - { let mPath = $1.Range - let mEquals = rhs parseState 2 - let pat = SynPat.Wild(mEquals.EndRange) - List.frontAndBack $1.LongIdent, Some mEquals, pat } + { let mEquals = rhs parseState 2 + $1, Some mEquals, patFromParseError (SynPat.Wild mEquals.EndRange) } | path recover - { let pat = SynPat.Wild($1.Range.EndRange) - List.frontAndBack $1.LongIdent, None, pat } + { $1, None, patFromParseError (SynPat.Wild $1.Range.EndRange) } listPatternElements: | /* EMPTY */ @@ -5659,7 +5673,7 @@ optInlineAssemblyReturnTypes: { [] } recdExpr: - | INHERIT atomTypeNonAtomicDeprecated opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType recdExprBindings opt_seps_recd + | INHERIT atomTypeNonAtomicDeprecated opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType recdExprBindings opt_seps_block { let arg = match $4 with None -> mkSynUnit (lhs parseState) | Some e -> e let l = List.rev $5 let dummyField = mkRecdField (SynLongIdent([], [], [])) // dummy identifier, it will be discarded @@ -5673,7 +5687,7 @@ recdExpr: None, a, b } recdExprCore: - | appExpr EQUALS declExprBlock recdExprBindings opt_seps_recd + | appExpr EQUALS declExprBlock recdExprBindings opt_seps_block { match $1 with | LongOrSingleIdent(false, (SynLongIdent _ as f), None, m) -> let f = mkRecdField f @@ -5717,7 +5731,7 @@ recdExprCore: (None, [ SynExprRecordField(f, Some mEquals, None, (rhs2 parseState 1 2), None) ]) } - | UNDERSCORE EQUALS declExprBlock recdExprBindings opt_seps_recd + | UNDERSCORE EQUALS declExprBlock recdExprBindings opt_seps_block { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnderscoreInvalidFieldName()) let f = mkUnderscoreRecdField (rhs parseState 1) let mEquals = rhs parseState 2 @@ -5726,27 +5740,27 @@ recdExprCore: (None, l) } /* handles case like {x with} */ - | appExpr WITH recdBinding recdExprBindings opt_seps_recd + | appExpr WITH recdBinding recdExprBindings opt_seps_block { let l = List.rev $4 let l = rebindRanges $3 l $5 (Some($1, (rhs parseState 2, None)), l) } - | appExpr OWITH opt_seps_recd OEND + | appExpr OWITH opt_seps_block OEND { (Some($1, (rhs parseState 2, None)), []) } - | appExpr OWITH recdBinding recdExprBindings opt_seps_recd OEND + | appExpr OWITH recdBinding recdExprBindings opt_seps_block OEND { let l = List.rev $4 let l = rebindRanges $3 l $5 (Some($1, (rhs parseState 2, None)), l) } -opt_seps_recd: - | seps_recd +opt_seps_block: + | seps_block { Some $1 } | /* EMPTY */ { None } -seps_recd: +seps_block: | OBLOCKSEP { (rhs parseState 1), None } @@ -5772,7 +5786,7 @@ pathOrUnderscore : mkUnderscoreRecdField m } recdExprBindings: - | recdExprBindings seps_recd recdBinding + | recdExprBindings seps_block recdBinding { ($3, Some $2) :: $1 } | /* EMPTY */ diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 32cad895835..bc08c7fd0bd 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -6158,6 +6158,26 @@ FSharp.Compiler.Syntax.Ident: System.String ToString() FSharp.Compiler.Syntax.Ident: System.String get_idText() FSharp.Compiler.Syntax.Ident: System.String idText FSharp.Compiler.Syntax.Ident: Void .ctor(System.String, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.NamePatPairField NewNamePatPairField(FSharp.Compiler.Syntax.SynLongIdent, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynPat, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]]) +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent FieldName +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent fieldName +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent get_FieldName() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent get_fieldName() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat Pattern +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat get_Pattern() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat get_pat() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat pat +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.NamePatPairField: Int32 Tag +FSharp.Compiler.Syntax.NamePatPairField: Int32 get_Tag() +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] equalsRange +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_equalsRange() +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]] blockSeparator +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]] get_blockSeparator() +FSharp.Compiler.Syntax.NamePatPairField: System.String ToString() 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() FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Text.Range range @@ -6545,8 +6565,8 @@ FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.SyntaxTrivia.Syn FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia trivia FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] get_pats() -FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] pats +FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] get_pats() +FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] pats FSharp.Compiler.Syntax.SynArgPats+Pats: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat] get_pats() FSharp.Compiler.Syntax.SynArgPats+Pats: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat] pats FSharp.Compiler.Syntax.SynArgPats+Tags: Int32 NamePatPairs @@ -6555,7 +6575,7 @@ FSharp.Compiler.Syntax.SynArgPats: Boolean IsNamePatPairs FSharp.Compiler.Syntax.SynArgPats: Boolean IsPats FSharp.Compiler.Syntax.SynArgPats: Boolean get_IsNamePatPairs() FSharp.Compiler.Syntax.SynArgPats: Boolean get_IsPats() -FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewNamePatPairs(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia) +FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewNamePatPairs(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia) FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewPats(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat]) FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats+NamePatPairs FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats+Pats @@ -8760,8 +8780,8 @@ FSharp.Compiler.Syntax.SynPat+QuoteExpr: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynPat+QuoteExpr: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynPat+Record: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynPat+Record: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident],FSharp.Compiler.Syntax.Ident],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] fieldPats -FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident],FSharp.Compiler.Syntax.Ident],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] get_fieldPats() +FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] fieldPats +FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] get_fieldPats() FSharp.Compiler.Syntax.SynPat+Tags: Int32 Ands FSharp.Compiler.Syntax.SynPat+Tags: Int32 ArrayOrList FSharp.Compiler.Syntax.SynPat+Tags: Int32 As @@ -8854,7 +8874,7 @@ FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewOptionalVal(FSha FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewOr(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynPatOrTrivia) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewParen(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewQuoteExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewRecord(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident],FSharp.Compiler.Syntax.Ident],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewRecord(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewTyped(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewWild(FSharp.Compiler.Text.Range) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 32cad895835..bc08c7fd0bd 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -6158,6 +6158,26 @@ FSharp.Compiler.Syntax.Ident: System.String ToString() FSharp.Compiler.Syntax.Ident: System.String get_idText() FSharp.Compiler.Syntax.Ident: System.String idText FSharp.Compiler.Syntax.Ident: Void .ctor(System.String, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.NamePatPairField NewNamePatPairField(FSharp.Compiler.Syntax.SynLongIdent, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynPat, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]]) +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent FieldName +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent fieldName +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent get_FieldName() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynLongIdent get_fieldName() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat Pattern +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat get_Pattern() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat get_pat() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Syntax.SynPat pat +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.NamePatPairField: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.NamePatPairField: Int32 Tag +FSharp.Compiler.Syntax.NamePatPairField: Int32 get_Tag() +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] equalsRange +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_equalsRange() +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]] blockSeparator +FSharp.Compiler.Syntax.NamePatPairField: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Range,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position]]] get_blockSeparator() +FSharp.Compiler.Syntax.NamePatPairField: System.String ToString() 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() FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Text.Range range @@ -6545,8 +6565,8 @@ FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.SyntaxTrivia.Syn FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia trivia FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] get_pats() -FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] pats +FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] get_pats() +FSharp.Compiler.Syntax.SynArgPats+NamePatPairs: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] pats FSharp.Compiler.Syntax.SynArgPats+Pats: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat] get_pats() FSharp.Compiler.Syntax.SynArgPats+Pats: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat] pats FSharp.Compiler.Syntax.SynArgPats+Tags: Int32 NamePatPairs @@ -6555,7 +6575,7 @@ FSharp.Compiler.Syntax.SynArgPats: Boolean IsNamePatPairs FSharp.Compiler.Syntax.SynArgPats: Boolean IsPats FSharp.Compiler.Syntax.SynArgPats: Boolean get_IsNamePatPairs() FSharp.Compiler.Syntax.SynArgPats: Boolean get_IsPats() -FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewNamePatPairs(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[FSharp.Compiler.Syntax.Ident,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia) +FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewNamePatPairs(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynArgPatsNamePatPairsTrivia) FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats NewPats(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat]) FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats+NamePatPairs FSharp.Compiler.Syntax.SynArgPats: FSharp.Compiler.Syntax.SynArgPats+Pats @@ -8760,8 +8780,8 @@ FSharp.Compiler.Syntax.SynPat+QuoteExpr: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynPat+QuoteExpr: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynPat+Record: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynPat+Record: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident],FSharp.Compiler.Syntax.Ident],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] fieldPats -FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident],FSharp.Compiler.Syntax.Ident],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]] get_fieldPats() +FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] fieldPats +FSharp.Compiler.Syntax.SynPat+Record: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField] get_fieldPats() FSharp.Compiler.Syntax.SynPat+Tags: Int32 Ands FSharp.Compiler.Syntax.SynPat+Tags: Int32 ArrayOrList FSharp.Compiler.Syntax.SynPat+Tags: Int32 As @@ -8854,7 +8874,7 @@ FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewOptionalVal(FSha FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewOr(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynPatOrTrivia) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewParen(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewQuoteExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewRecord(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`3[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident],FSharp.Compiler.Syntax.Ident],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range],FSharp.Compiler.Syntax.SynPat]], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewRecord(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.NamePatPairField], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewTyped(FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynPat: FSharp.Compiler.Syntax.SynPat NewWild(FSharp.Compiler.Text.Range) diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index fa6efcd415d..6a676b52c7a 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -34,7 +34,7 @@ [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x00000059][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000DA][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1422-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x000005FD][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1447-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x000005FD][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-516::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-516::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-516::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000082][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index 2d4f609d6db..3a9313580a0 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -33,7 +33,7 @@ [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1422-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000618][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1447-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000618][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-531::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-531::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-531::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack. diff --git a/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs.bsl b/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs.bsl index 930c7d13e77..7e0dcdbacdc 100644 --- a/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs.bsl +++ b/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs.bsl @@ -25,14 +25,16 @@ ImplFile (NoneAtInvisible, Ident _arg2, [SynMatchClause (Record - ([(([], Y), Some (3,9--3,10), - ListCons - (Named - (SynIdent (h, None), false, None, - (3,11--3,12)), Wild (3,14--3,15), - (3,11--3,15), - { ColonColonRange = (3,12--3,14) }))], - (3,5--3,17)), None, + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (3,9--3,10), (3,7--3,15), + ListCons + (Named + (SynIdent (h, None), false, None, + (3,11--3,12)), Wild (3,14--3,15), + (3,11--3,15), + { ColonColonRange = (3,12--3,14) }), + None)], (3,5--3,17)), None, Match (NoneAtInvisible, Ident _arg1, [SynMatchClause @@ -88,12 +90,15 @@ ImplFile (2,4--2,10)); Paren (Record - ([(([], Y), Some (3,9--3,10), - ListCons - (Named - (SynIdent (h, None), false, None, (3,11--3,12)), - Wild (3,14--3,15), (3,11--3,15), - { ColonColonRange = (3,12--3,14) }))], + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), Some (3,9--3,10), + (3,7--3,15), + ListCons + (Named + (SynIdent (h, None), false, None, + (3,11--3,12)), Wild (3,14--3,15), + (3,11--3,15), + { ColonColonRange = (3,12--3,14) }), None)], (3,5--3,17)), (3,4--3,18)); Paren (LongIdent @@ -108,13 +113,15 @@ ImplFile (NoneAtInvisible, Ident _arg2, [SynMatchClause (Record - ([(([], Y), Some (3,9--3,10), - ListCons - (Named - (SynIdent (h, None), false, None, - (3,11--3,12)), Wild (3,14--3,15), - (3,11--3,15), - { ColonColonRange = (3,12--3,14) }))], + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (3,9--3,10), (3,7--3,15), + ListCons + (Named + (SynIdent (h, None), false, None, + (3,11--3,12)), Wild (3,14--3,15), + (3,11--3,15), + { ColonColonRange = (3,12--3,14) }), None)], (3,5--3,17)), None, Match (NoneAtInvisible, Ident _arg1, diff --git a/tests/service/data/SyntaxTree/Lambda/DestructedLambdaHasArrowRange.fs.bsl b/tests/service/data/SyntaxTree/Lambda/DestructedLambdaHasArrowRange.fs.bsl index 3f1c530f9d5..575a421c923 100644 --- a/tests/service/data/SyntaxTree/Lambda/DestructedLambdaHasArrowRange.fs.bsl +++ b/tests/service/data/SyntaxTree/Lambda/DestructedLambdaHasArrowRange.fs.bsl @@ -14,10 +14,12 @@ ImplFile (NoneAtInvisible, Ident _arg1, [SynMatchClause (Record - ([(([], X), Some (2,8--2,9), - Named - (SynIdent (x, None), false, None, (2,10--2,11)))], - (2,4--2,13)), None, + ([NamePatPairField + (SynLongIdent ([X], [], [None]), Some (2,8--2,9), + (2,6--2,11), + Named + (SynIdent (x, None), false, None, (2,10--2,11)), + None)], (2,4--2,13)), None, App (NonAtomic, false, App @@ -35,17 +37,22 @@ ImplFile WithKeyword = (2,4--2,22) }), Some ([Record - ([(([], X), Some (2,8--2,9), - Named (SynIdent (x, None), false, None, (2,10--2,11)))], - (2,4--2,13))], + ([NamePatPairField + (SynLongIdent ([X], [], [None]), Some (2,8--2,9), + (2,6--2,11), + Named + (SynIdent (x, None), false, None, (2,10--2,11)), + None)], (2,4--2,13))], Match (NoneAtInvisible, Ident _arg1, [SynMatchClause (Record - ([(([], X), Some (2,8--2,9), - Named - (SynIdent (x, None), false, None, (2,10--2,11)))], - (2,4--2,13)), None, + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (2,8--2,9), (2,6--2,11), + Named + (SynIdent (x, None), false, None, + (2,10--2,11)), None)], (2,4--2,13)), None, App (NonAtomic, false, App diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 01.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 01.fs.bsl index caa7e025499..1e6a423ef30 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 01.fs.bsl @@ -10,8 +10,13 @@ ImplFile (LongIdent (SynLongIdent ([A], [], [None]), None, None, NamePatPairs - ([(a, Some (4,6--4,7), Wild (4,8--4,9)); - (b, Some (4,13--4,14), Wild (4,15--4,16))], + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,13--4,14), + (4,11--4,16), Wild (4,15--4,16), None)], (4,4--4,17), { ParenRange = (4,3--4,17) }), None, (4,2--4,17)), None, Const (Int32 2, (4,21--4,22)), (4,2--4,22), Yes, { ArrowRange = Some (4,18--4,20) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 02.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 02.fs.bsl index a571440a741..03cdcd2af1f 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 02.fs.bsl @@ -10,11 +10,16 @@ ImplFile (LongIdent (SynLongIdent ([A], [], [None]), None, None, NamePatPairs - ([(a, Some (4,6--4,7), Wild (4,8--4,9)); - (b, Some (4,13--4,14), - FromParseError (Wild (4,14--4,14), (4,14--4,14)))], - (4,4--4,16), { ParenRange = (4,3--4,16) }), None, - (4,2--4,16)), None, Const (Int32 2, (4,20--4,21)), + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,13--4,14), + (4,11--4,14), + FromParseError (Wild (4,14--4,14), (4,14--4,14)), + None)], (4,4--4,16), { ParenRange = (4,3--4,16) }), + None, (4,2--4,16)), None, Const (Int32 2, (4,20--4,21)), (4,2--4,21), Yes, { ArrowRange = Some (4,17--4,19) BarRange = Some (4,0--4,1) })], (3,0--4,21), { MatchKeyword = (3,0--3,5) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 03.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 03.fs.bsl index 4902847118f..27096cc44b7 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 03.fs.bsl @@ -10,11 +10,16 @@ ImplFile (LongIdent (SynLongIdent ([A], [], [None]), None, None, NamePatPairs - ([(a, Some (4,6--4,7), Wild (4,8--4,9)); - (b, None, - FromParseError (Wild (4,12--4,12), (4,12--4,12)))], - (4,4--4,13), { ParenRange = (4,3--4,13) }), None, - (4,2--4,13)), None, Const (Int32 2, (4,17--4,18)), + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([b], [], [None]), None, + (4,11--4,12), + FromParseError (Wild (4,12--4,12), (4,12--4,12)), + None)], (4,4--4,13), { ParenRange = (4,3--4,13) }), + None, (4,2--4,13)), None, Const (Int32 2, (4,17--4,18)), (4,2--4,18), Yes, { ArrowRange = Some (4,14--4,16) BarRange = Some (4,0--4,1) })], (3,0--4,18), { MatchKeyword = (3,0--3,5) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 04.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 04.fs.bsl index 8289d0b9bef..00ce8301648 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 04.fs.bsl @@ -10,7 +10,10 @@ ImplFile (LongIdent (SynLongIdent ([A], [], [None]), None, None, NamePatPairs - ([(a, Some (4,6--4,7), Wild (4,8--4,9))], (4,4--4,10), + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), + Some ((4,9--4,10), Some (4,10)))], (4,4--4,10), { ParenRange = (4,3--4,11) }), None, (4,2--4,11)), None, Const (Int32 2, (4,15--4,16)), (4,2--4,16), Yes, { ArrowRange = Some (4,12--4,14) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 05.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 05.fs.bsl index 9e12bc1e850..9a8d806c6f0 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 05.fs.bsl @@ -10,8 +10,13 @@ ImplFile (LongIdent (SynLongIdent ([A], [], [None]), None, None, NamePatPairs - ([(a, Some (4,6--4,7), Wild (4,8--4,9)); - (c, Some (4,15--4,16), Wild (4,17--4,18))], + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (4,15--4,16), + (4,13--4,18), Wild (4,17--4,18), None)], (4,4--4,19), { ParenRange = (4,3--4,19) }), None, (4,2--4,19)), None, Const (Int32 2, (4,23--4,24)), (4,2--4,24), Yes, { ArrowRange = Some (4,20--4,22) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 06.fs b/tests/service/data/SyntaxTree/Pattern/Named field 06.fs new file mode 100644 index 00000000000..6360370124a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 06.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = a; b = b; c = c) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 06.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 06.fs.bsl new file mode 100644 index 00000000000..a7bc36067bd --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 06.fs.bsl @@ -0,0 +1,40 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 06.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Const (Int32 1, (3,6--3,7)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), + Named + (SynIdent (a, None), false, None, (4,8--4,9)), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,13--4,14), + (4,11--4,16), + Named + (SynIdent (b, None), false, None, (4,15--4,16)), + Some ((4,16--4,17), Some (4,17))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (4,20--4,21), + (4,18--4,23), + Named + (SynIdent (c, None), false, None, (4,22--4,23)), + None)], (4,4--4,24), { ParenRange = (4,3--4,24) }), + None, (4,2--4,24)), None, Const (Int32 2, (4,28--4,29)), + (4,2--4,29), Yes, { ArrowRange = Some (4,25--4,27) + BarRange = Some (4,0--4,1) })], + (3,0--4,29), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 07.fs b/tests/service/data/SyntaxTree/Pattern/Named field 07.fs new file mode 100644 index 00000000000..ab7674cee35 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 07.fs @@ -0,0 +1,4 @@ +module Module + +match { A = 1 } with +| { Foo.Bar.A = 1; B = 2; C = 3 } -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 07.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 07.fs.bsl new file mode 100644 index 00000000000..813ba3344bd --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 07.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 07.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,20), + Record + (None, None, + [SynExprRecordField + ((SynLongIdent ([A], [], [None]), true), + Some (3,10--3,11), Some (Const (Int32 1, (3,12--3,13))), + (3,8--3,13), None)], (3,6--3,15)), + [SynMatchClause + (Record + ([NamePatPairField + (SynLongIdent + ([Foo; Bar; A], [(4,7--4,8); (4,11--4,12)], + [None; None; None]), Some (4,14--4,15), + (4,4--4,17), Const (Int32 1, (4,16--4,17)), + Some ((4,17--4,18), Some (4,18))); + NamePatPairField + (SynLongIdent ([B], [], [None]), Some (4,21--4,22), + (4,19--4,24), Const (Int32 2, (4,23--4,24)), + Some ((4,24--4,25), Some (4,25))); + NamePatPairField + (SynLongIdent ([C], [], [None]), Some (4,28--4,29), + (4,26--4,31), Const (Int32 3, (4,30--4,31)), None)], + (4,2--4,33)), None, Const (Unit, (4,37--4,39)), + (4,2--4,39), Yes, { ArrowRange = Some (4,34--4,36) + BarRange = Some (4,0--4,1) })], + (3,0--4,39), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,16--3,20) }), (3,0--4,39))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,39), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 08.fs b/tests/service/data/SyntaxTree/Pattern/Named field 08.fs new file mode 100644 index 00000000000..2b8bf60c548 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 08.fs @@ -0,0 +1,4 @@ +module Module + +match { A = 1 } with +| { A ; B = 3 } -> a diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 08.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 08.fs.bsl new file mode 100644 index 00000000000..cd8a867459d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 08.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 08.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,20), + Record + (None, None, + [SynExprRecordField + ((SynLongIdent ([A], [], [None]), true), + Some (3,10--3,11), Some (Const (Int32 1, (3,12--3,13))), + (3,8--3,13), None)], (3,6--3,15)), + [SynMatchClause + (Record + ([NamePatPairField + (SynLongIdent ([A], [], [None]), None, (4,4--4,5), + FromParseError (Wild (4,5--4,5), (4,5--4,5)), + Some ((4,6--4,7), Some (4,7))); + NamePatPairField + (SynLongIdent ([B], [], [None]), Some (4,10--4,11), + (4,8--4,13), Const (Int32 3, (4,12--4,13)), None)], + (4,2--4,15)), None, Ident a, (4,2--4,20), Yes, + { ArrowRange = Some (4,16--4,18) + BarRange = Some (4,0--4,1) })], (3,0--4,20), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,16--3,20) }), (3,0--4,20))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,20), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,6)-(4,7) parse error Unexpected symbol ';' in pattern. Expected '.', '=' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 09.fs b/tests/service/data/SyntaxTree/Pattern/Named field 09.fs new file mode 100644 index 00000000000..aa0961b9c6b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 09.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a; b = c) -> a diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 09.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 09.fs.bsl new file mode 100644 index 00000000000..a8245f3e9aa --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 09.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 09.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Const (Int32 1, (3,6--3,7)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + Pats + [FromParseError + (Paren + (Named + (SynIdent (a, None), false, None, (4,4--4,5)), + (4,3--4,5)), (4,3--4,5))], None, (4,2--4,5)), + None, Ident a, (4,2--4,18), Yes, + { ArrowRange = Some (4,14--4,16) + BarRange = Some (4,0--4,1) })], (3,0--4,18), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,5)-(4,6) parse error Unexpected symbol ';' in pattern. Expected ')' or other token. +(4,3)-(4,4) parse error Unmatched '(' diff --git a/tests/service/data/SyntaxTree/Pattern/ParenthesesOfSynArgPatsNamePatPairs.fs.bsl b/tests/service/data/SyntaxTree/Pattern/ParenthesesOfSynArgPatsNamePatPairs.fs.bsl index 14fd4eb7b5b..d8fea47cf6f 100644 --- a/tests/service/data/SyntaxTree/Pattern/ParenthesesOfSynArgPatsNamePatPairs.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/ParenthesesOfSynArgPatsNamePatPairs.fs.bsl @@ -11,11 +11,14 @@ ImplFile (LongIdent (SynLongIdent ([OnePartData], [], [None]), None, None, NamePatPairs - ([(part1, Some (4,10--4,11), - Named - (SynIdent (p1, None), false, None, (4,12--4,14)))], - (4,4--5,13), { ParenRange = (3,13--5,13) }), None, - (3,2--5,13)), None, Ident p1, (3,2--5,19), Yes, + ([NamePatPairField + (SynLongIdent ([part1], [], [None]), + Some (4,10--4,11), (4,4--4,14), + Named + (SynIdent (p1, None), false, None, (4,12--4,14)), + None)], (4,4--5,13), + { ParenRange = (3,13--5,13) }), None, (3,2--5,13)), + None, Ident p1, (3,2--5,19), Yes, { ArrowRange = Some (5,14--5,16) BarRange = Some (3,0--3,1) }); SynMatchClause diff --git a/tests/service/data/SyntaxTree/Pattern/Record 01.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Record 01.fs.bsl index 303bae43f43..983d374f240 100644 --- a/tests/service/data/SyntaxTree/Pattern/Record 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Record 01.fs.bsl @@ -8,12 +8,14 @@ ImplFile (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), [SynMatchClause (Record - ([(([], A), Some (4,6--4,7), Wild (4,8--4,9))], - (4,2--4,11)), None, Const (Unit, (4,15--4,17)), - (4,2--4,17), Yes, { ArrowRange = Some (4,12--4,14) - BarRange = Some (4,0--4,1) })], - (3,0--4,17), { MatchKeyword = (3,0--3,5) - WithKeyword = (3,9--3,13) }), (3,0--4,17))], + ([NamePatPairField + (SynLongIdent ([A], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), None)], (4,2--4,11)), + None, Const (Unit, (4,15--4,17)), (4,2--4,17), Yes, + { ArrowRange = Some (4,12--4,14) + BarRange = Some (4,0--4,1) })], (3,0--4,17), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--4,17))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--4,17), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Pattern/Record 02.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Record 02.fs.bsl index ad2b42fb23d..d5138dff78c 100644 --- a/tests/service/data/SyntaxTree/Pattern/Record 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Record 02.fs.bsl @@ -8,13 +8,18 @@ ImplFile (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), [SynMatchClause (Record - ([(([], A), Some (4,6--4,7), Wild (4,8--4,9)); - (([], B), Some (4,13--4,14), Wild (4,15--4,16))], - (4,2--4,18)), None, Const (Unit, (4,22--4,24)), - (4,2--4,24), Yes, { ArrowRange = Some (4,19--4,21) - BarRange = Some (4,0--4,1) })], - (3,0--4,24), { MatchKeyword = (3,0--3,5) - WithKeyword = (3,9--3,13) }), (3,0--4,24))], + ([NamePatPairField + (SynLongIdent ([A], [], [None]), Some (4,6--4,7), + (4,4--4,9), Wild (4,8--4,9), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([B], [], [None]), Some (4,13--4,14), + (4,11--4,16), Wild (4,15--4,16), None)], (4,2--4,18)), + None, Const (Unit, (4,22--4,24)), (4,2--4,24), Yes, + { ArrowRange = Some (4,19--4,21) + BarRange = Some (4,0--4,1) })], (3,0--4,24), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--4,24))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--4,24), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Pattern/Record 03.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Record 03.fs.bsl index f4d874a415d..a5cf1ae25b9 100644 --- a/tests/service/data/SyntaxTree/Pattern/Record 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Record 03.fs.bsl @@ -8,7 +8,10 @@ ImplFile (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), [SynMatchClause (Record - ([(([], A), Some (4,6--4,7), Wild (4,7--4,7))], + ([NamePatPairField + (SynLongIdent ([A], [], [None]), Some (4,6--4,7), + (4,4--4,7), + FromParseError (Wild (4,7--4,7), (4,7--4,7)), None)], (4,2--4,9)), None, Const (Unit, (4,13--4,15)), (4,2--4,15), Yes, { ArrowRange = Some (4,10--4,12) BarRange = Some (4,0--4,1) })], diff --git a/tests/service/data/SyntaxTree/Pattern/Record 04.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Record 04.fs.bsl index 60303d5874d..996a57781f5 100644 --- a/tests/service/data/SyntaxTree/Pattern/Record 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Record 04.fs.bsl @@ -7,12 +7,15 @@ ImplFile (Match (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), [SynMatchClause - (Record ([(([], A), None, Wild (4,5--4,5))], (4,2--4,7)), - None, Const (Unit, (4,11--4,13)), (4,2--4,13), Yes, - { ArrowRange = Some (4,8--4,10) - BarRange = Some (4,0--4,1) })], (3,0--4,13), - { MatchKeyword = (3,0--3,5) - WithKeyword = (3,9--3,13) }), (3,0--4,13))], + (Record + ([NamePatPairField + (SynLongIdent ([A], [], [None]), None, (4,4--4,5), + FromParseError (Wild (4,5--4,5), (4,5--4,5)), None)], + (4,2--4,7)), None, Const (Unit, (4,11--4,13)), + (4,2--4,13), Yes, { ArrowRange = Some (4,8--4,10) + BarRange = Some (4,0--4,1) })], + (3,0--4,13), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--4,13))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--4,13), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Pattern/Record 07.fs b/tests/service/data/SyntaxTree/Pattern/Record 07.fs new file mode 100644 index 00000000000..ae91e315e44 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Record 07.fs @@ -0,0 +1,4 @@ +module Module + +match () with +| { A = 1; B = 2; C = 3 } -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Record 07.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Record 07.fs.bsl new file mode 100644 index 00000000000..337fd109a31 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Record 07.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Record 07.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), + [SynMatchClause + (Record + ([NamePatPairField + (SynLongIdent ([A], [], [None]), Some (4,6--4,7), + (4,4--4,9), Const (Int32 1, (4,8--4,9)), + Some ((4,9--4,10), Some (4,10))); + NamePatPairField + (SynLongIdent ([B], [], [None]), Some (4,13--4,14), + (4,11--4,16), Const (Int32 2, (4,15--4,16)), + Some ((4,16--4,17), Some (4,17))); + NamePatPairField + (SynLongIdent ([C], [], [None]), Some (4,20--4,21), + (4,18--4,23), Const (Int32 3, (4,22--4,23)), None)], + (4,2--4,25)), None, Const (Unit, (4,29--4,31)), + (4,2--4,31), Yes, { ArrowRange = Some (4,26--4,28) + BarRange = Some (4,0--4,1) })], + (3,0--4,31), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--4,31))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,31), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/SynArgPatsNamePatPairsContainsTheRangeOfTheEqualsSign.fs.bsl b/tests/service/data/SyntaxTree/Pattern/SynArgPatsNamePatPairsContainsTheRangeOfTheEqualsSign.fs.bsl index 75f26b45484..b25fece4c04 100644 --- a/tests/service/data/SyntaxTree/Pattern/SynArgPatsNamePatPairsContainsTheRangeOfTheEqualsSign.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/SynArgPatsNamePatPairsContainsTheRangeOfTheEqualsSign.fs.bsl @@ -14,11 +14,13 @@ ImplFile (LongIdent (SynLongIdent ([X], [], [None]), None, None, NamePatPairs - ([(Y, Some (3,7--3,8), - Named - (SynIdent (y, None), false, None, (3,9--3,10)))], - (3,4--3,11), { ParenRange = (3,3--3,11) }), None, - (3,2--3,11)), None, Ident y, (3,2--3,16), Yes, + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), Some (3,7--3,8), + (3,4--3,10), + Named + (SynIdent (y, None), false, None, (3,9--3,10)), + None)], (3,4--3,11), { ParenRange = (3,3--3,11) }), + None, (3,2--3,11)), None, Ident y, (3,2--3,16), Yes, { ArrowRange = Some (3,12--3,14) BarRange = Some (3,0--3,1) })], (2,0--3,16), { MatchKeyword = (2,0--2,5) diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl index 0abee0c68bc..d280afccb59 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl @@ -19,10 +19,12 @@ ImplFile Paren (Typed (Record - ([(([], Name), Some (3,17--3,18), - Named - (SynIdent (name, None), false, None, - (3,19--3,23)))], (3,10--3,25)), + ([NamePatPairField + (SynLongIdent ([Name], [], [None]), + Some (3,17--3,18), (3,12--3,23), + Named + (SynIdent (name, None), false, None, + (3,19--3,23)), None)], (3,10--3,25)), LongIdent (SynLongIdent ([Person], [], [None])), (3,10--3,33)), (3,9--3,34)), None, App diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl index 8bb584f47e5..51ed7c21433 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl @@ -18,10 +18,12 @@ ImplFile None), Typed (Record - ([(([], Name), Some (3,16--3,17), - Named - (SynIdent (name, None), false, None, - (3,18--3,22)))], (3,9--3,24)), + ([NamePatPairField + (SynLongIdent ([Name], [], [None]), + Some (3,16--3,17), (3,11--3,22), + Named + (SynIdent (name, None), false, None, + (3,18--3,22)), None)], (3,9--3,24)), LongIdent (SynLongIdent ([Person], [], [None])), (3,9--3,32)), None, App diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl index 9ce3159e223..6095c4a0c36 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl @@ -20,14 +20,19 @@ ImplFile Paren (Typed (Record - ([(([], Name), Some (4,17--4,18), - Named - (SynIdent (name, None), false, None, - (4,19--4,23))); - (([], Age), Some (4,29--4,30), - Named - (SynIdent (age, None), false, None, - (4,31--4,34)))], (4,10--4,36)), + ([NamePatPairField + (SynLongIdent ([Name], [], [None]), + Some (4,17--4,18), (4,12--4,23), + Named + (SynIdent (name, None), false, None, + (4,19--4,23)), + Some ((4,23--4,24), Some (4,24))); + NamePatPairField + (SynLongIdent ([Age], [], [None]), + Some (4,29--4,30), (4,25--4,34), + Named + (SynIdent (age, None), false, None, + (4,31--4,34)), None)], (4,10--4,36)), LongIdent (SynLongIdent ([Person], [], [None])), (4,10--4,44)), (4,9--4,45)), None, App @@ -46,10 +51,12 @@ ImplFile Paren (Typed (Record - ([(([], Id), Some (5,15--5,16), - Named - (SynIdent (id, None), false, None, - (5,17--5,19)))], (5,10--5,21)), + ([NamePatPairField + (SynLongIdent ([Id], [], [None]), + Some (5,15--5,16), (5,12--5,19), + Named + (SynIdent (id, None), false, None, + (5,17--5,19)), None)], (5,10--5,21)), LongIdent (SynLongIdent ([User], [], [None])), (5,10--5,27)), (5,9--5,28)), None, App diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl index 8f192d0e7f0..b740454c545 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl @@ -19,14 +19,19 @@ ImplFile None), Typed (Record - ([(([], Name), Some (4,16--4,17), - Named - (SynIdent (name, None), false, None, - (4,18--4,22))); - (([], Age), Some (4,28--4,29), - Named - (SynIdent (age, None), false, None, - (4,30--4,33)))], (4,9--4,35)), + ([NamePatPairField + (SynLongIdent ([Name], [], [None]), + Some (4,16--4,17), (4,11--4,22), + Named + (SynIdent (name, None), false, None, + (4,18--4,22)), + Some ((4,22--4,23), Some (4,23))); + NamePatPairField + (SynLongIdent ([Age], [], [None]), + Some (4,28--4,29), (4,24--4,33), + Named + (SynIdent (age, None), false, None, + (4,30--4,33)), None)], (4,9--4,35)), LongIdent (SynLongIdent ([Person], [], [None])), (4,9--4,43)), None, App @@ -44,10 +49,12 @@ ImplFile None), Typed (Record - ([(([], Id), Some (5,14--5,15), - Named - (SynIdent (id, None), false, None, - (5,16--5,18)))], (5,9--5,20)), + ([NamePatPairField + (SynLongIdent ([Id], [], [None]), + Some (5,14--5,15), (5,11--5,18), + Named + (SynIdent (id, None), false, None, + (5,16--5,18)), None)], (5,9--5,20)), LongIdent (SynLongIdent ([User], [], [None])), (5,9--5,26)), None, App diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl index f1c41fa9742..907255daef4 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl @@ -20,14 +20,19 @@ ImplFile Paren (Typed (Record - ([(([], Name), Some (4,17--4,18), - Named - (SynIdent (name, None), false, None, - (4,19--4,23))); - (([], Age), Some (4,29--4,30), - Named - (SynIdent (age, None), false, None, - (4,31--4,34)))], (4,10--4,36)), + ([NamePatPairField + (SynLongIdent ([Name], [], [None]), + Some (4,17--4,18), (4,12--4,23), + Named + (SynIdent (name, None), false, None, + (4,19--4,23)), + Some ((4,23--4,24), Some (4,24))); + NamePatPairField + (SynLongIdent ([Age], [], [None]), + Some (4,29--4,30), (4,25--4,34), + Named + (SynIdent (age, None), false, None, + (4,31--4,34)), None)], (4,10--4,36)), LongIdent (SynLongIdent ([Person], [], [None])), (4,10--4,44)), (4,9--4,45)), None, App @@ -45,10 +50,12 @@ ImplFile None), Typed (Record - ([(([], Id), Some (5,14--5,15), - Named - (SynIdent (id, None), false, None, - (5,16--5,18)))], (5,9--5,20)), + ([NamePatPairField + (SynLongIdent ([Id], [], [None]), + Some (5,14--5,15), (5,11--5,18), + Named + (SynIdent (id, None), false, None, + (5,16--5,18)), None)], (5,9--5,20)), LongIdent (SynLongIdent ([User], [], [None])), (5,9--5,26)), None, App diff --git a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs index 4377253d1ad..942701b37b9 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs @@ -2090,10 +2090,10 @@ match { A = 1; B = 2 } with VerifyCompletionList(fileContents, "| { A = 1; ", [ "B"; "R1"; "R2" ], [ "C"; "D" ]) VerifyCompletionList(fileContents, "| { A = 2; s", [ "B"; "R1"; "R2" ], [ "C"; "D" ]) - VerifyCompletionList(fileContents, "| { B =", [ "R1"; "R2"; "Some"; "None"; "System"; "DU" ], [ "A"; "B"; "C"; "D" ]) - VerifyCompletionList(fileContents, "| { B = ", [ "R1"; "R2"; "Some"; "None"; "System"; "DU" ], [ "A"; "B"; "C"; "D" ]) - VerifyCompletionList(fileContents, "| { X =", [ "R1"; "R2"; "Some"; "None"; "System"; "DU" ], [ "A"; "B"; "C"; "D" ]) - VerifyCompletionList(fileContents, "| { X = ", [ "R1"; "R2"; "Some"; "None"; "System"; "DU" ], [ "A"; "B"; "C"; "D" ]) + VerifyCompletionList(fileContents, "| { B =", [ "R1"; "R2"; "System" ], [ "B"; "C"; "D" ]) + VerifyCompletionList(fileContents, "| { B = ", [ "R1"; "R2"; "System" ], [ "B"; "C"; "D" ]) + VerifyCompletionList(fileContents, "| { X =", [ "R1"; "R2"; "System" ], [ "B"; "C"; "D" ]) + VerifyCompletionList(fileContents, "| { X = ", [ "R1"; "R2"; "System" ], [ "B"; "C"; "D" ]) // Ideally C and D should not be present here, but right now we're not able to filter fields in an empty record pattern stub VerifyCompletionList(fileContents, "| { ", [ "A"; "B"; "C"; "D"; "R1"; "R2" ], [])