diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2019-09-11 13:44:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-11 13:44:45 +0300 |
commit | 7a8d555b7dc085de51f4b90b83edfa7b2bbb1aac (patch) | |
tree | ecef60e5b9e4156d401e46f130d5a80648e8a919 /main/external | |
parent | d5af6dbfc95c60151105c9a54e3da09e6f19503e (diff) | |
parent | 187a7e0041b4060b80b9e6c41be2f5ac017119e1 (diff) |
Merge pull request #8505 from mono/fsharp-compiler-31
[F#] Update to FSharp.CompilerService 31.0
Diffstat (limited to 'main/external')
7 files changed, 24 insertions, 19 deletions
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/Interactive.fs b/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/Interactive.fs index b242ba6fcc..10ccd7431f 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/Interactive.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/Interactive.fs @@ -108,7 +108,7 @@ module Interactive = do! session.TextReceived |> Async.AwaitEvent |> Async.Ignore let! results = session.TextReceived |> Async.AwaitEvent session.KillNow() - results |> should equal "val it : O [] = [|{X = \"\";}|]\n" + results |> should equal "val it : O [] = [|{ X = \"\" }|]\n" } |> toTask [<Test;AsyncStateMachine(typeof<Task>)>] diff --git a/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/TestHelpers.fs b/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/TestHelpers.fs index e0600fdb50..9aeadb911a 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/TestHelpers.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharp.Tests/TestHelpers.fs @@ -1,6 +1,7 @@ namespace MonoDevelopTests open System open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text open MonoDevelop.FSharp open MonoDevelop.Ide.Editor open MonoDevelop.Ide.TypeSystem @@ -36,8 +37,9 @@ module TestHelpers = async { try let checker = FSharpChecker.Create() - let! projOptions, _errors = checker.GetProjectOptionsFromScript(filename, source) - let! parseResults, checkAnswer = checker.ParseAndCheckFileInProject(filename, 0, source , projOptions) + let sourceText = SourceText.ofString source + let! projOptions, _errors = checker.GetProjectOptionsFromScript(filename, sourceText) + let! parseResults, checkAnswer = checker.ParseAndCheckFileInProject(filename, 0, sourceText , projOptions) // Construct new typed parse result if the task succeeded let results = diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormatter.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormatter.fs index fe193328f5..a3c61aaa81 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormatter.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormatter.fs @@ -8,6 +8,7 @@ open MonoDevelop.Projects.Policies open MonoDevelop.Ide.CodeFormatting open Fantomas open Fantomas.FormatConfig +open Fantomas.SourceOrigin; open FSharp.Compiler open FSharp.Compiler.Range //open ExtCore.Control @@ -78,7 +79,7 @@ type FSharpFormatter() = let output = try let parsingOptions, _errors = languageService.Checker.GetParsingOptionsFromProjectOptions(projectOptions) - let formatted = CodeFormatter.FormatDocumentAsync(filename, input, config, parsingOptions, languageService.Checker) + let formatted = CodeFormatter.FormatDocumentAsync(filename, SourceString(input), config, parsingOptions, languageService.Checker) |> Async.RunSynchronously let result = trimIfNeeded input formatted @@ -115,7 +116,7 @@ type FSharpFormatter() = let selection = input.Substring(fromOffset, toOffset - fromOffset) let checker = SourceCodeServices.FSharpChecker.Create() let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projectOptions) - let formatted = CodeFormatter.FormatSelectionAsync(filename, range, input, config, parsingOptions, languageService.Checker) + let formatted = CodeFormatter.FormatSelectionAsync(filename, range, SourceString(input), config, parsingOptions, languageService.Checker) |> Async.RunSynchronously let result = trimIfNeeded input formatted match editor with diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/ScriptDebugging.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/ScriptDebugging.fs index 2ce7d806e1..fb1c113b10 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/ScriptDebugging.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/ScriptDebugging.fs @@ -4,6 +4,7 @@ open System.IO open System.Threading open System.Threading.Tasks open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text open MonoDevelop.Components.Commands open MonoDevelop.Core open MonoDevelop.Core.Assemblies @@ -118,7 +119,7 @@ type FSharpDebugScriptTextEditorExtension() = inherit TextEditorExtension() member x.StartDebugging consoleKind = - let buildTarget = ScriptBuildTarget (x.Editor.FileName, consoleKind, x.Editor.Text) + let buildTarget = ScriptBuildTarget (x.Editor.FileName, consoleKind, SourceText.ofString x.Editor.Text) let debug = IdeApp.ProjectOperations.Debug buildTarget debug.Task @@ -148,7 +149,7 @@ type DebugScriptNodeHandler() = member x.StartDebugging consoleKind = let file = x.CurrentNode.DataItem :?> ProjectFile let doc = IdeApp.Workbench.OpenDocument(file.FilePath, null, true) |> Async.AwaitTask |> Async.RunSynchronously - let buildTarget = ScriptBuildTarget (file.FilePath, consoleKind, doc.Editor.Text) + let buildTarget = ScriptBuildTarget (file.FilePath, consoleKind, SourceText.ofString doc.Editor.Text) let debug = IdeApp.ProjectOperations.Debug buildTarget debug.Task diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/LanguageService.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/LanguageService.fs index 474bcb0645..4d5d8d3240 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/LanguageService.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/LanguageService.fs @@ -5,6 +5,7 @@ open System.IO open System.Diagnostics open FSharp.Compiler open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text open ExtCore.Control open ExtCore.Control.Collections open MonoDevelop.Core @@ -325,7 +326,7 @@ type LanguageService(dirtyNotify, _extraProjectInfo) as x = let fileName = fixFileName(fileName) LoggingService.LogDebug ("LanguageService: GetScriptCheckerOptions: Creating for stand-alone file or script: {0}", fileName) let opts, _errors = - Async.RunSynchronously (checker.GetProjectOptionsFromScript(fileName, source, fakeDateTimeRepresentingTimeLoaded projFilename), + Async.RunSynchronously (checker.GetProjectOptionsFromScript(fileName, SourceText.ofString source, fakeDateTimeRepresentingTimeLoaded projFilename), timeout = ServiceSettings.maximumTimeout) // The InteractiveChecker resolution sometimes doesn't include FSharp.Core and other essential assemblies, so we need to include them by hand @@ -437,7 +438,7 @@ type LanguageService(dirtyNotify, _extraProjectInfo) as x = let res = match stale with | AllowStaleResults.MatchingFileName -> checker.TryGetRecentCheckResultsForFile(fixFileName fileName, options) - | AllowStaleResults.MatchingSource -> checker.TryGetRecentCheckResultsForFile(fixFileName fileName, options, source=src) + | AllowStaleResults.MatchingSource -> checker.TryGetRecentCheckResultsForFile(fixFileName fileName, options, sourceText = SourceText.ofString src) match res with | Some (untyped,typed,_) when typed.HasFullTypeCheckInfo -> Some (ParseAndCheckResults(Some typed, Some untyped)) @@ -471,7 +472,7 @@ type LanguageService(dirtyNotify, _extraProjectInfo) as x = member x.ParseAndCheckFileInProject(projectFilename, fileName, version:int, src:string, obsoleteCheck) = let fileName = if Path.GetExtension fileName = ".sketchfs" then Path.ChangeExtension (fileName, ".fsx") else fileName let opts = x.GetCheckerOptions(fileName, projectFilename, src) - x.ParseAndCheckFile(fileName, src, version, opts, obsoleteCheck) + x.ParseAndCheckFile(fileName, SourceText.ofString src, version, opts, obsoleteCheck) /// Parses and checks the given file in the given project under the given configuration. ///Asynchronously returns the results of checking the file. @@ -492,7 +493,7 @@ type LanguageService(dirtyNotify, _extraProjectInfo) as x = match timeout with | Some timeout -> LoggingService.logDebug "LanguageService: GetTypedParseResultWithTimeout: No stale results - typechecking with timeout" - let! computation = Async.StartChild(x.ParseAndCheckFile(fileName, src, version, options, obs), timeout) + let! computation = Async.StartChild(x.ParseAndCheckFile(fileName, SourceText.ofString src, version, options, obs), timeout) try let! result = computation return Some(result) @@ -502,7 +503,7 @@ type LanguageService(dirtyNotify, _extraProjectInfo) as x = return None | None -> LoggingService.logDebug "LanguageService: GetTypedParseResultWithTimeout: No stale results - typechecking without timeout" - let! result = x.ParseAndCheckFile(fileName, src, version, options, obs) + let! result = x.ParseAndCheckFile(fileName, SourceText.ofString src, version, options, obs) return Some(result) | None -> return None } @@ -550,7 +551,7 @@ type LanguageService(dirtyNotify, _extraProjectInfo) as x = match options with | Some opts -> let parseOptions, _errors = x.GetParsingOptionsFromProjectOptions opts - checker.MatchBraces(filename, source, parseOptions) + checker.MatchBraces(filename, SourceText.ofString source, parseOptions) | None -> async { return [||] } /// Get all symbols derived from the specified symbol in the current project and optionally all dependent projects diff --git a/main/external/fsharpbinding/paket.dependencies b/main/external/fsharpbinding/paket.dependencies index d44d4c313f..0fa75c3a9f 100644 --- a/main/external/fsharpbinding/paket.dependencies +++ b/main/external/fsharpbinding/paket.dependencies @@ -3,10 +3,10 @@ framework: net472 source https://nuget.org/api/v2/ nuget ExtCore framework: >= net40 -nuget FSharp.Compiler.Service 28.0.0 +nuget FSharp.Compiler.Service 31.0.0 nuget FSharp.Core nuget System.ValueTuple -nuget Fantomas 3.0.0-beta-001 +nuget Fantomas 3.0.0-beta-002 nuget FSharp.Compiler.CodeDom 0.9.2 framework: >= net40 nuget Mono.Cecil 0.10.0-beta6 framework: >= net40 nuget FAKE diff --git a/main/external/fsharpbinding/paket.lock b/main/external/fsharpbinding/paket.lock index 1250fbd6f3..817a6a8ded 100644 --- a/main/external/fsharpbinding/paket.lock +++ b/main/external/fsharpbinding/paket.lock @@ -3,15 +3,15 @@ NUGET remote: https://www.nuget.org/api/v2 ExtCore (0.8.46) FAKE (5.8.4) - Fantomas (3.0.0-beta-001) - FSharp.Compiler.Service (>= 28.0) + Fantomas (3.0.0-beta-002) + FSharp.Compiler.Service (>= 30.0) FSharp.Compiler.CodeDom (0.9.2) - FSharp.Compiler.Service (28.0) + FSharp.Compiler.Service (31.0) FSharp.Core (>= 4.6.2) System.Collections.Immutable (>= 1.5) System.Reflection.Metadata (>= 1.6) System.ValueTuple (>= 4.4) - FSharp.Core (4.6.2) + FSharp.Core (4.7) Mono.Cecil (0.10.0-beta6) Newtonsoft.Json (12.0.2) StrongNamer (0.0.8) |