Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CliWrap" Version="3.6.4" />
<PackageVersion Include="FSharp.Core" Version="[9.0.300]" />
<PackageVersion Include="FSharp.Compiler.Service" Version="[43.9.300]" />
<PackageVersion Include="FSharp.Core" Version="[10.0.100]" />
<PackageVersion Include="FSharp.Compiler.Service" Version="[43.10.100]" />
<PackageVersion Include="Ionide.KeepAChangelog.Tasks" Version="0.3.0" PrivateAssets="all" />
<PackageVersion Include="McMaster.NETCore.Plugins" Version="2.0.0" />
<PackageVersion Include="Argu" Version="6.2.5" />
Expand Down
4 changes: 2 additions & 2 deletions docs/content/Getting Started Writing.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
<PackageReference Update="FSharp.Core" Version="9.0.300" />
<PackageReference Update="FSharp.Core" Version="10.0.100" />
```

## First analyzer
Expand Down Expand Up @@ -80,7 +80,7 @@ let optionValueAnalyzer: Analyzer<CliContext> =
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 = []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FSharp.Compiler.Service"/>
<PackageReference Include="FSharp.Compiler.Service" />
<PackageReference Include="CliWrap" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="MSBuild.StructuredLogger" />
Expand Down
27 changes: 16 additions & 11 deletions src/FSharp.Analyzers.SDK/ASTCollecting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down