diff --git a/FSharp.sln b/FSharp.sln index f76f0a7f2c8..be0a3252640 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -196,16 +196,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 @@ -245,7 +235,6 @@ 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} EndGlobalSection diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index fd56e8a1a7f..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 @@ -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,isError, err:PhasedDiagnostic) = + let outputWhere (showFullPaths,errorStyle) m : DiagnosticLocation = if m = rangeStartup || m = rangeCmdArgs then { Range = m; TextRepresentation = ""; IsEmpty = true; File = "" } else @@ -1533,48 +1533,48 @@ let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorS 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 - let OutputCanonicalInformation(subcategory, errorNumber) : CanonicalInformation = + let OutputCanonicalInformation(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. - | 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 + 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 : 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(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 : 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 (isError, entry) ) | _ -> let os = System.Text.StringBuilder() - OutputPhasedError errorStyle os err flattenErrors - errors.Add( ErrorOrWarning.Short((not warn), os.ToString()) ) + OutputPhasedDiagnostic errorStyle os err flattenErrors + errors.Add( Diagnostic.Short(isError, os.ToString()) ) relatedErrors |> List.iter OutputRelatedError @@ -1592,23 +1592,23 @@ 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,isError) os (err:PhasedDiagnostic) = - let errors = CollectErrorOrWarning (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 - | 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 = - match GetRangeOfError err with +let OutputDiagnosticContext prefix fileLineFn os err = + match GetRangeOfDiagnostic err with | None -> () | Some m -> let filename = m.FileName @@ -2953,7 +2953,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 @@ -3000,7 +3000,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)) @@ -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 @@ -3104,16 +3104,16 @@ 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 = GetDiagnosticNumber phasedError + match GetRangeOfDiagnostic phasedError with | Some m -> not (scopedPragmas |> List.exists (fun pragma -> match pragma with @@ -3122,27 +3122,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,false) + + 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 @@ -3309,10 +3295,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 @@ -3325,13 +3311,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 @@ -4698,6 +4684,14 @@ let GetAssemblyResolutionInformation(tcConfig : TcConfig) = let resolutions = TcAssemblyResolutions.Resolve(tcConfig,assemblyList,[]) resolutions.GetAssemblyResolutions(),resolutions.GetUnresolvedReferences() + +[] +type LoadClosureInput = + { FileName: string + SyntaxTree: ParsedInput option + ParseDiagnostics: (PhasedDiagnostic * bool) list + MetaCommandDiagnostics: (PhasedDiagnostic * bool) list } + [] type LoadClosure = { /// The source files along with the ranges of the #load positions in each file. @@ -4707,17 +4701,17 @@ 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 - ResolutionErrors : PhasedError list - /// Warnings seen while processing resolutions - ResolutionWarnings : PhasedError list - /// Errors seen while parsing root of closure - RootErrors : PhasedError list - /// Warnings seen while parsing root of closure - RootWarnings : PhasedError list } + /// Diagnostics seen while processing resolutions + ResolutionDiagnostics : (PhasedDiagnostic * bool) list + /// Diagnostics seen while parsing root of closure + AllRootFileDiagnostics : (PhasedDiagnostic * bool) list + /// Diagnostics seen while processing the compiler options implied root of closure + LoadClosureRootFileDiagnostics : (PhasedDiagnostic * bool) list } [] @@ -4734,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 list * PhasedError 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>() @@ -4830,18 +4824,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, parseDiagnostics = + let errorLogger = CapturingErrorLogger("FindClosureParse") + use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) + let result = ParseScriptText(filename,source,!tcConfig,codeContext,lexResourceManager,errorLogger) + result, errorLogger.Diagnostics + + match parseResult with | Some parsedScriptAst -> + let errorLogger = CapturingErrorLogger("FindClosureMetaCommands") + use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> errorLogger) + let pathOfMetaCommandSource = Path.GetDirectoryName(filename) let preSources = (!tcConfig).GetAvailableLoadedSources() let tcConfigResult, noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn !tcConfig (parsedScriptAst,pathOfMetaCommandSource) @@ -4861,11 +4854,11 @@ module private ScriptPreprocessClosure = 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, parseDiagnostics, errorLogger.Diagnostics, !noWarns) | None -> //printfn "yielding source %s (failed parse)" filename - yield ClosureFile(filename, m, None, !errors, !warnings, []) + yield ClosureFile(filename, m, None, parseDiagnostics, [], []) else // Don't traverse into .fs leafs. //printfn "yielding non-script source %s" filename @@ -4882,38 +4875,34 @@ 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,_))), 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,errs,warns,_nowarns)) in closureFiles -> (filename,input,errs,warns) ] + 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 rootErrors, rootWarnings = + let loadClosureRootDiagnostics, allRootDiagnostics = match List.rev closureFiles with - | ClosureFile(_,_,_,errors,warnings,_) :: _ -> errors @ !resolutionErrors, warnings @ !resolutionWarnings - | _ -> [],[] // When no file existed. + | ClosureFile(_,_,_,parseDiagnostics,metaDiagnostics,_) :: _ -> + (metaDiagnostics @ resolutionDiagnostics), + (parseDiagnostics @ metaDiagnostics @ resolutionDiagnostics) + | _ -> [], [] // 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) @@ -4922,8 +4911,7 @@ 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 allRootDiagnostics = allRootDiagnostics |> List.filter (fst >> isRootRange) let result : LoadClosure = { SourceFiles = List.groupByFirst sourceFiles @@ -4931,10 +4919,10 @@ module private ScriptPreprocessClosure = UnresolvedReferences = unresolvedReferences Inputs = sourceInputs NoWarns = List.groupByFirst globalNoWarns - ResolutionErrors = !resolutionErrors - ResolutionWarnings = !resolutionWarnings - RootErrors = rootErrors - RootWarnings = rootWarnings} + OriginalLoadReferences = tcConfig.loadedSources + ResolutionDiagnostics = resolutionDiagnostics + AllRootFileDiagnostics = allRootDiagnostics + LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics } result diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index bca3ff0cb98..7903657538e 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -74,48 +74,53 @@ 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 OutputErrorOrWarning : 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 -> PhasedDiagnostic -> 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 -> PhasedDiagnostic -> 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 * PhasedDiagnostic -> seq //---------------------------------------------------------------------------- // Resolve assembly references @@ -717,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 @@ -732,6 +737,14 @@ type CodeContext = | Compilation | Editing +[] +type LoadClosureInput = + { FileName: string + SyntaxTree: ParsedInput option + ParseDiagnostics: (PhasedDiagnostic * bool) list + MetaCommandDiagnostics: (PhasedDiagnostic * bool) list } + + [] type LoadClosure = { /// The source files along with the ranges of the #load positions in each file. @@ -740,26 +753,26 @@ 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 - /// Errors seen while processing resolutions - ResolutionErrors : PhasedError list - - /// Warnings seen while processing resolutions - ResolutionWarnings : PhasedError list + /// Diagnostics seen while processing resolutions + ResolutionDiagnostics : (PhasedDiagnostic * bool) list - /// *Parse* errors seen while parsing root of closure - RootErrors : PhasedError list + /// Diagnostics to show for root of closure (used by fsc.fs) + AllRootFileDiagnostics : (PhasedDiagnostic * bool) list - /// *Parse* warnings seen while parsing root of closure - RootWarnings : PhasedError list } + /// Diagnostics seen while processing the compiler options implied root of closure + 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/CompileOptions.fs b/src/fsharp/CompileOptions.fs index f36d8f7c12c..032fe555d27 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -1350,7 +1350,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 @@ -1367,7 +1367,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 bdd4b8ab505..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,39 +249,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: PhasedDiagnostic * 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 } + member x.DiagnosticSink(phasedError,isError) = assert false; () + member x.ErrorCount = assert false; 0 } + +type CapturingErrorLogger(nm) = + inherit ErrorLogger(nm) + 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 = @@ -301,7 +296,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 @@ -343,15 +338,30 @@ 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.Error exn = x.ErrorR exn; raise (ReportedError (Some exn)) - member x.PhasedError (ph:PhasedError) = - x.ErrorSink ph + + 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 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 @@ -370,13 +380,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 @@ -395,8 +405,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 @@ -406,17 +415,17 @@ 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 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 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 @@ -439,8 +448,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..2618b478442 100644 --- a/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs +++ b/src/fsharp/FSharp.Compiler.Unittests/HashIfExpression.fs @@ -48,14 +48,13 @@ type HashIfExpression() = sb.ToString () let createParser () = - let errors = ResizeArray() - let warnings = ResizeArray() + let errors = ResizeArray() + let warnings = ResizeArray() 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 f45ce5a0133..32233b5a577 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: PhasedDiagnostic * 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, 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, 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.RootWarnings |> List.iter warnSink - closure.RootErrors |> 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 fab2fdca831..15fc5a4152a 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -445,12 +445,13 @@ 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 () -> + let isError = true + DoWithErrorColor isError (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,isError)) err; errorWriter.WriteLine() errorWriter.Flush())) @@ -476,30 +477,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) @@ -1198,28 +1198,27 @@ 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 // 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 (filename, input, errs, warns)-> - errs |> List.iter errorSink - warns |> List.iter warnSink + |> List.map (fun input-> + input.ParseDiagnostics |> List.iter diagnosticSink + input.MetaCommandDiagnostics |> List.iter diagnosticSink 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); @@ -2428,8 +2427,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 f5ba7d69038..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) @@ -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 @@ -1102,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 @@ -1146,23 +1145,20 @@ type FrameworkImportsCache(keepStrongly) = type internal CompilationErrorLogger (debugName:string, tcConfig:TcConfig) = inherit ErrorLogger("CompilationErrorLogger("+debugName+")") - let warningsSeenInScope = new ResizeArray<_>() - let errorsSeenInScope = 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 mutable errorCount = 0 + let diagnostics = new ResizeArray<_>() + + 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 - 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.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 @@ -1193,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 @@ -1258,8 +1254,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 +1429,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 (err, isError) in inp.MetaCommandDiagnostics do + yield err,(if isError then FSharpErrorSeverity.Error else FSharpErrorSeverity.Warning) ] + let tcAcc = { tcGlobals=tcGlobals tcImports=tcImports @@ -1442,7 +1447,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 +1771,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 +1820,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 +1846,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 @@ -1849,7 +1854,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..3d36b5708e7 100755 --- a/src/fsharp/vs/IncrementalBuild.fsi +++ b/src/fsharp/vs/IncrementalBuild.fsi @@ -36,15 +36,15 @@ 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 [] 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 @@ -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 7bb1fbdff35..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 errorSink 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 @@ -1512,14 +1512,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 @@ -1608,7 +1607,7 @@ module internal Parser = None) - errHandler.CollectedErrorsAndWarnings, + errHandler.CollectedDiagnostics, matchPairRef.ToArray(), parseResult, errHandler.AnyErrors @@ -1629,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 - backgroundErrors: (PhasedError * FSharpErrorSeverity) list, + backgroundDiagnostics: (PhasedDiagnostic * FSharpErrorSeverity) list, reactorOps: IReactorOperations, // Used by 'FSharpDeclarationListInfo' to check the IncrementalBuilder is still alive. checkAlive : (unit -> bool), @@ -1645,7 +1644,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) @@ -1657,9 +1656,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 @@ -1667,48 +1665,51 @@ 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.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(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 = loadClosure.SourceFiles |> List.filter(fun (_,ms) -> ms<>[]) // #loaded file, ranges of #load - let hashLoadBackgroundErrors, otherBackgroundErrors = - backgroundErrors |> List.partition (fun backgroundError -> hashLoadsInFile |> List.exists (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 // 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 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 - 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 ] + for (fileOfHashLoad, rangesOfHashLoad) in hashLoadsInFile 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 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. @@ -1736,7 +1737,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) -> @@ -1773,6 +1774,7 @@ type FSharpProjectOptions = UseScriptResolutionRules : bool LoadTime : System.DateTime UnresolvedReferences : UnresolvedReferencesSet option + OriginalLoadReferences: (range * string) list ExtraProjectInfo : obj option } member x.ProjectOptions = x.OtherOptions @@ -1791,6 +1793,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 @@ -2124,7 +2128,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, @@ -2152,7 +2156,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 @@ -2498,27 +2502,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 () -> @@ -2720,6 +2725,7 @@ type FSharpChecker(referenceResolver, projectCacheSize, keepAssemblyContents, ke UseScriptResolutionRules = false LoadTime = loadedTimeStamp UnresolvedReferences = None + OriginalLoadReferences=[] ExtraProjectInfo=extraProjectInfo } /// Begin background parsing the given project. @@ -2797,11 +2803,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 -> @@ -2843,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 e844410f2d1..9d780d065f5 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 } @@ -600,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 [] 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/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 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 f1a2b7e59a7..5ae4ff77e30 100644 --- a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs +++ b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs @@ -137,6 +137,7 @@ type internal ProjectSitesAndFiles() = UseScriptResolutionRules = SourceFile.MustBeSingleFileProject fileName LoadTime = projectSite.LoadTime UnresolvedReferences = None + OriginalLoadReferences = [] ExtraProjectInfo=extraProjectInfo } /// Construct a project site for a single file. May be a single file project (for scripts) or an orphan project site (for everything else). 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 9e5ff4c191b..0d015c15a8b 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/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 } diff --git a/vsintegration/tests/unittests/GoToDefinitionServiceTests.fs b/vsintegration/tests/unittests/GoToDefinitionServiceTests.fs index 2510be923ea..fde26cd540a 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/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) = diff --git a/vsintegration/tests/unittests/QuickInfoProviderTests.fs b/vsintegration/tests/unittests/QuickInfoProviderTests.fs index 677dfc0ce13..7e1817d2ad1 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 } 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. 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..5c466bfdc3f 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,text,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,text,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``() =