Skip to content

Commit

Permalink
Properly walk SynModuleSigDecl.Val
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Nov 13, 2023
1 parent 20ae9f2 commit 70d5219
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ let mkOptionsFromProject (framework: string) (additionalPkgs: Package list) =
return FSharpProjectOptions.zero
}

let getContext (opts: FSharpProjectOptions) source =
let fileName = "A.fs"
let getContextFor (opts: FSharpProjectOptions) isSignature source =
let fileName = if isSignature then "A.fsi" else "A.fs"
let files = Map.ofArray [| (fileName, SourceText.ofString source) |]

let documentSource fileName =
Expand Down Expand Up @@ -260,6 +260,9 @@ let getContext (opts: FSharpProjectOptions) source =
Utils.createContext checkProjectResults fileName sourceText (parseFileResults, checkFileResults)
| None -> failwith "typechecking file failed"

let getContext (opts: FSharpProjectOptions) source = getContextFor opts false source
let getContextForSignature (opts: FSharpProjectOptions) source = getContextFor opts true source

module Assert =

let hasWarningsInLines (expectedLines: Set<int>) (msgs: FSharp.Analyzers.SDK.Message list) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exception CompilerDiagnosticErrors of FSharpDiagnostic array
val mkOptionsFromProject: framework: string -> additionalPkgs: Package list -> Task<FSharpProjectOptions>

val getContext: opts: FSharpProjectOptions -> source: string -> CliContext
val getContextForSignature: opts: FSharpProjectOptions -> source: string -> CliContext

module Assert =

Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Analyzers.SDK/ASTCollecting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ module ASTCollecting =
match decl with
| SynModuleSigDecl.ModuleAbbrev _ -> ()
| SynModuleSigDecl.NestedModule _ -> ()
| SynModuleSigDecl.Val(s, _range) -> walker.WalkValSig s
| SynModuleSigDecl.Val(s, _range) -> walkValSig s
| SynModuleSigDecl.Types _ -> ()
| SynModuleSigDecl.Exception _ -> ()
| SynModuleSigDecl.Open _ -> ()
Expand Down

0 comments on commit 70d5219

Please sign in to comment.