Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing improvements: no reactor, add parsing options, error severity options #3601

Merged
merged 14 commits into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ which does things like:
Yu can push the packages if you have permissions, either automatically using ``build Release`` or manually

set APIKEY=...
.nuget\nuget.exe push Release\FSharp.Compiler.Service.14.0.2.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.MSBuild.v12.14.0.2.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.ProjectCracker.14.0.2.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.16.0.1.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.MSBuild.v12.16.0.1.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.ProjectCracker.16.0.1.nupkg %APIKEY% -Source https://nuget.org


### Use of Paket and FAKE
Expand Down
8 changes: 7 additions & 1 deletion fcs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#### 14.0.2
#### 16.0.1
* FSharpChecker provides non-reactor ParseFile instead of ParseFileInProject
* Add FSharpParsingOptions, GetParsingOptionsFromProjectOptions, GetParsingOptionsFromCommandLine

#### 15.0.1
* Integrate latest changes from visualfsharp
* Add implementation file contents to CheckFileResults
* Fix non-public API in .NET Standard 1.6 version

#### 14.0.1
Expand Down
9 changes: 2 additions & 7 deletions fcs/docsrc/content/caches.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ Each FSharpChecker object maintains a set of caches. These are

* ``braceMatchCache`` - an MRU cache of size ``braceMatchCacheSize`` (default = 5) keeping the results of calls to MatchBraces, keyed by filename, source and project options.

* ``parseFileInProjectCache`` - an MRU cache of size ``parseFileInProjectCacheSize`` (default = 2) keeping the results of ParseFileInProject,
* ``parseFileCache`` - an MRU cache of size ``parseFileCacheSize`` (default = 2) keeping the results of ParseFile,
keyed by filename, source and project options.

* ``parseAndCheckFileInProjectCache`` - an MRU cache of size ``incrementalTypeCheckCacheSize`` (default = 5) keeping the results of
* ``checkFileInProjectCache`` - an MRU cache of size ``incrementalTypeCheckCacheSize`` (default = 5) keeping the results of
ParseAndCheckFileInProject, CheckFileInProject and/or CheckFileInProjectIfReady. This is keyed by filename, file source
and project options. The results held in this cache are only returned if they would reflect an accurate parse and check of the
file.

* ``parseAndCheckFileInProjectCachePossiblyStale`` - a somewhat peculiar MRU cache of size ``incrementalTypeCheckCacheSize`` (default = 5)
keeping the results of ParseAndCheckFileInProject, CheckFileInProject and CheckFileInProjectIfReady,
keyed by filename and project options. This cache is accessed by TryGetRecentTypeCheckResultsForFile. Because the results
are accessed regardless of the content of the file, the checking results returned may be "stale".

* ``getToolTipTextCache`` - an aged lookup cache of strong size ``getToolTipTextSize`` (default = 5) computing the results of GetToolTipText.

* ``ilModuleReaderCache`` - an aged lookup of weak references to "readers" for references .NET binaries. Because these
Expand Down
7 changes: 5 additions & 2 deletions fcs/docsrc/content/editor.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,19 @@ let projOptions =
checker.GetProjectOptionsFromScript(file, input)
|> Async.RunSynchronously

let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projOptions)

(**
To perform type checking, we first need to parse the input using
`ParseFileInProject`, which gives us access to the [untyped AST](untypedtree.html). However,
`ParseFile`, which gives us access to the [untyped AST](untypedtree.html). However,
then we need to call `CheckFileInProject` to perform the full type checking. This function
also requires the result of `ParseFileInProject`, so the two functions are often called
together.
*)
// Perform parsing

let parseFileResults =
checker.ParseFileInProject(file, input, projOptions)
checker.ParseFile(file, input, parsingOptions)
|> Async.RunSynchronously
(**
Before we look at the interesting operations provided by `TypeCheckResults`, we
Expand Down
8 changes: 5 additions & 3 deletions fcs/docsrc/content/ja/editor.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,22 @@ let file = "/home/user/Test.fsx"

let projOptions = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously

let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projOptions)

(**

型チェックを実行するには、まず `ParseFileInProject` を使って
型チェックを実行するには、まず `ParseFile` を使って
入力値をパースする必要があります。
このメソッドを使うと [型無しAST](untypedtree.html) にアクセスできるようになります。
しかし今回は完全な型チェックを実行するため、続けて `CheckFileInProject`
を呼び出す必要があります。
このメソッドは `ParseFileInProject` の結果も必要とするため、
このメソッドは `ParseFile` の結果も必要とするため、
たいていの場合にはこれら2つのメソッドをセットで呼び出すことになります。

*)
// パースを実行
let parseFileResults =
checker.ParseFileInProject(file, input, projOptions)
checker.ParseFile(file, input, parsingOptions)
|> Async.RunSynchronously
(**
`TypeCheckResults` に備えられた興味深い機能の紹介に入る前に、
Expand Down
4 changes: 3 additions & 1 deletion fcs/docsrc/content/ja/untypedtree.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ let getUntypedTree (file, input) =
checker.GetProjectOptionsFromScript(file, input)
|> Async.RunSynchronously

let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projOptions)

