Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 3d89f74

Browse files
committed
test update
1 parent 39221cd commit 3d89f74

20 files changed

Lines changed: 503 additions & 95 deletions

Export.FCS.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 14
3+
VisualStudioVersion = 14.0.25420.1
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service", "src\fsharp\FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj", "{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}"
6+
EndProject
7+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Export.FCS", "src\fsharp\Export.FCS\Export.FCS.fsproj", "{C89727FE-5D40-4DE2-B751-753D75C86E4C}"
8+
EndProject
9+
Global
10+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
11+
Debug|Any CPU = Debug|Any CPU
12+
Release|Any CPU = Release|Any CPU
13+
EndGlobalSection
14+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{C89727FE-5D40-4DE2-B751-753D75C86E4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{C89727FE-5D40-4DE2-B751-753D75C86E4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{C89727FE-5D40-4DE2-B751-753D75C86E4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{C89727FE-5D40-4DE2-B751-753D75C86E4C}.Release|Any CPU.Build.0 = Release|Any CPU
23+
EndGlobalSection
24+
GlobalSection(SolutionProperties) = preSolution
25+
HideSolutionNode = FALSE
26+
EndGlobalSection
27+
EndGlobal

src/fsharp/CompileOps.fs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4662,6 +4662,21 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
46624662
Microsoft.FSharp.Compiler.AbstractIL.Internal.AsciiConstants.parseILGlobals := tcGlobals.ilg
46634663
#endif
46644664
frameworkTcImports.SetTcGlobals(tcGlobals)
4665+
4666+
#if EXPORT_SIGDATA
4667+
let writeSigData (ccu:CcuThunk) =
4668+
let path = "../../../../../temp/"
4669+
let exportRemapping = MakeExportRemapping ccu ccu.Contents
4670+
let resource = WriteSignatureData (tcConfig,tcGlobals,exportRemapping,ccu,ccu.name)
4671+
match resource.Location with
4672+
| ILResourceLocation.Local bytes ->
4673+
File.WriteAllBytes(path + ccu.name + ".sigdata", bytes())
4674+
| _ -> ()
4675+
4676+
fslibCcu |> writeSigData
4677+
sysCcus |> Array.iter writeSigData
4678+
#endif
4679+
46654680
tcGlobals,frameworkTcImports
46664681

46674682
member tcImports.ReportUnresolvedAssemblyReferences(knownUnresolved) =
@@ -5189,7 +5204,7 @@ let CheckSimulateException(tcConfig:TcConfig) =
51895204
// cut-down TcConfig
51905205
type TcConfig() =
51915206
member x.implicitIncludeDir = ""
5192-
member x.compilingFslib = true
5207+
member x.compilingFslib = false
51935208
member x.isInteractive = false
51945209
member x.mlCompatibility = false
51955210
member x.emitDebugInfoInQuotations = false

src/fsharp/Export.FCS/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
5+
</startup>
6+
</configuration>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
namespace Export.FCS.AssemblyInfo
2+
3+
open System.Reflection
4+
open System.Runtime.CompilerServices
5+
open System.Runtime.InteropServices
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[<assembly: AssemblyTitle("Export.FCS")>]
11+
[<assembly: AssemblyDescription("")>]
12+
[<assembly: AssemblyConfiguration("")>]
13+
[<assembly: AssemblyCompany("")>]
14+
[<assembly: AssemblyProduct("Export.FCS")>]
15+
[<assembly: AssemblyCopyright("Copyright © 2016")>]
16+
[<assembly: AssemblyTrademark("")>]
17+
[<assembly: AssemblyCulture("")>]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[<assembly: ComVisible(false)>]
23+
24+
// The following GUID is for the ID of the typelib if this project is exposed to COM
25+
[<assembly: Guid("c89727fe-5d40-4de2-b751-753d75c86e4c")>]
26+
27+
// Version information for an assembly consists of the following four values:
28+
//
29+
// Major Version
30+
// Minor Version
31+
// Build Number
32+
// Revision
33+
//
34+
// You can specify all the values or you can default the Build and Revision Numbers
35+
// by using the '*' as shown below:
36+
// [<assembly: AssemblyVersion("1.0.*")>]
37+
[<assembly: AssemblyVersion("1.0.0.0")>]
38+
[<assembly: AssemblyFileVersion("1.0.0.0")>]
39+
40+
do
41+
()
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>c89727fe-5d40-4de2-b751-753d75c86e4c</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<RootNamespace>Export.FCS</RootNamespace>
11+
<AssemblyName>Export.FCS</AssemblyName>
12+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
15+
<Name>Export.FCS</Name>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<Tailcalls>false</Tailcalls>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<WarningLevel>3</WarningLevel>
25+
<PlatformTarget>AnyCPU</PlatformTarget>
26+
<DocumentationFile>bin\Debug\Export.FCS.XML</DocumentationFile>
27+
<Prefer32Bit>true</Prefer32Bit>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<Tailcalls>true</Tailcalls>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<WarningLevel>3</WarningLevel>
36+
<PlatformTarget>AnyCPU</PlatformTarget>
37+
<DocumentationFile>bin\Release\Export.FCS.XML</DocumentationFile>
38+
<Prefer32Bit>true</Prefer32Bit>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="mscorlib" />
42+
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
43+
<Private>True</Private>
44+
</Reference>
45+
<Reference Include="System" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Numerics" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Compile Include="AssemblyInfo.fs" />
51+
<Compile Include="Program.fs" />
52+
<None Include="App.config" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<ProjectReference Include="..\FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj">
56+
<Name>FSharp.Compiler.Service</Name>
57+
<Project>{2e4d67b4-522d-4cf7-97e4-ba940f0b18f3}</Project>
58+
<Private>True</Private>
59+
</ProjectReference>
60+
</ItemGroup>
61+
<PropertyGroup>
62+
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
63+
</PropertyGroup>
64+
<Choose>
65+
<When Condition="'$(VisualStudioVersion)' == '11.0'">
66+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
67+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
68+
</PropertyGroup>
69+
</When>
70+
<Otherwise>
71+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
72+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
73+
</PropertyGroup>
74+
</Otherwise>
75+
</Choose>
76+
<Import Project="$(FSharpTargetsPath)" />
77+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
78+
Other similar extension points exist, see Microsoft.Common.targets.
79+
<Target Name="BeforeBuild">
80+
</Target>
81+
<Target Name="AfterBuild">
82+
</Target>
83+
-->
84+
</Project>

src/fsharp/Export.FCS/Program.fs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
open System.IO
2+
open System.Collections.Generic
3+
open Microsoft.FSharp.Compiler
4+
open Microsoft.FSharp.Compiler.SourceCodeServices
5+
6+
let input =
7+
"""
8+
open System
9+
10+
let foo() =
11+
let msg = String.Concat("Hello"," ","world")
12+
if true then
13+
printfn "%s" msg
14+
"""
15+
16+
// Create one global interactive checker instance
17+
let checker = FSharpChecker.Create()
18+
19+
let parseAndCheckScript (file, input) =
20+
let projectOptions = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously
21+
let parseResult, typedRes = checker.ParseAndCheckFileInProject(file, 0, input, projectOptions) |> Async.RunSynchronously
22+
23+
// if parseResult.Errors.Length > 0 then
24+
// printfn "---> Parse Input = %A" input
25+
// printfn "---> Parse Error = %A" parseResult.Errors
26+
27+
match typedRes with
28+
| FSharpCheckFileAnswer.Succeeded(res) -> parseResult, res
29+
| res -> failwithf "Parsing did not finish... (%A)" res
30+
31+
let test() =
32+
let file = "/Test.fsx"
33+
let parseResult, typeCheckResults = parseAndCheckScript(file, input)
34+
35+
// We only expect one reported error. However,
36+
// on Unix, using filenames like /home/user/Test.fsx gives a second copy of all parse errors due to the
37+
// way the load closure for scripts is generated. So this returns two identical errors
38+
39+
// So we check that the messages are the same
40+
for msg in typeCheckResults.Errors do
41+
printfn "Error: %A" msg
42+
43+
[<EntryPoint>]
44+
let main argv =
45+
printfn "Parsing..."
46+
test()
47+
0 // return an integer exit code

src/fsharp/Fable.FCS/Fable.FCS.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "project", "project.fsproj", "{503AD75D-B915-4DAB-8819-16F9E8711881}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{503AD75D-B915-4DAB-8819-16F9E8711881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{503AD75D-B915-4DAB-8819-16F9E8711881}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{503AD75D-B915-4DAB-8819-16F9E8711881}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{503AD75D-B915-4DAB-8819-16F9E8711881}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

src/fsharp/Fable.FCS/adapters.fs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ module Microsoft =
184184
LanguagePrimitives.GenericHash //TODO: proper implementation
185185

186186
module Operators =
187-
let (|KeyValue|) (kvp: KeyValuePair<'T,'U>) = (kvp.Key, kvp.Value)
188187
let (|Failure|_|) (exn: exn) = Some exn.Message
189188
//if exn.GetType().FullName.EndsWith("Exception") then Some exn.Message else None
190189
let Failure message = new System.Exception(message)
@@ -252,3 +251,16 @@ module StructuredFormat =
252251
| Attr of string * (string * string) list * layout
253252
and layout = Layout
254253
and joint = Joint
254+
255+
//-------------------------------------------------------------------------
256+
// From IncrementalBuild.fs
257+
//------------------------------------------------------------------------
258+
module ErrorScope =
259+
let Protect m f1 f2 = try f1() with e -> f2(e.Message)
260+
261+
//-------------------------------------------------------------------------
262+
// From Reactor.fs
263+
//------------------------------------------------------------------------
264+
type internal IReactorOperations =
265+
abstract EnqueueAndAwaitOpAsync : string * (unit -> 'T) -> Async<'T>
266+
abstract EnqueueOp: string * (unit -> unit) -> unit

src/fsharp/Fable.FCS/app.fs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@ let main argv =
66
printfn "Parsing begins..."
77

88
let source = """
9-
let aa = 1
10-
type BB() = member x.MMM() = 1 + 1
11-
printfn "result: %A" aa
9+
module A =
10+
let aa = 5
11+
let times x y = x * y
12+
let f = times aa 6
13+
//type BB() = member x.MMM() = 2 * 3
14+
//printfn "result: %A" aa
1215
"""
13-
14-
let path = "C:/Program Files (x86)/Reference Assemblies/Microsoft/FSharp/.NETFramework/v4.0/4.4.0.0/FSharp.Core.sigdata"
15-
let bytes = [| 0uy |] //System.IO.File.ReadAllBytes(path)
16-
17-
let checker = InteractiveChecker(bytes)
16+
let sigdataPath = "../../../../../temp/"
17+
let checker = InteractiveChecker(sigdataPath)
1818

1919
// let untypedResults = checker.ParseScript(source)
2020
// printfn "untypedResults.ParseHadErrors: %A" untypedResults.ParseHadErrors
2121
// printfn "untypedResults.Errors: %A" untypedResults.Errors
2222
// printfn "untypedResults.ParseTree: %A" untypedResults.ParseTree
2323

24-
let results = checker.ParseAndCheckScript(source)
25-
printfn "result: %A" results
24+
let typeCheckResults, projectResults = checker.ParseAndCheckScript(source)
25+
printfn "typeCheckResults.Errors: %A" typeCheckResults.Errors
26+
printfn "projectResults.Contents: %A" projectResults.AssemblyContents.ImplementationFiles
2627

2728
0 // return an integer exit code

src/fsharp/Fable.FCS/fableconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"ecma": "es2015",
66
"outDir": "out",
77
"copyExt": true,
8-
//"refs": { "Fable.Core": "fable-core/umd" },
9-
//"extra": { "saveFSharpAst": "" },
108
"plugins": [
119
],
1210
"symbols": [

0 commit comments

Comments
 (0)