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 9779841c2c9..333723e3a05 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -3,6 +3,7 @@ * Add support for `when 'T : Enum` library-only static optimization constraint. ([PR #18546](https://github.com/dotnet/fsharp/pull/18546)) * Add support for tail calls in computation expressions ([PR #18804](https://github.com/dotnet/fsharp/pull/18804)) * Add `--typecheck-only` flag support for F# Interactive (FSI) scripts to type-check without execution. ([Issue #18686](https://github.com/dotnet/fsharp/issues/18686)) +* Allow comma as union case name field separator. ([PR #18833](https://github.com/dotnet/fsharp/pull/18833)) * Diagnostics: add extended data for 'No constructors' error ([PR #18863](https://github.com/dotnet/fsharp/pull/18863)) * FSharpType.Format: support top-level prefix generic types style. ([PR #18897](https://github.com/dotnet/fsharp/pull/18897)) * FCS: allow getting captured types ([PR $18878](https://github.com/dotnet/fsharp/pull/18878)) diff --git a/docs/release-notes/.Language/preview.md b/docs/release-notes/.Language/preview.md index fcec4b8170e..2eb29116480 100644 --- a/docs/release-notes/.Language/preview.md +++ b/docs/release-notes/.Language/preview.md @@ -11,6 +11,7 @@ * Allow `let!`, `use!`, `and!` type annotations without requiring parentheses (([PR #18508](https://github.com/dotnet/fsharp/pull/18508) and [PR #18682](https://github.com/dotnet/fsharp/pull/18682))) * Exception names are now validated for illegal characters using the same mechanism as types/modules/namespaces ([Issue #18763](https://github.com/dotnet/fsharp/issues/18763)) * Support tail calls in computation expressions ([PR #18804](https://github.com/dotnet/fsharp/pull/18804)) +* Allow comma as union case name field separator. ([PR #18833](https://github.com/dotnet/fsharp/pull/18833)) ### Fixed diff --git a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs index c4836865f79..6dd633bb045 100644 --- a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs +++ b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs @@ -59,7 +59,14 @@ let GroupUpdatesToNestedFields (fields: ((Ident list * Ident) * SynExpr option) /// Expands a long identifier into nested copy-and-update expressions. /// /// `{ x with A.B = 0; A.C = "" }` becomes `{ x with A = { x.A with B = 0 }; A = { x.A with C = "" } }` -let TransformAstForNestedUpdates (cenv: TcFileState) (env: TcEnv) overallTy (lid: LongIdent) exprBeingAssigned withExpr = +let TransformAstForNestedUpdates + (cenv: TcFileState) + (env: TcEnv) + overallTy + (lid: LongIdent) + exprBeingAssigned + (withExpr: SynExpr * BlockSeparator) + = let recdExprCopyInfo ids withExpr id = let upToId origSepRng id lidwd = let rec buildLid res (id: Ident) = diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 512e9b4dca7..2e52384e706 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1813,4 +1813,6 @@ featureAllowLetOrUseBangTypeAnnotationWithoutParens,"Allow let! and use! type an 3876,lexWarnDirectivesMustMatch,"There is another %s for this warning already in line %d." 3877,lexLineDirectiveMappingIsNotUnique,"The file '%s' was also pointed to in a line directive in '%s'. Proper warn directive application may not be possible." 3878,tcAttributeIsNotValidForUnionCaseWithFields,"This attribute is not valid for use on union cases with fields." +3879,parsInconsistentSeparators,"Inconsistent separators in pattern. Use either all commas or all semicolons, but not both." featureReturnFromFinal,"Support for ReturnFromFinal/YieldFromFinal in computation expressions to enable tailcall optimization when available on the builder." +featureAllowCommaAsUnionCaseNamedFieldSeparator,"Allow comma as union case name field separator." diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 4b032db713f..c21f39ca54d 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -105,6 +105,7 @@ type LanguageFeature = | ErrorOnInvalidDeclsInTypeDefinitions | AllowTypedLetUseAndBang | ReturnFromFinal + | AllowCommaAsUnionCaseNamedFieldSeparator /// LanguageVersion management type LanguageVersion(versionText) = @@ -245,6 +246,7 @@ type LanguageVersion(versionText) = // F# preview (still preview in 10.0) LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work + LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -415,6 +417,7 @@ type LanguageVersion(versionText) = | LanguageFeature.ErrorOnInvalidDeclsInTypeDefinitions -> FSComp.SR.featureErrorOnInvalidDeclsInTypeDefinitions () | LanguageFeature.AllowTypedLetUseAndBang -> FSComp.SR.featureAllowLetOrUseBangTypeAnnotationWithoutParens () | LanguageFeature.ReturnFromFinal -> FSComp.SR.featureReturnFromFinal () + | LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator -> FSComp.SR.featureAllowCommaAsUnionCaseNamedFieldSeparator () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index 1217b83baf6..9e3c42ad944 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -96,6 +96,7 @@ type LanguageFeature = | ErrorOnInvalidDeclsInTypeDefinitions | AllowTypedLetUseAndBang | ReturnFromFinal + | AllowCommaAsUnionCaseNamedFieldSeparator /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 572600f9ff9..aa4d1b9bb61 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1065,9 +1065,103 @@ let leadingKeywordIsAbstract = | SynLeadingKeyword.StaticAbstractMember _ -> true | _ -> false -/// Unified helper for creating let/let!/use/use! expressions -/// Creates SynExpr.LetOrUse based on isBang parameter -/// Handles all four cases: 'let', 'let!', 'use', and 'use!' +let mkNamePatPairFieldFromId (id: Ident) (mEq: range option) (pat: SynPat) (sep: BlockSeparator option) : NamePatPairField = + let m = unionRanges id.idRange pat.Range + let lid = SynLongIdent([ id ], [], [ None ]) + NamePatPairField(lid, mEq, m, pat, sep) + +let mkNamePatPairFieldFromLid (lid: SynLongIdent) (mEq: range option) (pat: SynPat) (sep: BlockSeparator option) : NamePatPairField = + let m = unionRanges lid.Range pat.Range + NamePatPairField(lid, mEq, m, pat, sep) + +let mkMissingNamePatPairFieldFromId (id: Ident) (sep: BlockSeparator option) : NamePatPairField = + let m = id.idRange + let lid = SynLongIdent([ id ], [], [ None ]) + let bindPat = SynPat.Named(SynIdent(id, None), false, None, m) + let patErr = patFromParseError bindPat + NamePatPairField(lid, None, m, patErr, sep) + +let private mkVarPatFromIdent (id: Ident) = + SynPat.Named(SynIdent(id, None), false, None, id.idRange) + +let mkTuplePatFromTrailingIdents (leadingPat: SynPat) (pairs: (BlockSeparator * Ident) list) : SynPat * range = + match List.tryFrontAndBack pairs with + | None -> leadingPat, leadingPat.Range + | Some(front, (lastSep, lastId)) -> + let trailingPats = front |> List.map (fun (_, id) -> mkVarPatFromIdent id) + let lastPat = mkVarPatFromIdent lastId + let pats = leadingPat :: (trailingPats @ [ lastPat ]) + + let commaRanges = + (front |> List.map (fun (sep, _) -> sep.Range)) @ [ lastSep.Range ] + + let mTuple = unionRanges leadingPat.Range lastId.idRange + SynPat.Tuple(false, pats, commaRanges, mTuple), mTuple + +let mkTuplePatFromTrailingPatterns (leadingPat: SynPat) (pairs: (BlockSeparator * SynPat) list) : SynPat * range = + match List.tryFrontAndBack pairs with + | None -> leadingPat, leadingPat.Range + | Some(front, (lastSep, lastPat)) -> + let trailingPats = front |> List.map (fun (_, p) -> p) + let pats = leadingPat :: (trailingPats @ [ lastPat ]) + + let commaRanges = + (front |> List.map (fun (sep, _) -> sep.Range)) @ [ lastSep.Range ] + + let mTuple = unionRanges leadingPat.Range lastPat.Range + SynPat.Tuple(false, pats, commaRanges, mTuple), mTuple + +let tryFoldTuplePat (mEq1: range option) (pat1: SynPat) (pairsAsPatterns: (BlockSeparator * SynPat) list) : (SynPat * range) option = + match mEq1, pat1, pairsAsPatterns with + | Some _, SynPat.FromParseError _, _ -> None + | Some _, _, [] -> None + | Some _, _, _ -> Some(mkTuplePatFromTrailingPatterns pat1 pairsAsPatterns) + | None, _, _ -> None + +let tryFoldTuplePatFromTrailingIdents + (mEq1: range option) + (pat1: SynPat) + (pairsAsIdents: (BlockSeparator * Ident) list) + : (SynPat * range) option = + match mEq1, pat1, pairsAsIdents with + | Some _, SynPat.FromParseError _, _ -> None + | Some _, _, [] -> None + | Some _, _, _ -> Some(mkTuplePatFromTrailingIdents pat1 pairsAsIdents) + | None, _, _ -> None + +let reportInconsistentSeparatorsForNamePatPairs (fields: NamePatPairField list) = + // Map BlockSeparator to a kind: semicolon=0, comma=1, offside=None + let kindOf sep = + match sep with + | BlockSeparator.Semicolon _ -> Some 0 + | BlockSeparator.Comma _ -> Some 1 + | BlockSeparator.Offside _ -> None + + // Find the first concrete kind (semicolon/comma) and return it together with the remaining fields to scan + let rec firstKind rest = + match rest with + | [] -> None + | NamePatPairField(blockSeparator = Some sep) :: tail -> + match kindOf sep with + | Some k -> Some(k, tail) + | None -> firstKind tail + | _ :: tail -> firstKind tail + + match firstKind fields with + | None -> () + | Some(k0, rest) -> + // Scan for the first conflicting separator and report once + let rec scan xs = + match xs with + | [] -> () + | NamePatPairField(blockSeparator = Some sep) :: tail -> + match kindOf sep with + | Some k when k <> k0 -> reportParseErrorAt sep.Range (FSComp.SR.parsInconsistentSeparators ()) + | _ -> scan tail + | _ :: tail -> scan tail + + scan rest + let mkLetExpression ( isBang: bool, diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fsi b/src/Compiler/SyntaxTree/ParseHelpers.fsi index 301e72e0ed7..86c4fd3fda6 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fsi +++ b/src/Compiler/SyntaxTree/ParseHelpers.fsi @@ -269,4 +269,35 @@ val mkSynField: leadingKeyword: SynLeadingKeyword option -> SynField +val mkNamePatPairFieldFromId: + id: Ident -> mEq: range option -> pat: SynPat -> sep: BlockSeparator option -> NamePatPairField + +val mkNamePatPairFieldFromLid: + lid: SynLongIdent -> mEq: range option -> pat: SynPat -> sep: BlockSeparator option -> NamePatPairField + +val mkMissingNamePatPairFieldFromId: id: Ident -> sep: BlockSeparator option -> NamePatPairField + +/// Build a tuple pattern by folding trailing identifiers (with their comma separators) +/// into a leading pattern. No Paren node is added; the commas are captured via commaRanges. +/// Returns the synthesized tuple pattern and its overall range. +val mkTuplePatFromTrailingIdents: leadingPat: SynPat -> pairs: (BlockSeparator * Ident) list -> SynPat * range + +/// Build a tuple pattern by folding trailing patterns (with their comma separators) +/// into a leading pattern. No Paren node is added; the commas are captured via commaRanges. +/// Returns the synthesized tuple pattern and its overall range. +val mkTuplePatFromTrailingPatterns: leadingPat: SynPat -> pairs: (BlockSeparator * SynPat) list -> SynPat * range + +/// Try to fold trailing patterns into a tuple for a named field under recovery. +/// Returns Some(tuplePat, mTuple) when mEq is present, pat1 is not FromParseError, and there is at least one trailing element. +val tryFoldTuplePat: + mEq1: range option -> pat1: SynPat -> pairsAsPatterns: (BlockSeparator * SynPat) list -> (SynPat * range) option + +/// Try to fold trailing identifiers into a tuple for a named field under recovery. +/// Returns Some(tuplePat, mTuple) when mEq is present, pat1 is not FromParseError, and there is at least one trailing ident. +val tryFoldTuplePatFromTrailingIdents: + mEq1: range option -> pat1: SynPat -> pairsAsIdents: (BlockSeparator * Ident) list -> (SynPat * range) option + +/// Reports an error when named-field patterns mix separators within the same list. +val reportInconsistentSeparatorsForNamePatPairs: fields: NamePatPairField list -> unit + val leadingKeywordIsAbstract: SynLeadingKeyword -> bool diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index b773f1ea1ac..8bd806910c3 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -3656,32 +3656,285 @@ conjPatternElements: | headBindingPattern AMP headBindingPattern { $3 :: $1 :: [] } - -namePatPairs: - | namePatPair opt_seps_block - { let (id: Ident), mEq, (pat: SynPat) = $1 + +namePatPairsRecovery: + // Recovery: fold trailing comma-separated patterns into a tuple for the previous named field. + // Conditions: only when the first field has '=' and the initial pattern is not FromParseError. + // Notes: commas are treated as tuple separators (not field separators); no parentheses are synthesized; tuple comma ranges are preserved. + | namePatPair namePatPairCommaPatterns + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let pairs: (BlockSeparator * SynPat) list = List.rev $2 + match tryFoldTuplePat mEq1 pat1 pairs with + | Some (tuplePat, _mTuple) -> + let lid1 = SynLongIdent([id1], [], [None]) + // Do not feature‑gate: commas are tuple commas here, not field separators. + [ mkNamePatPairFieldFromLid lid1 mEq1 tuplePat None ] + | None -> + // Minimal fallback: keep only the first field. If there are trailing patterns, attach the first comma + // as this field's blockSeparator and ignore the rest (we cannot synthesize fields from arbitrary patterns safely). + let lid1 = SynLongIdent([id1], [], [None]) + match pairs with + | [] -> [ mkNamePatPairFieldFromLid lid1 mEq1 pat1 None ] + | (firstSep, _pat2) :: _ -> [ mkNamePatPairFieldFromLid lid1 mEq1 pat1 (Some firstSep) ] } + + // Recovery: fold trailing comma-separated identifiers into a tuple for the previous named field. + // Conditions: only when the first field has '=' and the initial pattern is not FromParseError. + // Notes: commas here are tuple separators (not field separators); no parentheses are synthesized; trivia/comma ranges are preserved. + | namePatPair namePatPairCommaIdents + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let pairs: (BlockSeparator * Ident) list = List.rev $2 + match tryFoldTuplePatFromTrailingIdents mEq1 pat1 pairs with + | Some (tuplePat, _mTuple) -> + let lid1 = SynLongIdent([id1], [], [None]) + [ mkNamePatPairFieldFromLid lid1 mEq1 tuplePat None ] + | None -> + let lid1 = SynLongIdent([id1], [], [None]) + match pairs with + | [] -> [ mkNamePatPairFieldFromLid lid1 mEq1 pat1 None ] + | (firstSep, _id2) :: _ -> [ mkNamePatPairFieldFromLid lid1 mEq1 pat1 (Some firstSep) ] } + +// Recovery + continuation (semicolon): branches that fold trailing comma parts then continue with ';' +namePatPairsRecoveryContSemicolon: + // fold trailing identifiers into tuple, then continue with a semicolon-separated field list + // Example: A(a = x, y; b = z) + | namePatPair namePatPairCommaIdents pairs_seps_block_semicolon namePatPairsContSemicolon + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let pairs = List.rev $2 + let pat1' = + match tryFoldTuplePatFromTrailingIdents mEq1 pat1 pairs with + | Some (tuplePat, _) -> tuplePat + | None -> pat1 + let lid1 = SynLongIdent([id1], [], [None]) + let first = mkNamePatPairFieldFromLid lid1 mEq1 pat1' (Some $3) + let fields = first :: $4 + if parseState.LexBuffer.SupportsFeature LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator then + reportInconsistentSeparatorsForNamePatPairs fields + fields } + + // fold trailing arbitrary patterns into tuple, then continue with a semicolon-separated field list + // Example: A(a = p1, _; b = z) + | namePatPair namePatPairCommaPatterns pairs_seps_block_semicolon namePatPairsContSemicolon + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let pairs: (BlockSeparator * SynPat) list = List.rev $2 + let pat1' = + match tryFoldTuplePat mEq1 pat1 pairs with + | Some (tuplePat, _) -> tuplePat + | None -> pat1 + let lid1 = SynLongIdent([id1], [], [None]) + let first = mkNamePatPairFieldFromLid lid1 mEq1 pat1' (Some $3) + let fields = first :: $4 + if parseState.LexBuffer.SupportsFeature LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator then + reportInconsistentSeparatorsForNamePatPairs fields + fields } + + // semicolon followed by bare identifier — synthesize a missing field for the trailing ident. + // Example: A(a = x; b) + | namePatPair pairs_seps_block_semicolon ident + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let first = mkNamePatPairFieldFromId id1 mEq1 pat1 (Some $2) + let (id2: Ident) = $3 + let second = mkMissingNamePatPairFieldFromId id2 None + [ first; second ] } + + // two semicolons in a row means a missing pattern after the first semicolon. + // Example: A(a = x;; b = y) + | namePatPair pairs_seps_block_semicolon pairs_seps_block_semicolon namePatPairs + { reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsExpectingPattern ()) + 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 + mkNamePatPairFieldFromLid lid mEq pat (Some $2) :: $4 } + +// Recovery + continuation (comma): branches that fold trailing comma parts then continue with ',' (feature-gated) +namePatPairsRecoveryContComma: + // fold trailing identifiers into tuple, then continue with a comma-separated field list + // Example: A(a = x, y, b = z) + | namePatPair namePatPairCommaIdents pairs_seps_block_comma namePatPairsContComma + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let pairs = List.rev $2 + let pat1' = + match tryFoldTuplePatFromTrailingIdents mEq1 pat1 pairs with + | Some (tuplePat, _) -> tuplePat + | None -> pat1 + let lid1 = SynLongIdent([id1], [], [None]) + // Attach the comma as a named-field separator for continuation; gate the feature on this comma + let mComma = ($3: BlockSeparator).Range + match pat1 with + | SynPat.FromParseError _ -> () + | _ -> parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator mComma + let first = mkNamePatPairFieldFromLid lid1 mEq1 pat1' (Some $3) + let fields = first :: $4 + if parseState.LexBuffer.SupportsFeature LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator then + reportInconsistentSeparatorsForNamePatPairs fields + fields } + + // fold trailing arbitrary patterns into tuple, then continue with a comma-separated field list + // Example: A(a = p1, _, b = z) + | namePatPair namePatPairCommaPatterns pairs_seps_block_comma namePatPairsContComma + { let (id1: Ident), mEq1, (pat1: SynPat) = $1 + let pairs: (BlockSeparator * SynPat) list = List.rev $2 + let pat1' = + match tryFoldTuplePat mEq1 pat1 pairs with + | Some (tuplePat, _) -> tuplePat + | None -> pat1 + let lid1 = SynLongIdent([id1], [], [None]) + let mComma = ($3: BlockSeparator).Range + match pat1 with + | SynPat.FromParseError _ -> () + | _ -> parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator mComma + let first = mkNamePatPairFieldFromLid lid1 mEq1 pat1' (Some $3) + let fields = first :: $4 + if parseState.LexBuffer.SupportsFeature LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator then + reportInconsistentSeparatorsForNamePatPairs fields + fields } + + // two commas in a row means a missing pattern after the first comma. + // Example: A(a = x,, b = y) + // Note: Only the first comma ($2) is feature‑gated as a named-field separator; the second comma starts the error and is not gated. + | namePatPair pairs_seps_block_comma pairs_seps_block_comma namePatPairs + { reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsExpectingPattern ()) + 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 } + // Gate comma as named field separator only when previous pattern parsed successfully. + // Only gate the first separator token ($2); the second comma begins the error and is not gated. + let mComma = ($2: BlockSeparator).Range + match pat with + | SynPat.FromParseError _ -> () + | _ -> parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator mComma + mkNamePatPairFieldFromLid lid mEq pat (Some $2) :: $4 } + +// | A(a = x) +// | A(a = x; b = y +// | A(a = x, b = y) +// | A(a = p1, p2) +namePatPairs: + // Single named field with optional trailing separator. + // Examples: + // A(a = x) + // A(a = x; ) + // A(a = x, ) + | namePatPair opt_pairs_seps_block + { let (id: Ident), mEq, (pat: SynPat) = $1 + [ mkNamePatPairFieldFromId id mEq pat $2 ] } - | namePatPair seps_block seps_block namePatPairs - { reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsExpectingPattern ()) - 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 } + // Semicolon-separated continuation: add another named field. + // Example: A(a = x; b = y) + | namePatPair pairs_seps_block_semicolon namePatPairsContSemicolon + { let (id: Ident), mEq, (pat: SynPat) = $1 + let first = mkNamePatPairFieldFromId id mEq pat (Some $2) + let fields = first :: $3 + if parseState.LexBuffer.SupportsFeature LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator then + reportInconsistentSeparatorsForNamePatPairs fields + fields } + + // Comma-separated continuation (preview feature): add another named field. + // Example: A(a = x, b = y) + | namePatPair pairs_seps_block_comma namePatPairsContComma + { let (id: Ident), mEq, (pat: SynPat) = $1 + // Gate comma as named field separator only when previous pattern parsed successfully. + // Gate exactly once per separator token (this $2). The folding recovery branch treats commas + // as tuple commas and therefore does not feature‑gate them. + let mComma = ($2 : BlockSeparator).Range + match pat with + | SynPat.FromParseError _ -> () + | _ -> parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator mComma + let first = mkNamePatPairFieldFromId id mEq pat (Some $2) + let fields = first :: $3 + if parseState.LexBuffer.SupportsFeature LanguageFeature.AllowCommaAsUnionCaseNamedFieldSeparator then + reportInconsistentSeparatorsForNamePatPairs fields + fields } + + | namePatPairsRecovery + { $1 } + + | namePatPairsRecoveryContSemicolon + { $1 } + + | namePatPairsRecoveryContComma + { $1 } + +// | A(a = x, y, z) // collects identifiers y and z for tuple folding +namePatPairCommaIdents: + | pairs_seps_block_comma ident + { let sep : BlockSeparator = $1 + let id : Ident = $2 + List.singleton (sep, id) } + | namePatPairCommaIdents pairs_seps_block_comma ident + { let acc = $1 + let sep : BlockSeparator = $2 + let id : Ident = $3 + (sep, id) :: acc } + +// | A(a = p1, _) +// | A(a = p1, (p2)) +// | A(a = p1, { X = 1 }) +namePatPairCommaPatterns: + // Accept trailing underscore without parentheses + | pairs_seps_block_comma UNDERSCORE + { let sep: BlockSeparator = $1 + let m = rhs parseState 2 + let pat: SynPat = SynPat.Wild m + [ (sep, pat) ] } + + | namePatPairCommaPatterns pairs_seps_block_comma UNDERSCORE + { let acc = $1 + let sep: BlockSeparator = $2 + let m = rhs parseState 3 + let pat: SynPat = SynPat.Wild m + (sep, pat) :: acc } + // Accept other patterns only when parenthesized to avoid consuming the start of the next named field (ident '=') + | pairs_seps_block_comma parenPattern + { let sep: BlockSeparator = $1 + let pat: SynPat = $2 + [ (sep, pat) ] } + + | namePatPairCommaPatterns pairs_seps_block_comma parenPattern + { let acc = $1 + let sep: BlockSeparator = $2 + let pat: SynPat = $3 + (sep, pat) :: acc } + + // Accept record patterns without parentheses; '{' cannot begin a named field, so this is unambiguous + | pairs_seps_block_comma LBRACE recordPatternElementsAux rbrace + { let sep: BlockSeparator = $1 + let pat: SynPat = SynPat.Record($3, rhs2 parseState 2 4) + [ (sep, pat) ] } + + | namePatPairCommaPatterns pairs_seps_block_comma LBRACE recordPatternElementsAux rbrace + { let acc = $1 + let sep: BlockSeparator = $2 + let pat: SynPat = SynPat.Record($4, rhs2 parseState 3 5) + (sep, pat) :: acc } + +// | A(a = x; b = y) +// | A(a = x; _) +namePatPairsContSemicolon: + | namePatPairs + { $1 } + | UNDERSCORE + { [] } + + +// | A(a = x, b = y) // continuation with comma (preview) +namePatPairsContComma: + | namePatPairs + { $1 } +// | A(a = p) +// | A(a = (p1, p2)) +// | A(a = [p]) +// | A(a = { X = 1 }) namePatPair: | ident EQUALS parenPattern { let mEquals = rhs parseState 2 $1, Some mEquals, $3 } + | ident EQUALS ends_coming_soon_or_recover + { let mEquals = rhs parseState 2 + if not $3 then reportParseErrorAt mEquals (FSComp.SR.parsExpectingPattern ()) + $1, Some mEquals, patFromParseError (SynPat.Wild mEquals.EndRange) } + | ident EQUALS recover { let mEquals = rhs parseState 2 $1, Some mEquals, patFromParseError (SynPat.Wild mEquals.EndRange) } @@ -3689,17 +3942,38 @@ namePatPair: | ident recover { $1, None, patFromParseError (SynPat.Wild $1.idRange.EndRange) } +// Constructor-like patterns, including support for named field pairs. +// - Prefer the explicit "( namePatPairs )" form to reduce ambiguity with tuple patterns and commas. +// - When present, named field pairs are wrapped as SynArgPats.NamePatPairs with Paren trivia recorded. constrPattern: | atomicPatternLongIdent explicitValTyparDecls { let vis, lid = $1 SynPat.LongIdent(lid, None, Some $2, SynArgPats.Pats [], vis, lhs parseState) } + // Prefer direct matching of named-field pairs inside parentheses to reduce ambiguity + | atomicPatternLongIdent explicitValTyparDecls LPAREN namePatPairs rparen %prec pat_app + { let vis, lid = $1 + let mParen = rhs2 parseState 3 5 + let trivia = { ParenRange = mParen } + let args = SynArgPats.NamePatPairs($4, rhs parseState 4, trivia) + let m = unionRanges (rhs2 parseState 1 2) mParen + SynPat.LongIdent(lid, None, Some $2, args, vis, m) } + | atomicPatternLongIdent explicitValTyparDecls atomicPatsOrNamePatPairs %prec pat_app { let vis, lid = $1 let args, argsM = $3 let m = unionRanges (rhs2 parseState 1 2) argsM SynPat.LongIdent(lid, None, Some $2, args, vis, m) } + // Also cover the case without explicit type parameters + | atomicPatternLongIdent LPAREN namePatPairs rparen %prec pat_app + { let vis, lid = $1 + let mParen = rhs2 parseState 2 4 + let trivia = { ParenRange = mParen } + let args = SynArgPats.NamePatPairs($3, rhs parseState 3, trivia) + let m = unionRanges (rhs parseState 1) mParen + SynPat.LongIdent(lid, None, None, args, vis, m) } + | atomicPatternLongIdent explicitValTyparDecls HIGH_PRECEDENCE_PAREN_APP atomicPatsOrNamePatPairs { let vis, lid = $1 let args, argsM = $4 @@ -3756,6 +4030,11 @@ atomicPatsOrNamePatPairs: let trivia = { ParenRange = mParen } SynArgPats.NamePatPairs($2, rhs parseState 2, trivia), mParen } + | LPAREN parenPatternBody rparen + { let m = lhs parseState + let parenPat = SynPat.Paren($2 m, m) + SynArgPats.Pats [parenPat], m } + | atomicPatterns { let mParsed = rhs parseState 1 let mAll = (mParsed.StartRange, $1) ||> unionRangeWithListBy (fun p -> p.Range) @@ -4011,18 +4290,18 @@ recordPatternElementsAux: | recordPatternElement opt_seps_block { let (lid: SynLongIdent), mEq, (pat: SynPat) = $1 let m = unionRanges lid.Range pat.Range - [ NamePatPairField(lid, mEq, m, pat, $2) ] } + [ mkNamePatPairFieldFromLid lid mEq pat $2 ] } | 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 } + mkNamePatPairFieldFromLid lid mEq 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 } + mkNamePatPairFieldFromLid lid mEq pat (Some $2) :: $4 } recordPatternElement: | path EQUALS parenPattern @@ -5775,6 +6054,51 @@ seps_block: { BlockSeparator.Semicolon((rhs2 parseState 1 2), Some (rhs parseState 2).End) } +opt_pairs_seps_block: + | pairs_seps_block_semicolon { Some $1 } + | pairs_seps_block_comma { Some $1 } + | /* EMPTY */ { None } + +/* Semicolon-only separators for name pattern pairs */ +pairs_seps_block_semicolon: + | SEMICOLON + { let m = (rhs parseState 1) + BlockSeparator.Semicolon(m, Some m.End) } + + | SEMICOLON OBLOCKSEP + { let mSemi = rhs parseState 1 + let m = rhs2 parseState 1 2 + BlockSeparator.Semicolon(m, Some mSemi.End) } + + | OBLOCKSEP SEMICOLON + { let mSemi = rhs parseState 2 + let m = rhs2 parseState 1 2 + BlockSeparator.Semicolon(m, Some mSemi.End) } + + | OBLOCKSEP + { BlockSeparator.Offside(rhs parseState 1, None) } + +/* Comma-only separators for name pattern pairs */ +pairs_seps_block_comma: + | COMMA + { let m = (rhs parseState 1) + BlockSeparator.Comma(m, Some m.End) } + + | COMMA OBLOCKSEP + { let mComma = rhs parseState 1 + let m = rhs2 parseState 1 2 + BlockSeparator.Comma(m, Some mComma.End) } + + | OBLOCKSEP COMMA + { let mComma = rhs parseState 2 + let m = rhs2 parseState 1 2 + BlockSeparator.Comma(m, Some mComma.End) } + + | OBLOCKSEP /* Allow newlines with comma patterns */ + { BlockSeparator.Offside(rhs parseState 1, None) } + +/* End of separator rules */ + /* identifier can start from the underscore */ pathOrUnderscore : | path diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 244be90e142..559b1681c5a 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Neúplný výraz operátoru (například^b) nebo volání kvalifikovaného typu (příklad: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Chybí klíčové slovo „{0}“ diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index d1b1782d093..1d43eb6bcd6 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Unvollständiger Operatorausdruck (Beispiel: a^b) oder qualifizierter Typaufruf (Beispiel: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Schlüsselwort "{0}" fehlt. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index cd311cc7fc5..d564d4cb12b 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Expresión de operador incompleta (ejemplo, a^b) o invocación de tipo calificada (ejemplo: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Falta la palabra clave “{0}” diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index e05e9ecdf6c..7045446ce75 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Expression d’opérateur incomplète (exemple a^b) ou appel de type qualifié (exemple : ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Mot clé manquant '{0}' diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index a25fd816046..b2c01b0ae1f 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Espressione operatore incompleta (ad esempio a^b) o chiamata di tipo qualificato (ad esempio: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Parola chiave mancante "{0}" diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 87b7d40df1e..e9b27a07754 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ 不完全な演算子式 (例 a^b) または修飾型の呼び出し (例: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' キーワード '{0}' がありません diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index f2fe6e20f97..5ee3f19e0ec 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ 불완전한 연산자 식(예: a^b) 또는 정규화된 형식 호출(예: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' '{0}' 키워드가 없습니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 23a194ff258..f14445c2681 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Niekompletne wyrażenie operatora (na przykład a^b) lub wywołanie typu kwalifikowanego (przykład: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Brak słowa kluczowego „{0}” diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 503fc0f073f..0f391745a84 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Expressão de operador incompleta (exemplo a^b) ou invocação de tipo qualificado (exemplo: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Palavra-chave "{0}" ausente diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 7013fb0bc83..9507d600b57 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Неполное выражение оператора (например, a^b) или вызов квалифицированного типа (например, ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Отсутствует ключевое слово "{0}" diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 49d2a295b45..ad026703bde 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ Eksik işleç ifadesi (örnek a^b) veya tam tür çağrısı (örnek: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' Eksik '{0}' anahtar sözcüğü diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 3fc65eebc96..f444ed637fc 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ 运算符表达式不完整(示例: a^b)或限定类型调用(示例: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' 缺少关键字“{0}” diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 07fea0efd23..e6368a123a0 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -287,6 +287,11 @@ Allow access modifiers to auto properties getters and setters + + Allow comma as union case name field separator. + Allow comma as union case name field separator. + + Allow let! and use! type annotations without requiring parentheses Allow let! and use! type annotations without requiring parentheses @@ -1197,6 +1202,11 @@ 不完整的運算子運算式 (範例 a^b) 或限定類型調用 (範例: ^T.Name) + + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. + + Missing keyword '{0}' 遺漏關鍵字 '{0}' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs.fs new file mode 100644 index 00000000000..b16ec5f0b56 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs.fs @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module NamedPatPairs = + + let verifyCompile compilation = + compilation + |> asExe + |> withOptions ["--nowarn:988"] + |> compile + + let verifyCompileAndRun compilation = + compilation + |> asExe + |> withOptions ["--nowarn:988"] + |> compileAndRun + + [] + let ``Version9 NamedPatPairs - NamedPatPairs01_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 9, Col 18, Line 9, Col 19, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 10, Col 25, Line 10, Col 26, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 10, Col 18, Line 10, Col 19, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs01_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs02_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs02_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs03_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 10, Col 18, Line 10, Col 19, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 11, Col 25, Line 11, Col 26, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 11, Col 18, Line 11, Col 19, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs03_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs04_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs04_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs05_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs05_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs06_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs06_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs07_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs07_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs08_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs08_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs09_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs09_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs10_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 8, Col 21, Line 8, Col 22, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 12, Col 23, Line 12, Col 24, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 16, Col 21, Line 16, Col 22, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs10_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs11_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 4, Col 17, Line 4, Col 18, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 14, Col 24, Line 14, Col 25, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 14, Col 17, Line 14, Col 18, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs11_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs12_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs12_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs13_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 10, Col 18, Line 10, Col 19, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs13_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 9, Col 17, Line 9, Col 21, "This expression was expected to have type +'int' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 24, Line 10, Col 28, "This expression was expected to have type +'bool' +but here has type +''a * 'b' "); + (Warning 25, Line 7, Col 11, Line 7, Col 16, "Incomplete pattern matches on this expression.") + ] + + [] + let ``Version9 NamedPatPairs - NamedPatPairs14_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs14_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs15_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 4, Col 17, Line 4, Col 18, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs15_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 4, Col 23, Line 4, Col 27, "This expression was expected to have type +'string' +but here has type +''a * 'b' "); + (Warning 25, Line 4, Col 5, Line 4, Col 29, "Incomplete pattern matches on this expression.") + ] + + [] + let ``Version9 NamedPatPairs - NamedPatPairs16_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs16_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompileAndRun + |> shouldSucceed + + [] + let ``Version9: NamedPatPairs - NamedPatPairs17_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 10, Col 21, Line 10, Col 22, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs17_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 9, Col 17, Line 9, Col 21, "This expression was expected to have type +'int' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 17, Line 10, Col 21, "This expression was expected to have type +'float' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 27, Line 10, Col 31, "This expression was expected to have type +'bool' +but here has type +''a * 'b' "); + (Warning 25, Line 7, Col 11, Line 7, Col 16, "Incomplete pattern matches on this expression.") + ] + + [] + let ``Version9: NamedPatPairs - NamedPatPairs18_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 9, Col 17, Line 9, Col 21, "This expression was expected to have type +'int' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 17, Line 10, Col 21, "This expression was expected to have type +'float' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 27, Line 10, Col 31, "This expression was expected to have type +'bool' +but here has type +''a * 'b' "); + (Warning 25, Line 7, Col 11, Line 7, Col 16, "Incomplete pattern matches on this expression.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs18_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 9, Col 17, Line 9, Col 21, "This expression was expected to have type +'int' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 17, Line 10, Col 21, "This expression was expected to have type +'float' +but here has type +''a * 'b' "); + (Error 1, Line 10, Col 27, Line 10, Col 31, "This expression was expected to have type +'bool' +but here has type +''a * 'b' "); + (Warning 25, Line 7, Col 11, Line 7, Col 16, "Incomplete pattern matches on this expression.") + ] + + [] + let ``Version9 NamedPatPairs - NamedPatPairs19_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> verifyCompile + |> shouldSucceed + + [] + let ``Preview: NamedPatPairs - NamedPatPairs19_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompile + |> shouldSucceed + + [] + let ``Version9 NamedPatPairs - NamedPatPairs20_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 4, Col 17, Line 4, Col 18, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 5, Col 19, Line 5, Col 20, "Feature 'Allow comma as union case name field separator.' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + ] + + [] + let ``Preview: NamedPatPairs - NamedPatPairs20_fs`` compilation = + compilation + |> ignoreWarnings + |> withLangVersionPreview + |> verifyCompile + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs01.fs new file mode 100644 index 00000000000..fe6a07dfe8b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs01.fs @@ -0,0 +1,23 @@ +type MyUnion = + | CaseA of x: int + | CaseB of x: int * y: string + | CaseC of x: float * y: bool * z: char + +let testComma value = + match value with + | CaseA(x = x) -> sprintf "CaseA: a=%d" x + | CaseB(x = x, y = y) -> sprintf "CaseA: a=%d, b=%s" x y + | CaseC(x = p, y = q, z = r) -> sprintf "CaseB: x=%f, y=%b, z=%c" p q r + +let expected = + [ "CaseA: a=42" + "CaseA: a=7, b=hello" + "CaseB: x=3.140000, y=true, z=z" ] + +let actual = + [ testComma (CaseA 42) + testComma (CaseB(7, "hello")) + testComma (CaseC(3.14, true, 'z')) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs02.fs new file mode 100644 index 00000000000..23a3bb37f9e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs02.fs @@ -0,0 +1,23 @@ +type MyUnion = + | CaseA of x: int + | CaseB of x: int * y: string + | CaseC of x: float * y: bool * z: char + +let testSemicolon value = + match value with + | CaseA(x = x) -> sprintf "CaseA: a=%d" x + | CaseB(x = x; y = y) -> sprintf "CaseA: a=%d, b=%s" x y + | CaseC(x = p; y = q; z = r) -> sprintf "CaseB: x=%f, y=%b, z=%c" p q r + +let expected = + [ "CaseA: a=42" + "CaseA: a=7, b=hello" + "CaseB: x=3.140000, y=true, z=z" ] + +let actual = + [ testSemicolon (CaseA 42) + testSemicolon (CaseB(7, "hello")) + testSemicolon (CaseC(3.14, true, 'z')) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs03.fs new file mode 100644 index 00000000000..fb3c5992c1e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs03.fs @@ -0,0 +1,24 @@ +exception Error1 of x: string +exception Error2 of x: string * y: int +exception Error3 of x: string * y: int * z: float + +let testComma (value: exn) = + try + raise value + with + | Error1(x = x) -> sprintf "Error1: a=%s" x + | Error2(x = x, y = y) -> sprintf "Error2: a=%s, b=%d" x y + | Error3(x = p, y = q, z = r) -> sprintf "Error3: x=%s, y=%d, z=%f" p q r + +let expected = + [ "Error1: a=error one" + "Error2: a=error two, b=2" + "Error3: x=error three, y=3, z=3.140000" ] + +let actual = + [ testComma (Error1 "error one") + testComma (Error2("error two", 2)) + testComma (Error3("error three", 3, 3.14)) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs04.fs new file mode 100644 index 00000000000..ea6b61b44d6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs04.fs @@ -0,0 +1,24 @@ +exception Error1 of x: string +exception Error2 of x: string * y: int +exception Error3 of x: string * y: int * z: float + +let testSemicolon (value: exn) = + try + raise value + with + | Error1(x = x) -> sprintf "Error1: a=%s" x + | Error2(x = x; y = y) -> sprintf "Error2: a=%s, b=%d" x y + | Error3(x = p; y = q; z = r) -> sprintf "Error3: x=%s, y=%d, z=%f" p q r + +let expected = + [ "Error1: a=error one" + "Error2: a=error two, b=2" + "Error3: x=error three, y=3, z=3.140000" ] + +let actual = + [ testSemicolon (Error1 "error one") + testSemicolon (Error2("error two", 2)) + testSemicolon (Error3("error three", 3, 3.14)) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs05.fs new file mode 100644 index 00000000000..4e9bbe42bc9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs05.fs @@ -0,0 +1,13 @@ +type MyUnion = + | CaseA of x: (float * bool) + +let testTupled value = + match value with + | CaseA(x = (a, b)) -> $"CaseA: x=%f{a}, %b{b}" + +let expected = "CaseA: x=3.140000, true" + +let actual = testTupled (CaseA(3.14, true)) + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs06.fs new file mode 100644 index 00000000000..042125941a1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs06.fs @@ -0,0 +1,13 @@ +type MyUnion = + | CaseA of x: (float * bool) + +let testTupled value = + match value with + | CaseA(x = a, b) -> $"CaseA: x=%f{a}, %b{b}" + +let expected = "CaseA: x=3.140000, true" + +let actual = testTupled (CaseA(3.14, true)) + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs07.fs new file mode 100644 index 00000000000..718cfa6dc67 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs07.fs @@ -0,0 +1,15 @@ +type TupleAbbrev = float * bool + +type MyUnion = + | CaseA of x: TupleAbbrev + +let testTupled value = + match value with + | CaseA(x = a, b) -> $"CaseA: x=%f{a}, %b{b}" + +let expected = "CaseA: x=3.140000, true" + +let actual = testTupled (CaseA(3.14, true)) + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs08.fs new file mode 100644 index 00000000000..1a7029da8ab --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs08.fs @@ -0,0 +1,27 @@ +type SynLongIdent = +| SynLongIdent of id: string * dotRanges: string list + +type RecordFieldName = SynLongIdent * bool + +type MyUnion = + | CaseA of x: RecordFieldName + +let testTupled value = + match value with + | CaseA(x = SynLongIdent(a, b), _) -> $"CaseA: x=%s{a} %A{b}" + +let testTupled2 value = + match value with + | CaseA(x = (SynLongIdent(a, b), _)) -> $"CaseA: x=%s{a} %A{b}" + +let expected = "CaseA: x=3.140000 [\"\"]" + +let actual = testTupled (CaseA((SynLongIdent("3.140000", [""]), true))) + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual + +let actual2 = testTupled2 (CaseA((SynLongIdent("3.140000", [""]), true))) + +if actual2 <> expected then + failwithf "expected: %A, got: %A" expected actual2 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs09.fs new file mode 100644 index 00000000000..9e980055652 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs09.fs @@ -0,0 +1,25 @@ +type TupleAbbrev = float * bool + +type MyUnion = + | CaseA of x: TupleAbbrev * y: TupleAbbrev + +let testTupled value = + match value with + | CaseA(x = a, b; y = f, g) -> $"CaseA: x=%f{a}, %b{b}; y=%f{f}, %b{g}" + +let testTupled2 value = + match value with + | CaseA(x = _, _; y = _, _) -> $"CaseA: x=_, _; y=_, _" + +let expected = "CaseA: x=3.140000, true; y=2.720000, false" +let expected2 = "CaseA: x=_, _; y=_, _" + +let actual = testTupled (CaseA((3.14, true), (2.72, false))) + +let actual2 = testTupled2 (CaseA((3.14, true), (2.72, false))) + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual + +if actual2 <> expected2 then + failwithf "expected: %A, got: %A" expected2 actual2 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs10.fs new file mode 100644 index 00000000000..ea237d6a40d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs10.fs @@ -0,0 +1,35 @@ +type TupleAbbrev = float * bool + +type MyUnion = + | CaseA of x: TupleAbbrev * y: TupleAbbrev + +let testTupled value = + match value with + | CaseA(x = a, b, y = f, g) -> $"CaseA: x=%f{a}, %b{b}, y=%f{f}, %b{g}" + +let testTupled2 value = + match value with + | CaseA(x = (a, b), y = f, g) -> $"CaseA: x=%f{a}, %b{b}, y=%f{f}, %b{g}" + +let testTupled3 value = + match value with + | CaseA(x = _, _, y = _, _) -> $"CaseA: x=_, _, y=_, _" + +let expected = "CaseA: x=3.140000, true, y=2.720000, false" + +let expected2 = "CaseA: x=_, _, y=_, _" + +let actual = testTupled (CaseA((3.14, true), (2.72, false))) + +let actual2 = testTupled2 (CaseA((3.14, true), (2.72, false))) + +let actual3 = testTupled3 (CaseA((3.14, true), (2.72, false))) + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual + +if actual2 <> expected then + failwithf "expected: %A, got: %A" expected actual2 + +if actual3 <> expected2 then + failwith "expected: %A, got: %A" expected2 actual3 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs11.fs new file mode 100644 index 00000000000..5a7e331b6bc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs11.fs @@ -0,0 +1,19 @@ +type CaseB = + | CaseB of x: int * y: string + +let (CaseB(x = a, y = b)) = CaseB(7, "hello") + +let actual2 = a, b + +if actual2 <> (7, "hello") then + failwithf "expected: %A, got: %A" [7, "hello"] actual2 + +type CaseC = + | CaseC of x: float * y: bool * z: char + +let (CaseC(x = p, y = q, z = r)) = CaseC(3.14, true, 'z') + +let actual3 = (p, q, r) + +if actual3 <> (3.14, true, 'z') then + failwithf "expected: %A, got: %A" (3.14, true, 'z') actual3 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs12.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs12.fs new file mode 100644 index 00000000000..69f600f9d57 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs12.fs @@ -0,0 +1,19 @@ +type CaseB = + | CaseB of x: int * y: string + +let (CaseB(x = a; y = b)) = CaseB(7, "hello") + +let actual2 = a, b + +if actual2 <> (7, "hello") then + failwithf "expected: %A, got: %A" [7, "hello"] actual2 + +type CaseC = + | CaseC of x: float * y: bool * z: char + +let (CaseC(x = p; y = q; z = r)) = CaseC(3.14, true, 'z') + +let actual3 = (p, q, r) + +if actual3 <> (3.14, true, 'z') then + failwithf "expected: %A, got: %A" (3.14, true, 'z') actual3 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs13.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs13.fs new file mode 100644 index 00000000000..96a4fe32227 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs13.fs @@ -0,0 +1,23 @@ +type MyUnion = + | CaseA of x: int + | CaseB of x: int * y: string + | CaseC of x: float * y: bool * z: char + +let testComma value = + match value with + | CaseA(x = x) -> sprintf "CaseA: a=%d" x + | CaseB(x = x, _) -> sprintf "CaseA: a=%d" x + | CaseC(x = p, y = q, _) -> sprintf "CaseB: x=%f, y=%b" p q + +let expected = + [ "CaseA: a=42" + "CaseA: a=7" + "CaseB: x=3.140000, y=true" ] + +let actual = + [ testComma (CaseA 42) + testComma (CaseB(7, "hello")) + testComma (CaseC(3.14, true, 'z')) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs14.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs14.fs new file mode 100644 index 00000000000..1e18f2d70f6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs14.fs @@ -0,0 +1,23 @@ +type MyUnion = + | CaseA of x: int + | CaseB of x: int * y: string + | CaseC of x: float * y: bool * z: char + +let testSemicolon2 value = + match value with + | CaseA(x = x) -> sprintf "CaseA: a=%d" x + | CaseB(x = x; _) -> sprintf "CaseA: a=%d" x + | CaseC(x = p; y = q; _) -> sprintf "CaseB: x=%f, y=%b" p q + +let expected = + [ "CaseA: a=42" + "CaseA: a=7" + "CaseB: x=3.140000, y=true" ] + +let actual = + [ testSemicolon2 (CaseA 42) + testSemicolon2 (CaseB(7, "hello")) + testSemicolon2 (CaseC(3.14, true, 'z')) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs15.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs15.fs new file mode 100644 index 00000000000..514068146e6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs15.fs @@ -0,0 +1,9 @@ +type CaseB = + | CaseB of x: int * y: string * z: bool + +let (CaseB(x = a, y = b, _)) = CaseB(7, "hello", true) + +let actual2 = a, b + +if actual2 <> (7, "hello") then + failwithf "expected: %A, got: %A" [7, "hello"] actual2 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs16.fs new file mode 100644 index 00000000000..072242aff9f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs16.fs @@ -0,0 +1,9 @@ +type CaseB = + | CaseB of x: int * y: string * z: bool + +let (CaseB(x = a; y = b; _)) = CaseB(7, "hello", true) + +let actual2 = a, b + +if actual2 <> (7, "hello") then + failwithf "expected: %A, got: %A" [7, "hello"] actual2 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs17.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs17.fs new file mode 100644 index 00000000000..5fb4a2a439e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs17.fs @@ -0,0 +1,23 @@ +type MyUnion = + | CaseA of x: int + | CaseB of x: int * y: string + | CaseC of x: float * y: bool * z: char + +let testComma value = + match value with + | CaseA(x = x) -> sprintf "CaseA: a=%d" x + | CaseB(x = x, _) -> sprintf "CaseA: a=%d" x + | CaseC(x = p, a, y = q, r) -> sprintf "CaseB: x=%f, y=%b" p q + +let expected = + [ "CaseA: a=42" + "CaseA: a=7" + "CaseB: x=3.140000, y=true" ] + +let actual = + [ testComma (CaseA 42) + testComma (CaseB(7, "hello")) + testComma (CaseC(3.14, true, 'z')) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs18.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs18.fs new file mode 100644 index 00000000000..6debaaf5b82 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs18.fs @@ -0,0 +1,23 @@ +type MyUnion = + | CaseA of x: int + | CaseB of x: int * y: string + | CaseC of x: float * y: bool * z: char + +let testComma value = + match value with + | CaseA(x = x) -> sprintf "CaseA: a=%d" x + | CaseB(x = x, _) -> sprintf "CaseA: a=%d" x + | CaseC(x = p, a; y = q, r) -> sprintf "CaseB: x=%f, y=%b" p q + +let expected = + [ "CaseA: a=42" + "CaseA: a=7" + "CaseB: x=3.140000, y=true" ] + +let actual = + [ testComma (CaseA 42) + testComma (CaseB(7, "hello")) + testComma (CaseC(3.14, true, 'z')) ] + +if actual <> expected then + failwithf "expected: %A, got: %A" expected actual \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs19.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs19.fs new file mode 100644 index 00000000000..e6413eb0b0c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs19.fs @@ -0,0 +1,5 @@ +type U = A of x : (int * int) * y : int + +// These are the same +let (A (x = _, _; y = _)) = A ((1, 2), 3) +let (A (x = (_, _); y = _)) = A ((1, 2), 3) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs20.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs20.fs new file mode 100644 index 00000000000..f85d009925d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/NamedPatPairs/NamedPatPairs20.fs @@ -0,0 +1,5 @@ +type U = A of x : (int * int) * y : int + +// These are the same +let (A (x = _, _, y = _)) = A ((1, 2), 3) +let (A (x = (_, _), y = _)) = A ((1, 2), 3) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 960057baf98..3f4e5dca132 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -112,6 +112,7 @@ + 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 0d1885f7d54..2075b9a27a7 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 02.fs.bsl @@ -30,4 +30,4 @@ ImplFile WarnDirectives = [] CodeComments = [] }, set [])) -(4,15)-(4,16) parse error Unexpected symbol ')' in pattern +(4,13)-(4,14) parse error Expecting pattern 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 9e8aafe9bb9..f6400cb7a34 100644 --- a/tests/service/data/SyntaxTree/Pattern/Named field 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Named field 03.fs.bsl @@ -17,9 +17,12 @@ ImplFile 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)), + FromParseError + (Named + (SynIdent (b, None), false, None, + (4,11--4,12)), (4,11--4,12)), None)], + (4,4--4,12), { 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) @@ -29,5 +32,3 @@ ImplFile { ConditionalDirectives = [] WarnDirectives = [] CodeComments = [] }, set [])) - -(4,12)-(4,13) parse error Unexpected symbol ')' in pattern. Expected '=' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 10.fs b/tests/service/data/SyntaxTree/Pattern/Named field 10.fs new file mode 100644 index 00000000000..58cb8775530 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 10.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _, b = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 10.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 10.fs.bsl new file mode 100644 index 00000000000..75af2a1598d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 10.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 10.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), Wild (4,8--4,9), + Some (Comma ((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) + BarRange = Some (4,0--4,1) })], + (3,0--4,22), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,22))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,22), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 11.fs b/tests/service/data/SyntaxTree/Pattern/Named field 11.fs new file mode 100644 index 00000000000..633fa9602a7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 11.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _, b = ) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 11.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 11.fs.bsl new file mode 100644 index 00000000000..ddb6ea68692 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 11.fs.bsl @@ -0,0 +1,33 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 11.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), Wild (4,8--4,9), + Some (Comma ((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) + WithKeyword = (3,8--3,12) }), (3,0--4,21))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,13)-(4,14) parse error Expecting pattern diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 12.fs b/tests/service/data/SyntaxTree/Pattern/Named field 12.fs new file mode 100644 index 00000000000..cad1308ead9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 12.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _, b) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 12.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 12.fs.bsl new file mode 100644 index 00000000000..dc9a0566475 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 12.fs.bsl @@ -0,0 +1,32 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 12.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,12), + Tuple + (false, + [Wild (4,8--4,9); + Named + (SynIdent (b, None), false, None, + (4,11--4,12))], [(4,9--4,10)], (4,8--4,12)), + None)], (4,4--4,12), { 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) + 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 [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 13.fs b/tests/service/data/SyntaxTree/Pattern/Named field 13.fs new file mode 100644 index 00000000000..505049e223d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 13.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _,) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 13.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 13.fs.bsl new file mode 100644 index 00000000000..c2d118dcce4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 13.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 13.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), Wild (4,8--4,9), + Some (Comma ((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) + BarRange = Some (4,0--4,1) })], + (3,0--4,16), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,16))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,16), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 14.fs b/tests/service/data/SyntaxTree/Pattern/Named field 14.fs new file mode 100644 index 00000000000..5a6fe119f9b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 14.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _, , c = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 14.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 14.fs.bsl new file mode 100644 index 00000000000..ef6b9bdd150 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 14.fs.bsl @@ -0,0 +1,32 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 14.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), Wild (4,8--4,9), + Some (Comma ((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) + BarRange = Some (4,0--4,1) })], + (3,0--4,24), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (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 = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,11)-(4,12) parse error Expecting pattern diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 15.fs b/tests/service/data/SyntaxTree/Pattern/Named field 15.fs new file mode 100644 index 00000000000..81ce230e234 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 15.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 15.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 15.fs.bsl new file mode 100644 index 00000000000..67415fa1858 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 15.fs.bsl @@ -0,0 +1,40 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 15.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 (Comma ((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 (Comma ((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 16.fs b/tests/service/data/SyntaxTree/Pattern/Named field 16.fs new file mode 100644 index 00000000000..f314a18f0b8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 16.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 16.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 16.fs.bsl new file mode 100644 index 00000000000..892527ba7cd --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 16.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 16.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 + (Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (4,4--4,5)); + Named + (SynIdent (b, None), false, None, + (4,7--4,8))], [(4,5--4,6)], (4,4--4,8)), + (4,3--4,8)), (4,3--4,8))], None, (4,2--4,8)), + 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,9)-(4,10) 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/Named field 17.fs b/tests/service/data/SyntaxTree/Pattern/Named field 17.fs new file mode 100644 index 00000000000..1dad8be92bf --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 17.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = x, y) -> x diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 17.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 17.fs.bsl new file mode 100644 index 00000000000..c8a6c80721b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 17.fs.bsl @@ -0,0 +1,34 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 17.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,12), + Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,8--4,9)); + Named + (SynIdent (y, None), false, None, + (4,11--4,12))], [(4,9--4,10)], (4,8--4,12)), + None)], (4,4--4,12), { ParenRange = (4,3--4,13) }), + None, (4,2--4,13)), None, Ident x, (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 [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 18.fs b/tests/service/data/SyntaxTree/Pattern/Named field 18.fs new file mode 100644 index 00000000000..c7041dc0768 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 18.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = (x, y)) -> x diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 18.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 18.fs.bsl new file mode 100644 index 00000000000..8d71e3b5d4f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 18.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 18.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,14), + Paren + (Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,9--4,10)); + Named + (SynIdent (y, None), false, None, + (4,12--4,13))], [(4,10--4,11)], + (4,9--4,13)), (4,8--4,14)), None)], + (4,4--4,15), { ParenRange = (4,3--4,15) }), None, + (4,2--4,15)), None, Ident x, (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,8--3,12) }), (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 [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 19.fs b/tests/service/data/SyntaxTree/Pattern/Named field 19.fs new file mode 100644 index 00000000000..0d251386db7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 19.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _; _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 19.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 19.fs.bsl new file mode 100644 index 00000000000..cb2cd602caf --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 19.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 19.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), Wild (4,8--4,9), + Some (Semicolon ((4,9--4,10), Some (4,10))))], + (4,4--4,12), { 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) + 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 [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 20.fs b/tests/service/data/SyntaxTree/Pattern/Named field 20.fs new file mode 100644 index 00000000000..d01baf77463 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 20.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = _, _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 20.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 20.fs.bsl new file mode 100644 index 00000000000..45b24d7f769 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 20.fs.bsl @@ -0,0 +1,29 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 20.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,12), + Tuple + (false, [Wild (4,8--4,9); Wild (4,11--4,12)], + [(4,9--4,10)], (4,8--4,12)), None)], + (4,4--4,12), { 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) + 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 [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 21.fs b/tests/service/data/SyntaxTree/Pattern/Named field 21.fs new file mode 100644 index 00000000000..6294d361eaa --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 21.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _, b = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 21.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 21.fs.bsl new file mode 100644 index 00000000000..ecd1b1f3c12 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 21.fs.bsl @@ -0,0 +1,33 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 21.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Comma ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,13--6,14), + (6,11--6,16), Wild (6,15--6,16), None)], + (6,4--6,17), { ParenRange = (6,3--6,17) }), None, + (6,2--6,17)), None, Const (Int32 2, (6,21--6,22)), + (6,2--6,22), Yes, { ArrowRange = Some (6,18--6,20) + BarRange = Some (6,0--6,1) })], + (3,0--6,22), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,22) }), (3,0--6,22))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,22), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 22.fs b/tests/service/data/SyntaxTree/Pattern/Named field 22.fs new file mode 100644 index 00000000000..72c6dd0cb21 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 22.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _; b = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 22.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 22.fs.bsl new file mode 100644 index 00000000000..e9fa46131c0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 22.fs.bsl @@ -0,0 +1,33 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 22.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Semicolon ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,13--6,14), + (6,11--6,16), Wild (6,15--6,16), None)], + (6,4--6,17), { ParenRange = (6,3--6,17) }), None, + (6,2--6,17)), None, Const (Int32 2, (6,21--6,22)), + (6,2--6,22), Yes, { ArrowRange = Some (6,18--6,20) + BarRange = Some (6,0--6,1) })], + (3,0--6,22), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,22) }), (3,0--6,22))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,22), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 23.fs b/tests/service/data/SyntaxTree/Pattern/Named field 23.fs new file mode 100644 index 00000000000..4ce67c3b3c3 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 23.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _, b = ) -> 2 \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 23.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 23.fs.bsl new file mode 100644 index 00000000000..20701ed015b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 23.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 23.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Comma ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,13--6,14), + (6,11--6,14), + FromParseError (Wild (6,14--6,14), (6,14--6,14)), + None)], (6,4--6,16), { ParenRange = (6,3--6,16) }), + None, (6,2--6,16)), None, Const (Int32 2, (6,20--6,21)), + (6,2--6,21), Yes, { ArrowRange = Some (6,17--6,19) + BarRange = Some (6,0--6,1) })], + (3,0--6,21), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,21) }), (3,0--6,21))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(6,13)-(6,14) parse error Expecting pattern diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 24.fs b/tests/service/data/SyntaxTree/Pattern/Named field 24.fs new file mode 100644 index 00000000000..3b4c16437e5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 24.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _; b = ) -> 2 \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 24.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 24.fs.bsl new file mode 100644 index 00000000000..c63863b49f8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 24.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 24.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Semicolon ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,13--6,14), + (6,11--6,14), + FromParseError (Wild (6,14--6,14), (6,14--6,14)), + None)], (6,4--6,16), { ParenRange = (6,3--6,16) }), + None, (6,2--6,16)), None, Const (Int32 2, (6,20--6,21)), + (6,2--6,21), Yes, { ArrowRange = Some (6,17--6,19) + BarRange = Some (6,0--6,1) })], + (3,0--6,21), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,21) }), (3,0--6,21))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(6,13)-(6,14) parse error Expecting pattern diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 25.fs b/tests/service/data/SyntaxTree/Pattern/Named field 25.fs new file mode 100644 index 00000000000..bd6a0d1dfa8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 25.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _, b) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 25.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 25.fs.bsl new file mode 100644 index 00000000000..490162aef9a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 25.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 25.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, + [Wild (6,8--6,9); + Named + (SynIdent (b, None), false, None, + (6,11--6,12))], [(6,9--6,10)], (6,8--6,12)), + None)], (6,4--6,12), { ParenRange = (6,3--6,13) }), + None, (6,2--6,13)), None, Const (Int32 2, (6,17--6,18)), + (6,2--6,18), Yes, { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], + (3,0--6,18), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 26.fs b/tests/service/data/SyntaxTree/Pattern/Named field 26.fs new file mode 100644 index 00000000000..7928eea8e1e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 26.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _; b) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 26.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 26.fs.bsl new file mode 100644 index 00000000000..3dd9b92fcc4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 26.fs.bsl @@ -0,0 +1,37 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 26.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Semicolon ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), None, + (6,11--6,12), + FromParseError + (Named + (SynIdent (b, None), false, None, + (6,11--6,12)), (6,11--6,12)), None)], + (6,4--6,12), { ParenRange = (6,3--6,13) }), None, + (6,2--6,13)), None, Const (Int32 2, (6,17--6,18)), + (6,2--6,18), Yes, { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], + (3,0--6,18), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 27.fs b/tests/service/data/SyntaxTree/Pattern/Named field 27.fs new file mode 100644 index 00000000000..fb27e3ff7c3 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 27.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _,) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 27.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 27.fs.bsl new file mode 100644 index 00000000000..0abea57c4e6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 27.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 27.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Comma ((6,9--6,10), Some (6,10))))], + (6,4--6,10), { ParenRange = (6,3--6,11) }), None, + (6,2--6,11)), None, Const (Int32 2, (6,15--6,16)), + (6,2--6,16), Yes, { ArrowRange = Some (6,12--6,14) + BarRange = Some (6,0--6,1) })], + (3,0--6,16), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,16) }), (3,0--6,16))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,16), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 28.fs b/tests/service/data/SyntaxTree/Pattern/Named field 28.fs new file mode 100644 index 00000000000..9a79b4a29e9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 28.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _;) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 28.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 28.fs.bsl new file mode 100644 index 00000000000..634521edea9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 28.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 28.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Semicolon ((6,9--6,10), Some (6,10))))], + (6,4--6,10), { ParenRange = (6,3--6,11) }), None, + (6,2--6,11)), None, Const (Int32 2, (6,15--6,16)), + (6,2--6,16), Yes, { ArrowRange = Some (6,12--6,14) + BarRange = Some (6,0--6,1) })], + (3,0--6,16), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,16) }), (3,0--6,16))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,16), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 29.fs b/tests/service/data/SyntaxTree/Pattern/Named field 29.fs new file mode 100644 index 00000000000..13d4711b572 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 29.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _, , c = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 29.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 29.fs.bsl new file mode 100644 index 00000000000..28cdfad53a4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 29.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 29.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Comma ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (6,15--6,16), + (6,13--6,18), Wild (6,17--6,18), None)], + (6,4--6,19), { ParenRange = (6,3--6,19) }), None, + (6,2--6,19)), None, Const (Int32 2, (6,23--6,24)), + (6,2--6,24), Yes, { ArrowRange = Some (6,20--6,22) + BarRange = Some (6,0--6,1) })], + (3,0--6,24), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,24) }), (3,0--6,24))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,24), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(6,11)-(6,12) parse error Expecting pattern diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 30.fs b/tests/service/data/SyntaxTree/Pattern/Named field 30.fs new file mode 100644 index 00000000000..0b5f41b8586 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 30.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _; ; c = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 30.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 30.fs.bsl new file mode 100644 index 00000000000..56c8cfe1ca8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 30.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 30.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Semicolon ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (6,15--6,16), + (6,13--6,18), Wild (6,17--6,18), None)], + (6,4--6,19), { ParenRange = (6,3--6,19) }), None, + (6,2--6,19)), None, Const (Int32 2, (6,23--6,24)), + (6,2--6,24), Yes, { ArrowRange = Some (6,20--6,22) + BarRange = Some (6,0--6,1) })], + (3,0--6,24), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,24) }), (3,0--6,24))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,24), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(6,11)-(6,12) parse error Expecting pattern diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 31.fs b/tests/service/data/SyntaxTree/Pattern/Named field 31.fs new file mode 100644 index 00000000000..5f8b63bddde --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 31.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = a, b = b, c = c) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 31.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 31.fs.bsl new file mode 100644 index 00000000000..61860d04746 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 31.fs.bsl @@ -0,0 +1,43 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 31.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), + Named + (SynIdent (a, None), false, None, (6,8--6,9)), + Some (Comma ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,13--6,14), + (6,11--6,16), + Named + (SynIdent (b, None), false, None, (6,15--6,16)), + Some (Comma ((6,16--6,17), Some (6,17)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (6,20--6,21), + (6,18--6,23), + Named + (SynIdent (c, None), false, None, (6,22--6,23)), + None)], (6,4--6,24), { ParenRange = (6,3--6,24) }), + None, (6,2--6,24)), None, Const (Int32 2, (6,28--6,29)), + (6,2--6,29), Yes, { ArrowRange = Some (6,25--6,27) + BarRange = Some (6,0--6,1) })], + (3,0--6,29), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,29) }), (3,0--6,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 32.fs b/tests/service/data/SyntaxTree/Pattern/Named field 32.fs new file mode 100644 index 00000000000..f0ad3a35f47 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 32.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = a; b = b; c = c) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 32.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 32.fs.bsl new file mode 100644 index 00000000000..12f4c9de289 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 32.fs.bsl @@ -0,0 +1,43 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 32.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), + Named + (SynIdent (a, None), false, None, (6,8--6,9)), + Some (Semicolon ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,13--6,14), + (6,11--6,16), + Named + (SynIdent (b, None), false, None, (6,15--6,16)), + Some (Semicolon ((6,16--6,17), Some (6,17)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (6,20--6,21), + (6,18--6,23), + Named + (SynIdent (c, None), false, None, (6,22--6,23)), + None)], (6,4--6,24), { ParenRange = (6,3--6,24) }), + None, (6,2--6,24)), None, Const (Int32 2, (6,28--6,29)), + (6,2--6,29), Yes, { ArrowRange = Some (6,25--6,27) + BarRange = Some (6,0--6,1) })], + (3,0--6,29), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,29) }), (3,0--6,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 33.fs b/tests/service/data/SyntaxTree/Pattern/Named field 33.fs new file mode 100644 index 00000000000..ebc379a829d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 33.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a, b = c) -> a diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 33.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 33.fs.bsl new file mode 100644 index 00000000000..6e0b5b2c4f9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 33.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 33.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + Pats + [FromParseError + (Paren + (Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (6,4--6,5)); + Named + (SynIdent (b, None), false, None, + (6,7--6,8))], [(6,5--6,6)], (6,4--6,8)), + (6,3--6,8)), (6,3--6,8))], None, (6,2--6,8)), + None, Ident a, (6,2--6,18), Yes, + { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], (3,0--6,18), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(6,9)-(6,10) parse error Unexpected symbol '=' in pattern. Expected ')' or other token. +(6,3)-(6,4) parse error Unmatched '(' diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 34.fs b/tests/service/data/SyntaxTree/Pattern/Named field 34.fs new file mode 100644 index 00000000000..d7878658398 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 34.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a; b = c) -> a diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 34.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 34.fs.bsl new file mode 100644 index 00000000000..692514f6262 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 34.fs.bsl @@ -0,0 +1,33 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 34.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + Pats + [FromParseError + (Paren + (Named + (SynIdent (a, None), false, None, (6,4--6,5)), + (6,3--6,5)), (6,3--6,5))], None, (6,2--6,5)), + None, Ident a, (6,2--6,18), Yes, + { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], (3,0--6,18), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(6,5)-(6,6) parse error Unexpected symbol ';' in pattern. Expected ')' or other token. +(6,3)-(6,4) parse error Unmatched '(' diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 35.fs b/tests/service/data/SyntaxTree/Pattern/Named field 35.fs new file mode 100644 index 00000000000..b0bf69b8da0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 35.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = x, y) -> x diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 35.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 35.fs.bsl new file mode 100644 index 00000000000..e502415e09e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 35.fs.bsl @@ -0,0 +1,37 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 35.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (6,8--6,9)); + Named + (SynIdent (y, None), false, None, + (6,11--6,12))], [(6,9--6,10)], (6,8--6,12)), + None)], (6,4--6,12), { ParenRange = (6,3--6,13) }), + None, (6,2--6,13)), None, Ident x, (6,2--6,18), Yes, + { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], (3,0--6,18), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 36.fs b/tests/service/data/SyntaxTree/Pattern/Named field 36.fs new file mode 100644 index 00000000000..91ddf71ed9a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 36.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = x; y) -> x diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 36.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 36.fs.bsl new file mode 100644 index 00000000000..07513a05a98 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 36.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 36.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), + Named + (SynIdent (x, None), false, None, (6,8--6,9)), + Some (Semicolon ((6,9--6,10), Some (6,10)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), None, + (6,11--6,12), + FromParseError + (Named + (SynIdent (y, None), false, None, + (6,11--6,12)), (6,11--6,12)), None)], + (6,4--6,12), { ParenRange = (6,3--6,13) }), None, + (6,2--6,13)), None, Ident x, (6,2--6,18), Yes, + { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], (3,0--6,18), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 37.fs b/tests/service/data/SyntaxTree/Pattern/Named field 37.fs new file mode 100644 index 00000000000..2eee53db448 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 37.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = (x, y)) -> x diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 37.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 37.fs.bsl new file mode 100644 index 00000000000..b34c5b5856e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 37.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 37.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,14), + Paren + (Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (6,9--6,10)); + Named + (SynIdent (y, None), false, None, + (6,12--6,13))], [(6,10--6,11)], + (6,9--6,13)), (6,8--6,14)), None)], + (6,4--6,15), { ParenRange = (6,3--6,15) }), None, + (6,2--6,15)), None, Ident x, (6,2--6,20), Yes, + { ArrowRange = Some (6,16--6,18) + BarRange = Some (6,0--6,1) })], (3,0--6,20), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,20) }), (3,0--6,20))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,20), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 38.fs b/tests/service/data/SyntaxTree/Pattern/Named field 38.fs new file mode 100644 index 00000000000..f1f43a210d3 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 38.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _, _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 38.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 38.fs.bsl new file mode 100644 index 00000000000..3ca1fa79276 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 38.fs.bsl @@ -0,0 +1,32 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 38.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, [Wild (6,8--6,9); Wild (6,11--6,12)], + [(6,9--6,10)], (6,8--6,12)), None)], + (6,4--6,12), { ParenRange = (6,3--6,13) }), None, + (6,2--6,13)), None, Const (Int32 2, (6,17--6,18)), + (6,2--6,18), Yes, { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], + (3,0--6,18), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 39.fs b/tests/service/data/SyntaxTree/Pattern/Named field 39.fs new file mode 100644 index 00000000000..61755d85923 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 39.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| SynExprRecordField(fieldName = SynLongIdent(id = id :: _), _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 39.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 39.fs.bsl new file mode 100644 index 00000000000..58d2bf9a9ba --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 39.fs.bsl @@ -0,0 +1,46 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 39.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 ([SynExprRecordField], [], [None]), None, + None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([fieldName], [], [None]), + Some (4,31--4,32), (4,21--4,62), + Tuple + (false, + [LongIdent + (SynLongIdent ([SynLongIdent], [], [None]), + None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([id], [], [None]), + Some (4,49--4,50), (4,46--4,58), + ListCons + (Named + (SynIdent (id, None), false, + None, (4,51--4,53)), + Wild (4,57--4,58), (4,51--4,58), + { ColonColonRange = (4,54--4,56) }), + None)], (4,46--4,59), + { ParenRange = (4,45--4,59) }), None, + (4,33--4,59)); Wild (4,61--4,62)], + [(4,59--4,60)], (4,33--4,62)), None)], + (4,21--4,62), { ParenRange = (4,20--4,63) }), None, + (4,2--4,63)), None, Const (Int32 2, (4,67--4,68)), + (4,2--4,68), Yes, { ArrowRange = Some (4,64--4,66) + BarRange = Some (4,0--4,1) })], + (3,0--4,68), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,68))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,68), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 40.fs b/tests/service/data/SyntaxTree/Pattern/Named field 40.fs new file mode 100644 index 00000000000..cb7eee90a6d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 40.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(a = _; _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 40.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 40.fs.bsl new file mode 100644 index 00000000000..4a8c45acc7d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 40.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 40.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (6,6--6,7), + (6,4--6,9), Wild (6,8--6,9), + Some (Semicolon ((6,9--6,10), Some (6,10))))], + (6,4--6,12), { ParenRange = (6,3--6,13) }), None, + (6,2--6,13)), None, Const (Int32 2, (6,17--6,18)), + (6,2--6,18), Yes, { ArrowRange = Some (6,14--6,16) + BarRange = Some (6,0--6,1) })], + (3,0--6,18), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,18) }), (3,0--6,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 41.fs b/tests/service/data/SyntaxTree/Pattern/Named field 41.fs new file mode 100644 index 00000000000..b4860a1948d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 41.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| CaseA(x = a, b; y = f, g) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 41.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 41.fs.bsl new file mode 100644 index 00000000000..d9128b44fc9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 41.fs.bsl @@ -0,0 +1,48 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 41.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 ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (4,10--4,11), + (4,8--4,16), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (4,12--4,13)); + Named + (SynIdent (b, None), false, None, + (4,15--4,16))], [(4,13--4,14)], + (4,12--4,16)), + Some (Semicolon ((4,16--4,17), Some (4,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (4,20--4,21), + (4,18--4,26), + Tuple + (false, + [Named + (SynIdent (f, None), false, None, + (4,22--4,23)); + Named + (SynIdent (g, None), false, None, + (4,25--4,26))], [(4,23--4,24)], + (4,22--4,26)), None)], (4,8--4,26), + { ParenRange = (4,7--4,27) }), None, (4,2--4,27)), + None, Const (Unit, (4,31--4,33)), (4,2--4,33), Yes, + { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], (3,0--4,33), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 42.fs b/tests/service/data/SyntaxTree/Pattern/Named field 42.fs new file mode 100644 index 00000000000..e36da455f7f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 42.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| CaseA(x = a, b, y = f, g) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 42.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 42.fs.bsl new file mode 100644 index 00000000000..2d35c696f5e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 42.fs.bsl @@ -0,0 +1,48 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 42.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 ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (4,10--4,11), + (4,8--4,16), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (4,12--4,13)); + Named + (SynIdent (b, None), false, None, + (4,15--4,16))], [(4,13--4,14)], + (4,12--4,16)), + Some (Comma ((4,16--4,17), Some (4,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (4,20--4,21), + (4,18--4,26), + Tuple + (false, + [Named + (SynIdent (f, None), false, None, + (4,22--4,23)); + Named + (SynIdent (g, None), false, None, + (4,25--4,26))], [(4,23--4,24)], + (4,22--4,26)), None)], (4,8--4,26), + { ParenRange = (4,7--4,27) }), None, (4,2--4,27)), + None, Const (Unit, (4,31--4,33)), (4,2--4,33), Yes, + { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], (3,0--4,33), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 43.fs b/tests/service/data/SyntaxTree/Pattern/Named field 43.fs new file mode 100644 index 00000000000..65a728fa0b1 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 43.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| CaseA(x = (a, b), y = f, g) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 43.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 43.fs.bsl new file mode 100644 index 00000000000..e6af62e660f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 43.fs.bsl @@ -0,0 +1,49 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 43.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 ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (4,10--4,11), + (4,8--4,18), + Paren + (Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (4,13--4,14)); + Named + (SynIdent (b, None), false, None, + (4,16--4,17))], [(4,14--4,15)], + (4,13--4,17)), (4,12--4,18)), + Some (Comma ((4,18--4,19), Some (4,19)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (4,22--4,23), + (4,20--4,28), + Tuple + (false, + [Named + (SynIdent (f, None), false, None, + (4,24--4,25)); + Named + (SynIdent (g, None), false, None, + (4,27--4,28))], [(4,25--4,26)], + (4,24--4,28)), None)], (4,8--4,28), + { ParenRange = (4,7--4,29) }), None, (4,2--4,29)), + None, Const (Unit, (4,33--4,35)), (4,2--4,35), Yes, + { ArrowRange = Some (4,30--4,32) + BarRange = Some (4,0--4,1) })], (3,0--4,35), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,35))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,35), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 44.fs b/tests/service/data/SyntaxTree/Pattern/Named field 44.fs new file mode 100644 index 00000000000..70d211732cc --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 44.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(x = a, b; y = f, g) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 44.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 44.fs.bsl new file mode 100644 index 00000000000..bbb1afd258c --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 44.fs.bsl @@ -0,0 +1,50 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 44.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (6,8--6,9)); + Named + (SynIdent (b, None), false, None, + (6,11--6,12))], [(6,9--6,10)], (6,8--6,12)), + Some (Semicolon ((6,12--6,13), Some (6,13)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (6,16--6,17), + (6,14--6,22), + Tuple + (false, + [Named + (SynIdent (f, None), false, None, + (6,18--6,19)); + Named + (SynIdent (g, None), false, None, + (6,21--6,22))], [(6,19--6,20)], + (6,18--6,22)), None)], (6,4--6,22), + { ParenRange = (6,3--6,23) }), None, (6,2--6,23)), + None, Const (Unit, (6,27--6,29)), (6,2--6,29), Yes, + { ArrowRange = Some (6,24--6,26) + BarRange = Some (6,0--6,1) })], (3,0--6,29), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,29) }), (3,0--6,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 45.fs b/tests/service/data/SyntaxTree/Pattern/Named field 45.fs new file mode 100644 index 00000000000..d73a50f45c5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 45.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(x = a, b, y = f, g) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 45.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 45.fs.bsl new file mode 100644 index 00000000000..bd06ab9e82c --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 45.fs.bsl @@ -0,0 +1,50 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 45.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (6,8--6,9)); + Named + (SynIdent (b, None), false, None, + (6,11--6,12))], [(6,9--6,10)], (6,8--6,12)), + Some (Comma ((6,12--6,13), Some (6,13)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (6,16--6,17), + (6,14--6,22), + Tuple + (false, + [Named + (SynIdent (f, None), false, None, + (6,18--6,19)); + Named + (SynIdent (g, None), false, None, + (6,21--6,22))], [(6,19--6,20)], + (6,18--6,22)), None)], (6,4--6,22), + { ParenRange = (6,3--6,23) }), None, (6,2--6,23)), + None, Const (Unit, (6,27--6,29)), (6,2--6,29), Yes, + { ArrowRange = Some (6,24--6,26) + BarRange = Some (6,0--6,1) })], (3,0--6,29), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,29) }), (3,0--6,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 46.fs b/tests/service/data/SyntaxTree/Pattern/Named field 46.fs new file mode 100644 index 00000000000..4f7224a1075 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 46.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(x = (a, b), y = f, g) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 46.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 46.fs.bsl new file mode 100644 index 00000000000..5b20e9b8612 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 46.fs.bsl @@ -0,0 +1,52 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 46.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (6,6--6,7), + (6,4--6,14), + Paren + (Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (6,9--6,10)); + Named + (SynIdent (b, None), false, None, + (6,12--6,13))], [(6,10--6,11)], + (6,9--6,13)), (6,8--6,14)), + Some (Comma ((6,14--6,15), Some (6,15)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (6,18--6,19), + (6,16--6,24), + Tuple + (false, + [Named + (SynIdent (f, None), false, None, + (6,20--6,21)); + Named + (SynIdent (g, None), false, None, + (6,23--6,24))], [(6,21--6,22)], + (6,20--6,24)), None)], (6,4--6,24), + { ParenRange = (6,3--6,25) }), None, (6,2--6,25)), + None, Const (Unit, (6,29--6,31)), (6,2--6,31), Yes, + { ArrowRange = Some (6,26--6,28) + BarRange = Some (6,0--6,1) })], (3,0--6,31), + Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,31) }), (3,0--6,31))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,31), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 47.fs b/tests/service/data/SyntaxTree/Pattern/Named field 47.fs new file mode 100644 index 00000000000..d9deece7776 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 47.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| CaseA(x = _, _, y = _, _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 47.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 47.fs.bsl new file mode 100644 index 00000000000..b69788a5cfd --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 47.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 47.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 ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (4,10--4,11), + (4,8--4,16), + Tuple + (false, [Wild (4,12--4,13); Wild (4,15--4,16)], + [(4,13--4,14)], (4,12--4,16)), + Some (Comma ((4,16--4,17), Some (4,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (4,20--4,21), + (4,18--4,26), + Tuple + (false, [Wild (4,22--4,23); Wild (4,25--4,26)], + [(4,23--4,24)], (4,22--4,26)), None)], + (4,8--4,26), { ParenRange = (4,7--4,27) }), None, + (4,2--4,27)), None, Const (Unit, (4,31--4,33)), + (4,2--4,33), Yes, { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], + (3,0--4,33), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 48.fs b/tests/service/data/SyntaxTree/Pattern/Named field 48.fs new file mode 100644 index 00000000000..e6a69dc8f2f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 48.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(x = _, _, y = _, _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 48.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 48.fs.bsl new file mode 100644 index 00000000000..0b999fa2404 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 48.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 48.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, [Wild (6,8--6,9); Wild (6,11--6,12)], + [(6,9--6,10)], (6,8--6,12)), + Some (Comma ((6,12--6,13), Some (6,13)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (6,16--6,17), + (6,14--6,22), + Tuple + (false, [Wild (6,18--6,19); Wild (6,21--6,22)], + [(6,19--6,20)], (6,18--6,22)), None)], + (6,4--6,22), { ParenRange = (6,3--6,23) }), None, + (6,2--6,23)), None, Const (Unit, (6,27--6,29)), + (6,2--6,29), Yes, { ArrowRange = Some (6,24--6,26) + BarRange = Some (6,0--6,1) })], + (3,0--6,29), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,29) }), (3,0--6,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 49.fs b/tests/service/data/SyntaxTree/Pattern/Named field 49.fs new file mode 100644 index 00000000000..53367275efd --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 49.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| CaseA(x = _, _; y = _, _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 49.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 49.fs.bsl new file mode 100644 index 00000000000..cea52f636d2 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 49.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 49.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 ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (4,10--4,11), + (4,8--4,16), + Tuple + (false, [Wild (4,12--4,13); Wild (4,15--4,16)], + [(4,13--4,14)], (4,12--4,16)), + Some (Semicolon ((4,16--4,17), Some (4,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (4,20--4,21), + (4,18--4,26), + Tuple + (false, [Wild (4,22--4,23); Wild (4,25--4,26)], + [(4,23--4,24)], (4,22--4,26)), None)], + (4,8--4,26), { ParenRange = (4,7--4,27) }), None, + (4,2--4,27)), None, Const (Unit, (4,31--4,33)), + (4,2--4,33), Yes, { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], + (3,0--4,33), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 50.fs b/tests/service/data/SyntaxTree/Pattern/Named field 50.fs new file mode 100644 index 00000000000..050baaa7436 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 50.fs @@ -0,0 +1,6 @@ +module Module + +try + () +with +| A(x = _, _; y = _, _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 50.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 50.fs.bsl new file mode 100644 index 00000000000..fb318f2df81 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 50.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 50.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (4,2--4,4)), + [SynMatchClause + (LongIdent + (SynLongIdent ([A], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (6,6--6,7), + (6,4--6,12), + Tuple + (false, [Wild (6,8--6,9); Wild (6,11--6,12)], + [(6,9--6,10)], (6,8--6,12)), + Some (Semicolon ((6,12--6,13), Some (6,13)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (6,16--6,17), + (6,14--6,22), + Tuple + (false, [Wild (6,18--6,19); Wild (6,21--6,22)], + [(6,19--6,20)], (6,18--6,22)), None)], + (6,4--6,22), { ParenRange = (6,3--6,23) }), None, + (6,2--6,23)), None, Const (Unit, (6,27--6,29)), + (6,2--6,29), Yes, { ArrowRange = Some (6,24--6,26) + BarRange = Some (6,0--6,1) })], + (3,0--6,29), Yes (3,0--3,3), Yes (5,0--5,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,29) }), (3,0--6,29))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,29), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 51.fs b/tests/service/data/SyntaxTree/Pattern/Named field 51.fs new file mode 100644 index 00000000000..7ceb21c8438 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 51.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = x, y; b = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 51.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 51.fs.bsl new file mode 100644 index 00000000000..63dd2fc5b24 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 51.fs.bsl @@ -0,0 +1,38 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 51.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,12), + Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,8--4,9)); + Named + (SynIdent (y, None), false, None, + (4,11--4,12))], [(4,9--4,10)], (4,8--4,12)), + Some (Semicolon ((4,12--4,13), Some (4,13)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,16--4,17), + (4,14--4,19), Wild (4,18--4,19), None)], + (4,4--4,20), { ParenRange = (4,3--4,20) }), None, + (4,2--4,20)), None, Const (Int32 2, (4,24--4,25)), + (4,2--4,25), Yes, { ArrowRange = Some (4,21--4,23) + BarRange = Some (4,0--4,1) })], + (3,0--4,25), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,25))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,25), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 52.fs b/tests/service/data/SyntaxTree/Pattern/Named field 52.fs new file mode 100644 index 00000000000..1aea3d70a56 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 52.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = x, y, b = _) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 52.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 52.fs.bsl new file mode 100644 index 00000000000..0d2b4a3794e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 52.fs.bsl @@ -0,0 +1,38 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 52.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,12), + Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,8--4,9)); + Named + (SynIdent (y, None), false, None, + (4,11--4,12))], [(4,9--4,10)], (4,8--4,12)), + Some (Comma ((4,12--4,13), Some (4,13)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,16--4,17), + (4,14--4,19), Wild (4,18--4,19), None)], + (4,4--4,20), { ParenRange = (4,3--4,20) }), None, + (4,2--4,20)), None, Const (Int32 2, (4,24--4,25)), + (4,2--4,25), Yes, { ArrowRange = Some (4,21--4,23) + BarRange = Some (4,0--4,1) })], + (3,0--4,25), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,25))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,25), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 53.fs b/tests/service/data/SyntaxTree/Pattern/Named field 53.fs new file mode 100644 index 00000000000..7aa1f431450 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 53.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1; Y = 3}; b = { X = 1; Y = 3}) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 53.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 53.fs.bsl new file mode 100644 index 00000000000..30f92fb1cb0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 53.fs.bsl @@ -0,0 +1,54 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 53.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,23), + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), + Some + (Semicolon ((4,15--4,16), Some (4,16)))); + NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,19--4,20), (4,17--4,22), + Const (Int32 3, (4,21--4,22)), None)], + (4,8--4,23)), + Some (Semicolon ((4,23--4,24), Some (4,24)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,27--4,28), + (4,25--4,44), + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,33--4,34), (4,31--4,36), + Const (Int32 1, (4,35--4,36)), + Some + (Semicolon ((4,36--4,37), Some (4,37)))); + NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,40--4,41), (4,38--4,43), + Const (Int32 3, (4,42--4,43)), None)], + (4,29--4,44)), None)], (4,4--4,45), + { ParenRange = (4,3--4,45) }), None, (4,2--4,45)), + None, Const (Unit, (4,49--4,51)), (4,2--4,51), Yes, + { ArrowRange = Some (4,46--4,48) + BarRange = Some (4,0--4,1) })], (3,0--4,51), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,51))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,51), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 54.fs b/tests/service/data/SyntaxTree/Pattern/Named field 54.fs new file mode 100644 index 00000000000..11a6c7a18a6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 54.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 }, b = { Y = 3 }) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 54.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 54.fs.bsl new file mode 100644 index 00000000000..86759ebb034 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 54.fs.bsl @@ -0,0 +1,42 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 54.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,17), + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)), + Some (Comma ((4,17--4,18), Some (4,18)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,21--4,22), + (4,19--4,32), + Record + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,27--4,28), (4,25--4,30), + Const (Int32 3, (4,29--4,30)), None)], + (4,23--4,32)), None)], (4,4--4,33), + { ParenRange = (4,3--4,33) }), 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,8--3,12) }), (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 55.fs b/tests/service/data/SyntaxTree/Pattern/Named field 55.fs new file mode 100644 index 00000000000..1e2329a3af2 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 55.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 }, b = _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 55.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 55.fs.bsl new file mode 100644 index 00000000000..4b78302b3cb --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 55.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 55.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,17), + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)), + Some (Comma ((4,17--4,18), Some (4,18)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,21--4,22), + (4,19--4,24), Wild (4,23--4,24), None)], + (4,4--4,25), { ParenRange = (4,3--4,25) }), 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,8--3,12) }), (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/Named field 56.fs b/tests/service/data/SyntaxTree/Pattern/Named field 56.fs new file mode 100644 index 00000000000..ca419dc3e51 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 56.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 }, { X = 1 }, b = { X = 1 }) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 56.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 56.fs.bsl new file mode 100644 index 00000000000..430507f963b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 56.fs.bsl @@ -0,0 +1,51 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 56.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,28), + Tuple + (false, + [Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)); + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,23--4,24), (4,21--4,26), + Const (Int32 1, (4,25--4,26)), None)], + (4,19--4,28))], [(4,17--4,18)], + (4,8--4,28)), + Some (Comma ((4,28--4,29), Some (4,29)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,32--4,33), + (4,30--4,43), + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,38--4,39), (4,36--4,41), + Const (Int32 1, (4,40--4,41)), None)], + (4,34--4,43)), None)], (4,4--4,44), + { ParenRange = (4,3--4,44) }), None, (4,2--4,44)), + None, Const (Unit, (4,48--4,50)), (4,2--4,50), Yes, + { ArrowRange = Some (4,45--4,47) + BarRange = Some (4,0--4,1) })], (3,0--4,50), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,50))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,50), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 57.fs b/tests/service/data/SyntaxTree/Pattern/Named field 57.fs new file mode 100644 index 00000000000..ec13214ee03 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 57.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 }, { X = 1 }; b = { X = 1 }) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 57.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 57.fs.bsl new file mode 100644 index 00000000000..ba82c1ec8f4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 57.fs.bsl @@ -0,0 +1,51 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 57.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,28), + Tuple + (false, + [Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)); + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,23--4,24), (4,21--4,26), + Const (Int32 1, (4,25--4,26)), None)], + (4,19--4,28))], [(4,17--4,18)], + (4,8--4,28)), + Some (Semicolon ((4,28--4,29), Some (4,29)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,32--4,33), + (4,30--4,43), + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,38--4,39), (4,36--4,41), + Const (Int32 1, (4,40--4,41)), None)], + (4,34--4,43)), None)], (4,4--4,44), + { ParenRange = (4,3--4,44) }), None, (4,2--4,44)), + None, Const (Unit, (4,48--4,50)), (4,2--4,50), Yes, + { ArrowRange = Some (4,45--4,47) + BarRange = Some (4,0--4,1) })], (3,0--4,50), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,50))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,50), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 58.fs b/tests/service/data/SyntaxTree/Pattern/Named field 58.fs new file mode 100644 index 00000000000..df58cb90030 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 58.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = h :: tail; b = h:: tail) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 58.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 58.fs.bsl new file mode 100644 index 00000000000..af353719be7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 58.fs.bsl @@ -0,0 +1,45 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 58.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,17), + ListCons + (Named + (SynIdent (h, None), false, None, (4,8--4,9)), + Named + (SynIdent (tail, None), false, None, + (4,13--4,17)), (4,8--4,17), + { ColonColonRange = (4,10--4,12) }), + Some (Semicolon ((4,17--4,18), Some (4,18)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,21--4,22), + (4,19--4,31), + ListCons + (Named + (SynIdent (h, None), false, None, + (4,23--4,24)), + Named + (SynIdent (tail, None), false, None, + (4,27--4,31)), (4,23--4,31), + { ColonColonRange = (4,24--4,26) }), None)], + (4,4--4,32), { ParenRange = (4,3--4,32) }), None, + (4,2--4,32)), None, Const (Unit, (4,36--4,38)), + (4,2--4,38), Yes, { ArrowRange = Some (4,33--4,35) + BarRange = Some (4,0--4,1) })], + (3,0--4,38), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,38))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,38), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 59.fs b/tests/service/data/SyntaxTree/Pattern/Named field 59.fs new file mode 100644 index 00000000000..7721c099bfa --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 59.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = h :: tail, b = h:: tail) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 59.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 59.fs.bsl new file mode 100644 index 00000000000..2f0593c7e2b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 59.fs.bsl @@ -0,0 +1,45 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 59.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,17), + ListCons + (Named + (SynIdent (h, None), false, None, (4,8--4,9)), + Named + (SynIdent (tail, None), false, None, + (4,13--4,17)), (4,8--4,17), + { ColonColonRange = (4,10--4,12) }), + Some (Comma ((4,17--4,18), Some (4,18)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,21--4,22), + (4,19--4,31), + ListCons + (Named + (SynIdent (h, None), false, None, + (4,23--4,24)), + Named + (SynIdent (tail, None), false, None, + (4,27--4,31)), (4,23--4,31), + { ColonColonRange = (4,24--4,26) }), None)], + (4,4--4,32), { ParenRange = (4,3--4,32) }), None, + (4,2--4,32)), None, Const (Unit, (4,36--4,38)), + (4,2--4,38), Yes, { ArrowRange = Some (4,33--4,35) + BarRange = Some (4,0--4,1) })], + (3,0--4,38), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,38))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,38), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 60.fs b/tests/service/data/SyntaxTree/Pattern/Named field 60.fs new file mode 100644 index 00000000000..06bdababfec --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 60.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = h :: _; b = _:: tail) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 60.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 60.fs.bsl new file mode 100644 index 00000000000..a81fe5529c8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 60.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 60.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,14), + ListCons + (Named + (SynIdent (h, None), false, None, (4,8--4,9)), + Wild (4,13--4,14), (4,8--4,14), + { ColonColonRange = (4,10--4,12) }), + Some (Semicolon ((4,14--4,15), Some (4,15)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,18--4,19), + (4,16--4,28), + ListCons + (Wild (4,20--4,21), + Named + (SynIdent (tail, None), false, None, + (4,24--4,28)), (4,20--4,28), + { ColonColonRange = (4,21--4,23) }), None)], + (4,4--4,29), { ParenRange = (4,3--4,29) }), None, + (4,2--4,29)), None, Const (Unit, (4,33--4,35)), + (4,2--4,35), Yes, { ArrowRange = Some (4,30--4,32) + BarRange = Some (4,0--4,1) })], + (3,0--4,35), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,35))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,35), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 61.fs b/tests/service/data/SyntaxTree/Pattern/Named field 61.fs new file mode 100644 index 00000000000..444cb61a698 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 61.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = h :: _, b = _:: tail) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 61.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 61.fs.bsl new file mode 100644 index 00000000000..3dba3de5190 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 61.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 61.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,14), + ListCons + (Named + (SynIdent (h, None), false, None, (4,8--4,9)), + Wild (4,13--4,14), (4,8--4,14), + { ColonColonRange = (4,10--4,12) }), + Some (Comma ((4,14--4,15), Some (4,15)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,18--4,19), + (4,16--4,28), + ListCons + (Wild (4,20--4,21), + Named + (SynIdent (tail, None), false, None, + (4,24--4,28)), (4,20--4,28), + { ColonColonRange = (4,21--4,23) }), None)], + (4,4--4,29), { ParenRange = (4,3--4,29) }), None, + (4,2--4,29)), None, Const (Unit, (4,33--4,35)), + (4,2--4,35), Yes, { ArrowRange = Some (4,30--4,32) + BarRange = Some (4,0--4,1) })], + (3,0--4,35), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,35))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,35), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 62.fs b/tests/service/data/SyntaxTree/Pattern/Named field 62.fs new file mode 100644 index 00000000000..5d6f58e9fe6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 62.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = [ h ]; b = [| h |]) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 62.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 62.fs.bsl new file mode 100644 index 00000000000..51b2210f1d3 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 62.fs.bsl @@ -0,0 +1,40 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 62.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,13), + ArrayOrList + (false, + [Named + (SynIdent (h, None), false, None, + (4,10--4,11))], (4,8--4,13)), + Some (Semicolon ((4,13--4,14), Some (4,14)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,17--4,18), + (4,15--4,26), + ArrayOrList + (true, + [Named + (SynIdent (h, None), false, None, + (4,22--4,23))], (4,19--4,26)), None)], + (4,4--4,27), { ParenRange = (4,3--4,27) }), None, + (4,2--4,27)), None, Const (Unit, (4,31--4,33)), + (4,2--4,33), Yes, { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], + (3,0--4,33), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 63.fs b/tests/service/data/SyntaxTree/Pattern/Named field 63.fs new file mode 100644 index 00000000000..59fdd312c4e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 63.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = [ h ], b = [| h |]) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 63.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 63.fs.bsl new file mode 100644 index 00000000000..59067986c54 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 63.fs.bsl @@ -0,0 +1,40 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 63.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,13), + ArrayOrList + (false, + [Named + (SynIdent (h, None), false, None, + (4,10--4,11))], (4,8--4,13)), + Some (Comma ((4,13--4,14), Some (4,14)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,17--4,18), + (4,15--4,26), + ArrayOrList + (true, + [Named + (SynIdent (h, None), false, None, + (4,22--4,23))], (4,19--4,26)), None)], + (4,4--4,27), { ParenRange = (4,3--4,27) }), None, + (4,2--4,27)), None, Const (Unit, (4,31--4,33)), + (4,2--4,33), Yes, { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], + (3,0--4,33), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 64.fs b/tests/service/data/SyntaxTree/Pattern/Named field 64.fs new file mode 100644 index 00000000000..9ee096cb090 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 64.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = <@ 1 @>, b = <@@ A @@>) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 64.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 64.fs.bsl new file mode 100644 index 00000000000..c851abce85a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 64.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 64.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,15), + QuoteExpr + (Quote + (Ident op_Quotation, false, + Const (Int32 1, (4,11--4,12)), false, + (4,8--4,15)), (4,8--4,15)), + Some (Comma ((4,15--4,16), Some (4,16)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,19--4,20), + (4,17--4,30), + QuoteExpr + (Quote + (Ident op_QuotationUntyped, true, Ident A, + false, (4,21--4,30)), (4,21--4,30)), None)], + (4,4--4,31), { ParenRange = (4,3--4,31) }), None, + (4,2--4,31)), None, Const (Unit, (4,35--4,37)), + (4,2--4,37), Yes, { ArrowRange = Some (4,32--4,34) + BarRange = Some (4,0--4,1) })], + (3,0--4,37), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,37))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,37), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 65.fs b/tests/service/data/SyntaxTree/Pattern/Named field 65.fs new file mode 100644 index 00000000000..52439642e2f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 65.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = <@ 1 @>; b = <@@ A @@>) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 65.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 65.fs.bsl new file mode 100644 index 00000000000..4a73b6f0f23 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 65.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 65.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,15), + QuoteExpr + (Quote + (Ident op_Quotation, false, + Const (Int32 1, (4,11--4,12)), false, + (4,8--4,15)), (4,8--4,15)), + Some (Semicolon ((4,15--4,16), Some (4,16)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,19--4,20), + (4,17--4,30), + QuoteExpr + (Quote + (Ident op_QuotationUntyped, true, Ident A, + false, (4,21--4,30)), (4,21--4,30)), None)], + (4,4--4,31), { ParenRange = (4,3--4,31) }), None, + (4,2--4,31)), None, Const (Unit, (4,35--4,37)), + (4,2--4,37), Yes, { ArrowRange = Some (4,32--4,34) + BarRange = Some (4,0--4,1) })], + (3,0--4,37), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,37))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,37), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 66.fs b/tests/service/data/SyntaxTree/Pattern/Named field 66.fs new file mode 100644 index 00000000000..f65e0f34133 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 66.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 } as res, b = { Y = 3 } as res2) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 66.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 66.fs.bsl new file mode 100644 index 00000000000..378acd92c66 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 66.fs.bsl @@ -0,0 +1,50 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 66.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,24), + As + (Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)), + Named + (SynIdent (res, None), false, None, + (4,21--4,24)), (4,8--4,24)), + Some (Comma ((4,24--4,25), Some (4,25)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,28--4,29), + (4,26--4,47), + As + (Record + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,34--4,35), (4,32--4,37), + Const (Int32 3, (4,36--4,37)), None)], + (4,30--4,39)), + Named + (SynIdent (res2, None), false, None, + (4,43--4,47)), (4,30--4,47)), None)], + (4,4--4,48), { ParenRange = (4,3--4,48) }), None, + (4,2--4,48)), None, Const (Unit, (4,52--4,54)), + (4,2--4,54), Yes, { ArrowRange = Some (4,49--4,51) + BarRange = Some (4,0--4,1) })], + (3,0--4,54), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,54))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,54), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 67.fs b/tests/service/data/SyntaxTree/Pattern/Named field 67.fs new file mode 100644 index 00000000000..ff9ebdda797 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 67.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 } as res; b = { Y = 3 } as res2) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 67.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 67.fs.bsl new file mode 100644 index 00000000000..5c90b6fdd17 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 67.fs.bsl @@ -0,0 +1,50 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 67.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,24), + As + (Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)), + Named + (SynIdent (res, None), false, None, + (4,21--4,24)), (4,8--4,24)), + Some (Semicolon ((4,24--4,25), Some (4,25)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,28--4,29), + (4,26--4,47), + As + (Record + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,34--4,35), (4,32--4,37), + Const (Int32 3, (4,36--4,37)), None)], + (4,30--4,39)), + Named + (SynIdent (res2, None), false, None, + (4,43--4,47)), (4,30--4,47)), None)], + (4,4--4,48), { ParenRange = (4,3--4,48) }), None, + (4,2--4,48)), None, Const (Unit, (4,52--4,54)), + (4,2--4,54), Yes, { ArrowRange = Some (4,49--4,51) + BarRange = Some (4,0--4,1) })], + (3,0--4,54), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,54))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,54), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 68.fs b/tests/service/data/SyntaxTree/Pattern/Named field 68.fs new file mode 100644 index 00000000000..dbd74efa414 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 68.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 } as res, { X = 1 }; b = { X = 1 }, { Y = 3 } as res2) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 68.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 68.fs.bsl new file mode 100644 index 00000000000..186e38935af --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 68.fs.bsl @@ -0,0 +1,68 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 68.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,35), + Tuple + (false, + [As + (Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)), + Named + (SynIdent (res, None), false, None, + (4,21--4,24)), (4,8--4,24)); + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,30--4,31), (4,28--4,33), + Const (Int32 1, (4,32--4,33)), None)], + (4,26--4,35))], [(4,24--4,25)], + (4,8--4,35)), + Some (Semicolon ((4,35--4,36), Some (4,36)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,39--4,40), + (4,37--4,69), + Tuple + (false, + [Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,45--4,46), (4,43--4,48), + Const (Int32 1, (4,47--4,48)), None)], + (4,41--4,50)); + As + (Record + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,56--4,57), (4,54--4,59), + Const (Int32 3, (4,58--4,59)), None)], + (4,52--4,61)), + Named + (SynIdent (res2, None), false, None, + (4,65--4,69)), (4,52--4,69))], + [(4,50--4,51)], (4,41--4,69)), None)], + (4,4--4,69), { ParenRange = (4,3--4,70) }), None, + (4,2--4,70)), None, Const (Unit, (4,74--4,76)), + (4,2--4,76), Yes, { ArrowRange = Some (4,71--4,73) + BarRange = Some (4,0--4,1) })], + (3,0--4,76), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,76))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,76), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 69.fs b/tests/service/data/SyntaxTree/Pattern/Named field 69.fs new file mode 100644 index 00000000000..80757b14155 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 69.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = { X = 1 } as res, { X = 1 }, b = { X = 1 }, { Y = 3 } as res2) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 69.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 69.fs.bsl new file mode 100644 index 00000000000..51981780ac0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 69.fs.bsl @@ -0,0 +1,68 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 69.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,35), + Tuple + (false, + [As + (Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,12--4,13), (4,10--4,15), + Const (Int32 1, (4,14--4,15)), None)], + (4,8--4,17)), + Named + (SynIdent (res, None), false, None, + (4,21--4,24)), (4,8--4,24)); + Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,30--4,31), (4,28--4,33), + Const (Int32 1, (4,32--4,33)), None)], + (4,26--4,35))], [(4,24--4,25)], + (4,8--4,35)), + Some (Comma ((4,35--4,36), Some (4,36)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,39--4,40), + (4,37--4,69), + Tuple + (false, + [Record + ([NamePatPairField + (SynLongIdent ([X], [], [None]), + Some (4,45--4,46), (4,43--4,48), + Const (Int32 1, (4,47--4,48)), None)], + (4,41--4,50)); + As + (Record + ([NamePatPairField + (SynLongIdent ([Y], [], [None]), + Some (4,56--4,57), (4,54--4,59), + Const (Int32 3, (4,58--4,59)), None)], + (4,52--4,61)), + Named + (SynIdent (res2, None), false, None, + (4,65--4,69)), (4,52--4,69))], + [(4,50--4,51)], (4,41--4,69)), None)], + (4,4--4,69), { ParenRange = (4,3--4,70) }), None, + (4,2--4,70)), None, Const (Unit, (4,74--4,76)), + (4,2--4,76), Yes, { ArrowRange = Some (4,71--4,73) + BarRange = Some (4,0--4,1) })], + (3,0--4,76), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,76))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,76), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 70.fs b/tests/service/data/SyntaxTree/Pattern/Named field 70.fs new file mode 100644 index 00000000000..e93ac0dac8a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 70.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 70.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 70.fs.bsl new file mode 100644 index 00000000000..12c8b9adb93 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 70.fs.bsl @@ -0,0 +1,42 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 70.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 (Semicolon ((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 (Comma ((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 [])) + +(4,16)-(4,17) parse error Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 71.fs b/tests/service/data/SyntaxTree/Pattern/Named field 71.fs new file mode 100644 index 00000000000..5367f4a22b2 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 71.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 71.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 71.fs.bsl new file mode 100644 index 00000000000..c015e45104e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 71.fs.bsl @@ -0,0 +1,42 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 71.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 (Comma ((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 (Semicolon ((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 [])) + +(4,16)-(4,17) parse error Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 72.fs b/tests/service/data/SyntaxTree/Pattern/Named field 72.fs new file mode 100644 index 00000000000..df537b78906 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 72.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = a, r; b = b, c = c) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 72.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 72.fs.bsl new file mode 100644 index 00000000000..4e9512af51a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 72.fs.bsl @@ -0,0 +1,48 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 72.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,12), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (4,8--4,9)); + Named + (SynIdent (r, None), false, None, + (4,11--4,12))], [(4,9--4,10)], (4,8--4,12)), + Some (Semicolon ((4,12--4,13), Some (4,13)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,16--4,17), + (4,14--4,19), + Named + (SynIdent (b, None), false, None, (4,18--4,19)), + Some (Comma ((4,19--4,20), Some (4,20)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (4,23--4,24), + (4,21--4,26), + Named + (SynIdent (c, None), false, None, (4,25--4,26)), + None)], (4,4--4,27), { ParenRange = (4,3--4,27) }), + None, (4,2--4,27)), None, Const (Int32 2, (4,31--4,32)), + (4,2--4,32), Yes, { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], + (3,0--4,32), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,32))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,32), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,19)-(4,20) parse error Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 73.fs b/tests/service/data/SyntaxTree/Pattern/Named field 73.fs new file mode 100644 index 00000000000..e1f9737e2c4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 73.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = a, r, b = b; c = c) -> 2 diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 73.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 73.fs.bsl new file mode 100644 index 00000000000..fa4e6950362 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 73.fs.bsl @@ -0,0 +1,48 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 73.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,12), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (4,8--4,9)); + Named + (SynIdent (r, None), false, None, + (4,11--4,12))], [(4,9--4,10)], (4,8--4,12)), + Some (Comma ((4,12--4,13), Some (4,13)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,16--4,17), + (4,14--4,19), + Named + (SynIdent (b, None), false, None, (4,18--4,19)), + Some (Semicolon ((4,19--4,20), Some (4,20)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (4,23--4,24), + (4,21--4,26), + Named + (SynIdent (c, None), false, None, (4,25--4,26)), + None)], (4,4--4,27), { ParenRange = (4,3--4,27) }), + None, (4,2--4,27)), None, Const (Int32 2, (4,31--4,32)), + (4,2--4,32), Yes, { ArrowRange = Some (4,28--4,30) + BarRange = Some (4,0--4,1) })], + (3,0--4,32), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,32))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,32), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,19)-(4,20) parse error Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 74.fs b/tests/service/data/SyntaxTree/Pattern/Named field 74.fs new file mode 100644 index 00000000000..07cf97f2f06 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 74.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = B(b = b, Some { C = 2 }); _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 74.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 74.fs.bsl new file mode 100644 index 00000000000..38c4cf5b43a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 74.fs.bsl @@ -0,0 +1,57 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 74.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,32), + LongIdent + (SynLongIdent ([B], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([b], [], [None]), + Some (4,12--4,13), (4,10--4,31), + Tuple + (false, + [Named + (SynIdent (b, None), false, None, + (4,14--4,15)); + LongIdent + (SynLongIdent + ([Some], [], [None]), None, + None, + Pats + [Record + ([NamePatPairField + (SynLongIdent + ([C], [], [None]), + Some (4,26--4,27), + (4,24--4,29), + Const + (Int32 2, + (4,28--4,29)), None)], + (4,22--4,31))], None, + (4,17--4,31))], [(4,15--4,16)], + (4,14--4,31)), None)], (4,10--4,31), + { ParenRange = (4,9--4,32) }), None, + (4,8--4,32)), + Some (Semicolon ((4,32--4,33), Some (4,33))))], + (4,4--4,35), { ParenRange = (4,3--4,36) }), None, + (4,2--4,36)), None, Const (Unit, (4,40--4,42)), + (4,2--4,42), Yes, { ArrowRange = Some (4,37--4,39) + BarRange = Some (4,0--4,1) })], + (3,0--4,42), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,42))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,42), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 75.fs b/tests/service/data/SyntaxTree/Pattern/Named field 75.fs new file mode 100644 index 00000000000..a5556009381 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 75.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = B(b = b, Some { C = 2 }), _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 75.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 75.fs.bsl new file mode 100644 index 00000000000..0b22cc73c32 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 75.fs.bsl @@ -0,0 +1,61 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 75.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,35), + Tuple + (false, + [LongIdent + (SynLongIdent ([B], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([b], [], [None]), + Some (4,12--4,13), (4,10--4,31), + Tuple + (false, + [Named + (SynIdent (b, None), false, + None, (4,14--4,15)); + LongIdent + (SynLongIdent + ([Some], [], [None]), None, + None, + Pats + [Record + ([NamePatPairField + (SynLongIdent + ([C], [], [None]), + Some (4,26--4,27), + (4,24--4,29), + Const + (Int32 2, + (4,28--4,29)), + None)], + (4,22--4,31))], None, + (4,17--4,31))], + [(4,15--4,16)], (4,14--4,31)), + None)], (4,10--4,31), + { ParenRange = (4,9--4,32) }), None, + (4,8--4,32)); Wild (4,34--4,35)], + [(4,32--4,33)], (4,8--4,35)), None)], + (4,4--4,35), { ParenRange = (4,3--4,36) }), None, + (4,2--4,36)), None, Const (Unit, (4,40--4,42)), + (4,2--4,42), Yes, { ArrowRange = Some (4,37--4,39) + BarRange = Some (4,0--4,1) })], + (3,0--4,42), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,42))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,42), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 76.fs b/tests/service/data/SyntaxTree/Pattern/Named field 76.fs new file mode 100644 index 00000000000..2fc2a892ce3 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 76.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = B(b = b, _); _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 76.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 76.fs.bsl new file mode 100644 index 00000000000..3b0737c7b96 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 76.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 76.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,19), + LongIdent + (SynLongIdent ([B], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([b], [], [None]), + Some (4,12--4,13), (4,10--4,18), + Tuple + (false, + [Named + (SynIdent (b, None), false, None, + (4,14--4,15)); Wild (4,17--4,18)], + [(4,15--4,16)], (4,14--4,18)), None)], + (4,10--4,18), { ParenRange = (4,9--4,19) }), + None, (4,8--4,19)), + Some (Semicolon ((4,19--4,20), Some (4,20))))], + (4,4--4,22), { ParenRange = (4,3--4,23) }), None, + (4,2--4,23)), None, Const (Unit, (4,27--4,29)), + (4,2--4,29), Yes, { ArrowRange = Some (4,24--4,26) + 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 77.fs b/tests/service/data/SyntaxTree/Pattern/Named field 77.fs new file mode 100644 index 00000000000..dc40a58915d --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 77.fs @@ -0,0 +1,4 @@ +module Module + +match 1 with +| A(a = B(b = b, _), _) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 77.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 77.fs.bsl new file mode 100644 index 00000000000..02dad886255 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 77.fs.bsl @@ -0,0 +1,45 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 77.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,22), + Tuple + (false, + [LongIdent + (SynLongIdent ([B], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([b], [], [None]), + Some (4,12--4,13), (4,10--4,18), + Tuple + (false, + [Named + (SynIdent (b, None), false, + None, (4,14--4,15)); + Wild (4,17--4,18)], + [(4,15--4,16)], (4,14--4,18)), + None)], (4,10--4,18), + { ParenRange = (4,9--4,19) }), None, + (4,8--4,19)); Wild (4,21--4,22)], + [(4,19--4,20)], (4,8--4,22)), None)], + (4,4--4,22), { ParenRange = (4,3--4,23) }), None, + (4,2--4,23)), None, Const (Unit, (4,27--4,29)), + (4,2--4,29), Yes, { ArrowRange = Some (4,24--4,26) + 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 78.fs b/tests/service/data/SyntaxTree/Pattern/Named field 78.fs new file mode 100644 index 00000000000..aa59d298c49 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 78.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a; y = b)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 78.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 78.fs.bsl new file mode 100644 index 00000000000..0a61ef0da58 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 78.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 78.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,16), + Named + (SynIdent (a, None), false, None, (3,15--3,16)), + Some (Semicolon ((3,16--3,17), Some (3,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,20--3,21), + (3,18--3,23), + Named + (SynIdent (b, None), false, None, (3,22--3,23)), + None)], (3,11--3,24), + { ParenRange = (3,10--3,24) }), None, (3,5--3,24)), + (3,4--3,25)), None, Const (Unit, (3,28--3,30)), (3,4--3,25), + Yes (3,0--3,30), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,26--3,27) })], + (3,0--3,30))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,30), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 79.fs b/tests/service/data/SyntaxTree/Pattern/Named field 79.fs new file mode 100644 index 00000000000..a37013d4717 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 79.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a, y = b)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 79.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 79.fs.bsl new file mode 100644 index 00000000000..b2106c1cc67 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 79.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 79.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,16), + Named + (SynIdent (a, None), false, None, (3,15--3,16)), + Some (Comma ((3,16--3,17), Some (3,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,20--3,21), + (3,18--3,23), + Named + (SynIdent (b, None), false, None, (3,22--3,23)), + None)], (3,11--3,24), + { ParenRange = (3,10--3,24) }), None, (3,5--3,24)), + (3,4--3,25)), None, Const (Unit, (3,28--3,30)), (3,4--3,25), + Yes (3,0--3,30), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,26--3,27) })], + (3,0--3,30))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,30), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 80.fs b/tests/service/data/SyntaxTree/Pattern/Named field 80.fs new file mode 100644 index 00000000000..90d76fca9af --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 80.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a, b; y = c, d)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 80.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 80.fs.bsl new file mode 100644 index 00000000000..8243ce434b6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 80.fs.bsl @@ -0,0 +1,52 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 80.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,19), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (3,15--3,16)); + Named + (SynIdent (b, None), false, None, + (3,18--3,19))], [(3,16--3,17)], + (3,15--3,19)), + Some (Semicolon ((3,19--3,20), Some (3,20)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,23--3,24), + (3,21--3,29), + Tuple + (false, + [Named + (SynIdent (c, None), false, None, + (3,25--3,26)); + Named + (SynIdent (d, None), false, None, + (3,28--3,29))], [(3,26--3,27)], + (3,25--3,29)), None)], (3,11--3,29), + { ParenRange = (3,10--3,30) }), None, (3,5--3,30)), + (3,4--3,31)), None, Const (Unit, (3,34--3,36)), (3,4--3,31), + Yes (3,0--3,36), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,32--3,33) })], + (3,0--3,36))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,36), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 81.fs b/tests/service/data/SyntaxTree/Pattern/Named field 81.fs new file mode 100644 index 00000000000..6358970fcb2 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 81.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a, b, y = c, d)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 81.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 81.fs.bsl new file mode 100644 index 00000000000..c9c650e8e57 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 81.fs.bsl @@ -0,0 +1,52 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 81.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,19), + Tuple + (false, + [Named + (SynIdent (a, None), false, None, + (3,15--3,16)); + Named + (SynIdent (b, None), false, None, + (3,18--3,19))], [(3,16--3,17)], + (3,15--3,19)), + Some (Comma ((3,19--3,20), Some (3,20)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,23--3,24), + (3,21--3,29), + Tuple + (false, + [Named + (SynIdent (c, None), false, None, + (3,25--3,26)); + Named + (SynIdent (d, None), false, None, + (3,28--3,29))], [(3,26--3,27)], + (3,25--3,29)), None)], (3,11--3,29), + { ParenRange = (3,10--3,30) }), None, (3,5--3,30)), + (3,4--3,31)), None, Const (Unit, (3,34--3,36)), (3,4--3,31), + Yes (3,0--3,36), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,32--3,33) })], + (3,0--3,36))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,36), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 82.fs b/tests/service/data/SyntaxTree/Pattern/Named field 82.fs new file mode 100644 index 00000000000..6a69fb2a7e7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 82.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a; y = b, z = c)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 82.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 82.fs.bsl new file mode 100644 index 00000000000..61635b6e32f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 82.fs.bsl @@ -0,0 +1,47 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 82.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,16), + Named + (SynIdent (a, None), false, None, (3,15--3,16)), + Some (Semicolon ((3,16--3,17), Some (3,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,20--3,21), + (3,18--3,23), + Named + (SynIdent (b, None), false, None, (3,22--3,23)), + Some (Comma ((3,23--3,24), Some (3,24)))); + NamePatPairField + (SynLongIdent ([z], [], [None]), Some (3,27--3,28), + (3,25--3,30), + Named + (SynIdent (c, None), false, None, (3,29--3,30)), + None)], (3,11--3,31), + { ParenRange = (3,10--3,31) }), None, (3,5--3,31)), + (3,4--3,32)), None, Const (Unit, (3,35--3,37)), (3,4--3,32), + Yes (3,0--3,37), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,33--3,34) })], + (3,0--3,37))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,37), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(3,23)-(3,24) parse error Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 83.fs b/tests/service/data/SyntaxTree/Pattern/Named field 83.fs new file mode 100644 index 00000000000..30b7fd1db86 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 83.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a, y = b; z = c)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 83.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 83.fs.bsl new file mode 100644 index 00000000000..4d2599e7fc8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 83.fs.bsl @@ -0,0 +1,47 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 83.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,16), + Named + (SynIdent (a, None), false, None, (3,15--3,16)), + Some (Comma ((3,16--3,17), Some (3,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,20--3,21), + (3,18--3,23), + Named + (SynIdent (b, None), false, None, (3,22--3,23)), + Some (Semicolon ((3,23--3,24), Some (3,24)))); + NamePatPairField + (SynLongIdent ([z], [], [None]), Some (3,27--3,28), + (3,25--3,30), + Named + (SynIdent (c, None), false, None, (3,29--3,30)), + None)], (3,11--3,31), + { ParenRange = (3,10--3,31) }), None, (3,5--3,31)), + (3,4--3,32)), None, Const (Unit, (3,35--3,37)), (3,4--3,32), + Yes (3,0--3,37), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,33--3,34) })], + (3,0--3,37))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,37), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(3,23)-(3,24) parse error Inconsistent separators in pattern. Use either all commas or all semicolons, but not both. diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 84.fs b/tests/service/data/SyntaxTree/Pattern/Named field 84.fs new file mode 100644 index 00000000000..35ec6794797 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 84.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a; y = b; _)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 84.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 84.fs.bsl new file mode 100644 index 00000000000..14bb0c318a3 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 84.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 84.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,16), + Named + (SynIdent (a, None), false, None, (3,15--3,16)), + Some (Semicolon ((3,16--3,17), Some (3,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,20--3,21), + (3,18--3,23), + Named + (SynIdent (b, None), false, None, (3,22--3,23)), + Some (Semicolon ((3,23--3,24), Some (3,24))))], + (3,11--3,26), { ParenRange = (3,10--3,27) }), None, + (3,5--3,27)), (3,4--3,28)), None, + Const (Unit, (3,31--3,33)), (3,4--3,28), Yes (3,0--3,33), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,29--3,30) })], (3,0--3,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 85.fs b/tests/service/data/SyntaxTree/Pattern/Named field 85.fs new file mode 100644 index 00000000000..8fef2bbaad8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 85.fs @@ -0,0 +1,3 @@ +module Module + +let (CaseA(x = a, y = b, _)) = () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 85.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 85.fs.bsl new file mode 100644 index 00000000000..d57cf1139fd --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 85.fs.bsl @@ -0,0 +1,42 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 85.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Paren + (LongIdent + (SynLongIdent ([CaseA], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([x], [], [None]), Some (3,13--3,14), + (3,11--3,16), + Named + (SynIdent (a, None), false, None, (3,15--3,16)), + Some (Comma ((3,16--3,17), Some (3,17)))); + NamePatPairField + (SynLongIdent ([y], [], [None]), Some (3,20--3,21), + (3,18--3,26), + Tuple + (false, + [Named + (SynIdent (b, None), false, None, + (3,22--3,23)); Wild (3,25--3,26)], + [(3,23--3,24)], (3,22--3,26)), None)], + (3,11--3,26), { ParenRange = (3,10--3,27) }), None, + (3,5--3,27)), (3,4--3,28)), None, + Const (Unit, (3,31--3,33)), (3,4--3,28), Yes (3,0--3,33), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,29--3,30) })], (3,0--3,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 86.fs b/tests/service/data/SyntaxTree/Pattern/Named field 86.fs new file mode 100644 index 00000000000..3ac90b18ac7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 86.fs @@ -0,0 +1,7 @@ +module Module + +match r with +| R( + a = x; + b = y + ) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 86.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 86.fs.bsl new file mode 100644 index 00000000000..11b41c57f62 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 86.fs.bsl @@ -0,0 +1,34 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 86.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident r, + [SynMatchClause + (LongIdent + (SynLongIdent ([R], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (5,6--5,7), + (5,4--5,9), + Named + (SynIdent (x, None), false, None, (5,8--5,9)), + Some (Semicolon ((5,9--6,4), Some (5,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,6--6,7), + (6,4--6,9), + Named + (SynIdent (y, None), false, None, (6,8--6,9)), + None)], (5,4--7,3), { ParenRange = (4,3--7,3) }), + None, (4,2--7,3)), None, Const (Unit, (7,7--7,9)), + (4,2--7,9), Yes, { ArrowRange = Some (7,4--7,6) + BarRange = Some (4,0--4,1) })], + (3,0--7,9), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--7,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--7,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 87.fs b/tests/service/data/SyntaxTree/Pattern/Named field 87.fs new file mode 100644 index 00000000000..282a26edcd8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 87.fs @@ -0,0 +1,7 @@ +module Module + +match r with +| R( + a = x, + b = y + ) -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 87.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 87.fs.bsl new file mode 100644 index 00000000000..71728c5792f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 87.fs.bsl @@ -0,0 +1,34 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 87.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident r, + [SynMatchClause + (LongIdent + (SynLongIdent ([R], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (5,6--5,7), + (5,4--5,9), + Named + (SynIdent (x, None), false, None, (5,8--5,9)), + Some (Comma ((5,9--5,10), Some (5,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (6,6--6,7), + (6,4--6,9), + Named + (SynIdent (y, None), false, None, (6,8--6,9)), + None)], (5,4--7,3), { ParenRange = (4,3--7,3) }), + None, (4,2--7,3)), None, Const (Unit, (7,7--7,9)), + (4,2--7,9), Yes, { ArrowRange = Some (7,4--7,6) + BarRange = Some (4,0--4,1) })], + (3,0--7,9), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--7,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--7,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 88.fs b/tests/service/data/SyntaxTree/Pattern/Named field 88.fs new file mode 100644 index 00000000000..6dd32ebf538 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 88.fs @@ -0,0 +1,4 @@ +module Module + +match r with +| R(a = x, b = y, c = z,) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 88.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 88.fs.bsl new file mode 100644 index 00000000000..6e5eb5a3f78 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 88.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 88.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident r, + [SynMatchClause + (LongIdent + (SynLongIdent ([R], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), + Named + (SynIdent (x, None), false, None, (4,8--4,9)), + Some (Comma ((4,9--4,10), Some (4,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,13--4,14), + (4,11--4,16), + Named + (SynIdent (y, None), false, None, (4,15--4,16)), + Some (Comma ((4,16--4,17), Some (4,17)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (4,20--4,21), + (4,18--4,23), + Named + (SynIdent (z, None), false, None, (4,22--4,23)), + Some (Comma ((4,23--4,24), Some (4,24))))], + (4,4--4,24), { ParenRange = (4,3--4,25) }), 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,8--3,12) }), (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/Named field 89.fs b/tests/service/data/SyntaxTree/Pattern/Named field 89.fs new file mode 100644 index 00000000000..5eba367ca3b --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 89.fs @@ -0,0 +1,4 @@ +module Module + +match r with +| R(a = x; b = y; c = z;) -> () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Named field 89.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Named field 89.fs.bsl new file mode 100644 index 00000000000..563a1533476 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Named field 89.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Named field 89.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident r, + [SynMatchClause + (LongIdent + (SynLongIdent ([R], [], [None]), None, None, + NamePatPairs + ([NamePatPairField + (SynLongIdent ([a], [], [None]), Some (4,6--4,7), + (4,4--4,9), + Named + (SynIdent (x, None), false, None, (4,8--4,9)), + Some (Semicolon ((4,9--4,10), Some (4,10)))); + NamePatPairField + (SynLongIdent ([b], [], [None]), Some (4,13--4,14), + (4,11--4,16), + Named + (SynIdent (y, None), false, None, (4,15--4,16)), + Some (Semicolon ((4,16--4,17), Some (4,17)))); + NamePatPairField + (SynLongIdent ([c], [], [None]), Some (4,20--4,21), + (4,18--4,23), + Named + (SynIdent (z, None), false, None, (4,22--4,23)), + Some (Semicolon ((4,23--4,24), Some (4,24))))], + (4,4--4,24), { ParenRange = (4,3--4,25) }), 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,8--3,12) }), (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/OptionalVal 01.fs b/tests/service/data/SyntaxTree/Pattern/OptionalVal 01.fs new file mode 100644 index 00000000000..2e4275ac5ca --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/OptionalVal 01.fs @@ -0,0 +1,3 @@ +module Module + +let f (?x:int) = () diff --git a/tests/service/data/SyntaxTree/Pattern/OptionalVal 01.fs.bsl b/tests/service/data/SyntaxTree/Pattern/OptionalVal 01.fs.bsl new file mode 100644 index 00000000000..a69b7c6e44a --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/OptionalVal 01.fs.bsl @@ -0,0 +1,32 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/OptionalVal 01.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, + SynValInfo + ([[SynArgInfo ([], true, Some x)]], + SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([f], [], [None]), None, None, + Pats + [Paren + (Typed + (OptionalVal (x, (3,7--3,9)), + LongIdent (SynLongIdent ([int], [], [None])), + (3,7--3,13)), (3,6--3,14))], None, (3,4--3,14)), + None, Const (Unit, (3,17--3,19)), (3,4--3,14), NoneAtLet, + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,15--3,16) })], (3,0--3,19))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,19), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/QuoteExprInPattern.fs b/tests/service/data/SyntaxTree/Pattern/QuoteExprInPattern.fs new file mode 100644 index 00000000000..fefadbe8da5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/QuoteExprInPattern.fs @@ -0,0 +1,5 @@ +module QuoteExprInPattern + +let f x = + match x with + | <@ 1 + 2 @> -> () diff --git a/tests/service/data/SyntaxTree/Pattern/QuoteExprInPattern.fs.bsl b/tests/service/data/SyntaxTree/Pattern/QuoteExprInPattern.fs.bsl new file mode 100644 index 00000000000..7b5b1e42c7f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/QuoteExprInPattern.fs.bsl @@ -0,0 +1,52 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/QuoteExprInPattern.fs", false, + QualifiedNameOfFile QuoteExprInPattern, [], + [SynModuleOrNamespace + ([QuoteExprInPattern], false, NamedModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, + SynValInfo + ([[SynArgInfo ([], false, Some x)]], + SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([f], [], [None]), None, None, + Pats [Named (SynIdent (x, None), false, None, (3,6--3,7))], + None, (3,4--3,7)), None, + Match + (Yes (4,4--4,16), Ident x, + [SynMatchClause + (QuoteExpr + (Quote + (Ident op_Quotation, false, + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Addition], [], + [Some (OriginalNotation "+")]), None, + (5,11--5,12)), + Const (Int32 1, (5,9--5,10)), (5,9--5,12)), + Const (Int32 2, (5,13--5,14)), (5,9--5,14)), + false, (5,6--5,17)), (5,6--5,17)), None, + Const (Unit, (5,21--5,23)), (5,6--5,23), Yes, + { ArrowRange = Some (5,18--5,20) + BarRange = Some (5,4--5,5) })], (4,4--5,23), + { MatchKeyword = (4,4--4,9) + WithKeyword = (4,12--4,16) }), (3,4--3,7), NoneAtLet, + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,8--3,9) })], (3,0--5,23))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,23), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Record 08.fs b/tests/service/data/SyntaxTree/Pattern/Record 08.fs new file mode 100644 index 00000000000..95c0cc7f61f --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Record 08.fs @@ -0,0 +1,4 @@ +module Module + +match () with +| { A = 1, B = 2, C = 3 } -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Record 08.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Record 08.fs.bsl new file mode 100644 index 00000000000..853940b9a7e --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Record 08.fs.bsl @@ -0,0 +1,21 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Record 08.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), + [SynMatchClause + (Record ([], (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 [])) + +(4,13)-(4,14) parse error Unexpected symbol '=' in pattern. Expected '}' or other token.