forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ber.a
committed
Jan 16, 2020
1 parent
4b15d8d
commit cd408f5
Showing
7 changed files
with
198 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#if INTERACTIVE | ||
#r "../../artifacts/bin/fcs/net461/FSharp.Compiler.Service.dll" // note, build FSharp.Compiler.Service.Tests.fsproj to generate this, this DLL has a public API so can be used from F# Interactive | ||
#r "../../artifacts/bin/fcs/net461/nunit.framework.dll" | ||
#load "FsUnit.fs" | ||
#load "Common.fs" | ||
#else | ||
module FSharp.Compiler.Service.Tests.ExtensionTypingProvider | ||
#endif | ||
|
||
open System | ||
open System.IO | ||
open FsUnit | ||
open NUnit.Framework | ||
open FSharp.Compiler.ExtensionTyping | ||
open FSharp.Compiler.Range | ||
open FSharp.Compiler.AbstractIL.IL | ||
open FSharp.Compiler.AbstractIL.Internal.Library | ||
open FSharp.Compiler.Service.Tests.Common | ||
open FSharp.Compiler | ||
open FSharp.Compiler.SourceCodeServices | ||
|
||
let typeProviderProjectOptions = | ||
{ProjectFileName = __SOURCE_DIRECTORY__ + @"/data/TypeProviderConsole/TypeProviderConsole.fsproj"; | ||
ProjectId = None | ||
SourceFiles = [|__SOURCE_DIRECTORY__ + @"/data/TypeProviderConsole/Program.fs"|]; | ||
Stamp = None | ||
OtherOptions = | ||
[|yield "--simpleresolution"; | ||
yield "--noframework"; | ||
yield "--out:" + __SOURCE_DIRECTORY__ + @"/data/TypeProviderConsole/bin/Debug/TypeProviderConsole.exe"; | ||
yield "--doc:" + __SOURCE_DIRECTORY__ + @"/data/TypeProviderConsole/bin/Debug/TypeProviderConsole.xml"; | ||
yield "--subsystemversion:6.00"; | ||
yield "--highentropyva+"; | ||
yield "--fullpaths"; | ||
yield "--flaterrors"; | ||
yield "--target:exe"; | ||
yield "--define:DEBUG"; | ||
yield "--define:TRACE"; | ||
yield "--debug+"; | ||
yield "--optimize-"; | ||
yield "--tailcalls-"; | ||
yield "--debug:full"; | ||
yield "--platform:anycpu"; | ||
for r in mkStandardProjectReferences () do | ||
yield "-r:" + r | ||
yield "-r:" + __SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/TypeProviderLibrary.dll"|]; | ||
ReferencedProjects = | ||
[|(__SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/TypeProviderLibrary.dll", | ||
{ProjectFileName = __SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/TypeProviderLibrary.fsproj"; | ||
ProjectId = None | ||
SourceFiles = [|__SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/Library1.fs"|]; | ||
Stamp = None | ||
OtherOptions = | ||
[|yield "--simpleresolution"; | ||
yield "--noframework"; | ||
yield "--out:" + __SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/TypeProviderLibrary.dll"; | ||
yield "--doc:" + __SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/bin/Debug/TypeProviderLibrary.xml"; | ||
yield "--subsystemversion:6.00"; | ||
yield "--highentropyva+"; | ||
yield "--fullpaths"; | ||
yield "--flaterrors"; | ||
yield "--target:library"; | ||
yield "--define:DEBUG"; | ||
yield "--define:TRACE"; | ||
yield "--debug+"; | ||
yield "--optimize-"; | ||
yield "--tailcalls-"; | ||
yield "--debug:full"; | ||
yield "--platform:anycpu"; | ||
for r in mkStandardProjectReferences () do | ||
yield "-r:" + r | ||
yield "-r:" + __SOURCE_DIRECTORY__ + @"/data/TypeProviderLibrary/FSharp.Data.TypeProviders.dll"; | ||
|]; | ||
ReferencedProjects = [||]; | ||
IsIncompleteTypeCheckEnvironment = false; | ||
UseScriptResolutionRules = false; | ||
LoadTime = System.DateTime.Now | ||
UnresolvedReferences = None; | ||
OriginalLoadReferences = []; | ||
ExtraProjectInfo = None;})|]; | ||
IsIncompleteTypeCheckEnvironment = false; | ||
UseScriptResolutionRules = false; | ||
LoadTime = System.DateTime.Now | ||
UnresolvedReferences = None; | ||
OriginalLoadReferences = []; | ||
ExtraProjectInfo = None;} | ||
|
||
[<Test>] | ||
let ``Extension typing shim gets requests`` () = | ||
let mutable gotRequest = false | ||
let extensionTypingProvider = | ||
{ new IExtensionTypingProvider with | ||
member this.InstantiateTypeProvidersOfAssembly | ||
(runTimeAssemblyFileName: string, | ||
ilScopeRefOfRuntimeAssembly: ILScopeRef, | ||
designTimeAssemblyNameString: string, | ||
resolutionEnvironment: ResolutionEnvironment, | ||
isInvalidationSupported: bool, | ||
isInteractive: bool, | ||
systemRuntimeContainsType : string -> bool, | ||
systemRuntimeAssemblyVersion : System.Version, | ||
compilerToolPaths: string list, | ||
m:range) = | ||
gotRequest <- true | ||
[] | ||
} | ||
|
||
Shim.ExtensionTypingProvider <- extensionTypingProvider | ||
|
||
checker.ParseAndCheckProject(typeProviderProjectOptions) |> Async.RunSynchronously |> ignore | ||
gotRequest |> should be True |