diff --git a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fs b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fs index fd1bd5f..8c29e2d 100644 --- a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fs +++ b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fs @@ -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 = @@ -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) (msgs: FSharp.Analyzers.SDK.Message list) = diff --git a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsi b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsi index ad842d0..97c278c 100644 --- a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsi +++ b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsi @@ -19,6 +19,7 @@ exception CompilerDiagnosticErrors of FSharpDiagnostic array val mkOptionsFromProject: framework: string -> additionalPkgs: Package list -> Task val getContext: opts: FSharpProjectOptions -> source: string -> CliContext +val getContextForSignature: opts: FSharpProjectOptions -> source: string -> CliContext module Assert = diff --git a/src/FSharp.Analyzers.SDK/ASTCollecting.fs b/src/FSharp.Analyzers.SDK/ASTCollecting.fs index 552af4c..9194e24 100644 --- a/src/FSharp.Analyzers.SDK/ASTCollecting.fs +++ b/src/FSharp.Analyzers.SDK/ASTCollecting.fs @@ -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 _ -> ()