From fbb5ffe4fc57bd266d583d190ce563cfb5840278 Mon Sep 17 00:00:00 2001 From: dsyme Date: Wed, 7 Dec 2016 19:01:11 +0000 Subject: [PATCH 01/17] fix 1962 --- src/fsharp/CompileOps.fs | 83 ++++++++++++------- src/fsharp/CompileOps.fsi | 33 ++++++-- src/fsharp/ErrorLogger.fs | 10 +++ src/fsharp/fsc.fs | 4 +- src/fsharp/fsi/fsi.fs | 22 ++--- src/fsharp/vs/IncrementalBuild.fs | 29 ++++--- src/fsharp/vs/service.fs | 38 +++++---- src/fsharp/vs/service.fsi | 4 +- tests/service/FileSystemTests.fs | 1 + .../FSharp.LanguageService/FSharpSource.fs | 1 + .../ProjectSitesAndFiles.fs | 1 + .../unittests/BraceMatchingServiceTests.fs | 1 + .../unittests/BreakpointResolutionService.fs | 1 + .../unittests/CompletionProviderTests.fs | 1 + .../DocumentDiagnosticAnalyzerTests.fs | 1 + .../unittests/GoToDefinitionServiceTests.fs | 1 + .../tests/unittests/QuickInfoProviderTests.fs | 1 + .../unittests/SignatureHelpProviderTests.fs | 1 + 18 files changed, 156 insertions(+), 77 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 1391d6e0549..8bc79a454ab 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -4688,6 +4688,16 @@ let GetAssemblyResolutionInformation(tcConfig : TcConfig) = let resolutions = TcAssemblyResolutions.Resolve(tcConfig,assemblyList,[]) resolutions.GetAssemblyResolutions(),resolutions.GetUnresolvedReferences() + +[] +type LoadClosureInput = + { FileName: string + SyntaxTree: ParsedInput option + ParseErrors: PhasedError list + ParseWarnings: PhasedError list + MetaCommandErrors: PhasedError list + MetaCommandWarnings: PhasedError list } + [] type LoadClosure = { /// The source files along with the ranges of the #load positions in each file. @@ -4697,7 +4707,9 @@ type LoadClosure = /// The list of references that were not resolved during load closure. These may still be extension references. UnresolvedReferences : UnresolvedAssemblyReference list /// The list of all sources in the closure with inputs when available - Inputs: (string * ParsedInput option * PhasedError list * PhasedError list) list + Inputs: LoadClosureInput list + /// The #load, including those that didn't resolve + OriginalLoadReferences: (range * string) list /// The #nowarns NoWarns: (string * range list) list /// Errors seen while processing resolutions @@ -4705,9 +4717,13 @@ type LoadClosure = /// Warnings seen while processing resolutions ResolutionWarnings : PhasedError list /// Errors seen while parsing root of closure - RootErrors : PhasedError list + AllRootFileErrors : PhasedError list /// Warnings seen while parsing root of closure - RootWarnings : PhasedError list } + AllRootFileWarnings : PhasedError list + /// Errors seen while processing the root of closure, which are related to the options and load closure + LoadClosureRootFileErrors : PhasedError list + /// Warnings seen while processing the root of closure, which are related to the options and load closure + LoadClosureRootFileWarnings: PhasedError list } [] @@ -4724,7 +4740,7 @@ module private ScriptPreprocessClosure = type ClosureSource = ClosureSource of filename: string * referenceRange: range * sourceText: string * parseRequired: bool /// Represents an output of the closure finding process - type ClosureFile = ClosureFile of string * range * ParsedInput option * PhasedError list * PhasedError list * (string * range) list // filename, range, errors, warnings, nowarns + type ClosureFile = ClosureFile of string * range * ParsedInput option * PhasedError list * PhasedError list * PhasedError list * PhasedError list * (string * range) list // filename, range, errors, warnings, nowarns type Observed() = let seen = System.Collections.Generic.Dictionary<_,bool>() @@ -4820,18 +4836,17 @@ module private ScriptPreprocessClosure = observedSources.SetSeen(filename) //printfn "visiting %s" filename if IsScript(filename) || parseRequired then - let errors = ref [] - let warnings = ref [] - let errorLogger = - { new ErrorLogger("FindClosure") with - member x.ErrorSinkImpl(e) = errors := e :: !errors - member x.WarnSinkImpl(e) = warnings := e :: !warnings - member x.ErrorCount = (!errors).Length } - - use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) - let pathOfMetaCommandSource = Path.GetDirectoryName(filename) - match ParseScriptText(filename,source,!tcConfig,codeContext,lexResourceManager,errorLogger) with + let parseResult, parseErrors, parseWarnings = + let errorLogger = CaptureErrorLogger("FindClosureParse") + use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) + let result = ParseScriptText(filename,source,!tcConfig,codeContext,lexResourceManager,errorLogger) + result, errorLogger.Errors, errorLogger.Warnings + + match parseResult with | Some parsedScriptAst -> + let errorLogger = CaptureErrorLogger("FindClosureMetaCommands") + use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) + let pathOfMetaCommandSource = Path.GetDirectoryName(filename) let preSources = (!tcConfig).GetAvailableLoadedSources() let tcConfigResult, noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn !tcConfig (parsedScriptAst,pathOfMetaCommandSource) @@ -4848,18 +4863,18 @@ module private ScriptPreprocessClosure = for subSource in ClosureSourceOfFilename(subFile,m,tcConfigResult.inputCodePage,false) do yield! loop subSource else - yield ClosureFile(subFile, m, None, [], [], []) + yield ClosureFile(subFile, m, None, [], [], [], [], []) //printfn "yielding source %s" filename - yield ClosureFile(filename, m, Some parsedScriptAst, !errors, !warnings, !noWarns) + yield ClosureFile(filename, m, Some parsedScriptAst, parseErrors, parseWarnings, errorLogger.Errors, errorLogger.Warnings, !noWarns) | None -> //printfn "yielding source %s (failed parse)" filename - yield ClosureFile(filename, m, None, !errors, !warnings, []) + yield ClosureFile(filename, m, None, parseErrors, parseWarnings, [], [], []) else // Don't traverse into .fs leafs. //printfn "yielding non-script source %s" filename - yield ClosureFile(filename, m, None, [], [], []) ] + yield ClosureFile(filename, m, None, [], [], [], [], []) ] closureSources |> List.map loop |> List.concat, !tcConfig @@ -4872,14 +4887,14 @@ module private ScriptPreprocessClosure = closureFiles else match List.frontAndBack closureFiles with - | rest, ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,_))),errs,warns,nowarns) -> - rest @ [ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,(true, tcConfig.target.IsExe)))),errs,warns,nowarns)] + | rest, ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,_))),parseErrors,parseWarnings, metaErrors, metaWarnings, nowarns) -> + rest @ [ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,(true, tcConfig.target.IsExe)))),parseErrors,parseWarnings, metaErrors, metaWarnings,nowarns)] | _ -> closureFiles // Get all source files. - let sourceFiles = [ for (ClosureFile(filename,m,_,_,_,_)) in closureFiles -> (filename,m) ] - let sourceInputs = [ for (ClosureFile(filename,_,input,errs,warns,_nowarns)) in closureFiles -> (filename,input,errs,warns) ] - let globalNoWarns = closureFiles |> List.collect (fun (ClosureFile(_,_,_,_,_,noWarns)) -> noWarns) + let sourceFiles = [ for (ClosureFile(filename,m,_,_,_,_,_,_)) in closureFiles -> (filename,m) ] + let sourceInputs = [ for (ClosureFile(filename,_,input,parseErrors,parseWarnings, metaErrors, metaWarnings,_nowarns)) in closureFiles -> ({ FileName=filename; SyntaxTree=input; ParseErrors=parseErrors; ParseWarnings=parseWarnings; MetaCommandErrors=metaErrors; MetaCommandWarnings=metaWarnings }: LoadClosureInput) ] + let globalNoWarns = closureFiles |> List.collect (fun (ClosureFile(_,_,_,_,_,_,_,noWarns)) -> noWarns) // Resolve all references. let references, unresolvedReferences, resolutionWarnings, resolutionErrors = @@ -4897,9 +4912,14 @@ module private ScriptPreprocessClosure = references, unresolvedReferences, resolutionWarnings, resolutionErrors // Root errors and warnings - look at the last item in the closureFiles list - let rootErrors, rootWarnings = + let loadClosureRootErrors, loadClosureRootWarnings = + match List.rev closureFiles with + | ClosureFile(_,_,_,_,_, metaErrors, metaWarnings,_) :: _ -> metaErrors @ !resolutionErrors, metaWarnings @ !resolutionWarnings + | _ -> [],[] // When no file existed. + + let allRootErrors, allRootWarnings = match List.rev closureFiles with - | ClosureFile(_,_,_,errors,warnings,_) :: _ -> errors @ !resolutionErrors, warnings @ !resolutionWarnings + | ClosureFile(_,_,_,parseErrors,parseWarnings, metaErrors, metaWarnings,_) :: _ -> parseErrors @ metaErrors @ !resolutionErrors, parseWarnings @ metaWarnings @ !resolutionWarnings | _ -> [],[] // When no file existed. let isRootRange exn = @@ -4912,8 +4932,8 @@ module private ScriptPreprocessClosure = | None -> true // Filter out non-root errors and warnings - let rootErrors = rootErrors |> List.filter isRootRange - let rootWarnings = rootWarnings |> List.filter isRootRange + let allRootErrors = allRootErrors |> List.filter isRootRange + let allRootWarnings = allRootWarnings |> List.filter isRootRange let result : LoadClosure = { SourceFiles = List.groupByFirst sourceFiles @@ -4921,10 +4941,13 @@ module private ScriptPreprocessClosure = UnresolvedReferences = unresolvedReferences Inputs = sourceInputs NoWarns = List.groupByFirst globalNoWarns + OriginalLoadReferences = tcConfig.loadedSources ResolutionErrors = !resolutionErrors ResolutionWarnings = !resolutionWarnings - RootErrors = rootErrors - RootWarnings = rootWarnings} + AllRootFileErrors = allRootErrors + AllRootFileWarnings = allRootWarnings + LoadClosureRootFileErrors = loadClosureRootErrors + LoadClosureRootFileWarnings = loadClosureRootWarnings } result diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 1a5bc04cdd8..e13d31dabe4 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -740,6 +740,16 @@ type CodeContext = | Compilation | Editing +[] +type LoadClosureInput = + { FileName: string + SyntaxTree: ParsedInput option + ParseErrors: PhasedError list + ParseWarnings: PhasedError list + MetaCommandErrors: PhasedError list + MetaCommandWarnings: PhasedError list } + + [] type LoadClosure = { /// The source files along with the ranges of the #load positions in each file. @@ -748,11 +758,14 @@ type LoadClosure = /// The resolved references along with the ranges of the #r positions in each file. References: (string * AssemblyResolution list) list - /// The list of references that were not resolved during load closure. These may still be extension references. + /// The list of references that were not resolved during load closure. UnresolvedReferences : UnresolvedAssemblyReference list - /// The list of all sources in the closure with inputs when available - Inputs: (string * ParsedInput option * PhasedError list * PhasedError list) list + /// The list of all sources in the closure with inputs when available, with associated parse errors and warnings + Inputs: LoadClosureInput list + + /// The original #load references, including those that didn't resolve + OriginalLoadReferences: (range * string) list /// The #nowarns NoWarns: (string * range list) list @@ -763,11 +776,17 @@ type LoadClosure = /// Warnings seen while processing resolutions ResolutionWarnings : PhasedError list - /// *Parse* errors seen while parsing root of closure - RootErrors : PhasedError list + /// All parse, meta-command and reference resolution errors seen while parsing root of closure + AllRootFileErrors : PhasedError list + + /// All parse, meta-command and reference resolution warnings seen while parsing root of closure + AllRootFileWarnings : PhasedError list + + /// Errors seen while processing the root of closure, which are related to the options and load closure + LoadClosureRootFileErrors : PhasedError list - /// *Parse* warnings seen while parsing root of closure - RootWarnings : PhasedError list } + /// Warnings seen while processing the root of closure, which are related to the options and load closure + LoadClosureRootFileWarnings: PhasedError list } // Used from service.fs, when editing a script file static member ComputeClosureOfSourceText : referenceResolver: ReferenceResolver.Resolver * filename: string * source: string * implicitDefines:CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) * assumeDotNetFramework : bool -> LoadClosure diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index f6335c1e06b..c887729ddfe 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -257,6 +257,16 @@ let AssertFalseErrorLogger = member x.ErrorCount = assert false; 0 } +type CaptureErrorLogger(nm) = + inherit ErrorLogger(nm) + let errors = ref [] + let warnings = ref [] + override x.ErrorSinkImpl(e) = errors := e :: !errors + override x.WarnSinkImpl(e) = warnings := e :: !warnings + override x.ErrorCount = (!errors).Length + member x.Errors = !errors + member x.Warnings = !warnings + /// When no errorLogger is installed (on the thread) use this one. let uninitializedErrorLoggerFallback = ref AssertFalseErrorLogger diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index f45ce5a0133..cb61de0c8ac 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -251,8 +251,8 @@ let AdjustForScriptCompile(tcConfigB:TcConfigBuilder, commandLineSourceFiles, le references |> List.iter (fun r-> tcConfigB.AddReferencedAssemblyByPath(r.originalReference.Range, r.resolvedPath)) closure.NoWarns |> List.map(fun (n, ms)->ms|>List.map(fun m->m, n)) |> List.concat |> List.iter tcConfigB.TurnWarningOff closure.SourceFiles |> List.map fst |> List.iter AddIfNotPresent - closure.RootWarnings |> List.iter warnSink - closure.RootErrors |> List.iter errorSink + closure.AllRootFileWarnings |> List.iter warnSink + closure.AllRootFileErrors |> List.iter errorSink else AddIfNotPresent(filename) diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index fab2fdca831..c87b1acb468 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1198,9 +1198,9 @@ type internal FsiDynamicCompiler // Intent "[Loading %s]\n" (String.concat "\n and " sourceFiles) fsiConsoleOutput.uprintf "[%s " (FSIstrings.SR.fsiLoadingFilesPrefixText()) - closure.Inputs |> List.iteri (fun i (sourceFile,_,_,_) -> - if i=0 then fsiConsoleOutput.uprintf "%s" sourceFile - else fsiConsoleOutput.uprintnf " %s %s" (FSIstrings.SR.fsiLoadingFilesPrefixText()) sourceFile) + closure.Inputs |> List.iteri (fun i input -> + if i=0 then fsiConsoleOutput.uprintf "%s" input.FileName + else fsiConsoleOutput.uprintnf " %s %s" (FSIstrings.SR.fsiLoadingFilesPrefixText()) input.FileName) fsiConsoleOutput.uprintfn "]" closure.NoWarns |> Seq.map (fun (n,ms) -> ms |> Seq.map (fun m -> m,n)) |> Seq.concat |> Seq.iter tcConfigB.TurnWarningOff @@ -1212,14 +1212,16 @@ type internal FsiDynamicCompiler // Non-scripts will not have been parsed during #load closure so parse them now let sourceFiles,inputs = closure.Inputs - |> List.map (fun (filename, input, errs, warns)-> - errs |> List.iter errorSink - warns |> List.iter warnSink + |> List.map (fun input-> + input.ParseErrors |> List.iter errorSink + input.MetaCommandErrors |> List.iter errorSink + input.ParseWarnings |> List.iter errorSink + input.MetaCommandWarnings |> List.iter errorSink let parsedInput = - match input with - | None -> ParseOneInputFile(tcConfig,lexResourceManager,["INTERACTIVE"],filename,(true,false),errorLogger,(*retryLocked*)false) - | _-> input - filename, parsedInput) + match input.SyntaxTree with + | None -> ParseOneInputFile(tcConfig,lexResourceManager,["INTERACTIVE"],input.FileName,(true,false),errorLogger,(*retryLocked*)false) + | _-> input.SyntaxTree + input.FileName, parsedInput) |> List.unzip errorLogger.AbortOnError(fsiConsoleOutput); diff --git a/src/fsharp/vs/IncrementalBuild.fs b/src/fsharp/vs/IncrementalBuild.fs index 482e77c6784..2d2c2523999 100755 --- a/src/fsharp/vs/IncrementalBuild.fs +++ b/src/fsharp/vs/IncrementalBuild.fs @@ -1258,8 +1258,9 @@ type RawFSharpAssemblyDataBackedByLanguageService (tcConfig,tcGlobals,tcState:Tc /// Manages an incremental build graph for the build of a single F# project -type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig: TcConfig, projectDirectory, outfile, assemblyName, niceNameGen: Ast.NiceNameGenerator, lexResourceManager, - sourceFiles, projectReferences: IProjectReference list, ensureReactive, +type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig: TcConfig, projectDirectory, outfile, + assemblyName, niceNameGen: Ast.NiceNameGenerator, lexResourceManager, + sourceFiles, projectReferences: IProjectReference list, loadClosureOpt: LoadClosure option, ensureReactive, keepAssemblyContents, keepAllBackgroundResolutions) = /// Maximum time share for a piece of background work before it should (cooperatively) yield @@ -1432,6 +1433,14 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig let tcEnvAtEndOfFile = GetInitialTcEnv (assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals) let tcState = GetInitialTcState (rangeStartup, assemblyName, tcConfig, tcGlobals, tcImports, niceNameGen, tcEnvAtEndOfFile) + let loadClosureErrors = + [ match loadClosureOpt with + | None -> () + | Some loadClosure -> + for inp in loadClosure.Inputs do + for e in inp.MetaCommandErrors do yield e,FSharpErrorSeverity.Error + for e in inp.MetaCommandWarnings do yield e,FSharpErrorSeverity.Warning ] + let tcAcc = { tcGlobals=tcGlobals tcImports=tcImports @@ -1442,7 +1451,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig tcSymbolUses=[] topAttribs=None typedImplFiles=[] - tcErrors=errorLogger.GetErrors() } + tcErrors = loadClosureErrors @ errorLogger.GetErrors() } tcAcc /// This is a build task function that gets placed into the build rules as the computation for a Vector.ScanLeft @@ -1766,7 +1775,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig /// CreateIncrementalBuilder (for background type checking). Note that fsc.fs also /// creates an incremental builder used by the command line compiler. - static member TryCreateBackgroundBuilderForProjectOptions (referenceResolver, frameworkTcImportsCache, scriptClosureOptions:LoadClosure option, sourceFiles:string list, commandLineArgs:string list, projectReferences, projectDirectory, useScriptResolutionRules, keepAssemblyContents, keepAllBackgroundResolutions) = + static member TryCreateBackgroundBuilderForProjectOptions (referenceResolver, frameworkTcImportsCache, loadClosureOpt:LoadClosure option, sourceFiles:string list, commandLineArgs:string list, projectReferences, projectDirectory, useScriptResolutionRules, keepAssemblyContents, keepAllBackgroundResolutions) = // Trap and report warnings and errors from creation. use errorScope = new ErrorScope() @@ -1815,21 +1824,21 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig tcConfigB, sourceFilesNew - match scriptClosureOptions with - | Some closure -> + match loadClosureOpt with + | Some loadClosure -> let dllReferences = [for reference in tcConfigB.referencedDLLs do // If there's (one or more) resolutions of closure references then yield them all - match closure.References |> List.tryFind (fun (resolved,_)->resolved=reference.Text) with + match loadClosure.References |> List.tryFind (fun (resolved,_)->resolved=reference.Text) with | Some (resolved,closureReferences) -> for closureReference in closureReferences do yield AssemblyReference(closureReference.originalReference.Range, resolved, None) | None -> yield reference] - tcConfigB.referencedDLLs<-[] + tcConfigB.referencedDLLs <- [] // Add one by one to remove duplicates for dllReference in dllReferences do tcConfigB.AddReferencedAssemblyByPath(dllReference.Range,dllReference.Text) - tcConfigB.knownUnresolvedReferences<-closure.UnresolvedReferences + tcConfigB.knownUnresolvedReferences <- loadClosure.UnresolvedReferences | None -> () let tcConfig = TcConfig.Create(tcConfigB,validate=true) @@ -1841,7 +1850,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig let builder = new IncrementalBuilder(frameworkTcImportsCache, tcConfig, projectDirectory, outfile, assemblyName, niceNameGen, - resourceManager, sourceFilesNew, projectReferences, ensureReactive=true, + resourceManager, sourceFilesNew, projectReferences, loadClosureOpt, ensureReactive=true, keepAssemblyContents=keepAssemblyContents, keepAllBackgroundResolutions=keepAllBackgroundResolutions) Some builder diff --git a/src/fsharp/vs/service.fs b/src/fsharp/vs/service.fs index 199c46318af..ee1734ba982 100755 --- a/src/fsharp/vs/service.fs +++ b/src/fsharp/vs/service.fs @@ -1626,14 +1626,13 @@ module internal Parser = // Play unresolved references for this file. tcImports.ReportUnresolvedAssemblyReferences(loadClosure.UnresolvedReferences) - // If there was a loadClosure, replay the errors and warnings - loadClosure.RootErrors |> List.iter errorSink - loadClosure.RootWarnings |> List.iter warnSink - + // If there was a loadClosure, replay the errors and warnings from resolution, excluding parsing + loadClosure.LoadClosureRootFileErrors |> List.iter errorSink + loadClosure.LoadClosureRootFileWarnings |> List.iter warnSink let fileOfBackgroundError err = (match GetRangeOfError (fst err) with Some m-> m.FileName | None -> null) let sameFile file hashLoadInFile = - (0 = String.Compare(fst hashLoadInFile, file, StringComparison.OrdinalIgnoreCase)) + (0 = String.Compare(hashLoadInFile, file, StringComparison.OrdinalIgnoreCase)) // walk the list of #loads and keep the ones for this file. let hashLoadsInFile = @@ -1641,7 +1640,7 @@ module internal Parser = |> List.filter(fun (_,ms) -> ms<>[]) // #loaded file, ranges of #load let hashLoadBackgroundErrors, otherBackgroundErrors = - backgroundErrors |> List.partition (fun backgroundError -> hashLoadsInFile |> List.exists (sameFile (fileOfBackgroundError backgroundError))) + backgroundErrors |> List.partition (fun backgroundError -> hashLoadsInFile |> List.exists (fst >> sameFile (fileOfBackgroundError backgroundError))) // Create single errors for the #load-ed files. // Group errors and warnings by file name. @@ -1653,10 +1652,10 @@ module internal Parser = // Join the sets and report errors. // It is by-design that these messages are only present in the language service. A true build would report the errors at their // spots in the individual source files. - for hashLoadInFile in hashLoadsInFile do + for (fileOfHashLoad, rangesOfHashLoad) in hashLoadsInFile do for errorGroupedByFileName in hashLoadBackgroundErrorsGroupedByFileName do - if sameFile (fst errorGroupedByFileName) hashLoadInFile then - for rangeOfHashLoad in snd hashLoadInFile do // Handle the case of two #loads of the same file + if sameFile (fst errorGroupedByFileName) fileOfHashLoad then + for rangeOfHashLoad in rangesOfHashLoad do // Handle the case of two #loads of the same file let errorsAndWarnings = snd errorGroupedByFileName |> List.map(fun (pe,f)->pe.Exception,f) // Strip the build phase here. It will be replaced, in total, with TypeCheck let errors = [ for (err,sev) in errorsAndWarnings do if sev = FSharpErrorSeverity.Error then yield err ] let warnings = [ for (err,sev) in errorsAndWarnings do if sev = FSharpErrorSeverity.Warning then yield err ] @@ -1732,6 +1731,7 @@ type FSharpProjectOptions = UseScriptResolutionRules : bool LoadTime : System.DateTime UnresolvedReferences : UnresolvedReferencesSet option + OriginalLoadReferences: (range * string) list ExtraProjectInfo : obj option } member x.ProjectOptions = x.OtherOptions @@ -1750,6 +1750,8 @@ type FSharpProjectOptions = options1.ProjectFileName = options2.ProjectFileName && options1.ProjectFileNames = options2.ProjectFileNames && options1.OtherOptions = options2.OtherOptions && + options1.UnresolvedReferences = options2.UnresolvedReferences && + options1.OriginalLoadReferences = options2.OriginalLoadReferences && options1.ReferencedProjects.Length = options2.ReferencedProjects.Length && Array.forall2 (fun (n1,a) (n2,b) -> n1 = n2 && FSharpProjectOptions.AreSameForChecking(a,b)) options1.ReferencedProjects options2.ReferencedProjects && options1.LoadTime = options2.LoadTime @@ -2457,27 +2459,28 @@ type BackgroundCompiler(referenceResolver, projectCacheSize, keepAssemblyContent let collect _name = () let fsiCompilerOptions = CompileOptions.GetCoreFsiCompilerOptions tcConfigB CompileOptions.ParseCompilerOptions (collect, fsiCompilerOptions, Array.toList otherFlags) - let fas = LoadClosure.ComputeClosureOfSourceText(referenceResolver,filename, source, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, new Lexhelp.LexResourceManager(), applyCompilerOptions, assumeDotNetFramework) + let loadClosure = LoadClosure.ComputeClosureOfSourceText(referenceResolver,filename, source, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, new Lexhelp.LexResourceManager(), applyCompilerOptions, assumeDotNetFramework) let otherFlags = [| yield "--noframework"; yield "--warn:3"; yield! otherFlags - for r in fas.References do yield "-r:" + fst r - for (code,_) in fas.NoWarns do yield "--nowarn:" + code + for r in loadClosure.References do yield "-r:" + fst r + for (code,_) in loadClosure.NoWarns do yield "--nowarn:" + code |] - let co = + let options = { ProjectFileName = filename + ".fsproj" // Make a name that is unique in this directory. - ProjectFileNames = fas.SourceFiles |> List.map fst |> List.toArray + ProjectFileNames = loadClosure.SourceFiles |> List.map fst |> List.toArray OtherOptions = otherFlags ReferencedProjects= [| |] IsIncompleteTypeCheckEnvironment = false UseScriptResolutionRules = true LoadTime = loadedTimeStamp - UnresolvedReferences = Some (UnresolvedReferencesSet(fas.UnresolvedReferences)) + UnresolvedReferences = Some (UnresolvedReferencesSet(loadClosure.UnresolvedReferences)) + OriginalLoadReferences = loadClosure.OriginalLoadReferences ExtraProjectInfo=extraProjectInfo } - scriptClosureCache.Set(co,fas) // Save the full load closure for later correlation. - co) + scriptClosureCache.Set(options,loadClosure) // Save the full load closure for later correlation. + options) member bc.InvalidateConfiguration(options : FSharpProjectOptions) = reactor.EnqueueOp("InvalidateConfiguration", fun () -> @@ -2679,6 +2682,7 @@ type FSharpChecker(referenceResolver, projectCacheSize, keepAssemblyContents, ke UseScriptResolutionRules = false LoadTime = loadedTimeStamp UnresolvedReferences = None + OriginalLoadReferences=[] ExtraProjectInfo=extraProjectInfo } /// Begin background parsing the given project. diff --git a/src/fsharp/vs/service.fsi b/src/fsharp/vs/service.fsi index e844410f2d1..f0cc3d0c843 100755 --- a/src/fsharp/vs/service.fsi +++ b/src/fsharp/vs/service.fsi @@ -316,8 +316,10 @@ type internal FSharpProjectOptions = /// This ensures that a complete reload of the project or script type checking /// context occurs on project or script unload/reload. LoadTime : DateTime - /// Unused in this API and should be 'None' + /// Unused in this API and should be 'None' when used as user-specified input UnresolvedReferences : UnresolvedReferencesSet option + /// Unused in this API and should be '[]' when used as user-specified input + OriginalLoadReferences: (range * string) list /// Extra information passed back on event trigger ExtraProjectInfo : obj option } diff --git a/tests/service/FileSystemTests.fs b/tests/service/FileSystemTests.fs index b5e492e6960..d9f25f42890 100644 --- a/tests/service/FileSystemTests.fs +++ b/tests/service/FileSystemTests.fs @@ -102,6 +102,7 @@ let ``FileSystem compilation test``() = UseScriptResolutionRules = true LoadTime = System.DateTime.Now // Not 'now', we don't want to force reloading UnresolvedReferences = None + OriginalLoadReferences = [] ExtraProjectInfo = None } let results = checker.ParseAndCheckProject(projectOptions) |> Async.RunSynchronously diff --git a/vsintegration/src/FSharp.LanguageService/FSharpSource.fs b/vsintegration/src/FSharp.LanguageService/FSharpSource.fs index 04957099d16..3de4acef0be 100644 --- a/vsintegration/src/FSharp.LanguageService/FSharpSource.fs +++ b/vsintegration/src/FSharp.LanguageService/FSharpSource.fs @@ -329,6 +329,7 @@ type internal FSharpSource(service:LanguageService, textLines, colorizer, vsFile UseScriptResolutionRules = false LoadTime = new System.DateTime(2000,1,1) // dummy data, just enough to get a parse UnresolvedReferences = None + OriginalLoadReferences = [] ExtraProjectInfo=None } ic.ParseFileInProject(fileName, source.GetText(), co) |> Async.RunSynchronously diff --git a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs index 00448e3dfb4..12b86decb64 100644 --- a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs +++ b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs @@ -174,6 +174,7 @@ type internal ProjectSitesAndFiles() = UseScriptResolutionRules = SourceFile.MustBeSingleFileProject(filename) LoadTime = projectSite.LoadTime UnresolvedReferences = None + OriginalLoadReferences = [] ExtraProjectInfo=extraProjectInfo } /// Create project site for these project options diff --git a/vsintegration/tests/unittests/BraceMatchingServiceTests.fs b/vsintegration/tests/unittests/BraceMatchingServiceTests.fs index 6386c3adf90..02ae70b1a57 100644 --- a/vsintegration/tests/unittests/BraceMatchingServiceTests.fs +++ b/vsintegration/tests/unittests/BraceMatchingServiceTests.fs @@ -24,6 +24,7 @@ type BraceMatchingServiceTests() = IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } diff --git a/vsintegration/tests/unittests/BreakpointResolutionService.fs b/vsintegration/tests/unittests/BreakpointResolutionService.fs index 32c6d343d57..5708ee9c8da 100644 --- a/vsintegration/tests/unittests/BreakpointResolutionService.fs +++ b/vsintegration/tests/unittests/BreakpointResolutionService.fs @@ -28,6 +28,7 @@ type BreakpointResolutionServiceTests() = IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } diff --git a/vsintegration/tests/unittests/CompletionProviderTests.fs b/vsintegration/tests/unittests/CompletionProviderTests.fs index 361bd25de61..d742043d64a 100644 --- a/vsintegration/tests/unittests/CompletionProviderTests.fs +++ b/vsintegration/tests/unittests/CompletionProviderTests.fs @@ -48,6 +48,7 @@ let internal options = { IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } diff --git a/vsintegration/tests/unittests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/unittests/DocumentDiagnosticAnalyzerTests.fs index cfc48e7127f..2207f1d3209 100644 --- a/vsintegration/tests/unittests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/unittests/DocumentDiagnosticAnalyzerTests.fs @@ -30,6 +30,7 @@ type DocumentDiagnosticAnalyzerTests() = IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } diff --git a/vsintegration/tests/unittests/GoToDefinitionServiceTests.fs b/vsintegration/tests/unittests/GoToDefinitionServiceTests.fs index c201ffb6aca..0068100b2ac 100644 --- a/vsintegration/tests/unittests/GoToDefinitionServiceTests.fs +++ b/vsintegration/tests/unittests/GoToDefinitionServiceTests.fs @@ -90,6 +90,7 @@ let _ = Module1.foo 1 IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } diff --git a/vsintegration/tests/unittests/QuickInfoProviderTests.fs b/vsintegration/tests/unittests/QuickInfoProviderTests.fs index d6157fc8317..16848795cee 100644 --- a/vsintegration/tests/unittests/QuickInfoProviderTests.fs +++ b/vsintegration/tests/unittests/QuickInfoProviderTests.fs @@ -46,6 +46,7 @@ let internal options = { IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } diff --git a/vsintegration/tests/unittests/SignatureHelpProviderTests.fs b/vsintegration/tests/unittests/SignatureHelpProviderTests.fs index 5588dee1cb1..bb1de661a6d 100644 --- a/vsintegration/tests/unittests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/unittests/SignatureHelpProviderTests.fs @@ -57,6 +57,7 @@ let internal options = { IsIncompleteTypeCheckEnvironment = true UseScriptResolutionRules = false LoadTime = DateTime.MaxValue + OriginalLoadReferences = [] UnresolvedReferences = None ExtraProjectInfo = None } From 78792aa3ebe407a87e6420e6642cbf92b32b9876 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 7 Dec 2016 23:16:12 +0000 Subject: [PATCH 02/17] fix warnings --- src/fsharp/fsi/fsi.fs | 4 ++-- .../tests/unittests/Tests.LanguageService.ErrorList.fs | 2 +- .../tests/unittests/Tests.LanguageService.Script.fs | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index c87b1acb468..2472c19d359 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1215,8 +1215,8 @@ type internal FsiDynamicCompiler |> List.map (fun input-> input.ParseErrors |> List.iter errorSink input.MetaCommandErrors |> List.iter errorSink - input.ParseWarnings |> List.iter errorSink - input.MetaCommandWarnings |> List.iter errorSink + input.ParseWarnings |> List.iter warnSink + input.MetaCommandWarnings |> List.iter warnSink let parsedInput = match input.SyntaxTree with | None -> ParseOneInputFile(tcConfig,lexResourceManager,["INTERACTIVE"],input.FileName,(true,false),errorLogger,(*retryLocked*)false) diff --git a/vsintegration/tests/unittests/Tests.LanguageService.ErrorList.fs b/vsintegration/tests/unittests/Tests.LanguageService.ErrorList.fs index e06e5d29f24..7a4f67c7131 100644 --- a/vsintegration/tests/unittests/Tests.LanguageService.ErrorList.fs +++ b/vsintegration/tests/unittests/Tests.LanguageService.ErrorList.fs @@ -138,7 +138,7 @@ let g (t : T) = t.Count() "#r \"System2\"" ] TakeCoffeeBreak(this.VS) - checkErrors 1 + checkErrors 2 ReplaceFileInMemory file <| [ diff --git a/vsintegration/tests/unittests/Tests.LanguageService.Script.fs b/vsintegration/tests/unittests/Tests.LanguageService.Script.fs index 27396609c03..6b19eac335f 100644 --- a/vsintegration/tests/unittests/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/unittests/Tests.LanguageService.Script.fs @@ -72,15 +72,18 @@ type UsingMSBuild() as this = printf " message = <<<%s> \n" e.Message AssertEqual(0,count) - let AssertExactlyOneErrorSeenContaining(project:OpenProject,text) = + let AssertExactlyCountErrorSeenContaining(project:OpenProject,tex,expectedCount) = let nMatching = (GetErrors(project)) |> List.filter (fun e ->e.ToString().Contains(text)) |> List.length match nMatching with | 0 -> failwith (sprintf "No errors containing \"%s\"" text) - | 1 -> () + | x when x = expectedCount -> () | _ -> failwith (sprintf "Multiple errors containing \"%s\"" text) + let AssertExactlyOneErrorSeenContaining(project:OpenProject,text) = + AssertExactlyCountErrorSeenContaining(project:OpenProject,tex,1) + /// Assert that a given squiggle is an Error (or warning) containing the given text let AssertSquiggleIsErrorContaining,AssertSquiggleIsWarningContaining, AssertSquiggleIsErrorNotContaining,AssertSquiggleIsWarningNotContaining = let AssertSquiggle expectedSeverity nameOfExpected nameOfNotExpected assertf (squiggleOption,containing) = @@ -155,7 +158,7 @@ type UsingMSBuild() as this = "#r \"Nonexistent\"" ] let (project, _) = createSingleFileFsxFromLines code - AssertExactlyOneErrorSeenContaining(project, "Nonexistent") // ...and not an error on the first line. + AssertExactlyCountErrorSeenContaining(project, "Nonexistent", 2) // ...and not an error on the first line. [] member public this.``Fsx.InvalidHashLoad.ShouldBeASquiggle.Bug3012``() = From 082142336a2529e12d7c517610c8690194ae1ae1 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 8 Dec 2016 01:04:33 +0000 Subject: [PATCH 03/17] simplify diagnostics processing --- FSharp.sln | 26 ++- src/fsharp/CompileOps.fs | 188 +++++++----------- src/fsharp/CompileOps.fsi | 52 +++-- src/fsharp/CompileOptions.fs | 4 +- src/fsharp/CompileOptions.fsi | 2 +- src/fsharp/ErrorLogger.fs | 78 +++----- .../HashIfExpression.fs | 3 +- src/fsharp/LegacyHostedCompilerForTesting.fs | 11 +- src/fsharp/MSBuildReferenceResolver.fs | 16 +- src/fsharp/ReferenceResolver.fs | 2 +- src/fsharp/fsc.fs | 89 +++------ src/fsharp/fsc.fsi | 5 +- src/fsharp/fsi/fsi.fs | 56 +++--- src/fsharp/vs/IncrementalBuild.fs | 39 ++-- src/fsharp/vs/IncrementalBuild.fsi | 2 +- src/fsharp/vs/service.fs | 56 +++--- 16 files changed, 268 insertions(+), 361 deletions(-) diff --git a/FSharp.sln b/FSharp.sln index f76f0a7f2c8..7f3e7ef9864 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -45,6 +45,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ILComparer", "tests\fsharpq EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Tests.FSharpSuite.DrivingCoreCLR", "tests\fsharp\FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj", "{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}" EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.LanguageService.Compiler", "src\fsharp\FSharp.LanguageService.Compiler\FSharp.LanguageService.Compiler.fsproj", "{A437A6EC-5323-47C2-8F86-E2CAC54FF152}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -196,16 +198,6 @@ Global {4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|Any CPU.Build.0 = Release|Any CPU {4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|x86.ActiveCfg = Release|Any CPU {4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|x86.Build.0 = Release|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Debug|x86.ActiveCfg = Debug|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Debug|x86.Build.0 = Debug|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Proto|Any CPU.ActiveCfg = Release|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Proto|x86.ActiveCfg = Release|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Release|Any CPU.Build.0 = Release|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Release|x86.ActiveCfg = Release|Any CPU - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91}.Release|x86.Build.0 = Release|Any CPU {2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -228,6 +220,18 @@ Global {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|Any CPU.Build.0 = Release|Any CPU {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|x86.ActiveCfg = Release|Any CPU {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|x86.Build.0 = Release|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|x86.ActiveCfg = Debug|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|x86.Build.0 = Debug|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|Any CPU.Build.0 = Proto|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|x86.ActiveCfg = Proto|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|x86.Build.0 = Proto|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|Any CPU.Build.0 = Release|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|x86.ActiveCfg = Release|Any CPU + {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -245,8 +249,8 @@ Global {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {88E2D422-6852-46E3-A740-83E391DC7973} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {4239EFEA-E746-446A-BF7A-51FCBAB13946} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} - {BF5C6D92-D053-4216-9C42-B62F5F5C5E91} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {2E60864A-E3FF-4BCC-810F-DC7C34E6B236} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} + {A437A6EC-5323-47C2-8F86-E2CAC54FF152} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77} EndGlobalSection EndGlobal diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 8bc79a454ab..a3e93399f3f 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -1453,32 +1453,32 @@ let SanitizeFileName fileName implicitIncludeDir = fileName [] -type ErrorLocation = +type DiagnosticLocation = { Range : range File : string TextRepresentation : string IsEmpty : bool } [] -type CanonicalInformation = +type DiagnosticCanonicalInformation = { ErrorNumber : int Subcategory : string TextRepresentation : string } [] -type DetailedIssueInfo = - { Location : ErrorLocation option - Canonical : CanonicalInformation +type DiagnosticDetailedInfo = + { Location : DiagnosticLocation option + Canonical : DiagnosticCanonicalInformation Message : string } [] -type ErrorOrWarning = +type Diagnostic = | Short of bool * string - | Long of bool * DetailedIssueInfo + | Long of bool * DiagnosticDetailedInfo -/// returns sequence that contains ErrorOrWarning for the given error + ErrorOrWarning for all related errors -let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn, err:PhasedError) = - let outputWhere (showFullPaths,errorStyle) m : ErrorLocation = +/// returns sequence that contains Diagnostic for the given error + Diagnostic for all related errors +let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn, err:PhasedError) = + let outputWhere (showFullPaths,errorStyle) m : DiagnosticLocation = if m = rangeStartup || m = rangeCmdArgs then { Range = m; TextRepresentation = ""; IsEmpty = true; File = "" } else @@ -1537,7 +1537,7 @@ let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorS | Some m -> Some(outputWhere (showFullPaths,errorStyle) m) | None -> None - let OutputCanonicalInformation(err:PhasedError,subcategory, errorNumber) : CanonicalInformation = + let OutputDiagnosticCanonicalInformation(err:PhasedError,subcategory, errorNumber) : DiagnosticCanonicalInformation = let text = match errorStyle with // Show the subcategory for --vserrors so that we can fish it out in Visual Studio and use it to determine error stickiness. @@ -1547,34 +1547,34 @@ let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorS let mainError,relatedErrors = SplitRelatedErrors err let where = OutputWhere(mainError) - let canonical = OutputCanonicalInformation(mainError,err.Subcategory(),GetErrorNumber mainError) + let canonical = OutputDiagnosticCanonicalInformation(mainError,err.Subcategory(),GetErrorNumber mainError) let message = let os = System.Text.StringBuilder() OutputPhasedError os mainError flattenErrors os.ToString() - let entry : DetailedIssueInfo = { Location = where; Canonical = canonical; Message = message } + let entry : DiagnosticDetailedInfo = { Location = where; Canonical = canonical; Message = message } - errors.Add ( ErrorOrWarning.Long( not warn, entry ) ) + errors.Add ( Diagnostic.Long( not warn, entry ) ) let OutputRelatedError(err) = match errorStyle with // Give a canonical string when --vserror. | ErrorStyle.VSErrors -> let relWhere = OutputWhere(mainError) // mainError? - let relCanonical = OutputCanonicalInformation(err, err.Subcategory(),GetErrorNumber mainError) // Use main error for code + let relCanonical = OutputDiagnosticCanonicalInformation(err, err.Subcategory(),GetErrorNumber mainError) // Use main error for code let relMessage = let os = System.Text.StringBuilder() OutputPhasedError os err flattenErrors os.ToString() - let entry : DetailedIssueInfo = { Location = relWhere; Canonical = relCanonical; Message = relMessage} - errors.Add( ErrorOrWarning.Long (not warn, entry) ) + let entry : DiagnosticDetailedInfo = { Location = relWhere; Canonical = relCanonical; Message = relMessage} + errors.Add( Diagnostic.Long (not warn, entry) ) | _ -> let os = System.Text.StringBuilder() OutputPhasedError os err flattenErrors - errors.Add( ErrorOrWarning.Short((not warn), os.ToString()) ) + errors.Add( Diagnostic.Short((not warn), os.ToString()) ) relatedErrors |> List.iter OutputRelatedError @@ -1592,22 +1592,22 @@ let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorS /// used by fsc.exe and fsi.exe, but not by VS /// prints error and related errors to the specified StringBuilder -let rec OutputErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn) os (err:PhasedError) = +let rec OutputDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn) os (err:PhasedError) = - let errors = CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn, err) + let errors = CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn, err) for e in errors do Printf.bprintf os "\n" match e with - | ErrorOrWarning.Short(_, txt) -> + | Diagnostic.Short(_, txt) -> os.Append txt |> ignore - | ErrorOrWarning.Long(_, details) -> + | Diagnostic.Long(_, details) -> match details.Location with | Some l when not l.IsEmpty -> os.Append(l.TextRepresentation) |> ignore | _ -> () os.Append( details.Canonical.TextRepresentation ) |> ignore os.Append( details.Message ) |> ignore -let OutputErrorOrWarningContext prefix fileLineFn os err = +let OutputDiagnosticContext prefix fileLineFn os err = match GetRangeOfError err with | None -> () | Some m -> @@ -2949,7 +2949,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = if showMessages && tcConfig.showReferenceResolutions then (fun (message:string)->dprintf "%s\n" message) else ignore - let logErrorOrWarning showMessages = + let logDiagnostic showMessages = (fun isError code message-> if showMessages && mode = ReportErrors then if isError then @@ -2996,7 +2996,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = tcConfig.fsharpBinariesDir, // FSharp binaries directory tcConfig.includes, // Explicit include directories tcConfig.implicitIncludeDir, // Implicit include directory (likely the project directory) - logMessage showMessages, logErrorOrWarning showMessages) + logMessage showMessages, logDiagnostic showMessages) with ReferenceResolver.ResolutionFailure -> error(Error(FSComp.SR.buildAssemblyResolutionFailed(),errorAndWarningRange)) @@ -3100,16 +3100,17 @@ let GetScopedPragmasForInput input = // However this is indicative of a more systematic problem where source-line // sensitive operations (lexfilter and warning filtering) do not always // interact well with #line directives. -type ErrorLoggerFilteringByScopedPragmas (checkFile,scopedPragmas,errorLogger:ErrorLogger) = +type ErrorLoggerFilteringByScopedPragmas (checkFile, scopedPragmas, errorLogger:ErrorLogger) = inherit ErrorLogger("ErrorLoggerFilteringByScopedPragmas") let mutable scopedPragmas = scopedPragmas member x.ScopedPragmas with set v = scopedPragmas <- v - override x.ErrorSinkImpl err = errorLogger.ErrorSink err - override x.ErrorCount = errorLogger.ErrorCount - override x.WarnSinkImpl err = - let report = - let warningNum = GetErrorNumber err - match GetRangeOfError err with + override x.DiagnosticSink (phasedError,isError) = + if isError then + errorLogger.DiagnosticSink (phasedError,isError) + else + let report = + let warningNum = GetErrorNumber phasedError + match GetRangeOfError phasedError with | Some m -> not (scopedPragmas |> List.exists (fun pragma -> match pragma with @@ -3118,27 +3119,13 @@ type ErrorLoggerFilteringByScopedPragmas (checkFile,scopedPragmas,errorLogger:Er (not checkFile || m.FileIndex = pragmaRange.FileIndex) && Range.posGeq m.Start pragmaRange.Start)) | None -> true - if report then errorLogger.WarnSink(err) - override x.ErrorNumbers = errorLogger.ErrorNumbers - override x.WarningNumbers = errorLogger.WarningNumbers + if report then errorLogger.DiagnosticSink(phasedError,true) + + override x.ErrorCount = errorLogger.ErrorCount let GetErrorLoggerFilteringByScopedPragmas(checkFile,scopedPragmas,errorLogger) = (ErrorLoggerFilteringByScopedPragmas(checkFile,scopedPragmas,errorLogger) :> ErrorLogger) -/// Build an ErrorLogger that delegates to another ErrorLogger but filters warnings turned off by the given pragma declarations -type DelayedErrorLogger(errorLogger:ErrorLogger) = - inherit ErrorLogger("DelayedErrorLogger") - let delayed = new ResizeArray<_>() - override x.ErrorSinkImpl err = delayed.Add (err,true) - override x.ErrorCount = delayed |> Seq.filter snd |> Seq.length - override x.WarnSinkImpl err = delayed.Add(err,false) - member x.CommitDelayedErrorsAndWarnings() = - // Eagerly grab all the errors and warnings from the mutable collection - let errors = delayed |> Seq.toList - // Now report them - for (err,isError) in errors do - if isError then errorLogger.ErrorSink err else errorLogger.WarnSink err - //---------------------------------------------------------------------------- // Parsing @@ -3303,10 +3290,10 @@ let ParseInput (lexer,errorLogger:ErrorLogger,lexbuf:UnicodeLexing.Lexbuf,defaul let lower = String.lowercase filename // Delay sending errors and warnings until after the file is parsed. This gives us a chance to scrape the // #nowarn declarations for the file - let filteringErrorLogger = ErrorLoggerFilteringByScopedPragmas(false,[],errorLogger) - let errorLogger = DelayedErrorLogger(filteringErrorLogger) - use unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) + let delayLogger = CapturingErrorLogger("Parsing") + use unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> delayLogger) use unwindBP = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parse) + let mutable scopedPragmas = [] try let input = if mlCompatSuffixes |> List.exists (Filename.checkSuffix lower) then @@ -3319,13 +3306,13 @@ let ParseInput (lexer,errorLogger:ErrorLogger,lexbuf:UnicodeLexing.Lexbuf,defaul let intfs = Parser.signatureFile lexer lexbuf PostParseModuleSpecs (defaultNamespace,filename,isLastCompiland,intfs) else - errorLogger.Error(Error(FSComp.SR.buildInvalidSourceFileExtension(filename),Range.rangeStartup)) - filteringErrorLogger.ScopedPragmas <- GetScopedPragmasForInput input + delayLogger.Error(Error(FSComp.SR.buildInvalidSourceFileExtension(filename),Range.rangeStartup)) + scopedPragmas <- GetScopedPragmasForInput input input finally // OK, now commit the errors, since the ScopedPragmas will (hopefully) have been scraped - errorLogger.CommitDelayedErrorsAndWarnings() - (* unwindEL, unwindBP dispose *) + let filteringErrorLogger = ErrorLoggerFilteringByScopedPragmas(false,scopedPragmas,errorLogger) + delayLogger.CommitDelayedDiagnostics(filteringErrorLogger) //---------------------------------------------------------------------------- // parsing - ParseOneInputFile @@ -4693,10 +4680,8 @@ let GetAssemblyResolutionInformation(tcConfig : TcConfig) = type LoadClosureInput = { FileName: string SyntaxTree: ParsedInput option - ParseErrors: PhasedError list - ParseWarnings: PhasedError list - MetaCommandErrors: PhasedError list - MetaCommandWarnings: PhasedError list } + ParseDiagnostics: (PhasedError * bool) list + MetaCommandDiagnostics: (PhasedError * bool) list } [] type LoadClosure = @@ -4712,18 +4697,12 @@ type LoadClosure = OriginalLoadReferences: (range * string) list /// The #nowarns NoWarns: (string * range list) list - /// Errors seen while processing resolutions - ResolutionErrors : PhasedError list - /// Warnings seen while processing resolutions - ResolutionWarnings : PhasedError list - /// Errors seen while parsing root of closure - AllRootFileErrors : PhasedError list - /// Warnings seen while parsing root of closure - AllRootFileWarnings : PhasedError list - /// Errors seen while processing the root of closure, which are related to the options and load closure - LoadClosureRootFileErrors : PhasedError list - /// Warnings seen while processing the root of closure, which are related to the options and load closure - LoadClosureRootFileWarnings: PhasedError list } + /// Diagnostics seen while processing resolutions + ResolutionDiagnostics : (PhasedError * bool) list + /// Diagnostics seen while parsing root of closure + AllRootFileDiagnostics : (PhasedError * bool) list + /// Diagnostics seen while processing the compiler options implied root of closure + LoadClosureRootFileDiagnostics : (PhasedError * bool) list } [] @@ -4740,7 +4719,7 @@ module private ScriptPreprocessClosure = type ClosureSource = ClosureSource of filename: string * referenceRange: range * sourceText: string * parseRequired: bool /// Represents an output of the closure finding process - type ClosureFile = ClosureFile of string * range * ParsedInput option * PhasedError list * PhasedError list * PhasedError list * PhasedError list * (string * range) list // filename, range, errors, warnings, nowarns + type ClosureFile = ClosureFile of string * range * ParsedInput option * (PhasedError * bool) list * (PhasedError * bool) list * (string * range) list // filename, range, errors, warnings, nowarns type Observed() = let seen = System.Collections.Generic.Dictionary<_,bool>() @@ -4836,15 +4815,15 @@ module private ScriptPreprocessClosure = observedSources.SetSeen(filename) //printfn "visiting %s" filename if IsScript(filename) || parseRequired then - let parseResult, parseErrors, parseWarnings = - let errorLogger = CaptureErrorLogger("FindClosureParse") + let parseResult, parseDiagnostics = + let errorLogger = CapturingErrorLogger("FindClosureParse") use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) let result = ParseScriptText(filename,source,!tcConfig,codeContext,lexResourceManager,errorLogger) - result, errorLogger.Errors, errorLogger.Warnings + result, errorLogger.Diagnostics match parseResult with | Some parsedScriptAst -> - let errorLogger = CaptureErrorLogger("FindClosureMetaCommands") + let errorLogger = CapturingErrorLogger("FindClosureMetaCommands") use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) let pathOfMetaCommandSource = Path.GetDirectoryName(filename) let preSources = (!tcConfig).GetAvailableLoadedSources() @@ -4863,18 +4842,18 @@ module private ScriptPreprocessClosure = for subSource in ClosureSourceOfFilename(subFile,m,tcConfigResult.inputCodePage,false) do yield! loop subSource else - yield ClosureFile(subFile, m, None, [], [], [], [], []) + yield ClosureFile(subFile, m, None, [], [], []) //printfn "yielding source %s" filename - yield ClosureFile(filename, m, Some parsedScriptAst, parseErrors, parseWarnings, errorLogger.Errors, errorLogger.Warnings, !noWarns) + yield ClosureFile(filename, m, Some parsedScriptAst, parseDiagnostics, errorLogger.Diagnostics, !noWarns) | None -> //printfn "yielding source %s (failed parse)" filename - yield ClosureFile(filename, m, None, parseErrors, parseWarnings, [], [], []) + yield ClosureFile(filename, m, None, parseDiagnostics, [], []) else // Don't traverse into .fs leafs. //printfn "yielding non-script source %s" filename - yield ClosureFile(filename, m, None, [], [], [], [], []) ] + yield ClosureFile(filename, m, None, [], [], []) ] closureSources |> List.map loop |> List.concat, !tcConfig @@ -4887,40 +4866,31 @@ module private ScriptPreprocessClosure = closureFiles else match List.frontAndBack closureFiles with - | rest, ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,_))),parseErrors,parseWarnings, metaErrors, metaWarnings, nowarns) -> - rest @ [ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,(true, tcConfig.target.IsExe)))),parseErrors,parseWarnings, metaErrors, metaWarnings,nowarns)] + | rest, ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,_))), parseDiagnostics, metaDiagnostics, nowarns) -> + rest @ [ClosureFile(filename,m,Some(ParsedInput.ImplFile(ParsedImplFileInput(name,isScript,qualNameOfFile,scopedPragmas,hashDirectives,implFileFlags,(true, tcConfig.target.IsExe)))),parseDiagnostics, metaDiagnostics, nowarns)] | _ -> closureFiles // Get all source files. - let sourceFiles = [ for (ClosureFile(filename,m,_,_,_,_,_,_)) in closureFiles -> (filename,m) ] - let sourceInputs = [ for (ClosureFile(filename,_,input,parseErrors,parseWarnings, metaErrors, metaWarnings,_nowarns)) in closureFiles -> ({ FileName=filename; SyntaxTree=input; ParseErrors=parseErrors; ParseWarnings=parseWarnings; MetaCommandErrors=metaErrors; MetaCommandWarnings=metaWarnings }: LoadClosureInput) ] - let globalNoWarns = closureFiles |> List.collect (fun (ClosureFile(_,_,_,_,_,_,_,noWarns)) -> noWarns) + let sourceFiles = [ for (ClosureFile(filename,m,_,_,_,_)) in closureFiles -> (filename,m) ] + let sourceInputs = [ for (ClosureFile(filename,_,input,parseDiagnostics,metaDiagnostics,_nowarns)) in closureFiles -> ({ FileName=filename; SyntaxTree=input; ParseDiagnostics=parseDiagnostics; MetaCommandDiagnostics=metaDiagnostics }: LoadClosureInput) ] + let globalNoWarns = closureFiles |> List.collect (fun (ClosureFile(_,_,_,_,_,noWarns)) -> noWarns) // Resolve all references. - let references, unresolvedReferences, resolutionWarnings, resolutionErrors = - let resolutionErrors = ref [] - let resolutionWarnings = ref [] - let errorLogger = - { new ErrorLogger("GetLoadClosure") with - member x.ErrorSinkImpl(e) = resolutionErrors := e :: !resolutionErrors - member x.WarnSinkImpl(e) = resolutionWarnings := e :: !resolutionWarnings - member x.ErrorCount = (!resolutionErrors).Length } + let references, unresolvedReferences, resolutionDiagnostics = + let errorLogger = CapturingErrorLogger("GetLoadClosure") use unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) let references,unresolvedReferences = GetAssemblyResolutionInformation(tcConfig) let references = references |> List.map (fun ar -> ar.resolvedPath,ar) - references, unresolvedReferences, resolutionWarnings, resolutionErrors + references, unresolvedReferences, errorLogger.Diagnostics // Root errors and warnings - look at the last item in the closureFiles list - let loadClosureRootErrors, loadClosureRootWarnings = - match List.rev closureFiles with - | ClosureFile(_,_,_,_,_, metaErrors, metaWarnings,_) :: _ -> metaErrors @ !resolutionErrors, metaWarnings @ !resolutionWarnings - | _ -> [],[] // When no file existed. - - let allRootErrors, allRootWarnings = + let loadClosureRootDiagnostics, allRootDiagnostics = match List.rev closureFiles with - | ClosureFile(_,_,_,parseErrors,parseWarnings, metaErrors, metaWarnings,_) :: _ -> parseErrors @ metaErrors @ !resolutionErrors, parseWarnings @ metaWarnings @ !resolutionWarnings - | _ -> [],[] // When no file existed. + | ClosureFile(_,_,_,parseDiagnostics,metaDiagnostics,_) :: _ -> + (metaDiagnostics @ resolutionDiagnostics), + (parseDiagnostics @ metaDiagnostics @ resolutionDiagnostics) + | _ -> [], [] // When no file existed. let isRootRange exn = match GetRangeOfError exn with @@ -4932,8 +4902,7 @@ module private ScriptPreprocessClosure = | None -> true // Filter out non-root errors and warnings - let allRootErrors = allRootErrors |> List.filter isRootRange - let allRootWarnings = allRootWarnings |> List.filter isRootRange + let allRootDiagnostics = allRootDiagnostics |> List.filter (fst >> isRootRange) let result : LoadClosure = { SourceFiles = List.groupByFirst sourceFiles @@ -4942,12 +4911,9 @@ module private ScriptPreprocessClosure = Inputs = sourceInputs NoWarns = List.groupByFirst globalNoWarns OriginalLoadReferences = tcConfig.loadedSources - ResolutionErrors = !resolutionErrors - ResolutionWarnings = !resolutionWarnings - AllRootFileErrors = allRootErrors - AllRootFileWarnings = allRootWarnings - LoadClosureRootFileErrors = loadClosureRootErrors - LoadClosureRootFileWarnings = loadClosureRootWarnings } + ResolutionDiagnostics = resolutionDiagnostics + AllRootFileDiagnostics = allRootDiagnostics + LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics } result diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index e13d31dabe4..3d018390aee 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -94,36 +94,41 @@ val SplitRelatedErrors : PhasedError -> PhasedError * PhasedError list val OutputPhasedError : StringBuilder -> PhasedError -> bool -> unit /// Output an error or warning to a buffer -val OutputErrorOrWarning : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool -> StringBuilder -> PhasedError -> unit +val OutputDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool -> StringBuilder -> PhasedError -> unit /// Output extra context information for an error or warning to a buffer -val OutputErrorOrWarningContext : prefix:string -> fileLineFunction:(string -> int -> string) -> StringBuilder -> PhasedError -> unit +val OutputDiagnosticContext : prefix:string -> fileLineFunction:(string -> int -> string) -> StringBuilder -> PhasedError -> unit +/// Part of LegacyHostedCompilerForTesting [] -type ErrorLocation = +type DiagnosticLocation = { Range : range File : string TextRepresentation : string IsEmpty : bool } +/// Part of LegacyHostedCompilerForTesting [] -type CanonicalInformation = +type DiagnosticCanonicalInformation = { ErrorNumber : int Subcategory : string TextRepresentation : string } +/// Part of LegacyHostedCompilerForTesting [] -type DetailedIssueInfo = - { Location : ErrorLocation option - Canonical : CanonicalInformation +type DiagnosticDetailedInfo = + { Location : DiagnosticLocation option + Canonical : DiagnosticCanonicalInformation Message : string } +/// Part of LegacyHostedCompilerForTesting [] -type ErrorOrWarning = +type Diagnostic = | Short of bool * string - | Long of bool * DetailedIssueInfo + | Long of bool * DiagnosticDetailedInfo -val CollectErrorOrWarning : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool * PhasedError -> seq +/// Part of LegacyHostedCompilerForTesting +val CollectDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool * PhasedError -> seq //---------------------------------------------------------------------------- // Resolve assembly references @@ -744,10 +749,8 @@ type CodeContext = type LoadClosureInput = { FileName: string SyntaxTree: ParsedInput option - ParseErrors: PhasedError list - ParseWarnings: PhasedError list - MetaCommandErrors: PhasedError list - MetaCommandWarnings: PhasedError list } + ParseDiagnostics: (PhasedError * bool) list + MetaCommandDiagnostics: (PhasedError * bool) list } [] @@ -770,23 +773,14 @@ type LoadClosure = /// The #nowarns NoWarns: (string * range list) list - /// Errors seen while processing resolutions - ResolutionErrors : PhasedError list + /// Diagnostics seen while processing resolutions + ResolutionDiagnostics : (PhasedError * bool) list - /// Warnings seen while processing resolutions - ResolutionWarnings : PhasedError list + /// Diagnostics to show for root of closure (used by fsc.fs) + AllRootFileDiagnostics : (PhasedError * bool) list - /// All parse, meta-command and reference resolution errors seen while parsing root of closure - AllRootFileErrors : PhasedError list - - /// All parse, meta-command and reference resolution warnings seen while parsing root of closure - AllRootFileWarnings : PhasedError list - - /// Errors seen while processing the root of closure, which are related to the options and load closure - LoadClosureRootFileErrors : PhasedError list - - /// Warnings seen while processing the root of closure, which are related to the options and load closure - LoadClosureRootFileWarnings: PhasedError list } + /// Diagnostics seen while processing the compiler options implied root of closure + LoadClosureRootFileDiagnostics : (PhasedError * bool) list } // Used from service.fs, when editing a script file static member ComputeClosureOfSourceText : referenceResolver: ReferenceResolver.Resolver * filename: string * source: string * implicitDefines:CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) * assumeDotNetFramework : bool -> LoadClosure diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index a3702e7d7cd..4c0b346cd37 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -1342,7 +1342,7 @@ let GetGeneratedILModuleName (t:CompilerTarget) (s:string) = let ignoreFailureOnMono1_1_16 f = try f() with _ -> () -let DoWithErrorColor isWarn f = +let DoWithErrorColor isError f = if not enableConsoleColoring then f() else @@ -1359,7 +1359,7 @@ let DoWithErrorColor isWarn f = try let warnColor = if Console.BackgroundColor = ConsoleColor.White then ConsoleColor.DarkBlue else ConsoleColor.Cyan let errorColor = ConsoleColor.Red - ignoreFailureOnMono1_1_16 (fun () -> Console.ForegroundColor <- (if isWarn then warnColor else errorColor)) + ignoreFailureOnMono1_1_16 (fun () -> Console.ForegroundColor <- (if isError then errorColor else warnColor)) f() finally ignoreFailureOnMono1_1_16 (fun () -> Console.ForegroundColor <- c) diff --git a/src/fsharp/CompileOptions.fsi b/src/fsharp/CompileOptions.fsi index fd59f27a58a..d4e029f6acf 100644 --- a/src/fsharp/CompileOptions.fsi +++ b/src/fsharp/CompileOptions.fsi @@ -92,7 +92,7 @@ val NormalizeAssemblyRefs : TcImports -> (AbstractIL.IL.ILScopeRef -> AbstractIL // Miscellany val ignoreFailureOnMono1_1_16 : (unit -> unit) -> unit val mutable enableConsoleColoring : bool -val DoWithErrorColor : bool -> (unit -> 'a) -> 'a +val DoWithErrorColor : isError:bool -> (unit -> 'a) -> 'a val ReportTime : TcConfig -> string -> unit val GetAbbrevFlagSet : TcConfigBuilder -> bool -> Set val PostProcessCompilerArgs : string Set -> string [] -> string list diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index c887729ddfe..97d58517e90 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -226,49 +226,33 @@ type ErrorLogger(nameForDebugging:string) = abstract ErrorCount: int // The 'Impl' factoring enables a developer to place a breakpoint at the non-Impl // code just below and get a breakpoint for all error logger implementations. - abstract WarnSinkImpl: PhasedError -> unit - abstract ErrorSinkImpl: PhasedError -> unit - member this.WarnSink err = - this.WarnSinkImpl err - member this.ErrorSink err = - this.ErrorSinkImpl err + abstract DiagnosticSink: phasedError: PhasedError * isError: bool -> unit member this.DebugDisplay() = sprintf "ErrorLogger(%s)" nameForDebugging - // Record the reported error/warning numbers for SQM purpose - abstract ErrorNumbers : int list - abstract WarningNumbers : int list - default this.ErrorNumbers = [] - default this.WarningNumbers = [] let DiscardErrorsLogger = { new ErrorLogger("DiscardErrorsLogger") with - member x.WarnSinkImpl(e) = - () - member x.ErrorSinkImpl(e) = - () - member x.ErrorCount = - 0 } + member x.DiagnosticSink(phasedError,isError) = () + member x.ErrorCount = 0 } let AssertFalseErrorLogger = { new ErrorLogger("AssertFalseErrorLogger") with - member x.WarnSinkImpl(e) = - assert false; () - member x.ErrorSinkImpl(e) = - assert false; () - member x.ErrorCount = - assert false; 0 } - -type CaptureErrorLogger(nm) = + member x.DiagnosticSink(phasedError,isError) = assert false; () + member x.ErrorCount = assert false; 0 } + +type CapturingErrorLogger(nm) = inherit ErrorLogger(nm) - let errors = ref [] - let warnings = ref [] - override x.ErrorSinkImpl(e) = errors := e :: !errors - override x.WarnSinkImpl(e) = warnings := e :: !warnings - override x.ErrorCount = (!errors).Length - member x.Errors = !errors - member x.Warnings = !warnings + let mutable errorCount = 0 + let diagnostics = ResizeArray() + override x.DiagnosticSink(phasedError, isError) = + if isError then errorCount <- errorCount + 1 + diagnostics.Add (phasedError, isError) + override x.ErrorCount = errorCount + member x.Diagnostics = diagnostics |> Seq.toList + member x.CommitDelayedDiagnostics(errorLogger:ErrorLogger) = + // Eagerly grab all the errors and warnings from the mutable collection + let errors = diagnostics.ToArray() + errors |> Array.iter errorLogger.DiagnosticSink -/// When no errorLogger is installed (on the thread) use this one. -let uninitializedErrorLoggerFallback = ref AssertFalseErrorLogger /// Type holds thread-static globals for use by the compile. type internal CompileThreadStatic = @@ -289,7 +273,7 @@ type internal CompileThreadStatic = static member ErrorLogger with get() = match box CompileThreadStatic.errorLogger with - | null -> !uninitializedErrorLoggerFallback + | null -> AssertFalseErrorLogger | _ -> CompileThreadStatic.errorLogger and set v = CompileThreadStatic.errorLogger <- v @@ -331,15 +315,15 @@ module ErrorLoggerExtensions = #endif type ErrorLogger with - member x.ErrorR exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.ErrorSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase)) - member x.Warning exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.WarnSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase)) + member x.ErrorR exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.DiagnosticSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase), true) + member x.Warning exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.DiagnosticSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase), false) member x.Error exn = x.ErrorR exn; raise (ReportedError (Some exn)) member x.PhasedError (ph:PhasedError) = - x.ErrorSink ph + x.DiagnosticSink (ph, true) raise (ReportedError (Some ph.Exception)) member x.ErrorRecovery (exn:exn) (m:range) = // Never throws ReportedError. - // Throws StopProcessing and exceptions raised by the ErrorSink(exn) handler. + // Throws StopProcessing and exceptions raised by the DiagnosticSink(exn) handler. match exn with (* Don't send ThreadAbortException down the error channel *) #if FX_REDUCED_EXCEPTIONS @@ -358,13 +342,13 @@ module ErrorLoggerExtensions = // Do standard error recovery. // Additionally ignore/catch StopProcessing. [This is the only catch handler for StopProcessing]. // Additionally ignore/catch ReportedError. - // Can throw other exceptions raised by the ErrorSink(exn) handler. + // Can throw other exceptions raised by the DiagnosticSink(exn) handler. match exn with | StopProcessing | WrappedError(StopProcessing,_) -> () // suppress, so skip error recovery. | _ -> try x.ErrorRecovery exn m with - | StopProcessing | WrappedError(StopProcessing,_) -> () // catch, e.g. raised by ErrorSink. + | StopProcessing | WrappedError(StopProcessing,_) -> () // catch, e.g. raised by DiagnosticSink. | ReportedError _ | WrappedError(ReportedError _,_) -> () // catch, but not expected unless ErrorRecovery is changed. member x.ErrorRecoveryNoRange (exn:exn) = x.ErrorRecovery exn range0 @@ -383,8 +367,7 @@ let PushErrorLoggerPhaseUntilUnwind(errorLoggerTransformer : ErrorLogger -> #Err let newInstalled = ref true let newIsInstalled() = if !newInstalled then () else (assert false; (); (*failwith "error logger used after unwind"*)) // REVIEW: ok to throw? let chkErrorLogger = { new ErrorLogger("PushErrorLoggerPhaseUntilUnwind") with - member x.WarnSinkImpl(e) = newIsInstalled(); newErrorLogger.WarnSink(e) - member x.ErrorSinkImpl(e) = newIsInstalled(); newErrorLogger.ErrorSink(e) + member x.DiagnosticSink(phasedError, isError) = newIsInstalled(); newErrorLogger.DiagnosticSink(phasedError, isError) member x.ErrorCount = newIsInstalled(); newErrorLogger.ErrorCount } CompileThreadStatic.ErrorLogger <- chkErrorLogger { new System.IDisposable with @@ -394,7 +377,6 @@ let PushErrorLoggerPhaseUntilUnwind(errorLoggerTransformer : ErrorLogger -> #Err let SetThreadBuildPhaseNoUnwind(phase:BuildPhase) = CompileThreadStatic.BuildPhase <- phase let SetThreadErrorLoggerNoUnwind(errorLogger) = CompileThreadStatic.ErrorLogger <- errorLogger -let SetUninitializedErrorLoggerFallback errLogger = uninitializedErrorLoggerFallback := errLogger // Global functions are still used by parser and TAST ops. let errorR exn = CompileThreadStatic.ErrorLogger.ErrorR exn @@ -403,8 +385,9 @@ let error exn = CompileThreadStatic.ErrorLogger.Error exn // for test only let phasedError (p : PhasedError) = CompileThreadStatic.ErrorLogger.PhasedError p -let errorSink pe = CompileThreadStatic.ErrorLogger.ErrorSink pe -let warnSink pe = CompileThreadStatic.ErrorLogger.WarnSink pe +let diagnosticSink (phasedError, isError) = CompileThreadStatic.ErrorLogger.DiagnosticSink (phasedError, isError) +let errorSink pe = diagnosticSink (pe, true) +let warnSink pe = diagnosticSink (pe, false) let errorRecovery exn m = CompileThreadStatic.ErrorLogger.ErrorRecovery exn m let stopProcessingRecovery exn m = CompileThreadStatic.ErrorLogger.StopProcessingRecovery exn m let errorRecoveryNoRange exn = CompileThreadStatic.ErrorLogger.ErrorRecoveryNoRange exn @@ -427,8 +410,7 @@ let suppressErrorReporting f = try let errorLogger = { new ErrorLogger("suppressErrorReporting") with - member x.WarnSinkImpl(_exn) = () - member x.ErrorSinkImpl(_exn) = () + member x.DiagnosticSink(_phasedError,_isError) = () member x.ErrorCount = 0 } SetThreadErrorLoggerNoUnwind(errorLogger) f() diff --git a/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs b/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs index b788bd15c2f..9534ccd0c19 100644 --- a/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs +++ b/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs @@ -54,8 +54,7 @@ type HashIfExpression() = let errorLogger = { new ErrorLogger("TestErrorLogger") with - member x.WarnSinkImpl(e) = warnings.Add e - member x.ErrorSinkImpl(e) = errors.Add e + member x.DiagnosticSink(e, isError) = if isError then errors.Add e else warnings.Add e member x.ErrorCount = errors.Count } diff --git a/src/fsharp/LegacyHostedCompilerForTesting.fs b/src/fsharp/LegacyHostedCompilerForTesting.fs index 4ff8cc5affe..8c5d69bbca5 100644 --- a/src/fsharp/LegacyHostedCompilerForTesting.fs +++ b/src/fsharp/LegacyHostedCompilerForTesting.fs @@ -9,6 +9,7 @@ open System open System.IO open System.Text open System.Text.RegularExpressions +open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Driver open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.CompileOps @@ -48,8 +49,8 @@ type internal CompilationResult = [] type internal CompilationOutput = - { Errors : ErrorOrWarning[] - Warnings : ErrorOrWarning[] } + { Errors : Diagnostic[] + Warnings : Diagnostic[] } type internal InProcCompiler(referenceResolver) = member this.Compile(argv) = @@ -72,7 +73,7 @@ type internal InProcCompiler(referenceResolver) = /// in-proc version of fsc.exe type internal FscCompiler() = - let referenceResolver = Microsoft.FSharp.Compiler.MSBuildReferenceResolver.Resolver + let referenceResolver = MSBuildReferenceResolver.Resolver let compiler = InProcCompiler(referenceResolver) let emptyLocation = @@ -86,7 +87,7 @@ type internal FscCompiler() = /// converts short and long issue types to the same CompilationIssue reprsentation let convert issue : CompilationIssue = match issue with - | Microsoft.FSharp.Compiler.CompileOps.ErrorOrWarning.Short(isError, text) -> + | Diagnostic.Short(isError, text) -> { Location = emptyLocation Code = "" @@ -95,7 +96,7 @@ type internal FscCompiler() = Text = text Type = if isError then CompilationIssueType.Error else CompilationIssueType.Warning } - | Microsoft.FSharp.Compiler.CompileOps.ErrorOrWarning.Long(isError, details) -> + | Diagnostic.Long(isError, details) -> let loc, file = match details.Location with | Some l when not l.IsEmpty -> diff --git a/src/fsharp/MSBuildReferenceResolver.fs b/src/fsharp/MSBuildReferenceResolver.fs index 9f7eb7199e0..8351ee5c4b6 100644 --- a/src/fsharp/MSBuildReferenceResolver.fs +++ b/src/fsharp/MSBuildReferenceResolver.fs @@ -225,7 +225,7 @@ module internal Microsoft.FSharp.Compiler.MSBuildReferenceResolver implicitIncludeDir: string, allowRawFileName: bool, logMessage: (string -> unit), - logErrorOrWarning: (bool -> string -> string -> unit)) = + logDiagnostic: (bool -> string -> string -> unit)) = let frameworkRegistryBase, assemblyFoldersSuffix, assemblyFoldersConditions = "Software\Microsoft\.NetFramework", "AssemblyFoldersEx" , "" @@ -243,14 +243,14 @@ module internal Microsoft.FSharp.Compiler.MSBuildReferenceResolver member __.BuildProjectFile(projectFileName, targetNames, globalProperties, targetOutputs) = true #if FX_RESHAPED_MSBUILD member __.LogCustomEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string)) - member __.LogErrorEvent(e) = protect (fun () -> logErrorOrWarning true ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string)) + member __.LogErrorEvent(e) = protect (fun () -> logDiagnostic true ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string)) member __.LogMessageEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string)) - member __.LogWarningEvent(e) = protect (fun () -> logErrorOrWarning false ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string)) + member __.LogWarningEvent(e) = protect (fun () -> logDiagnostic false ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string)) #else member __.LogCustomEvent(e) = protect (fun () -> logMessage e.Message) - member __.LogErrorEvent(e) = protect (fun () -> logErrorOrWarning true e.Code e.Message) + member __.LogErrorEvent(e) = protect (fun () -> logDiagnostic true e.Code e.Message) member __.LogMessageEvent(e) = protect (fun () -> logMessage e.Message) - member __.LogWarningEvent(e) = protect (fun () -> logErrorOrWarning false e.Code e.Message) + member __.LogWarningEvent(e) = protect (fun () -> logDiagnostic false e.Code e.Message) #endif member __.ColumnNumberOfTaskNode with get() = 1 member __.LineNumberOfTaskNode with get() = 1 @@ -353,7 +353,7 @@ module internal Microsoft.FSharp.Compiler.MSBuildReferenceResolver /// Perform the resolution on rooted and unrooted paths, and then combine the results. member __.Resolve(resolutionEnvironment, references, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture, - fsharpCoreDir, explicitIncludeDirs, implicitIncludeDir, logMessage, logErrorOrWarning) = + fsharpCoreDir, explicitIncludeDirs, implicitIncludeDir, logMessage, logDiagnostic) = // The {RawFileName} target is 'dangerous', in the sense that is uses Directory.GetCurrentDirectory() to resolve unrooted file paths. // It is unreliable to use this mutable global state inside Visual Studio. As a result, we partition all references into a "rooted" set @@ -375,9 +375,9 @@ module internal Microsoft.FSharp.Compiler.MSBuildReferenceResolver let rooted, unrooted = references |> Array.partition (fst >> FileSystem.IsPathRootedShim) - let rootedResults = ResolveCore(resolutionEnvironment, rooted, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture, fsharpCoreDir, explicitIncludeDirs, implicitIncludeDir, true, logMessage, logErrorOrWarning) + let rootedResults = ResolveCore(resolutionEnvironment, rooted, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture, fsharpCoreDir, explicitIncludeDirs, implicitIncludeDir, true, logMessage, logDiagnostic) - let unrootedResults = ResolveCore(resolutionEnvironment, unrooted, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture, fsharpCoreDir, explicitIncludeDirs, implicitIncludeDir, false, logMessage, logErrorOrWarning) + let unrootedResults = ResolveCore(resolutionEnvironment, unrooted, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture, fsharpCoreDir, explicitIncludeDirs, implicitIncludeDir, false, logMessage, logDiagnostic) // now unify the two sets of results Array.concat [| rootedResults; unrootedResults |] diff --git a/src/fsharp/ReferenceResolver.fs b/src/fsharp/ReferenceResolver.fs index 8228ac8da96..84d44e6d129 100644 --- a/src/fsharp/ReferenceResolver.fs +++ b/src/fsharp/ReferenceResolver.fs @@ -52,5 +52,5 @@ module internal ReferenceResolver = explicitIncludeDirs:string list * implicitIncludeDir:string * logMessage:(string->unit) * - logErrorOrWarning:(bool -> string -> string -> unit) + logDiagnostic:(bool -> string -> string -> unit) -> ResolvedFile[] diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index cb61de0c8ac..4fa36552891 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -69,24 +69,22 @@ type ErrorLoggerUpToMaxErrors(tcConfigB: TcConfigBuilder, exiter: Exiter, nameFo inherit ErrorLogger(nameForDebugging) let mutable errors = 0 - let mutable errorNumbers = [] - let mutable warningNumbers = [] /// Called when an error or warning occurs - abstract HandleIssue : tcConfigB : TcConfigBuilder * error : PhasedError * isWarning : bool -> unit + abstract HandleIssue: tcConfigB: TcConfigBuilder * error: PhasedError * isError: bool -> unit /// Called when 'too many errors' has occured - abstract HandleTooManyErrors : text : string -> unit + abstract HandleTooManyErrors: text: string -> unit override x.ErrorCount = errors - override x.ErrorSinkImpl(err) = + override x.DiagnosticSink(err, isError) = + if isError || ReportWarningAsError (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn, tcConfigB.specificWarnAsError, tcConfigB.specificWarnAsWarn, tcConfigB.globalWarnAsError) err then if errors >= tcConfigB.maxErrors then x.HandleTooManyErrors(FSComp.SR.fscTooManyErrors()) exiter.Exit 1 - x.HandleIssue(tcConfigB, err, false) + x.HandleIssue(tcConfigB, err, true) errors <- errors + 1 - errorNumbers <- (GetErrorNumber err) :: errorNumbers match err.Exception with | InternalError _ @@ -97,63 +95,31 @@ type ErrorLoggerUpToMaxErrors(tcConfigB: TcConfigBuilder, exiter: Exiter, nameFo | None -> Debug.Assert(false, sprintf "Bug seen in compiler: %s" (err.ToString())) | _ -> () - - override x.WarnSinkImpl(err) = - if ReportWarningAsError (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn, tcConfigB.specificWarnAsError, tcConfigB.specificWarnAsWarn, tcConfigB.globalWarnAsError) err then - x.ErrorSink(err) - elif ReportWarning (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn) err then - x.HandleIssue(tcConfigB, err, true) - warningNumbers <- (GetErrorNumber err) :: warningNumbers + elif ReportWarning (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn) err then + x.HandleIssue(tcConfigB, err, isError) - override x.WarningNumbers = warningNumbers - override x.ErrorNumbers = errorNumbers /// Create an error logger that counts and prints errors let ConsoleErrorLoggerUpToMaxErrors (tcConfigB:TcConfigBuilder, exiter : Exiter) : ErrorLogger = { new ErrorLoggerUpToMaxErrors(tcConfigB, exiter, "ConsoleErrorLoggerUpToMaxErrors") with member this.HandleTooManyErrors(text : string) = - DoWithErrorColor true (fun () -> Printf.eprintfn "%s" text) + DoWithErrorColor false (fun () -> Printf.eprintfn "%s" text) - member this.HandleIssue(tcConfigB, err, isWarning) = - DoWithErrorColor isWarning (fun () -> - (writeViaBufferWithEnvironmentNewLines stderr (OutputErrorOrWarning (tcConfigB.implicitIncludeDir, tcConfigB.showFullPaths, tcConfigB.flatErrors, tcConfigB.errorStyle, isWarning)) err + member this.HandleIssue(tcConfigB, err, isError) = + DoWithErrorColor isError (fun () -> + (writeViaBufferWithEnvironmentNewLines stderr (OutputDiagnostic (tcConfigB.implicitIncludeDir, tcConfigB.showFullPaths, tcConfigB.flatErrors, tcConfigB.errorStyle, not isError)) err stderr.WriteLine())) } :> _ -/// This error logger delays the messages it receives. At the end, call ForwardDelayedErrorsAndWarnings +/// This error logger delays the messages it receives. At the end, call ForwardDelayedDiagnostics /// to send the held messages. type DelayAndForwardErrorLogger(exiter: Exiter, errorLoggerProvider: ErrorLoggerProvider) = - inherit ErrorLogger("DelayAndForwardErrorLogger") - - let delayed = new ResizeArray<_>() - let mutable errors = 0 - - override x.ErrorSinkImpl(e) = - errors <- errors + 1 - delayed.Add (e, true) + inherit CapturingErrorLogger("DelayAndForwardErrorLogger") - override x.ErrorCount = delayed |> Seq.filter snd |> Seq.length - - override x.WarnSinkImpl(e) = delayed.Add(e, false) - - member x.ForwardDelayedErrorsAndWarnings(errorLogger:ErrorLogger) = - // Eagerly grab all the errors and warnings from the mutable collection - let errors = delayed |> Seq.toList - // Now report them - for (e, isError) in errors do - if isError then errorLogger.ErrorSink(e) else errorLogger.WarnSink(e) - // Clear errors just reported. Keep errors count. - delayed.Clear() - - member x.ForwardDelayedErrorsAndWarnings(tcConfigB:TcConfigBuilder) = + member x.ForwardDelayedDiagnostics(tcConfigB:TcConfigBuilder) = let errorLogger = errorLoggerProvider.CreateErrorLoggerUpToMaxErrors(tcConfigB, exiter) - x.ForwardDelayedErrorsAndWarnings(errorLogger) - - member x.FullErrorCount = errors - - override x.WarningNumbers = delayed |> Seq.filter (snd >> not) |> Seq.map (fst >> GetErrorNumber) |> Seq.toList - override x.ErrorNumbers = delayed |> Seq.filter snd |> Seq.map (fst >> GetErrorNumber) |> Seq.toList + x.CommitDelayedDiagnostics(errorLogger) and [] ErrorLoggerProvider() = @@ -161,6 +127,8 @@ and [] abstract CreateErrorLoggerUpToMaxErrors : tcConfigBuilder : TcConfigBuilder * exiter : Exiter -> ErrorLogger +/// Part of LegacyHostedCompilerForTesting +/// /// Yet another ErrorLogger implementation, capturing the messages but only up to the maxerrors maximum type InProcErrorLoggerProvider() = let errors = ResizeArray() @@ -169,10 +137,10 @@ type InProcErrorLoggerProvider() = { new ErrorLoggerProvider() with member log.CreateErrorLoggerUpToMaxErrors(tcConfigBuilder, exiter) = { new ErrorLoggerUpToMaxErrors(tcConfigBuilder, exiter, "InProcCompilerErrorLoggerUpToMaxErrors") with - member this.HandleTooManyErrors(text) = warnings.Add(ErrorOrWarning.Short(false, text)) - member this.HandleIssue(tcConfigBuilder, err, isWarning) = - let errs = CollectErrorOrWarning(tcConfigBuilder.implicitIncludeDir, tcConfigBuilder.showFullPaths, tcConfigBuilder.flatErrors, tcConfigBuilder.errorStyle, isWarning, err) - let container = if isWarning then warnings else errors + member this.HandleTooManyErrors(text) = warnings.Add(Diagnostic.Short(false, text)) + member this.HandleIssue(tcConfigBuilder, err, isError) = + let errs = CollectDiagnostic(tcConfigBuilder.implicitIncludeDir, tcConfigBuilder.showFullPaths, tcConfigBuilder.flatErrors, tcConfigBuilder.errorStyle, not isError, err) + let container = if isError then errors else warnings container.AddRange(errs) } :> ErrorLogger } member __.CapturedErrors = errors.ToArray() @@ -251,8 +219,7 @@ let AdjustForScriptCompile(tcConfigB:TcConfigBuilder, commandLineSourceFiles, le references |> List.iter (fun r-> tcConfigB.AddReferencedAssemblyByPath(r.originalReference.Range, r.resolvedPath)) closure.NoWarns |> List.map(fun (n, ms)->ms|>List.map(fun m->m, n)) |> List.concat |> List.iter tcConfigB.TurnWarningOff closure.SourceFiles |> List.map fst |> List.iter AddIfNotPresent - closure.AllRootFileWarnings |> List.iter warnSink - closure.AllRootFileErrors |> List.iter errorSink + closure.AllRootFileDiagnostics |> List.iter diagnosticSink else AddIfNotPresent(filename) @@ -1727,7 +1694,7 @@ let main0(argv, referenceResolver, bannerAlreadyPrinted, exiter:Exiter, errorLog with e -> errorRecovery e rangeStartup - delayForFlagsLogger.ForwardDelayedErrorsAndWarnings(tcConfigB) + delayForFlagsLogger.ForwardDelayedDiagnostics(tcConfigB) exiter.Exit 1 tcConfigB.sqmNumOfSourceFiles <- sourceFiles.Length @@ -1740,12 +1707,12 @@ let main0(argv, referenceResolver, bannerAlreadyPrinted, exiter:Exiter, errorLog tcConfigB.DecideNames sourceFiles with e -> errorRecovery e rangeStartup - delayForFlagsLogger.ForwardDelayedErrorsAndWarnings(tcConfigB) + delayForFlagsLogger.ForwardDelayedDiagnostics(tcConfigB) exiter.Exit 1 // DecideNames may give "no inputs" error. Abort on error at this point. bug://3911 - if not tcConfigB.continueAfterParseFailure && delayForFlagsLogger.FullErrorCount > 0 then - delayForFlagsLogger.ForwardDelayedErrorsAndWarnings(tcConfigB) + if not tcConfigB.continueAfterParseFailure && delayForFlagsLogger.ErrorCount > 0 then + delayForFlagsLogger.ForwardDelayedDiagnostics(tcConfigB) exiter.Exit 1 // If there's a problem building TcConfig, abort @@ -1753,7 +1720,7 @@ let main0(argv, referenceResolver, bannerAlreadyPrinted, exiter:Exiter, errorLog try TcConfig.Create(tcConfigB, validate=false) with e -> - delayForFlagsLogger.ForwardDelayedErrorsAndWarnings(tcConfigB) + delayForFlagsLogger.ForwardDelayedDiagnostics(tcConfigB) exiter.Exit 1 let errorLogger = errorLoggerProvider.CreateErrorLoggerUpToMaxErrors(tcConfigB, exiter) @@ -1762,7 +1729,7 @@ let main0(argv, referenceResolver, bannerAlreadyPrinted, exiter:Exiter, errorLog let _unwindEL_2 = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) // Forward all errors from flags - delayForFlagsLogger.ForwardDelayedErrorsAndWarnings(errorLogger) + delayForFlagsLogger.CommitDelayedDiagnostics(errorLogger) if not tcConfigB.continueAfterParseFailure then AbortOnError(errorLogger, exiter) diff --git a/src/fsharp/fsc.fsi b/src/fsharp/fsc.fsi index db7fe2c2350..300a1cda832 100755 --- a/src/fsharp/fsc.fsi +++ b/src/fsharp/fsc.fsi @@ -42,11 +42,12 @@ val mainCompile : exiter : Exiter -> unit +/// Part of LegacyHostedCompilerForTesting type InProcErrorLoggerProvider = new : unit -> InProcErrorLoggerProvider member Provider : ErrorLoggerProvider - member CapturedWarnings : ErrorOrWarning[] - member CapturedErrors : ErrorOrWarning[] + member CapturedWarnings : Diagnostic[] + member CapturedErrors : Diagnostic[] module internal MainModuleBuilder = diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 2472c19d359..a743541bce8 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -445,12 +445,12 @@ type internal FsiStdinSyphon(errorWriter: TextWriter) = if 0 < i && i <= lines.Length then lines.[i-1] else "" /// Display the given error. - member syphon.PrintError (tcConfig:TcConfigBuilder, isWarn, err) = + member syphon.PrintError (tcConfig:TcConfigBuilder, err) = Utilities.ignoreAllErrors (fun () -> - DoWithErrorColor isWarn (fun () -> + DoWithErrorColor true (fun () -> errorWriter.WriteLine(); - writeViaBufferWithEnvironmentNewLines errorWriter (OutputErrorOrWarningContext " " syphon.GetLine) err; - writeViaBufferWithEnvironmentNewLines errorWriter (OutputErrorOrWarning (tcConfig.implicitIncludeDir,tcConfig.showFullPaths,tcConfig.flatErrors,tcConfig.errorStyle,false)) err; + writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnosticContext " " syphon.GetLine) err; + writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnostic (tcConfig.implicitIncludeDir,tcConfig.showFullPaths,tcConfig.flatErrors,tcConfig.errorStyle,false)) err; errorWriter.WriteLine() errorWriter.Flush())) @@ -476,30 +476,29 @@ type internal FsiConsoleOutput(tcConfigB, outWriter:TextWriter, errorWriter:Text /// This ErrorLogger reports all warnings, but raises StopProcessing on first error or early exit type internal ErrorLoggerThatStopsOnFirstError(tcConfigB:TcConfigBuilder, fsiStdinSyphon:FsiStdinSyphon, fsiConsoleOutput: FsiConsoleOutput) = inherit ErrorLogger("ErrorLoggerThatStopsOnFirstError") - let mutable errors = 0 + let mutable errorCount = 0 + member x.SetError() = - errors <- 1 - member x.ErrorSinkHelper(err) = - fsiStdinSyphon.PrintError(tcConfigB,false,err) - errors <- errors + 1 - if tcConfigB.abortOnError then exit 1 (* non-zero exit code *) - // STOP ON FIRST ERROR (AVOIDS PARSER ERROR RECOVERY) - raise StopProcessing - - member x.ResetErrorCount() = (errors <- 0) + errorCount <- 1 + + member x.ResetErrorCount() = (errorCount <- 0) - override x.WarnSinkImpl(err) = - DoWithErrorColor true (fun () -> - if ReportWarningAsError (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn, tcConfigB.specificWarnAsError, tcConfigB.specificWarnAsWarn, tcConfigB.globalWarnAsError) err then - x.ErrorSinkHelper err - elif ReportWarning (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn) err then + override x.DiagnosticSink(err, isError) = + if isError || ReportWarningAsError (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn, tcConfigB.specificWarnAsError, tcConfigB.specificWarnAsWarn, tcConfigB.globalWarnAsError) err then + fsiStdinSyphon.PrintError(tcConfigB,err) + errorCount <- errorCount + 1 + if tcConfigB.abortOnError then exit 1 (* non-zero exit code *) + // STOP ON FIRST ERROR (AVOIDS PARSER ERROR RECOVERY) + raise StopProcessing + else + DoWithErrorColor isError (fun () -> + if ReportWarning (tcConfigB.globalWarnLevel, tcConfigB.specificWarnOff, tcConfigB.specificWarnOn) err then fsiConsoleOutput.Error.WriteLine() - writeViaBufferWithEnvironmentNewLines fsiConsoleOutput.Error (OutputErrorOrWarningContext " " fsiStdinSyphon.GetLine) err - writeViaBufferWithEnvironmentNewLines fsiConsoleOutput.Error (OutputErrorOrWarning (tcConfigB.implicitIncludeDir,tcConfigB.showFullPaths,tcConfigB.flatErrors,tcConfigB.errorStyle,true)) err + writeViaBufferWithEnvironmentNewLines fsiConsoleOutput.Error (OutputDiagnosticContext " " fsiStdinSyphon.GetLine) err + writeViaBufferWithEnvironmentNewLines fsiConsoleOutput.Error (OutputDiagnostic (tcConfigB.implicitIncludeDir,tcConfigB.showFullPaths,tcConfigB.flatErrors,tcConfigB.errorStyle,isError)) err fsiConsoleOutput.Error.WriteLine()) - override x.ErrorSinkImpl err = x.ErrorSinkHelper err - override x.ErrorCount = errors + override x.ErrorCount = errorCount type ErrorLogger with member x.CheckForErrors() = (x.ErrorCount > 0) @@ -1206,17 +1205,14 @@ type internal FsiDynamicCompiler closure.NoWarns |> Seq.map (fun (n,ms) -> ms |> Seq.map (fun m -> m,n)) |> Seq.concat |> Seq.iter tcConfigB.TurnWarningOff // Play errors and warnings from resolution - closure.ResolutionErrors |> List.iter errorSink - closure.ResolutionWarnings |> List.iter warnSink + closure.ResolutionDiagnostics |> List.iter diagnosticSink // Non-scripts will not have been parsed during #load closure so parse them now let sourceFiles,inputs = closure.Inputs |> List.map (fun input-> - input.ParseErrors |> List.iter errorSink - input.MetaCommandErrors |> List.iter errorSink - input.ParseWarnings |> List.iter warnSink - input.MetaCommandWarnings |> List.iter warnSink + input.ParseDiagnostics |> List.iter diagnosticSink + input.MetaCommandDiagnostics |> List.iter diagnosticSink let parsedInput = match input.SyntaxTree with | None -> ParseOneInputFile(tcConfig,lexResourceManager,["INTERACTIVE"],input.FileName,(true,false),errorLogger,(*retryLocked*)false) @@ -2430,8 +2426,6 @@ type internal FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:st do if runningOnMono then enableConsoleColoring <- false #endif - do SetUninitializedErrorLoggerFallback AssertFalseErrorLogger - //---------------------------------------------------------------------------- // tcConfig - build the initial config diff --git a/src/fsharp/vs/IncrementalBuild.fs b/src/fsharp/vs/IncrementalBuild.fs index 2d2c2523999..fe2dd3b0031 100755 --- a/src/fsharp/vs/IncrementalBuild.fs +++ b/src/fsharp/vs/IncrementalBuild.fs @@ -1000,17 +1000,16 @@ type ErrorScope() = let unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _oldLogger -> { new ErrorLogger("ErrorScope") with - member x.WarnSinkImpl(exn) = - errors <- FSharpErrorInfo.CreateFromException(exn,true,false,range.Zero):: errors - member x.ErrorSinkImpl(exn) = - let err = FSharpErrorInfo.CreateFromException(exn,false,false,range.Zero) + member x.DiagnosticSink(exn, isError) = + let err = FSharpErrorInfo.CreateFromException(exn,isError,false,range.Zero) errors <- err :: errors - mostRecentError <- Some err + if isError then + mostRecentError <- Some err member x.ErrorCount = errors.Length }) member x.Errors = errors |> List.filter (fun error -> error.Severity = FSharpErrorSeverity.Error) member x.Warnings = errors |> List.filter (fun error -> error.Severity = FSharpErrorSeverity.Warning) - member x.ErrorsAndWarnings = errors + member x.Diagnostics = errors member x.TryGetFirstErrorText() = match x.Errors with | error :: _ -> Some error.Message @@ -1146,23 +1145,21 @@ type FrameworkImportsCache(keepStrongly) = type internal CompilationErrorLogger (debugName:string, tcConfig:TcConfig) = inherit ErrorLogger("CompilationErrorLogger("+debugName+")") - let warningsSeenInScope = new ResizeArray<_>() - let errorsSeenInScope = new ResizeArray<_>() + let mutable errorCount = 0 + let diagnostics = new ResizeArray<_>() - let warningOrError warn exn = - let warn = warn && not (ReportWarningAsError (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn, tcConfig.specificWarnAsError, tcConfig.specificWarnAsWarn, tcConfig.globalWarnAsError) exn) - if not warn then - errorsSeenInScope.Add(exn) + let warningOrError isError exn = + if isError || ReportWarningAsError (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn, tcConfig.specificWarnAsError, tcConfig.specificWarnAsWarn, tcConfig.globalWarnAsError) exn then + diagnostics.Add(exn, isError) + errorCount <- errorCount + 1 else if ReportWarning (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn) exn then - warningsSeenInScope.Add(exn) + diagnostics.Add(exn, isError) - override x.WarnSinkImpl(exn) = warningOrError true exn - override x.ErrorSinkImpl(exn) = warningOrError false exn - override x.ErrorCount = errorsSeenInScope.Count + override x.DiagnosticSink(exn, isError) = warningOrError isError exn + override x.ErrorCount = errorCount member x.GetErrors() = - [ for e in errorsSeenInScope -> e,FSharpErrorSeverity.Error - for e in warningsSeenInScope -> e,FSharpErrorSeverity.Warning ] + [ for (e,isError) in diagnostics -> e, (if isError then FSharpErrorSeverity.Error else FSharpErrorSeverity.Warning) ] /// This represents the global state established as each task function runs as part of the build @@ -1438,8 +1435,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig | None -> () | Some loadClosure -> for inp in loadClosure.Inputs do - for e in inp.MetaCommandErrors do yield e,FSharpErrorSeverity.Error - for e in inp.MetaCommandWarnings do yield e,FSharpErrorSeverity.Warning ] + for (err, isError) in inp.MetaCommandDiagnostics do + yield err,(if isError then FSharpErrorSeverity.Error else FSharpErrorSeverity.Warning) ] let tcAcc = { tcGlobals=tcGlobals @@ -1858,7 +1855,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig errorRecoveryNoRange e None - builderOpt, errorScope.ErrorsAndWarnings + builderOpt, errorScope.Diagnostics static member KeepBuilderAlive (builderOpt: IncrementalBuilder option) = match builderOpt with diff --git a/src/fsharp/vs/IncrementalBuild.fsi b/src/fsharp/vs/IncrementalBuild.fsi index 6ca31a191ea..3dc578f3db3 100755 --- a/src/fsharp/vs/IncrementalBuild.fsi +++ b/src/fsharp/vs/IncrementalBuild.fsi @@ -44,7 +44,7 @@ type internal FSharpErrorInfo = type internal ErrorScope = interface IDisposable new : unit -> ErrorScope - member ErrorsAndWarnings : FSharpErrorInfo list + member Diagnostics : FSharpErrorInfo list static member Protect<'a> : range -> (unit->'a) -> (string->'a) -> 'a static member ProtectWithDefault<'a> : range -> (unit -> 'a) -> 'a -> 'a static member ProtectAndDiscard : range -> (unit -> unit) -> unit diff --git a/src/fsharp/vs/service.fs b/src/fsharp/vs/service.fs index ee1734ba982..5c422d78f1a 100755 --- a/src/fsharp/vs/service.fs +++ b/src/fsharp/vs/service.fs @@ -1443,7 +1443,7 @@ module internal Parser = let fileInfo = GetFileInfoForLastLineErrors source // This function gets called whenever an error happens during parsing or checking - let errorSink sev (exn:PhasedError) = + let diagnosticSink sev (exn:PhasedError) = // Sanity check here. The phase of an error should be in a phase known to the language service. let exn = if not(exn.IsPhaseInCompile()) then @@ -1471,14 +1471,13 @@ module internal Parser = let errorLogger = { new ErrorLogger("ErrorHandler") with - member x.WarnSinkImpl exn = errorSink FSharpErrorSeverity.Warning exn - member x.ErrorSinkImpl exn = errorSink FSharpErrorSeverity.Error exn + member x.DiagnosticSink (exn, isError) = diagnosticSink (if isError then FSharpErrorSeverity.Error else FSharpErrorSeverity.Warning) exn member x.ErrorCount = errorCount } // Public members member x.ErrorLogger = errorLogger - member x.CollectedErrorsAndWarnings = errorsAndWarningsCollector.ToArray() + member x.CollectedDiagnostics = errorsAndWarningsCollector.ToArray() member x.ErrorCount = errorCount member x.TcConfig with set tc = tcConfig <- tc member x.AnyErrors = errorCount > 0 @@ -1567,7 +1566,7 @@ module internal Parser = None) - errHandler.CollectedErrorsAndWarnings, + errHandler.CollectedDiagnostics, matchPairRef.ToArray(), parseResult, errHandler.AnyErrors @@ -1588,7 +1587,7 @@ module internal Parser = tcState: TcState, loadClosure: LoadClosure option, // These are the errors and warnings seen by the background compiler for the entire antecedant - backgroundErrors: (PhasedError * FSharpErrorSeverity) list, + backgroundDiagnostics: (PhasedError * FSharpErrorSeverity) list, reactorOps: IReactorOperations, // Used by 'FSharpDeclarationListInfo' to check the IncrementalBuilder is still alive. checkAlive : (unit -> bool), @@ -1604,7 +1603,7 @@ module internal Parser = | Some parsedMainInput -> // Initialize the error handler - let errHandler = new ErrorHandler(true,mainInputFileName,tcConfig, source) + let errHandler = new ErrorHandler(true, mainInputFileName, tcConfig, source) use unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _oldLogger -> errHandler.ErrorLogger) use unwindBP = PushThreadBuildPhaseUntilUnwind (BuildPhase.TypeCheck) @@ -1616,9 +1615,8 @@ module internal Parser = errHandler.TcConfig <- tcConfig // Play background errors and warnings for this file. - for (err,sev) in backgroundErrors do - if sev = FSharpErrorSeverity.Error then errorSink err else warnSink err - + for (err,sev) in backgroundDiagnostics do + diagnosticSink (err, (sev = FSharpErrorSeverity.Error)) // If additional references were brought in by the preprocessor then we need to process them match loadClosure with @@ -1627,8 +1625,7 @@ module internal Parser = tcImports.ReportUnresolvedAssemblyReferences(loadClosure.UnresolvedReferences) // If there was a loadClosure, replay the errors and warnings from resolution, excluding parsing - loadClosure.LoadClosureRootFileErrors |> List.iter errorSink - loadClosure.LoadClosureRootFileWarnings |> List.iter warnSink + loadClosure.LoadClosureRootFileDiagnostics |> List.iter diagnosticSink let fileOfBackgroundError err = (match GetRangeOfError (fst err) with Some m-> m.FileName | None -> null) let sameFile file hashLoadInFile = @@ -1639,13 +1636,16 @@ module internal Parser = loadClosure.SourceFiles |> List.filter(fun (_,ms) -> ms<>[]) // #loaded file, ranges of #load - let hashLoadBackgroundErrors, otherBackgroundErrors = - backgroundErrors |> List.partition (fun backgroundError -> hashLoadsInFile |> List.exists (fst >> sameFile (fileOfBackgroundError backgroundError))) + let hashLoadBackgroundDiagnostics, otherBackgroundDiagnostics = + backgroundDiagnostics + |> List.partition (fun backgroundError -> + hashLoadsInFile + |> List.exists (fst >> sameFile (fileOfBackgroundError backgroundError))) // Create single errors for the #load-ed files. // Group errors and warnings by file name. - let hashLoadBackgroundErrorsGroupedByFileName = - hashLoadBackgroundErrors + let hashLoadBackgroundDiagnosticsGroupedByFileName = + hashLoadBackgroundDiagnostics |> List.map(fun err -> fileOfBackgroundError err,err) |> List.groupByFirst // fileWithErrors, error list @@ -1653,20 +1653,22 @@ module internal Parser = // It is by-design that these messages are only present in the language service. A true build would report the errors at their // spots in the individual source files. for (fileOfHashLoad, rangesOfHashLoad) in hashLoadsInFile do - for errorGroupedByFileName in hashLoadBackgroundErrorsGroupedByFileName do + for errorGroupedByFileName in hashLoadBackgroundDiagnosticsGroupedByFileName do if sameFile (fst errorGroupedByFileName) fileOfHashLoad then for rangeOfHashLoad in rangesOfHashLoad do // Handle the case of two #loads of the same file - let errorsAndWarnings = snd errorGroupedByFileName |> List.map(fun (pe,f)->pe.Exception,f) // Strip the build phase here. It will be replaced, in total, with TypeCheck - let errors = [ for (err,sev) in errorsAndWarnings do if sev = FSharpErrorSeverity.Error then yield err ] - let warnings = [ for (err,sev) in errorsAndWarnings do if sev = FSharpErrorSeverity.Warning then yield err ] + let diagnostics = snd errorGroupedByFileName |> List.map(fun (pe,f)->pe.Exception,f) // Strip the build phase here. It will be replaced, in total, with TypeCheck + let errors = [ for (err,sev) in diagnostics do if sev = FSharpErrorSeverity.Error then yield err ] + let warnings = [ for (err,sev) in diagnostics do if sev = FSharpErrorSeverity.Warning then yield err ] let message = HashLoadedSourceHasIssues(warnings,errors,rangeOfHashLoad) if errors=[] then warning(message) else errorR(message) // Replay other background errors. - for (phasedError,sev) in otherBackgroundErrors do - if sev = FSharpErrorSeverity.Warning then warning phasedError.Exception else errorR phasedError.Exception + for (phasedError,sev) in otherBackgroundDiagnostics do + if sev = FSharpErrorSeverity.Warning then + warning phasedError.Exception + else errorR phasedError.Exception | None -> // For non-scripts, check for disallow #r and #load. @@ -1694,7 +1696,7 @@ module internal Parser = errorR e Some(tcState.TcEnvFromSignatures, [], tcState) - let errors = errHandler.CollectedErrorsAndWarnings + let errors = errHandler.CollectedDiagnostics match tcEnvAtEndOpt with | Some (tcEnvAtEnd, _typedImplFiles, tcState) -> @@ -2085,7 +2087,7 @@ type BackgroundCompiler(referenceResolver, projectCacheSize, keepAssemblyContent self.GetLogicalTimeStampForProject(opts, ct) member x.FileName = nm } ] - let builderOpt, errorsAndWarnings = + let builderOpt, diagnostics = IncrementalBuilder.TryCreateBackgroundBuilderForProjectOptions (referenceResolver, frameworkTcImportsCache, scriptClosureCache.TryGet options, Array.toList options.ProjectFileNames, Array.toList options.OtherOptions, projectReferences, options.ProjectDirectory, @@ -2113,7 +2115,7 @@ type BackgroundCompiler(referenceResolver, projectCacheSize, keepAssemblyContent builder.FileChecked.Add (fun file -> fileChecked.Trigger(file, options.ExtraProjectInfo)) builder.ProjectChecked.Add (fun () -> projectChecked.Trigger (options.ProjectFileName, options.ExtraProjectInfo)) - (builderOpt, errorsAndWarnings, decrement) + (builderOpt, diagnostics, decrement) // STATIC ROOT: FSharpLanguageServiceTestable.FSharpChecker.backgroundCompiler.incrementalBuildersCache. This root typically holds more // live information than anything else in the F# Language Service, since it holds up to 3 (projectCacheStrongSize) background project builds @@ -2760,11 +2762,11 @@ type FsiInteractiveChecker(reactorOps: IReactorOperations, tcConfig, tcGlobals, let dependencyFiles = [] // interactions have no dependencies let parseResults = FSharpParseFileResults(parseErrors, inputOpt, parseHadErrors = anyErrors, dependencyFiles = dependencyFiles) - let backgroundErrors = [] + let backgroundDiagnostics = [] let ct = CancellationToken.None let tcErrors, tcFileResult = Parser.TypeCheckOneFile(parseResults,source,mainInputFileName,"project",tcConfig,tcGlobals,tcImports, tcState, - loadClosure,backgroundErrors,reactorOps,(fun () -> true),ct,None) + loadClosure,backgroundDiagnostics,reactorOps,(fun () -> true),ct,None) match tcFileResult with | Parser.TypeCheckAborted.No scope -> From 05c3f8dcaaf639316ace1b19c4fb26e3a352347e Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 8 Dec 2016 01:10:14 +0000 Subject: [PATCH 04/17] simplify diagnostics processing (2) --- src/fsharp/CompileOps.fs | 3 +-- src/fsharp/vs/IncrementalBuild.fs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index a3e93399f3f..64fbdffbcc3 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -3102,8 +3102,7 @@ let GetScopedPragmasForInput input = // interact well with #line directives. type ErrorLoggerFilteringByScopedPragmas (checkFile, scopedPragmas, errorLogger:ErrorLogger) = inherit ErrorLogger("ErrorLoggerFilteringByScopedPragmas") - let mutable scopedPragmas = scopedPragmas - member x.ScopedPragmas with set v = scopedPragmas <- v + override x.DiagnosticSink (phasedError,isError) = if isError then errorLogger.DiagnosticSink (phasedError,isError) diff --git a/src/fsharp/vs/IncrementalBuild.fs b/src/fsharp/vs/IncrementalBuild.fs index fe2dd3b0031..e1f4e79491b 100755 --- a/src/fsharp/vs/IncrementalBuild.fs +++ b/src/fsharp/vs/IncrementalBuild.fs @@ -1147,15 +1147,14 @@ type internal CompilationErrorLogger (debugName:string, tcConfig:TcConfig) = let mutable errorCount = 0 let diagnostics = new ResizeArray<_>() - - let warningOrError isError exn = + + override x.DiagnosticSink(exn, isError) = if isError || ReportWarningAsError (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn, tcConfig.specificWarnAsError, tcConfig.specificWarnAsWarn, tcConfig.globalWarnAsError) exn then diagnostics.Add(exn, isError) errorCount <- errorCount + 1 else if ReportWarning (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn) exn then diagnostics.Add(exn, isError) - override x.DiagnosticSink(exn, isError) = warningOrError isError exn override x.ErrorCount = errorCount member x.GetErrors() = From 5b3ead1483b124c5cdb9a39b9ebc4ba9a2188aa8 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 8 Dec 2016 02:11:59 +0000 Subject: [PATCH 05/17] remove project --- FSharp.sln | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/FSharp.sln b/FSharp.sln index 7f3e7ef9864..be0a3252640 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -45,8 +45,6 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ILComparer", "tests\fsharpq EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Tests.FSharpSuite.DrivingCoreCLR", "tests\fsharp\FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj", "{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.LanguageService.Compiler", "src\fsharp\FSharp.LanguageService.Compiler\FSharp.LanguageService.Compiler.fsproj", "{A437A6EC-5323-47C2-8F86-E2CAC54FF152}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -220,18 +218,6 @@ Global {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|Any CPU.Build.0 = Release|Any CPU {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|x86.ActiveCfg = Release|Any CPU {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|x86.Build.0 = Release|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|x86.ActiveCfg = Debug|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Debug|x86.Build.0 = Debug|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|Any CPU.ActiveCfg = Proto|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|Any CPU.Build.0 = Proto|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|x86.ActiveCfg = Proto|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Proto|x86.Build.0 = Proto|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|Any CPU.Build.0 = Release|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|x86.ActiveCfg = Release|Any CPU - {A437A6EC-5323-47C2-8F86-E2CAC54FF152}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -251,6 +237,5 @@ Global {4239EFEA-E746-446A-BF7A-51FCBAB13946} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {2E60864A-E3FF-4BCC-810F-DC7C34E6B236} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} - {A437A6EC-5323-47C2-8F86-E2CAC54FF152} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77} EndGlobalSection EndGlobal From d51a7b8ab89433dec318adbf20a794049ba59ca9 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 8 Dec 2016 02:25:14 +0000 Subject: [PATCH 06/17] fix build --- src/fsharp/CompileOps.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 64fbdffbcc3..a3996bb69c9 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -3118,7 +3118,7 @@ type ErrorLoggerFilteringByScopedPragmas (checkFile, scopedPragmas, errorLogger: (not checkFile || m.FileIndex = pragmaRange.FileIndex) && Range.posGeq m.Start pragmaRange.Start)) | None -> true - if report then errorLogger.DiagnosticSink(phasedError,true) + if report then errorLogger.DiagnosticSink(phasedError,false) override x.ErrorCount = errorLogger.ErrorCount From 61d98b1a42dac3d0dea426ddf78f48c89096d59d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 8 Dec 2016 03:01:05 +0000 Subject: [PATCH 07/17] fix build --- packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.config b/packages.config index c62c1e23783..52ddefde324 100644 --- a/packages.config +++ b/packages.config @@ -30,7 +30,7 @@ - + From 38dd3d33d538c9c5c82fb254a68c375ad5d347fe Mon Sep 17 00:00:00 2001 From: dsyme Date: Thu, 8 Dec 2016 14:41:53 +0000 Subject: [PATCH 08/17] fix build --- vsintegration/tests/unittests/Tests.LanguageService.Script.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/tests/unittests/Tests.LanguageService.Script.fs b/vsintegration/tests/unittests/Tests.LanguageService.Script.fs index 6b19eac335f..81f6a0d4816 100644 --- a/vsintegration/tests/unittests/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/unittests/Tests.LanguageService.Script.fs @@ -82,7 +82,7 @@ type UsingMSBuild() as this = failwith (sprintf "Multiple errors containing \"%s\"" text) let AssertExactlyOneErrorSeenContaining(project:OpenProject,text) = - AssertExactlyCountErrorSeenContaining(project:OpenProject,tex,1) + AssertExactlyCountErrorSeenContaining(project,text,1) /// Assert that a given squiggle is an Error (or warning) containing the given text let AssertSquiggleIsErrorContaining,AssertSquiggleIsWarningContaining, AssertSquiggleIsErrorNotContaining,AssertSquiggleIsWarningNotContaining = From e3a9f1c5e32069b91cdf0bd83a29820f76d2cb70 Mon Sep 17 00:00:00 2001 From: dsyme Date: Thu, 8 Dec 2016 14:56:03 +0000 Subject: [PATCH 09/17] fix build --- vsintegration/tests/unittests/Tests.LanguageService.Script.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/tests/unittests/Tests.LanguageService.Script.fs b/vsintegration/tests/unittests/Tests.LanguageService.Script.fs index 81f6a0d4816..5c466bfdc3f 100644 --- a/vsintegration/tests/unittests/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/unittests/Tests.LanguageService.Script.fs @@ -72,7 +72,7 @@ type UsingMSBuild() as this = printf " message = <<<%s> \n" e.Message AssertEqual(0,count) - let AssertExactlyCountErrorSeenContaining(project:OpenProject,tex,expectedCount) = + let AssertExactlyCountErrorSeenContaining(project:OpenProject,text,expectedCount) = let nMatching = (GetErrors(project)) |> List.filter (fun e ->e.ToString().Contains(text)) |> List.length match nMatching with | 0 -> From 05717e7aba70d5bfd67ad69be50e185735227a64 Mon Sep 17 00:00:00 2001 From: dsyme Date: Tue, 27 Dec 2016 18:23:13 +0000 Subject: [PATCH 10/17] merge master --- src/fsharp/CompileOps.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 1f79f8df1d9..23363c4e7c9 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -1547,7 +1547,7 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle let mainError,relatedErrors = SplitRelatedErrors err let where = OutputWhere(mainError) - let canonical = OutputDiagnosticCanonicalInformation(err.Subcategory(),GetErrorNumber mainError) + let canonical = OutputCanonicalInformation(err.Subcategory(),GetErrorNumber mainError) let message = let os = System.Text.StringBuilder() OutputPhasedError errorStyle os mainError flattenErrors @@ -1562,7 +1562,7 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle // Give a canonical string when --vserror. | ErrorStyle.VSErrors -> let relWhere = OutputWhere(mainError) // mainError? - let relCanonical = OutputDiagnosticCanonicalInformation(err.Subcategory(),GetErrorNumber mainError) // Use main error for code + let relCanonical = OutputCanonicalInformation(err.Subcategory(),GetErrorNumber mainError) // Use main error for code let relMessage = let os = System.Text.StringBuilder() OutputPhasedError errorStyle os err flattenErrors From 0c01552fd3500c8b1de66117eb05fa2c329a0f33 Mon Sep 17 00:00:00 2001 From: dsyme Date: Tue, 27 Dec 2016 19:55:20 +0000 Subject: [PATCH 11/17] fix build of tests --- vsintegration/tests/unittests/HelpContextServiceTests.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/vsintegration/tests/unittests/HelpContextServiceTests.fs b/vsintegration/tests/unittests/HelpContextServiceTests.fs index 6752fc0617d..bc764f4522c 100644 --- a/vsintegration/tests/unittests/HelpContextServiceTests.fs +++ b/vsintegration/tests/unittests/HelpContextServiceTests.fs @@ -29,6 +29,7 @@ type HelpContextServiceTests() = LoadTime = DateTime.MaxValue UnresolvedReferences = None ExtraProjectInfo = None + OriginalLoadReferences = [] } let markers (source:string) = From 21d4a175bddb11be30699780f0d3c1105c48f713 Mon Sep 17 00:00:00 2001 From: dsyme Date: Tue, 27 Dec 2016 20:14:35 +0000 Subject: [PATCH 12/17] fix error flag --- src/fsharp/CompileOps.fs | 16 ++++++++-------- src/fsharp/CompileOps.fsi | 2 +- src/fsharp/fsc.fs | 2 +- src/fsharp/fsi/fsi.fs | 5 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 23363c4e7c9..b2717021da1 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -1477,7 +1477,7 @@ type Diagnostic = | Long of bool * DiagnosticDetailedInfo /// returns sequence that contains Diagnostic for the given error + Diagnostic for all related errors -let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn, err:PhasedError) = +let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError, err:PhasedError) = let outputWhere (showFullPaths,errorStyle) m : DiagnosticLocation = if m = rangeStartup || m = rangeCmdArgs then { Range = m; TextRepresentation = ""; IsEmpty = true; File = "" } @@ -1541,8 +1541,8 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle let text = match errorStyle with // Show the subcategory for --vserrors so that we can fish it out in Visual Studio and use it to determine error stickiness. - | ErrorStyle.VSErrors -> sprintf "%s %s FS%04d: " subcategory (if warn then "warning" else "error") errorNumber - | _ -> sprintf "%s FS%04d: " (if warn then "warning" else "error") errorNumber + | ErrorStyle.VSErrors -> sprintf "%s %s FS%04d: " subcategory (if isError then "error" else "warning") errorNumber + | _ -> sprintf "%s FS%04d: " (if isError then "error" else "warning") errorNumber { ErrorNumber = errorNumber; Subcategory = subcategory; TextRepresentation = text} let mainError,relatedErrors = SplitRelatedErrors err @@ -1555,7 +1555,7 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle let entry : DiagnosticDetailedInfo = { Location = where; Canonical = canonical; Message = message } - errors.Add ( Diagnostic.Long( not warn, entry ) ) + errors.Add ( Diagnostic.Long(isError, entry ) ) let OutputRelatedError(err:PhasedError) = match errorStyle with @@ -1569,12 +1569,12 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle os.ToString() let entry : DiagnosticDetailedInfo = { Location = relWhere; Canonical = relCanonical; Message = relMessage} - errors.Add( Diagnostic.Long (not warn, entry) ) + errors.Add( Diagnostic.Long (isError, entry) ) | _ -> let os = System.Text.StringBuilder() OutputPhasedError errorStyle os err flattenErrors - errors.Add( Diagnostic.Short((not warn), os.ToString()) ) + errors.Add( Diagnostic.Short(isError, os.ToString()) ) relatedErrors |> List.iter OutputRelatedError @@ -1592,9 +1592,9 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle /// used by fsc.exe and fsi.exe, but not by VS /// prints error and related errors to the specified StringBuilder -let rec OutputDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn) os (err:PhasedError) = +let rec OutputDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError) os (err:PhasedError) = - let errors = CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,warn, err) + let errors = CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError, err) for e in errors do Printf.bprintf os "\n" match e with diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index eb053509615..dd40e83cb11 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -86,7 +86,7 @@ val SplitRelatedErrors : PhasedError -> PhasedError * PhasedError list val OutputPhasedError : ErrorLogger.ErrorStyle -> StringBuilder -> PhasedError -> bool -> unit /// Output an error or warning to a buffer -val OutputDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool -> StringBuilder -> PhasedError -> unit +val OutputDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * isError:bool -> StringBuilder -> PhasedError -> unit /// Output extra context information for an error or warning to a buffer val OutputDiagnosticContext : prefix:string -> fileLineFunction:(string -> int -> string) -> StringBuilder -> PhasedError -> unit diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 4fa36552891..73252a7d130 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -108,7 +108,7 @@ let ConsoleErrorLoggerUpToMaxErrors (tcConfigB:TcConfigBuilder, exiter : Exiter) member this.HandleIssue(tcConfigB, err, isError) = DoWithErrorColor isError (fun () -> - (writeViaBufferWithEnvironmentNewLines stderr (OutputDiagnostic (tcConfigB.implicitIncludeDir, tcConfigB.showFullPaths, tcConfigB.flatErrors, tcConfigB.errorStyle, not isError)) err + (writeViaBufferWithEnvironmentNewLines stderr (OutputDiagnostic (tcConfigB.implicitIncludeDir, tcConfigB.showFullPaths, tcConfigB.flatErrors, tcConfigB.errorStyle, isError)) err stderr.WriteLine())) } :> _ diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index a743541bce8..15fc5a4152a 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -447,10 +447,11 @@ type internal FsiStdinSyphon(errorWriter: TextWriter) = /// Display the given error. member syphon.PrintError (tcConfig:TcConfigBuilder, err) = Utilities.ignoreAllErrors (fun () -> - DoWithErrorColor true (fun () -> + let isError = true + DoWithErrorColor isError (fun () -> errorWriter.WriteLine(); writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnosticContext " " syphon.GetLine) err; - writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnostic (tcConfig.implicitIncludeDir,tcConfig.showFullPaths,tcConfig.flatErrors,tcConfig.errorStyle,false)) err; + writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnostic (tcConfig.implicitIncludeDir,tcConfig.showFullPaths,tcConfig.flatErrors,tcConfig.errorStyle,isError)) err; errorWriter.WriteLine() errorWriter.Flush())) From 8b2c00783b5511f5c254c8c6c1ffae425b8d6ffc Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 28 Dec 2016 16:02:06 +0000 Subject: [PATCH 13/17] fix tests and build --- tests/fsharp/test-framework.fs | 6 +- tests/fsharp/tests.fs | 503 +++++++++++++----- tests/fsharp/typecheck/sigs/neg67.bsl | 8 +- tests/fsharp/typecheck/sigs/neg67.vsbsl | 8 +- tests/fsharp/typecheck/sigs/neg69.bsl | 64 +-- tests/fsharp/typecheck/sigs/neg69.vsbsl | 64 +-- tests/fsharp/typecheck/sigs/neg71.bsl | 4 +- tests/fsharp/typecheck/sigs/neg71.vsbsl | 4 +- tests/fsharp/typecheck/sigs/neg74.bsl | 52 +- tests/fsharp/typecheck/sigs/neg74.vsbsl | 52 +- tests/fsharp/typecheck/sigs/neg75.bsl | 8 +- tests/fsharp/typecheck/sigs/neg75.vsbsl | 8 +- tests/fsharp/typecheck/sigs/neg76.bsl | 8 +- tests/fsharp/typecheck/sigs/neg76.vsbsl | 8 +- tests/fsharp/typecheck/sigs/neg81.bsl | 10 +- tests/fsharp/typecheck/sigs/neg81.vsbsl | 10 +- tests/fsharp/typecheck/sigs/neg82.bsl | 22 +- tests/fsharp/typecheck/sigs/neg82.vsbsl | 22 +- tests/fsharp/typecheck/sigs/neg83.bsl | 4 +- tests/fsharp/typecheck/sigs/neg83.vsbsl | 4 +- .../DocumentHighlightsServiceTests.fs | 1 + 21 files changed, 560 insertions(+), 310 deletions(-) diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index 43088301a7e..0de22d8b9b6 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -144,7 +144,11 @@ module WindowsPlatform = let CORSDK = let find s = envVars |> Map.tryFind s - [| "WINSDKNETFXTOOLS"; "WindowsSDK_ExecutablePath_x64"; "WindowsSDK_ExecutablePath_x86" |] |> Seq.tryPick (fun s -> find s) |> function None -> "" | Some x -> x + [| "WINSDKNETFXTOOLS"; "WindowsSDK_ExecutablePath_x64"; "WindowsSDK_ExecutablePath_x86" |] + |> Seq.tryPick find + |> function + | None -> @"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\" + | Some x -> x CORDIR, CORSDK diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 7bcf3275ece..1977357aa68 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1712,135 +1712,380 @@ module TypecheckTests = let cfg = testConfig "typecheck/sigs" fsc cfg "%s -a -o:pos05.dll" cfg.fsc_flags ["pos05.fs"] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - let ``type check signatures`` (groupName:string,testName:string) = - log "Group: %s" groupName - let cfg = testConfig "typecheck/sigs" - singleNegTest cfg testName + [] + let ``type check neg01`` () = singleNegTest (testConfig "typecheck/sigs") "neg01" + + [] + let ``type check neg02`` () = singleNegTest (testConfig "typecheck/sigs") "neg02" + + [] + let ``type check neg03`` () = singleNegTest (testConfig "typecheck/sigs") "neg03" + + [] + let ``type check neg04`` () = singleNegTest (testConfig "typecheck/sigs") "neg04" + + [] + let ``type check neg05`` () = singleNegTest (testConfig "typecheck/sigs") "neg05" + + [] + let ``type check neg06`` () = singleNegTest (testConfig "typecheck/sigs") "neg06" + + [] + let ``type check neg06_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg06_a" + + [] + let ``type check neg06_b`` () = singleNegTest (testConfig "typecheck/sigs") "neg06_b" + + [] + let ``type check neg07`` () = singleNegTest (testConfig "typecheck/sigs") "neg07" + + [] + let ``type check neg08`` () = singleNegTest (testConfig "typecheck/sigs") "neg08" + + [] + let ``type check neg09`` () = singleNegTest (testConfig "typecheck/sigs") "neg09" + + [] + let ``type check neg10`` () = singleNegTest (testConfig "typecheck/sigs") "neg10" + + [] + let ``type check neg10_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg10_a" + + [] + let ``type check neg11`` () = singleNegTest (testConfig "typecheck/sigs") "neg11" + + [] + let ``type check neg12`` () = singleNegTest (testConfig "typecheck/sigs") "neg12" + + [] + let ``type check neg13`` () = singleNegTest (testConfig "typecheck/sigs") "neg13" + + [] + let ``type check neg14`` () = singleNegTest (testConfig "typecheck/sigs") "neg14" + + [] + let ``type check neg15`` () = singleNegTest (testConfig "typecheck/sigs") "neg15" + + [] + let ``type check neg16`` () = singleNegTest (testConfig "typecheck/sigs") "neg16" + + [] + let ``type check neg17`` () = singleNegTest (testConfig "typecheck/sigs") "neg17" + + [] + let ``type check neg18`` () = singleNegTest (testConfig "typecheck/sigs") "neg18" + + [] + let ``type check neg19`` () = singleNegTest (testConfig "typecheck/sigs") "neg19" + + [] + let ``type check neg20`` () = singleNegTest (testConfig "typecheck/sigs") "neg20" + + [] + let ``type check neg21`` () = singleNegTest (testConfig "typecheck/sigs") "neg21" + + [] + let ``type check neg22`` () = singleNegTest (testConfig "typecheck/sigs") "neg22" + + [] + let ``type check neg23`` () = singleNegTest (testConfig "typecheck/sigs") "neg23" + + [] + let ``type check neg24`` () = singleNegTest (testConfig "typecheck/sigs") "neg24" + + [] + let ``type check neg25`` () = singleNegTest (testConfig "typecheck/sigs") "neg25" + + [] + let ``type check neg26`` () = singleNegTest (testConfig "typecheck/sigs") "neg26" + + [] + let ``type check neg27`` () = singleNegTest (testConfig "typecheck/sigs") "neg27" + + [] + let ``type check neg28`` () = singleNegTest (testConfig "typecheck/sigs") "neg28" + + [] + let ``type check neg29`` () = singleNegTest (testConfig "typecheck/sigs") "neg29" + + [] + let ``type check neg30`` () = singleNegTest (testConfig "typecheck/sigs") "neg30" + + [] + let ``type check neg31`` () = singleNegTest (testConfig "typecheck/sigs") "neg31" + + [] + let ``type check neg32`` () = singleNegTest (testConfig "typecheck/sigs") "neg32" + + [] + let ``type check neg33`` () = singleNegTest (testConfig "typecheck/sigs") "neg33" + + [] + let ``type check neg34`` () = singleNegTest (testConfig "typecheck/sigs") "neg34" + + [] + let ``type check neg35`` () = singleNegTest (testConfig "typecheck/sigs") "neg35" + + [] + let ``type check neg36`` () = singleNegTest (testConfig "typecheck/sigs") "neg36" + + [] + let ``type check neg37`` () = singleNegTest (testConfig "typecheck/sigs") "neg37" + + [] + let ``type check neg37_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg37_a" + + [] + let ``type check neg38`` () = singleNegTest (testConfig "typecheck/sigs") "neg38" + + [] + let ``type check neg39`` () = singleNegTest (testConfig "typecheck/sigs") "neg39" + + [] + let ``type check neg40`` () = singleNegTest (testConfig "typecheck/sigs") "neg40" + + [] + let ``type check neg41`` () = singleNegTest (testConfig "typecheck/sigs") "neg41" + + [] + let ``type check neg42`` () = singleNegTest (testConfig "typecheck/sigs") "neg42" + + [] + let ``type check neg43`` () = singleNegTest (testConfig "typecheck/sigs") "neg43" + + [] + let ``type check neg44`` () = singleNegTest (testConfig "typecheck/sigs") "neg44" + + [] + let ``type check neg45`` () = singleNegTest (testConfig "typecheck/sigs") "neg45" + + [] + let ``type check neg46`` () = singleNegTest (testConfig "typecheck/sigs") "neg46" + + [] + let ``type check neg47`` () = singleNegTest (testConfig "typecheck/sigs") "neg47" + + [] + let ``type check neg48`` () = singleNegTest (testConfig "typecheck/sigs") "neg48" + + [] + let ``type check neg49`` () = singleNegTest (testConfig "typecheck/sigs") "neg49" + + [] + let ``type check neg50`` () = singleNegTest (testConfig "typecheck/sigs") "neg50" + + [] + let ``type check neg51`` () = singleNegTest (testConfig "typecheck/sigs") "neg51" + + [] + let ``type check neg52`` () = singleNegTest (testConfig "typecheck/sigs") "neg52" + + [] + let ``type check neg53`` () = singleNegTest (testConfig "typecheck/sigs") "neg53" + + [] + let ``type check neg54`` () = singleNegTest (testConfig "typecheck/sigs") "neg54" + + [] + let ``type check neg55`` () = singleNegTest (testConfig "typecheck/sigs") "neg55" + + [] + let ``type check neg56`` () = singleNegTest (testConfig "typecheck/sigs") "neg56" + + [] + let ``type check neg56_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg56_a" + + [] + let ``type check neg56_b`` () = singleNegTest (testConfig "typecheck/sigs") "neg56_b" + + [] + let ``type check neg57`` () = singleNegTest (testConfig "typecheck/sigs") "neg57" + + [] + let ``type check neg58`` () = singleNegTest (testConfig "typecheck/sigs") "neg58" + + [] + let ``type check neg59`` () = singleNegTest (testConfig "typecheck/sigs") "neg59" + + [] + let ``type check neg60`` () = singleNegTest (testConfig "typecheck/sigs") "neg60" + + [] + let ``type check neg61`` () = singleNegTest (testConfig "typecheck/sigs") "neg61" + + [] + let ``type check neg62`` () = singleNegTest (testConfig "typecheck/sigs") "neg62" + + [] + let ``type check neg63`` () = singleNegTest (testConfig "typecheck/sigs") "neg63" + + [] + let ``type check neg64`` () = singleNegTest (testConfig "typecheck/sigs") "neg64" + + [] + let ``type check neg65`` () = singleNegTest (testConfig "typecheck/sigs") "neg65" + + [] + let ``type check neg66`` () = singleNegTest (testConfig "typecheck/sigs") "neg66" + + [] + let ``type check neg67`` () = singleNegTest (testConfig "typecheck/sigs") "neg67" + + [] + let ``type check neg68`` () = singleNegTest (testConfig "typecheck/sigs") "neg68" + + [] + let ``type check neg69`` () = singleNegTest (testConfig "typecheck/sigs") "neg69" + + [] + let ``type check neg70`` () = singleNegTest (testConfig "typecheck/sigs") "neg70" + + [] + let ``type check neg71`` () = singleNegTest (testConfig "typecheck/sigs") "neg71" + + [] + let ``type check neg72`` () = singleNegTest (testConfig "typecheck/sigs") "neg72" + + [] + let ``type check neg73`` () = singleNegTest (testConfig "typecheck/sigs") "neg73" + + [] + let ``type check neg74`` () = singleNegTest (testConfig "typecheck/sigs") "neg74" + + [] + let ``type check neg75`` () = singleNegTest (testConfig "typecheck/sigs") "neg75" + + [] + let ``type check neg76`` () = singleNegTest (testConfig "typecheck/sigs") "neg76" + + [] + let ``type check neg77`` () = singleNegTest (testConfig "typecheck/sigs") "neg77" + + [] + let ``type check neg78`` () = singleNegTest (testConfig "typecheck/sigs") "neg78" + + [] + let ``type check neg79`` () = singleNegTest (testConfig "typecheck/sigs") "neg79" + + [] + let ``type check neg80`` () = singleNegTest (testConfig "typecheck/sigs") "neg80" + + [] + let ``type check neg81`` () = singleNegTest (testConfig "typecheck/sigs") "neg81" + + [] + let ``type check neg82`` () = singleNegTest (testConfig "typecheck/sigs") "neg82" + + [] + let ``type check neg83`` () = singleNegTest (testConfig "typecheck/sigs") "neg83" + + [] + let ``type check neg84`` () = singleNegTest (testConfig "typecheck/sigs") "neg84" + + [] + let ``type check neg85`` () = singleNegTest (testConfig "typecheck/sigs") "neg85" + + [] + let ``type check neg86`` () = singleNegTest (testConfig "typecheck/sigs") "neg86" + + [] + let ``type check neg87`` () = singleNegTest (testConfig "typecheck/sigs") "neg87" + + [] + let ``type check neg88`` () = singleNegTest (testConfig "typecheck/sigs") "neg88" + + [] + let ``type check neg89`` () = singleNegTest (testConfig "typecheck/sigs") "neg89" + + [] + let ``type check neg90`` () = singleNegTest (testConfig "typecheck/sigs") "neg90" + + [] + let ``type check neg91`` () = singleNegTest (testConfig "typecheck/sigs") "neg91" + + [] + let ``type check neg92`` () = singleNegTest (testConfig "typecheck/sigs") "neg92" + + [] + let ``type check neg93`` () = singleNegTest (testConfig "typecheck/sigs") "neg93" + + [] + let ``type check neg94`` () = singleNegTest (testConfig "typecheck/sigs") "neg94" + + [] + let ``type check neg95`` () = singleNegTest (testConfig "typecheck/sigs") "neg95" + + [] + let ``type check neg96`` () = singleNegTest (testConfig "typecheck/sigs") "neg96" + + [] + let ``type check neg97`` () = singleNegTest (testConfig "typecheck/sigs") "neg97" + + [] + let ``type check neg_byref_1`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_1" + + [] + let ``type check neg_byref_2`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_2" + + [] + let ``type check neg_byref_3`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_3" + + [] + let ``type check neg_byref_4`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_4" + + [] + let ``type check neg_byref_5`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_5" + + [] + let ``type check neg_byref_6`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_6" + + [] + let ``type check neg_byref_7`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_7" + + [] + let ``type check neg_byref_8`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_8" + + [] + let ``type check neg_byref_10`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_10" + + [] + let ``type check neg_byref_11`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_11" + + [] + let ``type check neg_byref_12`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_12" + + [] + let ``type check neg_byref_13`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_13" + + [] + let ``type check neg_byref_14`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_14" + + [] + let ``type check neg_byref_15`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_15" + + [] + let ``type check neg_byref_16`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_16" + + [] + let ``type check neg_byref_17`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_17" + + [] + let ``type check neg_byref_18`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_18" + + [] + let ``type check neg_byref_19`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_19" + + [] + let ``type check neg_byref_20`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_20" + + [] + let ``type check neg_byref_21`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_21" + + [] + let ``type check neg_byref_22`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_22" + + [] + let ``type check neg_byref_23`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_23" module FscTests = [] diff --git a/tests/fsharp/typecheck/sigs/neg67.bsl b/tests/fsharp/typecheck/sigs/neg67.bsl index dcbee8e4dba..8fee8cf3f5d 100644 --- a/tests/fsharp/typecheck/sigs/neg67.bsl +++ b/tests/fsharp/typecheck/sigs/neg67.bsl @@ -1,8 +1,8 @@ -neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token. - -neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized +neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token. neg67.fsx(41,15,41,16): parse error FS0604: Unmatched '{' -neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token. +neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized + +neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token. diff --git a/tests/fsharp/typecheck/sigs/neg67.vsbsl b/tests/fsharp/typecheck/sigs/neg67.vsbsl index 8cb90ef9b8f..d6b1e867d1e 100644 --- a/tests/fsharp/typecheck/sigs/neg67.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg67.vsbsl @@ -1,11 +1,11 @@ -neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token. - -neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized +neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token. neg67.fsx(41,15,41,16): parse error FS0604: Unmatched '{' -neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token. +neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized + +neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token. neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token. diff --git a/tests/fsharp/typecheck/sigs/neg69.bsl b/tests/fsharp/typecheck/sigs/neg69.bsl index fb2c0bcdfc7..e8270894f00 100644 --- a/tests/fsharp/typecheck/sigs/neg69.bsl +++ b/tests/fsharp/typecheck/sigs/neg69.bsl @@ -1,66 +1,66 @@ -neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument -neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token. -neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file -neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions. neg69.fsx(171,1,171,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (170:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file +neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token. +neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument +neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg69.vsbsl b/tests/fsharp/typecheck/sigs/neg69.vsbsl index 7b3b296bc63..7c5c0a5fecb 100644 --- a/tests/fsharp/typecheck/sigs/neg69.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg69.vsbsl @@ -1,69 +1,69 @@ -neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument -neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token. -neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file -neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. -neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions. neg69.fsx(171,1,171,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (170:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions. +neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions. +neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file +neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token. +neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions. -neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument +neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions. neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument diff --git a/tests/fsharp/typecheck/sigs/neg71.bsl b/tests/fsharp/typecheck/sigs/neg71.bsl index 5eb45a8bd57..dd572143c38 100644 --- a/tests/fsharp/typecheck/sigs/neg71.bsl +++ b/tests/fsharp/typecheck/sigs/neg71.bsl @@ -1,6 +1,6 @@ -neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition +neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token. neg71.fsx(166,24,168,1): parse error FS0010: Incomplete structured construct at or before this point in member definition. Expected incomplete structured construct at or before this point, 'end' or other token. -neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token. +neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition diff --git a/tests/fsharp/typecheck/sigs/neg71.vsbsl b/tests/fsharp/typecheck/sigs/neg71.vsbsl index 7145f57cf3a..2f2ec96f201 100644 --- a/tests/fsharp/typecheck/sigs/neg71.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg71.vsbsl @@ -1,9 +1,9 @@ -neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition +neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token. neg71.fsx(166,24,168,1): parse error FS0010: Incomplete structured construct at or before this point in member definition. Expected incomplete structured construct at or before this point, 'end' or other token. -neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token. +neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token. diff --git a/tests/fsharp/typecheck/sigs/neg74.bsl b/tests/fsharp/typecheck/sigs/neg74.bsl index 4f4e40cd8e2..2a3f2816a0a 100644 --- a/tests/fsharp/typecheck/sigs/neg74.bsl +++ b/tests/fsharp/typecheck/sigs/neg74.bsl @@ -1,56 +1,56 @@ -neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token. -neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file +neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token. +neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file diff --git a/tests/fsharp/typecheck/sigs/neg74.vsbsl b/tests/fsharp/typecheck/sigs/neg74.vsbsl index 9696443febf..609fcc1264e 100644 --- a/tests/fsharp/typecheck/sigs/neg74.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg74.vsbsl @@ -1,59 +1,59 @@ -neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token. -neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. +neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file +neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. -neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token. +neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg75.bsl b/tests/fsharp/typecheck/sigs/neg75.bsl index 9aedc28bf2b..b46bf301d19 100644 --- a/tests/fsharp/typecheck/sigs/neg75.bsl +++ b/tests/fsharp/typecheck/sigs/neg75.bsl @@ -1,10 +1,10 @@ -neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - -neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. +neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + +neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + neg75.fsx(153,24,153,27): parse error FS0588: The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result. diff --git a/tests/fsharp/typecheck/sigs/neg75.vsbsl b/tests/fsharp/typecheck/sigs/neg75.vsbsl index c3c9981022f..fbafdc0a328 100644 --- a/tests/fsharp/typecheck/sigs/neg75.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg75.vsbsl @@ -1,12 +1,12 @@ -neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - -neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. +neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + +neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + neg75.fsx(153,24,153,27): parse error FS0588: The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result. neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg76.bsl b/tests/fsharp/typecheck/sigs/neg76.bsl index a52c63988d2..e5d4673dfc2 100644 --- a/tests/fsharp/typecheck/sigs/neg76.bsl +++ b/tests/fsharp/typecheck/sigs/neg76.bsl @@ -1,10 +1,10 @@ -neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - -neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. +neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + +neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + neg76.fsx(153,24,153,27): parse error FS0588: The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result. diff --git a/tests/fsharp/typecheck/sigs/neg76.vsbsl b/tests/fsharp/typecheck/sigs/neg76.vsbsl index 9edfa764762..b7e157d83f6 100644 --- a/tests/fsharp/typecheck/sigs/neg76.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg76.vsbsl @@ -1,12 +1,12 @@ -neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - -neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. - neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. +neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + +neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. + neg76.fsx(153,24,153,27): parse error FS0588: The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result. neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg81.bsl b/tests/fsharp/typecheck/sigs/neg81.bsl index 7deb26c5608..fae282eb3e2 100644 --- a/tests/fsharp/typecheck/sigs/neg81.bsl +++ b/tests/fsharp/typecheck/sigs/neg81.bsl @@ -1,14 +1,14 @@ -neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions. - neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions. neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions. -neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token. +neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions. -neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword. +neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression neg81.fsx(8,1,8,5): parse error FS0010: Unexpected keyword 'type' in binding. Expected incomplete structured construct at or before this point or other token. -neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression +neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword. + +neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token. diff --git a/tests/fsharp/typecheck/sigs/neg81.vsbsl b/tests/fsharp/typecheck/sigs/neg81.vsbsl index dc19e54e183..e7f03277d2b 100644 --- a/tests/fsharp/typecheck/sigs/neg81.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg81.vsbsl @@ -1,17 +1,17 @@ -neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions. - neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions. neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions. -neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token. +neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions. -neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword. +neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression neg81.fsx(8,1,8,5): parse error FS0010: Unexpected keyword 'type' in binding. Expected incomplete structured construct at or before this point or other token. -neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression +neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword. + +neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token. neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg82.bsl b/tests/fsharp/typecheck/sigs/neg82.bsl index 5e12949b62c..9d355415d81 100644 --- a/tests/fsharp/typecheck/sigs/neg82.bsl +++ b/tests/fsharp/typecheck/sigs/neg82.bsl @@ -1,22 +1,22 @@ -neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions. - -neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression -neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. -neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. -neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token. neg82.fsx(95,1,95,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (88:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. +neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file -neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. +neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file +neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token. +neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression +neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions. + +neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg82.vsbsl b/tests/fsharp/typecheck/sigs/neg82.vsbsl index 6cba5bd2f8f..71dac9748c9 100644 --- a/tests/fsharp/typecheck/sigs/neg82.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg82.vsbsl @@ -1,25 +1,25 @@ -neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions. - -neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression -neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. -neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. -neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions. +neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token. neg82.fsx(95,1,95,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (88:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. +neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file -neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions. +neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file +neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token. +neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions. -neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression +neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions. + +neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions. neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression diff --git a/tests/fsharp/typecheck/sigs/neg83.bsl b/tests/fsharp/typecheck/sigs/neg83.bsl index 641ecf842bd..f8a21a04a21 100644 --- a/tests/fsharp/typecheck/sigs/neg83.bsl +++ b/tests/fsharp/typecheck/sigs/neg83.bsl @@ -1,6 +1,6 @@ +neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression + neg83.fsx(13,1,13,2): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:9). Try indenting this token further or using standard formatting conventions. neg83.fsx(16,1,16,1): parse error FS0010: Incomplete structured construct at or before this point in expression - -neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression diff --git a/tests/fsharp/typecheck/sigs/neg83.vsbsl b/tests/fsharp/typecheck/sigs/neg83.vsbsl index 69d51b3c898..9f6c89db45a 100644 --- a/tests/fsharp/typecheck/sigs/neg83.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg83.vsbsl @@ -1,12 +1,12 @@ +neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression + neg83.fsx(13,1,13,2): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:9). Try indenting this token further or using standard formatting conventions. neg83.fsx(16,1,16,1): parse error FS0010: Incomplete structured construct at or before this point in expression neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression -neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression - neg83.fsx(13,1,13,2): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:9). Try indenting this token further or using standard formatting conventions. neg83.fsx(16,1,16,1): parse error FS0010: Incomplete structured construct at or before this point in expression diff --git a/vsintegration/tests/unittests/DocumentHighlightsServiceTests.fs b/vsintegration/tests/unittests/DocumentHighlightsServiceTests.fs index 35e6b5f2464..4d2b177d5d2 100644 --- a/vsintegration/tests/unittests/DocumentHighlightsServiceTests.fs +++ b/vsintegration/tests/unittests/DocumentHighlightsServiceTests.fs @@ -44,6 +44,7 @@ let internal options = { UseScriptResolutionRules = false LoadTime = DateTime.MaxValue UnresolvedReferences = None + OriginalLoadReferences = [] ExtraProjectInfo = None } From 10de6d36c582d89f0cb384416851aec3c7cb1c77 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 28 Dec 2016 17:15:41 +0000 Subject: [PATCH 14/17] fix tests --- src/fsharp/fsc.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 73252a7d130..682ce6b9e69 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -139,7 +139,7 @@ type InProcErrorLoggerProvider() = { new ErrorLoggerUpToMaxErrors(tcConfigBuilder, exiter, "InProcCompilerErrorLoggerUpToMaxErrors") with member this.HandleTooManyErrors(text) = warnings.Add(Diagnostic.Short(false, text)) member this.HandleIssue(tcConfigBuilder, err, isError) = - let errs = CollectDiagnostic(tcConfigBuilder.implicitIncludeDir, tcConfigBuilder.showFullPaths, tcConfigBuilder.flatErrors, tcConfigBuilder.errorStyle, not isError, err) + let errs = CollectDiagnostic(tcConfigBuilder.implicitIncludeDir, tcConfigBuilder.showFullPaths, tcConfigBuilder.flatErrors, tcConfigBuilder.errorStyle, isError, err) let container = if isError then errors else warnings container.AddRange(errs) } :> ErrorLogger } From bdf93f869fb56e3bf71b5fa03ef6e4c3f8993dc4 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 28 Dec 2016 21:30:22 +0000 Subject: [PATCH 15/17] fix test --- .../Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx index 5ecbcf05084..1ed9611bb9d 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions #load "FunctionalLibrary01.fs";; #q;; -//Unexpected keyword 'end' in implementation file$ \ No newline at end of file +//Unexpected character '\?' in type name$ \ No newline at end of file From 3b6f5c4f08b65eb0c068de73391c570d533735c4 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 28 Dec 2016 23:17:51 +0000 Subject: [PATCH 16/17] test diagnostic --- .../tests/unittests/Tests.LanguageService.Completion.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/vsintegration/tests/unittests/Tests.LanguageService.Completion.fs b/vsintegration/tests/unittests/Tests.LanguageService.Completion.fs index db2a4d2211d..4e39334f916 100644 --- a/vsintegration/tests/unittests/Tests.LanguageService.Completion.fs +++ b/vsintegration/tests/unittests/Tests.LanguageService.Completion.fs @@ -4532,6 +4532,7 @@ let x = query { for bbbb in abbbbc(*D0*) do for completion in completions do let _,_,descfunc,_ = completion let desc = descfunc() + printfn "MemberInfoCompileErrorsShowInDataTip: desc = <<<%s>>>" desc AssertContains(desc,"Simulated compiler error") // Bunch of crud in empty list. This test asserts that unwanted things don't exist at the top level. From 462a3aed8bbd4917a90a805a39c58c3faec13e6c Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 29 Dec 2016 00:26:12 +0000 Subject: [PATCH 17/17] fix isError mistake and clarify namings Error --> Diagnostic --- src/fsharp/CompileOps.fs | 60 +++++++++---------- src/fsharp/CompileOps.fsi | 28 ++++----- src/fsharp/ErrorLogger.fs | 36 +++++++---- .../HashIfExpression.fs | 4 +- src/fsharp/fsc.fs | 2 +- src/fsharp/vs/IncrementalBuild.fs | 18 +++--- src/fsharp/vs/IncrementalBuild.fsi | 10 ++-- src/fsharp/vs/ServiceDeclarations.fs | 4 +- src/fsharp/vs/service.fs | 20 +++---- src/fsharp/vs/service.fsi | 2 +- 10 files changed, 100 insertions(+), 84 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index b2717021da1..6da1c78311d 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -107,7 +107,7 @@ exception HashLoadedSourceHasIssues of (*warnings*) exn list * (*errors*) exn li exception HashLoadedScriptConsideredSource of range -let GetRangeOfError(err:PhasedError) = +let GetRangeOfDiagnostic(err:PhasedDiagnostic) = let rec RangeFromException = function | ErrorFromAddingConstraint(_,err2,_) -> RangeFromException err2 #if EXTENSIONTYPING @@ -247,7 +247,7 @@ let GetRangeOfError(err:PhasedError) = RangeFromException err.Exception -let GetErrorNumber(err:PhasedError) = +let GetDiagnosticNumber(err:PhasedDiagnostic) = let rec GetFromException(e:exn) = match e with (* DO NOT CHANGE THESE NUMBERS *) @@ -400,7 +400,7 @@ let GetWarningLevel err = | _ -> 2 let warningOn err level specificWarnOn = - let n = GetErrorNumber err + let n = GetDiagnosticNumber err List.contains n specificWarnOn || // Some specific warnings are never on by default, i.e. unused variable warnings match n with @@ -408,7 +408,7 @@ let warningOn err level specificWarnOn = | 3180 -> false // abImplicitHeapAllocation - off by default | _ -> level >= GetWarningLevel err -let SplitRelatedErrors(err:PhasedError) = +let SplitRelatedDiagnostics(err:PhasedDiagnostic) = let ToPhased(e) = {Exception=e; Phase = err.Phase} let rec SplitRelatedException = function | UnresolvedOverloading(a,overloads,b,c) -> @@ -609,7 +609,7 @@ let getErrorString key = SR.GetString key let (|InvalidArgument|_|) (exn:exn) = match exn with :? ArgumentException as e -> Some e.Message | _ -> None -let OutputPhasedErrorR errorStyle (os:System.Text.StringBuilder) (err:PhasedError) = +let OutputPhasedErrorR errorStyle (os:System.Text.StringBuilder) (err:PhasedDiagnostic) = let rec OutputExceptionR (os:System.Text.StringBuilder) = function | ConstraintSolverTupleDiffLengths(_,tl1,tl2,m,m2) -> os.Append(ConstraintSolverTupleDiffLengthsE().Format tl1.Length tl2.Length) |> ignore @@ -1424,7 +1424,7 @@ let OutputPhasedErrorR errorStyle (os:System.Text.StringBuilder) (err:PhasedErro // remove any newlines and tabs -let OutputPhasedError errorStyle (os:System.Text.StringBuilder) (err:PhasedError) (flattenErrors:bool) = +let OutputPhasedDiagnostic errorStyle (os:System.Text.StringBuilder) (err:PhasedDiagnostic) (flattenErrors:bool) = let buf = new System.Text.StringBuilder() OutputPhasedErrorR errorStyle buf err @@ -1477,7 +1477,7 @@ type Diagnostic = | Long of bool * DiagnosticDetailedInfo /// returns sequence that contains Diagnostic for the given error + Diagnostic for all related errors -let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError, err:PhasedError) = +let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError, err:PhasedDiagnostic) = let outputWhere (showFullPaths,errorStyle) m : DiagnosticLocation = if m = rangeStartup || m = rangeCmdArgs then { Range = m; TextRepresentation = ""; IsEmpty = true; File = "" } @@ -1533,7 +1533,7 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle let errors = ResizeArray() let report err = let OutputWhere(err) = - match GetRangeOfError err with + match GetRangeOfDiagnostic err with | Some m -> Some(outputWhere (showFullPaths,errorStyle) m) | None -> None @@ -1545,27 +1545,27 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle | _ -> sprintf "%s FS%04d: " (if isError then "error" else "warning") errorNumber { ErrorNumber = errorNumber; Subcategory = subcategory; TextRepresentation = text} - let mainError,relatedErrors = SplitRelatedErrors err + let mainError,relatedErrors = SplitRelatedDiagnostics err let where = OutputWhere(mainError) - let canonical = OutputCanonicalInformation(err.Subcategory(),GetErrorNumber mainError) + let canonical = OutputCanonicalInformation(err.Subcategory(),GetDiagnosticNumber mainError) let message = let os = System.Text.StringBuilder() - OutputPhasedError errorStyle os mainError flattenErrors + OutputPhasedDiagnostic errorStyle os mainError flattenErrors os.ToString() let entry : DiagnosticDetailedInfo = { Location = where; Canonical = canonical; Message = message } errors.Add ( Diagnostic.Long(isError, entry ) ) - let OutputRelatedError(err:PhasedError) = + let OutputRelatedError(err:PhasedDiagnostic) = match errorStyle with // Give a canonical string when --vserror. | ErrorStyle.VSErrors -> let relWhere = OutputWhere(mainError) // mainError? - let relCanonical = OutputCanonicalInformation(err.Subcategory(),GetErrorNumber mainError) // Use main error for code + let relCanonical = OutputCanonicalInformation(err.Subcategory(),GetDiagnosticNumber mainError) // Use main error for code let relMessage = let os = System.Text.StringBuilder() - OutputPhasedError errorStyle os err flattenErrors + OutputPhasedDiagnostic errorStyle os err flattenErrors os.ToString() let entry : DiagnosticDetailedInfo = { Location = relWhere; Canonical = relCanonical; Message = relMessage} @@ -1573,7 +1573,7 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle | _ -> let os = System.Text.StringBuilder() - OutputPhasedError errorStyle os err flattenErrors + OutputPhasedDiagnostic errorStyle os err flattenErrors errors.Add( Diagnostic.Short(isError, os.ToString()) ) relatedErrors |> List.iter OutputRelatedError @@ -1592,7 +1592,7 @@ let CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle /// used by fsc.exe and fsi.exe, but not by VS /// prints error and related errors to the specified StringBuilder -let rec OutputDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError) os (err:PhasedError) = +let rec OutputDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError) os (err:PhasedDiagnostic) = let errors = CollectDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorStyle,isError, err) for e in errors do @@ -1608,7 +1608,7 @@ let rec OutputDiagnostic (implicitIncludeDir,showFullPaths,flattenErrors,errorSt os.Append( details.Message ) |> ignore let OutputDiagnosticContext prefix fileLineFn os err = - match GetRangeOfError err with + match GetRangeOfDiagnostic err with | None -> () | Some m -> let filename = m.FileName @@ -3065,14 +3065,14 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = let ReportWarning (globalWarnLevel : int, specificWarnOff : int list, specificWarnOn : int list) err = - let n = GetErrorNumber err + let n = GetDiagnosticNumber err warningOn err globalWarnLevel specificWarnOn && not (List.contains n specificWarnOff) let ReportWarningAsError (globalWarnLevel : int, specificWarnOff : int list, specificWarnOn : int list, specificWarnAsError : int list, specificWarnAsWarn : int list, globalWarnAsError : bool) err = warningOn err globalWarnLevel specificWarnOn && - not (List.contains (GetErrorNumber err) specificWarnAsWarn) && - ((globalWarnAsError && not (List.contains (GetErrorNumber err) specificWarnOff)) || - List.contains (GetErrorNumber err) specificWarnAsError) + not (List.contains (GetDiagnosticNumber err) specificWarnAsWarn) && + ((globalWarnAsError && not (List.contains (GetDiagnosticNumber err) specificWarnOff)) || + List.contains (GetDiagnosticNumber err) specificWarnAsError) //---------------------------------------------------------------------------- // Scoped #nowarn pragmas @@ -3112,8 +3112,8 @@ type ErrorLoggerFilteringByScopedPragmas (checkFile, scopedPragmas, errorLogger: errorLogger.DiagnosticSink (phasedError,isError) else let report = - let warningNum = GetErrorNumber phasedError - match GetRangeOfError phasedError with + let warningNum = GetDiagnosticNumber phasedError + match GetRangeOfDiagnostic phasedError with | Some m -> not (scopedPragmas |> List.exists (fun pragma -> match pragma with @@ -4689,8 +4689,8 @@ let GetAssemblyResolutionInformation(tcConfig : TcConfig) = type LoadClosureInput = { FileName: string SyntaxTree: ParsedInput option - ParseDiagnostics: (PhasedError * bool) list - MetaCommandDiagnostics: (PhasedError * bool) list } + ParseDiagnostics: (PhasedDiagnostic * bool) list + MetaCommandDiagnostics: (PhasedDiagnostic * bool) list } [] type LoadClosure = @@ -4707,11 +4707,11 @@ type LoadClosure = /// The #nowarns NoWarns: (string * range list) list /// Diagnostics seen while processing resolutions - ResolutionDiagnostics : (PhasedError * bool) list + ResolutionDiagnostics : (PhasedDiagnostic * bool) list /// Diagnostics seen while parsing root of closure - AllRootFileDiagnostics : (PhasedError * bool) list + AllRootFileDiagnostics : (PhasedDiagnostic * bool) list /// Diagnostics seen while processing the compiler options implied root of closure - LoadClosureRootFileDiagnostics : (PhasedError * bool) list } + LoadClosureRootFileDiagnostics : (PhasedDiagnostic * bool) list } [] @@ -4728,7 +4728,7 @@ module private ScriptPreprocessClosure = type ClosureSource = ClosureSource of filename: string * referenceRange: range * sourceText: string * parseRequired: bool /// Represents an output of the closure finding process - type ClosureFile = ClosureFile of string * range * ParsedInput option * (PhasedError * bool) list * (PhasedError * bool) list * (string * range) list // filename, range, errors, warnings, nowarns + type ClosureFile = ClosureFile of string * range * ParsedInput option * (PhasedDiagnostic * bool) list * (PhasedDiagnostic * bool) list * (string * range) list // filename, range, errors, warnings, nowarns type Observed() = let seen = System.Collections.Generic.Dictionary<_,bool>() @@ -4902,7 +4902,7 @@ module private ScriptPreprocessClosure = | _ -> [], [] // When no file existed. let isRootRange exn = - match GetRangeOfError exn with + match GetRangeOfDiagnostic exn with | Some m -> // Return true if the error was *not* from a #load-ed file. let isArgParameterWhileNotEditing = (codeContext <> CodeContext.Editing) && (m = range0 || m = rangeStartup || m = rangeCmdArgs) diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index dd40e83cb11..7903657538e 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -74,22 +74,22 @@ val ParseInput : (UnicodeLexing.Lexbuf -> Parser.token) * ErrorLogger * UnicodeL //-------------------------------------------------------------------------- /// Get the location associated with an error -val GetRangeOfError : PhasedError -> range option +val GetRangeOfDiagnostic : PhasedDiagnostic -> range option /// Get the number associated with an error -val GetErrorNumber : PhasedError -> int +val GetDiagnosticNumber : PhasedDiagnostic -> int /// Split errors into a "main" error and a set of associated errors -val SplitRelatedErrors : PhasedError -> PhasedError * PhasedError list +val SplitRelatedDiagnostics : PhasedDiagnostic -> PhasedDiagnostic * PhasedDiagnostic list /// Output an error to a buffer -val OutputPhasedError : ErrorLogger.ErrorStyle -> StringBuilder -> PhasedError -> bool -> unit +val OutputPhasedDiagnostic : ErrorStyle -> StringBuilder -> PhasedDiagnostic -> isError: bool -> unit /// Output an error or warning to a buffer -val OutputDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * isError:bool -> StringBuilder -> PhasedError -> unit +val OutputDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * isError:bool -> StringBuilder -> PhasedDiagnostic -> unit /// Output extra context information for an error or warning to a buffer -val OutputDiagnosticContext : prefix:string -> fileLineFunction:(string -> int -> string) -> StringBuilder -> PhasedError -> unit +val OutputDiagnosticContext : prefix:string -> fileLineFunction:(string -> int -> string) -> StringBuilder -> PhasedDiagnostic -> unit /// Part of LegacyHostedCompilerForTesting [] @@ -120,7 +120,7 @@ type Diagnostic = | Long of bool * DiagnosticDetailedInfo /// Part of LegacyHostedCompilerForTesting -val CollectDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool * PhasedError -> seq +val CollectDiagnostic : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool * PhasedDiagnostic -> seq //---------------------------------------------------------------------------- // Resolve assembly references @@ -722,10 +722,10 @@ val TypeCheckOneInputAndFinishEventually : -> Eventually<(TcEnv * TopAttribs * TypedImplFile list) * TcState> /// Indicates if we should report a warning -val ReportWarning : globalWarnLevel: int * specificWarnOff: int list * specificWarnOn: int list -> PhasedError -> bool +val ReportWarning : globalWarnLevel: int * specificWarnOff: int list * specificWarnOn: int list -> PhasedDiagnostic -> bool /// Indicates if we should report a warning as an error -val ReportWarningAsError : globalWarnLevel: int * specificWarnOff: int list * specificWarnOn: int list * specificWarnAsError: int list * specificWarnAsWarn: int list * globalWarnAsError: bool -> PhasedError -> bool +val ReportWarningAsError : globalWarnLevel: int * specificWarnOff: int list * specificWarnOn: int list * specificWarnAsError: int list * specificWarnAsWarn: int list * globalWarnAsError: bool -> PhasedDiagnostic -> bool //---------------------------------------------------------------------------- // #load closure @@ -741,8 +741,8 @@ type CodeContext = type LoadClosureInput = { FileName: string SyntaxTree: ParsedInput option - ParseDiagnostics: (PhasedError * bool) list - MetaCommandDiagnostics: (PhasedError * bool) list } + ParseDiagnostics: (PhasedDiagnostic * bool) list + MetaCommandDiagnostics: (PhasedDiagnostic * bool) list } [] @@ -766,13 +766,13 @@ type LoadClosure = NoWarns: (string * range list) list /// Diagnostics seen while processing resolutions - ResolutionDiagnostics : (PhasedError * bool) list + ResolutionDiagnostics : (PhasedDiagnostic * bool) list /// Diagnostics to show for root of closure (used by fsc.fs) - AllRootFileDiagnostics : (PhasedError * bool) list + AllRootFileDiagnostics : (PhasedDiagnostic * bool) list /// Diagnostics seen while processing the compiler options implied root of closure - LoadClosureRootFileDiagnostics : (PhasedError * bool) list } + LoadClosureRootFileDiagnostics : (PhasedDiagnostic * bool) list } // Used from service.fs, when editing a script file static member ComputeClosureOfSourceText : referenceResolver: ReferenceResolver.Resolver * filename: string * source: string * implicitDefines:CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) * assumeDotNetFramework : bool -> LoadClosure diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index a2110a38601..3c79aaabf25 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -176,9 +176,10 @@ module BuildPhaseSubcategory = let Internal = "internal" // Compiler ICE [] -type PhasedError = { Exception:exn; Phase:BuildPhase } with +type PhasedDiagnostic = + { Exception:exn; Phase:BuildPhase } /// Construct a phased error - static member Create(exn:exn,phase:BuildPhase) : PhasedError = + static member Create(exn:exn,phase:BuildPhase) : PhasedDiagnostic = System.Diagnostics.Debug.Assert(phase<>BuildPhase.DefaultPhase, sprintf "Compile error seen with no phase to attribute it to.%A %s %s" phase exn.Message exn.StackTrace ) {Exception = exn; Phase=phase} member this.DebugDisplay() = @@ -236,9 +237,9 @@ type PhasedError = { Exception:exn; Phase:BuildPhase } with // Sanity check ensures that Phase matches Subcategory #if DEBUG if isPhaseInCompile then - System.Diagnostics.Debug.Assert(PhasedError.IsSubcategoryOfCompile(pe.Subcategory()), "Subcategory did not match isPhaesInCompile=true") + System.Diagnostics.Debug.Assert(PhasedDiagnostic.IsSubcategoryOfCompile(pe.Subcategory()), "Subcategory did not match isPhaesInCompile=true") else - System.Diagnostics.Debug.Assert(not(PhasedError.IsSubcategoryOfCompile(pe.Subcategory())), "Subcategory did not match isPhaseInCompile=false") + System.Diagnostics.Debug.Assert(not(PhasedDiagnostic.IsSubcategoryOfCompile(pe.Subcategory())), "Subcategory did not match isPhaseInCompile=false") #endif isPhaseInCompile @@ -248,7 +249,7 @@ type ErrorLogger(nameForDebugging:string) = abstract ErrorCount: int // The 'Impl' factoring enables a developer to place a breakpoint at the non-Impl // code just below and get a breakpoint for all error logger implementations. - abstract DiagnosticSink: phasedError: PhasedError * isError: bool -> unit + abstract DiagnosticSink: phasedError: PhasedDiagnostic * isError: bool -> unit member this.DebugDisplay() = sprintf "ErrorLogger(%s)" nameForDebugging let DiscardErrorsLogger = @@ -337,12 +338,27 @@ module ErrorLoggerExtensions = #endif type ErrorLogger with - member x.ErrorR exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.DiagnosticSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase), true) - member x.Warning exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.DiagnosticSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase), false) - member x.Error exn = x.ErrorR exn; raise (ReportedError (Some exn)) - member x.PhasedError (ph:PhasedError) = + + member x.ErrorR exn = + match exn with + | StopProcessing + | ReportedError _ -> raise exn + | _ -> x.DiagnosticSink(PhasedDiagnostic.Create(exn,CompileThreadStatic.BuildPhase), true) + + member x.Warning exn = + match exn with + | StopProcessing + | ReportedError _ -> raise exn + | _ -> x.DiagnosticSink(PhasedDiagnostic.Create(exn,CompileThreadStatic.BuildPhase), false) + + member x.Error exn = + x.ErrorR exn + raise (ReportedError (Some exn)) + + member x.SimulateError (ph:PhasedDiagnostic) = x.DiagnosticSink (ph, true) raise (ReportedError (Some ph.Exception)) + member x.ErrorRecovery (exn:exn) (m:range) = // Never throws ReportedError. // Throws StopProcessing and exceptions raised by the DiagnosticSink(exn) handler. @@ -405,7 +421,7 @@ let errorR exn = CompileThreadStatic.ErrorLogger.ErrorR exn let warning exn = CompileThreadStatic.ErrorLogger.Warning exn let error exn = CompileThreadStatic.ErrorLogger.Error exn // for test only -let phasedError (p : PhasedError) = CompileThreadStatic.ErrorLogger.PhasedError p +let simulateError (p : PhasedDiagnostic) = CompileThreadStatic.ErrorLogger.SimulateError p let diagnosticSink (phasedError, isError) = CompileThreadStatic.ErrorLogger.DiagnosticSink (phasedError, isError) let errorSink pe = diagnosticSink (pe, true) diff --git a/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs b/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs index 9534ccd0c19..2618b478442 100644 --- a/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs +++ b/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs @@ -48,8 +48,8 @@ type HashIfExpression() = sb.ToString () let createParser () = - let errors = ResizeArray() - let warnings = ResizeArray() + let errors = ResizeArray() + let warnings = ResizeArray() let errorLogger = { diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 682ce6b9e69..32233b5a577 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -71,7 +71,7 @@ type ErrorLoggerUpToMaxErrors(tcConfigB: TcConfigBuilder, exiter: Exiter, nameFo let mutable errors = 0 /// Called when an error or warning occurs - abstract HandleIssue: tcConfigB: TcConfigBuilder * error: PhasedError * isError: bool -> unit + abstract HandleIssue: tcConfigB: TcConfigBuilder * error: PhasedDiagnostic * isError: bool -> unit /// Called when 'too many errors' has occured abstract HandleTooManyErrors: text: string -> unit diff --git a/src/fsharp/vs/IncrementalBuild.fs b/src/fsharp/vs/IncrementalBuild.fs index 0737c2a8627..6b24dfea898 100755 --- a/src/fsharp/vs/IncrementalBuild.fs +++ b/src/fsharp/vs/IncrementalBuild.fs @@ -970,16 +970,16 @@ type FSharpErrorInfo(fileName, s:pos, e:pos, severity: FSharpErrorSeverity, mess override __.ToString()= sprintf "%s (%d,%d)-(%d,%d) %s %s %s" fileName (int s.Line) (s.Column + 1) (int e.Line) (e.Column + 1) subcategory (if severity=FSharpErrorSeverity.Warning then "warning" else "error") message /// Decompose a warning or error into parts: position, severity, message, error number - static member (*internal*) CreateFromException(exn,warn,trim:bool,fallbackRange:range) = - let m = match GetRangeOfError exn with Some m -> m | None -> fallbackRange + static member (*internal*) CreateFromException(exn, isError, trim:bool, fallbackRange:range) = + let m = match GetRangeOfDiagnostic exn with Some m -> m | None -> fallbackRange let e = if trim then m.Start else m.End - let msg = bufs (fun buf -> OutputPhasedError ErrorLogger.ErrorStyle.DefaultErrors buf exn false) - let errorNum = GetErrorNumber exn - FSharpErrorInfo(m.FileName, m.Start, e, (if warn then FSharpErrorSeverity.Warning else FSharpErrorSeverity.Error), msg, exn.Subcategory(), errorNum) + let msg = bufs (fun buf -> OutputPhasedDiagnostic ErrorLogger.ErrorStyle.DefaultErrors buf exn false) + let errorNum = GetDiagnosticNumber exn + FSharpErrorInfo(m.FileName, m.Start, e, (if isError then FSharpErrorSeverity.Error else FSharpErrorSeverity.Warning), msg, exn.Subcategory(), errorNum) /// Decompose a warning or error into parts: position, severity, message, error number - static member internal CreateFromExceptionAndAdjustEof(exn,warn,trim:bool,fallbackRange:range, (linesCount:int, lastLength:int)) = - let r = FSharpErrorInfo.CreateFromException(exn,warn,trim,fallbackRange) + static member internal CreateFromExceptionAndAdjustEof(exn, isError, trim:bool, fallbackRange:range, (linesCount:int, lastLength:int)) = + let r = FSharpErrorInfo.CreateFromException(exn,isError,trim,fallbackRange) // Adjust to make sure that errors reported at Eof are shown at the linesCount let startline, schange = min (r.StartLineAlternate, false) (linesCount, true) @@ -1101,7 +1101,7 @@ type TypeCheckAccumulator = tcSymbolUses: TcSymbolUses list topAttribs:TopAttribs option typedImplFiles:TypedImplFile list - tcErrors:(PhasedError * FSharpErrorSeverity) list } // errors=true, warnings=false + tcErrors:(PhasedDiagnostic * FSharpErrorSeverity) list } // errors=true, warnings=false /// Global service state @@ -1189,7 +1189,7 @@ type PartialCheckResults = TcGlobals: TcGlobals TcConfig: TcConfig TcEnvAtEnd: TcEnv - Errors: (PhasedError * FSharpErrorSeverity) list + Errors: (PhasedDiagnostic * FSharpErrorSeverity) list TcResolutions: TcResolutions list TcSymbolUses: TcSymbolUses list TopAttribs: TopAttribs option diff --git a/src/fsharp/vs/IncrementalBuild.fsi b/src/fsharp/vs/IncrementalBuild.fsi index 3dc578f3db3..3d36b5708e7 100755 --- a/src/fsharp/vs/IncrementalBuild.fsi +++ b/src/fsharp/vs/IncrementalBuild.fsi @@ -36,8 +36,8 @@ type internal FSharpErrorInfo = member Message:string member Subcategory:string member ErrorNumber:int - static member internal CreateFromExceptionAndAdjustEof : PhasedError * bool * bool * range * lastPosInFile:(int*int) -> FSharpErrorInfo - static member internal CreateFromException : PhasedError * bool * bool * range -> FSharpErrorInfo + static member internal CreateFromExceptionAndAdjustEof : PhasedDiagnostic * isError: bool * trim: bool * range * lastPosInFile:(int*int) -> FSharpErrorInfo + static member internal CreateFromException : PhasedDiagnostic * isError: bool * trim: bool * range -> FSharpErrorInfo // Implementation details used by other code in the compiler [] @@ -75,7 +75,7 @@ type internal CompilationErrorLogger = new : debugName:string * tcConfig:TcConfig -> CompilationErrorLogger /// Get the captured errors - member GetErrors : unit -> (PhasedError * FSharpErrorSeverity) list + member GetErrors : unit -> (PhasedDiagnostic * FSharpErrorSeverity) list /// Represents the state in the incremental graph assocaited with checking a file type internal PartialCheckResults = @@ -89,7 +89,7 @@ type internal PartialCheckResults = TcEnvAtEnd : TypeChecker.TcEnv /// Represents the collected errors from type checking - Errors : (PhasedError * FSharpErrorSeverity) list + Errors : (PhasedDiagnostic * FSharpErrorSeverity) list /// Represents the collected name resolutions from type checking TcResolutions: TcResolutions list @@ -186,7 +186,7 @@ type internal IncrementalBuilder = /// Await the untyped parse results for a particular slot in the vector of parse results. /// /// This may be a marginally long-running operation (parses are relatively quick, only one file needs to be parsed) - member GetParseResultsForFile : filename:string * ct: CancellationToken -> Ast.ParsedInput option * Range.range * string * (PhasedError * FSharpErrorSeverity) list + member GetParseResultsForFile : filename:string * ct: CancellationToken -> Ast.ParsedInput option * Range.range * string * (PhasedDiagnostic * FSharpErrorSeverity) list static member TryCreateBackgroundBuilderForProjectOptions : ReferenceResolver.Resolver * FrameworkImportsCache * scriptClosureOptions:LoadClosure option * sourceFiles:string list * commandLineArgs:string list * projectReferences: IProjectReference list * projectDirectory:string * useScriptResolutionRules:bool * keepAssemblyContents: bool * keepAllBackgroundResolutions: bool -> IncrementalBuilder option * FSharpErrorInfo list diff --git a/src/fsharp/vs/ServiceDeclarations.fs b/src/fsharp/vs/ServiceDeclarations.fs index 4f6b4bc9091..ae2b577ec11 100644 --- a/src/fsharp/vs/ServiceDeclarations.fs +++ b/src/fsharp/vs/ServiceDeclarations.fs @@ -435,8 +435,8 @@ module internal ItemDescriptionsImpl = ToolTipFault |> Option.iter (fun msg -> let exn = Error((0,msg),range.Zero) - let ph = PhasedError.Create(exn, BuildPhase.TypeCheck) - phasedError ph) + let ph = PhasedDiagnostic.Create(exn, BuildPhase.TypeCheck) + simulateError ph) FSharpToolTipElement.Group(minfos |> List.map formatOne) diff --git a/src/fsharp/vs/service.fs b/src/fsharp/vs/service.fs index 532a719c028..b01b8876c7a 100755 --- a/src/fsharp/vs/service.fs +++ b/src/fsharp/vs/service.fs @@ -1453,25 +1453,25 @@ module internal Parser = lastLine, lastLineLength let ReportError (tcConfig:TcConfig, allErrors, mainInputFileName, fileInfo, (exn, sev)) = - [ let warn = (sev = FSharpErrorSeverity.Warning) && not (ReportWarningAsError (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn, tcConfig.specificWarnAsError, tcConfig.specificWarnAsWarn, tcConfig.globalWarnAsError) exn) - if (not warn || ReportWarning (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn) exn) then + [ let isError = (sev = FSharpErrorSeverity.Error) || ReportWarningAsError (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn, tcConfig.specificWarnAsError, tcConfig.specificWarnAsWarn, tcConfig.globalWarnAsError) exn + if (isError || ReportWarning (tcConfig.globalWarnLevel, tcConfig.specificWarnOff, tcConfig.specificWarnOn) exn) then let oneError trim exn = [ // We use the first line of the file as a fallbackRange for reporting unexpected errors. // Not ideal, but it's hard to see what else to do. let fallbackRange = rangeN mainInputFileName 1 - let ei = FSharpErrorInfo.CreateFromExceptionAndAdjustEof(exn,warn,trim,fallbackRange,fileInfo) + let ei = FSharpErrorInfo.CreateFromExceptionAndAdjustEof (exn, isError, trim, fallbackRange, fileInfo) if allErrors || (ei.FileName=mainInputFileName) || (ei.FileName=Microsoft.FSharp.Compiler.TcGlobals.DummyFileNameForRangesWithoutASpecificLocation) then yield ei ] - let mainError,relatedErrors = SplitRelatedErrors exn + let mainError,relatedErrors = SplitRelatedDiagnostics exn yield! oneError false mainError for e in relatedErrors do yield! oneError true e ] let CreateErrorInfos (tcConfig:TcConfig, allErrors, mainInputFileName, errors) = let fileInfo = (Int32.MaxValue, Int32.MaxValue) - [| for (exn,warn) in errors do - yield! ReportError (tcConfig, allErrors, mainInputFileName, fileInfo, (exn, warn)) |] + [| for (exn,isError) in errors do + yield! ReportError (tcConfig, allErrors, mainInputFileName, fileInfo, (exn, isError)) |] /// Error handler for parsing & type checking while processing a single file @@ -1484,7 +1484,7 @@ module internal Parser = let fileInfo = GetFileInfoForLastLineErrors source // This function gets called whenever an error happens during parsing or checking - let diagnosticSink sev (exn:PhasedError) = + let diagnosticSink sev (exn:PhasedDiagnostic) = // Sanity check here. The phase of an error should be in a phase known to the language service. let exn = if not(exn.IsPhaseInCompile()) then @@ -1628,7 +1628,7 @@ module internal Parser = tcState: TcState, loadClosure: LoadClosure option, // These are the errors and warnings seen by the background compiler for the entire antecedant - backgroundDiagnostics: (PhasedError * FSharpErrorSeverity) list, + backgroundDiagnostics: (PhasedDiagnostic * FSharpErrorSeverity) list, reactorOps: IReactorOperations, // Used by 'FSharpDeclarationListInfo' to check the IncrementalBuilder is still alive. checkAlive : (unit -> bool), @@ -1668,7 +1668,7 @@ module internal Parser = // If there was a loadClosure, replay the errors and warnings from resolution, excluding parsing loadClosure.LoadClosureRootFileDiagnostics |> List.iter diagnosticSink - let fileOfBackgroundError err = (match GetRangeOfError (fst err) with Some m-> m.FileName | None -> null) + let fileOfBackgroundError err = (match GetRangeOfDiagnostic (fst err) with Some m-> m.FileName | None -> null) let sameFile file hashLoadInFile = (0 = String.Compare(hashLoadInFile, file, StringComparison.OrdinalIgnoreCase)) @@ -2849,7 +2849,7 @@ module CompilerEnvironment = /// Return true if this is a subcategory of error or warning message that the language service can emit let IsCheckerSupportedSubcategory(subcategory:string) = // Beware: This code logic is duplicated in DocumentTask.cs in the language service - PhasedError.IsSubcategoryOfCompile(subcategory) + PhasedDiagnostic.IsSubcategoryOfCompile(subcategory) /// Information about the debugging environment module DebuggerEnvironment = diff --git a/src/fsharp/vs/service.fsi b/src/fsharp/vs/service.fsi index f0cc3d0c843..9d780d065f5 100755 --- a/src/fsharp/vs/service.fsi +++ b/src/fsharp/vs/service.fsi @@ -602,7 +602,7 @@ type internal FSharpChecker = type internal FsiInteractiveChecker = internal new : ops: IReactorOperations * tcConfig: TcConfig * tcGlobals: TcGlobals * tcImports: TcImports * tcState: TcState * loadClosure: LoadClosure option -> FsiInteractiveChecker member internal ParseAndCheckInteraction : source:string -> FSharpParseFileResults * FSharpCheckFileResults * FSharpCheckProjectResults - static member internal CreateErrorInfos : tcConfig: TcConfig * allErrors:bool * mainInputFileName : string * seq -> FSharpErrorInfo[] + static member internal CreateErrorInfos : tcConfig: TcConfig * allErrors:bool * mainInputFileName : string * seq -> FSharpErrorInfo[] /// Information about the compilation environment []