// コンパイラの第1フェーズを実行する
let untypedRes =
checker.ParseFileInProject(file, input, projectOptions)
checker.ParseFile(file, input, parsingOptions)
|> Async.RunSynchronously

match untypedRes.ParseTree with
Expand Down
6 changes: 4 additions & 2 deletions fcs/docsrc/content/untypedtree.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To get the AST, we define a function that takes file name and the source code
(the file is only used for location information and does not have to exist).
We first need to get "interactive checker options" which represents the context.
For simple tasks, you can use `GetProjectOptionsFromScriptRoot` which infers
the context for a script file. Then we use the `ParseFileInProject` method and
the context for a script file. Then we use the `ParseFile` method and
return the `ParseTree` property:

*)
Expand All @@ -60,9 +60,11 @@ let getUntypedTree (file, input) =
checker.GetProjectOptionsFromScript(file, input)
|> Async.RunSynchronously

let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projOptions)

// Run the first phase (untyped parsing) of the compiler
let parseFileResults =
checker.ParseFileInProject(file, input, projOptions)
checker.ParseFile(file, input, parsingOptions)
|> Async.RunSynchronously

match parseFileResults.ParseTree with
Expand Down
2 changes: 1 addition & 1 deletion fcs/fcs.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>

<VersionPrefix>14.0.2</VersionPrefix>
<VersionPrefix>16.0.1</VersionPrefix>
<!-- FSharp.Compiler.Tools is currently only used to get a working FSI.EXE to execute some scripts during the build -->
<!-- The LKG FSI.EXE requires MSBuild 15 to be installed, which is painful -->
<FsiToolPath>$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.23\tools</FsiToolPath>
Expand Down
2 changes: 1 addition & 1 deletion fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</description>
<language>en-US</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<version>14.0.2</version>
<version>16.0.1</version>
<authors>Microsoft Corporation and F# community contributors</authors>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</description>
<language>en-US</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<version>14.0.2</version>
<version>16.0.1</version>
<authors>Microsoft Corporation and F# community contributors</authors>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion fcs/nuget/FSharp.Compiler.Service.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</description>
<language>en-US</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<version>14.0.2</version>
<version>16.0.1</version>
<authors>Microsoft Corporation and F# community contributors</authors>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
Expand Down
10 changes: 10 additions & 0 deletions fcs/paket.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RESTRICTION: == net45
NUGET
remote: https://www.nuget.org/api/v2
FAKE (4.63.2)
FSharp.Compiler.Service (2.0.0.6)
FSharp.Formatting (2.14.4)
FSharp.Compiler.Service (2.0.0.6)
FSharpVSPowerTools.Core (>= 2.3 < 2.4)
FSharpVSPowerTools.Core (2.3)
FSharp.Compiler.Service (>= 2.0.0.3)
3 changes: 2 additions & 1 deletion fcs/samples/EditorService/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ let checker = FSharpChecker.Create()

let parseWithTypeInfo (file, input) =
let checkOptions, _errors = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously
let untypedRes = checker.ParseFileInProject(file, input, checkOptions) |> Async.RunSynchronously
let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(checkOptions)
let untypedRes = checker.ParseFile(file, input, parsingOptions) |> Async.RunSynchronously

match checker.CheckFileInProject(untypedRes, file, 0, input, checkOptions) |> Async.RunSynchronously with
| FSharpCheckFileAnswer.Succeeded(res) -> untypedRes, res
Expand Down
5 changes: 2 additions & 3 deletions fcs/samples/FscExe/App.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<legacyUnhandledExceptionPolicy enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>

</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
Expand Down
5 changes: 2 additions & 3 deletions fcs/samples/FsiExe/App.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<legacyUnhandledExceptionPolicy enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>

</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
Expand Down
5 changes: 1 addition & 4 deletions fcs/samples/InteractiveService/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>

</configuration>
5 changes: 1 addition & 4 deletions fcs/samples/Tokenizer/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>

</configuration>
5 changes: 1 addition & 4 deletions fcs/samples/UntypedTree/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>

</configuration>
7 changes: 2 additions & 5 deletions fcs/samples/UntypedTree/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ let checker = FSharpChecker.Create()

// Get untyped tree for a specified input
let getUntypedTree (file, input) =
// Get compiler options for a single script file
let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously
// Run the first phase (untyped parsing) of the compiler

let untypedRes = checker.ParseFileInProject(file, input, checkOptions) |> Async.RunSynchronously
let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| file |] }
let untypedRes = checker.ParseFile(file, input, parsingOptions) |> Async.RunSynchronously
match untypedRes.ParseTree with
| Some tree -> tree
| None -> failwith "Something went wrong during parsing!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ open System.Runtime.InteropServices
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsc-proto, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("LanguageServiceProfiling, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
#endif
#if STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsc, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
Expand Down
Loading