diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets index 8d37e28bca..a4642c2550 100644 --- a/.paket/Paket.Restore.targets +++ b/.paket/Paket.Restore.targets @@ -275,7 +275,7 @@ - false + diff --git a/src/Fantomas.Tests/FormattingPropertyTests.fs b/src/Fantomas.Tests/FormattingPropertyTests.fs index 90ccd2f66a..ee846a741a 100644 --- a/src/Fantomas.Tests/FormattingPropertyTests.fs +++ b/src/Fantomas.Tests/FormattingPropertyTests.fs @@ -250,7 +250,7 @@ and generateSynExpr size = Gen.map2 (fun b clauses -> SynExpr.MatchLambda(b, zero, clauses, NoDebugPointAtDoBinding, zero)) Arb.generate<_> genSubSynMatchClauseList 2, - Gen.map3 (fun b pat expr -> SynExpr.Lambda(b, false, pat, expr, zero)) Arb.generate<_> + Gen.map3 (fun b pat expr -> SynExpr.Lambda(b, false, pat, expr, None, zero)) Arb.generate<_> genSubSynSimplePats genSubSynExpr 2, Gen.map5 (fun b expr1 expr2 expr3 s -> @@ -419,7 +419,7 @@ and generateDeclExpr size = Gen.map2 (fun b clauses -> SynExpr.MatchLambda(b, zero, clauses, NoDebugPointAtDoBinding, zero)) Arb.generate<_> genSubSynMatchClauseList // 4, - Gen.map3 (fun b pat expr -> SynExpr.Lambda(b, false, pat, expr, zero)) Arb.generate<_> + Gen.map3 (fun b pat expr -> SynExpr.Lambda(b, false, pat, expr, None, zero)) Arb.generate<_> genSubSynSimplePats genSubDeclExpr // 1, Gen.map2 (fun expr1 expr2 -> @@ -574,7 +574,7 @@ let rec shrinkSynExpr = | SynExpr.TypeApp (expr, _, _, _, _, _, _) | SynExpr.Do (expr, _) | SynExpr.Assert (expr, _) - | SynExpr.Lambda (_, _, _, expr, _) + | SynExpr.Lambda (_, _, _, expr, _, _) | SynExpr.CompExpr (_, _, expr, _) | SynExpr.ArrayOrListOfSeqExpr (_, expr, _) | SynExpr.New (_, _, expr, _) diff --git a/src/Fantomas/AstTransformer.fs b/src/Fantomas/AstTransformer.fs index 31c77ac2de..0fefe1f8f6 100644 --- a/src/Fantomas/AstTransformer.fs +++ b/src/Fantomas/AstTransformer.fs @@ -123,10 +123,10 @@ module private Ast = Properties = p [] FsAstNode = ast Childs = [ visitSynExceptionDefn exceptionDef ] } - | SynModuleDecl.Open (longDotId, range) -> + | SynModuleDecl.Open (SynOpenDeclTarget.ModuleOrNamespace(s, _), range) -> // todo: types { Type = SynModuleDecl_Open Range = r range - Properties = p [ "longIdent" ==> lid longDotId ] + Properties = p [ "longIdent" ==> s ] FsAstNode = ast Childs = [] } | SynModuleDecl.Attributes (attrs, range) -> @@ -147,6 +147,7 @@ module private Ast = Properties = p [] FsAstNode = ast Childs = [ visitSynModuleOrNamespace moduleOrNamespace ] } + | _ -> failwith "todo" // todo: open types and visitSynExpr (synExpr: SynExpr): Node = match synExpr with @@ -269,7 +270,7 @@ module private Ast = "isNotNakedRefCell" ==> isNotNakedRefCell ] FsAstNode = synExpr Childs = [ yield visitSynExpr expr ] } - | SynExpr.Lambda (fromMethod, inLambdaSeq, args, body, range) -> + | SynExpr.Lambda (fromMethod, inLambdaSeq, args, body, _, range) -> { Type = SynExpr_Lambda Range = r range Properties = @@ -832,10 +833,10 @@ module private Ast = and visitSynMemberDefn (mbrDef: SynMemberDefn): Node = match mbrDef with - | SynMemberDefn.Open (longIdent, range) -> + | SynMemberDefn.Open (SynOpenDeclTarget.ModuleOrNamespace(s, _), range) -> // todo: types { Type = SynMemberDefn_Open Range = r range - Properties = p [ "longIdent" ==> li longIdent ] + Properties = p [ "longIdent" ==> li s ] FsAstNode = mbrDef Childs = [] } | SynMemberDefn.Member (memberDefn, range) -> @@ -844,7 +845,7 @@ module private Ast = Properties = p [] FsAstNode = mbrDef Childs = [ yield visitSynBinding memberDefn ] } - | SynMemberDefn.ImplicitCtor (access, attrs, ctorArgs, selfIdentifier, range) -> + | SynMemberDefn.ImplicitCtor (access, attrs, ctorArgs, selfIdentifier, _, range) -> { Type = SynMemberDefn_ImplicitCtor Range = r range Properties = @@ -935,6 +936,7 @@ module private Ast = [ yield! (visitSynAttributeLists range attrs) if typeOpt.IsSome then yield visitSynType typeOpt.Value yield visitSynExpr synExpr ] } + | _ -> failwith "todo" // todo: open types and visitSynSimplePat (sp: SynSimplePat): Node = match sp with @@ -1765,10 +1767,10 @@ module private Ast = Properties = p [] FsAstNode = ast Childs = typeDefs |> List.map visitSynTypeDefnSig } - | SynModuleSigDecl.Open (longId, range) -> + | SynModuleSigDecl.Open (SynOpenDeclTarget.ModuleOrNamespace(s, _), range) -> // todo: types { Type = SynModuleSigDecl_Open Range = r range - Properties = p [ "longIdent" ==> li longId ] + Properties = p [ "longIdent" ==> li s ] FsAstNode = ast Childs = [] } | SynModuleSigDecl.HashDirective (hash, range) -> @@ -1789,6 +1791,7 @@ module private Ast = Properties = p [] FsAstNode = ast Childs = [ visitSynExceptionSig synExceptionSig ] } + | _ -> failwith "todo" // todo: open types and visitSynExceptionSig (exceptionDef: SynExceptionSig): Node = match exceptionDef with diff --git a/src/Fantomas/CodeFormatterImpl.fs b/src/Fantomas/CodeFormatterImpl.fs index d295179710..78256b4958 100644 --- a/src/Fantomas/CodeFormatterImpl.fs +++ b/src/Fantomas/CodeFormatterImpl.fs @@ -211,7 +211,7 @@ let isValidAST ast = | SynExpr.ArrayOrListOfSeqExpr (_, synExpr, _range) -> validateExpr synExpr | SynExpr.CompExpr (_, _, synExpr, _range) -> validateExpr synExpr - | SynExpr.Lambda (_, _, _synSimplePats, synExpr, _range) -> validateExpr synExpr + | SynExpr.Lambda (_, _, _synSimplePats, synExpr, _, _range) -> validateExpr synExpr | SynExpr.MatchLambda (_isExnMatch, _argm, synMatchClauseList, _spBind, _wholem) -> List.forall validateClause synMatchClauseList diff --git a/src/Fantomas/SourceParser.fs b/src/Fantomas/SourceParser.fs index 877f4b0db6..ada407d0b7 100644 --- a/src/Fantomas/SourceParser.fs +++ b/src/Fantomas/SourceParser.fs @@ -295,13 +295,12 @@ let (|Access|) = | SynAccess.Private -> "private" let (|PreXmlDoc|) (px: PreXmlDoc) = - match px.ToXmlDoc() with - | XmlDoc lines -> lines + px.ToXmlDoc(false, None).UnprocessedLines // Module declarations (10 cases) let (|Open|_|) = function - | SynModuleDecl.Open (LongIdentWithDots s, _) -> Some s + | SynModuleDecl.Open (SynOpenDeclTarget.ModuleOrNamespace(LongIdent s, _), _) -> Some s // todo: types | _ -> None let (|ModuleAbbrev|_|) = @@ -362,7 +361,7 @@ let (|Exception|_|) = let (|SigOpen|_|) = function - | SynModuleSigDecl.Open (LongIdent s, _) -> Some s + | SynModuleSigDecl.Open (SynOpenDeclTarget.ModuleOrNamespace(LongIdent s, _), _) -> Some s // todo: types | _ -> None let (|SigModuleAbbrev|_|) = @@ -448,7 +447,7 @@ let (|MDNestedType|_|) = let (|MDOpen|_|) = function - | SynMemberDefn.Open (LongIdent s, _) -> Some s + | SynMemberDefn.Open (SynOpenDeclTarget.ModuleOrNamespace(LongIdent s, _), _) -> Some s // todo: types | _ -> None let (|MDImplicitInherit|_|) = @@ -468,7 +467,7 @@ let (|MDValField|_|) = let (|MDImplicitCtor|_|) = function - | SynMemberDefn.ImplicitCtor (ao, ats, ps, ido, _) -> Some(ats, ao, ps, Option.map (|Ident|) ido) + | SynMemberDefn.ImplicitCtor (ao, ats, ps, ido, _, _) -> Some(ats, ao, ps, Option.map (|Ident|) ido) | _ -> None let (|MDMember|_|) = @@ -852,8 +851,8 @@ let (|AppWithMultilineArgument|_|) e = /// Gather all arguments in lambda let rec (|Lambda|_|) = function - | SynExpr.Lambda (_, _, pats, Lambda (e, patss), _) -> Some(e, pats :: patss) - | SynExpr.Lambda (_, _, pats, e, _) -> Some(e, [ pats ]) + | SynExpr.Lambda (_, _, pats, Lambda (e, patss), _, _) -> Some(e, pats :: patss) + | SynExpr.Lambda (_, _, pats, e, _, _) -> Some(e, [ pats ]) | _ -> None let (|MatchLambda|_|) =