diff --git a/Directory.Packages.props b/Directory.Packages.props index 0a04360..812857b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,8 +6,8 @@ - - + + diff --git a/docs/content/Getting Started Writing.fsx b/docs/content/Getting Started Writing.fsx index 2510aaa..b241df5 100644 --- a/docs/content/Getting Started Writing.fsx +++ b/docs/content/Getting Started Writing.fsx @@ -38,7 +38,7 @@ The `FSharp.Analyzers.SDK` takes a dependency on [FSharp.Compiler.Service](https It is considered a best practice to use the correct `FSharp.Core` version and not the implicit one from the SDK. ```xml - + ``` ## First analyzer @@ -80,7 +80,7 @@ let optionValueAnalyzer: Analyzer = Message = "Option.Value shouldn't be used" Code = "OV001" Severity = Severity.Warning - Range = FSharp.Compiler.Text.Range.Zero + Range = FSharp.Compiler.Text.Range.range0 Fixes = [] } ] diff --git a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj index b2173c0..6c2f169 100644 --- a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj +++ b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj @@ -17,7 +17,7 @@ - + diff --git a/src/FSharp.Analyzers.SDK/ASTCollecting.fs b/src/FSharp.Analyzers.SDK/ASTCollecting.fs index 601e272..6f78b55 100644 --- a/src/FSharp.Analyzers.SDK/ASTCollecting.fs +++ b/src/FSharp.Analyzers.SDK/ASTCollecting.fs @@ -36,7 +36,7 @@ module ASTCollecting = | SynArgPats.Pats ps -> ps | SynArgPats.NamePatPairs(pats = xs) -> xs - |> List.map (fun (_, _, pat) -> pat) + |> List.map _.Pattern type SyntaxCollectorBase() = abstract WalkSynModuleOrNamespace: path: SyntaxVisitorPath * SynModuleOrNamespace -> unit @@ -425,9 +425,23 @@ module ASTCollecting = | SynExpr.TypeApp(expr = e; typeArgs = tys) -> List.iter (walkType nextPath) tys walkExpr nextPath e - | SynExpr.LetOrUse(bindings = bindings; body = e; range = _) -> + | SynExpr.LetOrUse(isBang = false; bindings = bindings; body = e; range = _) -> List.iter (walkBinding nextPath) bindings walkExpr nextPath e + | SynExpr.LetOrUse(isBang = true; bindings = bindings; body = e2; range = _) -> + match bindings with + | SynBinding(headPat = pat; expr = e1) :: andBangs -> + walkPat nextPath pat + walkExpr nextPath e1 + + for SynBinding(headPat = pat; expr = body) in andBangs do + walkPat nextPath pat + walkExpr nextPath body + + | [] -> // error case + + walkExpr nextPath e2 + | SynExpr.TryWith(tryExpr = e; withCases = clauses; range = _) -> List.iter (walkClause nextPath) clauses walkExpr nextPath e @@ -475,15 +489,6 @@ module ASTCollecting = e1 e2 ] - | SynExpr.LetOrUseBang(pat = pat; rhs = e1; andBangs = ands; body = e2; range = _) -> - walkPat nextPath pat - walkExpr nextPath e1 - - for SynExprAndBang(pat = pat; body = body; range = _) in ands do - walkPat nextPath pat - walkExpr nextPath body - - walkExpr nextPath e2 | SynExpr.TraitCall(t, sign, e, _) -> walkType nextPath t walkMemberSig nextPath sign