This commit is contained in:
Omar Tawfik 2016-04-13 15:54:49 -07:00
Родитель 6c767e7fb8 8088283c7e
Коммит cfd76f437c
157 изменённых файлов: 4489 добавлений и 97465 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -98,3 +98,4 @@ tests/fsharpqa/Source/*FSharpQA_Failures.lst
*.ldf
*.cto
tests/**/FSharp.Core.dll
project.lock.json

Двоичные данные
.nuget/NuGet.exe

Двоичный файл не отображается.

Просмотреть файл

@ -72,8 +72,6 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Build", "src\fsharp\
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsc", "src\fsharp\Fsc\Fsc.fsproj", "{C94C257C-3C0A-4858-B5D8-D746498D1F08}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Data.TypeProviders", "src\fsharp\FSharp.Data.TypeProviders\FSharp.Data.TypeProviders.fsproj", "{CB7D20C4-6506-406D-9144-5342C3595F03}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Interactive.Settings", "src\fsharp\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj", "{649FA588-F02E-457C-9FCF-87E46407481E}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsiAnyCPU", "src\fsharp\fsiAnyCpu\FsiAnyCPU.fsproj", "{8B3E283D-B5FE-4055-9D80-7E3A32F3967B}"
@ -122,20 +120,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppConfig", "vsintegration\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeFile", "vsintegration\ItemTemplates\CodeFile\CodeFile.csproj", "{12AC2813-E895-4AAA-AE6C-94E21DA09F64}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ODataServiceConnection", "vsintegration\ItemTemplates\ODataServiceConnection\ODataServiceConnection.csproj", "{17716AF4-D439-4C74-8326-475FB1847DF2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptFile", "vsintegration\ItemTemplates\ScriptFile\ScriptFile.csproj", "{A333B85A-DC23-49B6-9797-B89A7951E92D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignatureFile", "vsintegration\ItemTemplates\SignatureFile\SignatureFile.csproj", "{E3FDD4AC-46B6-4B9F-B672-317D1202CC50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlDataConnection", "vsintegration\ItemTemplates\SqlDataConnection\SqlDataConnection.csproj", "{35E83EDF-CC5A-441D-8949-17AACC463CA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlEntityConnection", "vsintegration\ItemTemplates\SqlEntityConnection\SqlEntityConnection.csproj", "{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextFile", "vsintegration\ItemTemplates\TextFile\TextFile.csproj", "{D11FC318-8F5D-4C8C-9287-AB40A016D13C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WsdlServiceConnection", "vsintegration\ItemTemplates\WsdlServiceConnection\WsdlServiceConnection.csproj", "{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLFile", "vsintegration\ItemTemplates\XMLFile\XMLFile.csproj", "{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}"
EndProject
Global
@ -1109,26 +1099,6 @@ Global
{12AC2813-E895-4AAA-AE6C-94E21DA09F64}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{12AC2813-E895-4AAA-AE6C-94E21DA09F64}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{12AC2813-E895-4AAA-AE6C-94E21DA09F64}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Debug|x86.ActiveCfg = Debug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Debug|x86.Build.0 = Debug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Proto|Any CPU.Build.0 = Proto|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Proto|x86.ActiveCfg = Proto|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Proto|x86.Build.0 = Proto|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Release|Any CPU.Build.0 = Release|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Release|x86.ActiveCfg = Release|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.Release|x86.Build.0 = Release|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSDebug|x86.ActiveCfg = VSDebug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSDebug|x86.Build.0 = VSDebug|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{17716AF4-D439-4C74-8326-475FB1847DF2}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{A333B85A-DC23-49B6-9797-B89A7951E92D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A333B85A-DC23-49B6-9797-B89A7951E92D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A333B85A-DC23-49B6-9797-B89A7951E92D}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1169,46 +1139,6 @@ Global
{E3FDD4AC-46B6-4B9F-B672-317D1202CC50}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{E3FDD4AC-46B6-4B9F-B672-317D1202CC50}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{E3FDD4AC-46B6-4B9F-B672-317D1202CC50}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Debug|x86.ActiveCfg = Debug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Debug|x86.Build.0 = Debug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Proto|Any CPU.Build.0 = Proto|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Proto|x86.ActiveCfg = Proto|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Proto|x86.Build.0 = Proto|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Release|Any CPU.Build.0 = Release|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Release|x86.ActiveCfg = Release|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.Release|x86.Build.0 = Release|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSDebug|x86.ActiveCfg = VSDebug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSDebug|x86.Build.0 = VSDebug|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{35E83EDF-CC5A-441D-8949-17AACC463CA4}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Debug|x86.Build.0 = Debug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Proto|Any CPU.Build.0 = Proto|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Proto|x86.ActiveCfg = Proto|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Proto|x86.Build.0 = Proto|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Release|Any CPU.Build.0 = Release|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Release|x86.ActiveCfg = Release|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.Release|x86.Build.0 = Release|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSDebug|x86.ActiveCfg = VSDebug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSDebug|x86.Build.0 = VSDebug|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{D11FC318-8F5D-4C8C-9287-AB40A016D13C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D11FC318-8F5D-4C8C-9287-AB40A016D13C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D11FC318-8F5D-4C8C-9287-AB40A016D13C}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1229,26 +1159,6 @@ Global
{D11FC318-8F5D-4C8C-9287-AB40A016D13C}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{D11FC318-8F5D-4C8C-9287-AB40A016D13C}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{D11FC318-8F5D-4C8C-9287-AB40A016D13C}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Debug|x86.ActiveCfg = Debug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Debug|x86.Build.0 = Debug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Proto|Any CPU.Build.0 = Proto|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Proto|x86.ActiveCfg = Proto|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Proto|x86.Build.0 = Proto|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Release|Any CPU.Build.0 = Release|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Release|x86.ActiveCfg = Release|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.Release|x86.Build.0 = Release|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSDebug|x86.ActiveCfg = VSDebug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSDebug|x86.Build.0 = VSDebug|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1306,7 +1216,6 @@ Global
{956BBE41-ABD1-4DBA-9F3B-BA1C9821C98C} = {3F044931-FB83-4433-B934-AE66AB27B278}
{702A7979-BCF9-4C41-853E-3ADFC9897890} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{C94C257C-3C0A-4858-B5D8-D746498D1F08} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
{CB7D20C4-6506-406D-9144-5342C3595F03} = {3058BC79-8E79-4645-B05D-48CC182FA8A6}
{649FA588-F02E-457C-9FCF-87E46407481E} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{8B3E283D-B5FE-4055-9D80-7E3A32F3967B} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{D0E98C0D-490B-4C61-9329-0862F6E87645} = {B8DDA694-7939-42E3-95E5-265C2217C142}
@ -1327,13 +1236,9 @@ Global
{F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
{6BA13AA4-C25F-480F-856B-8E8000299A72} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{12AC2813-E895-4AAA-AE6C-94E21DA09F64} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{17716AF4-D439-4C74-8326-475FB1847DF2} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{A333B85A-DC23-49B6-9797-B89A7951E92D} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{E3FDD4AC-46B6-4B9F-B672-317D1202CC50} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{35E83EDF-CC5A-441D-8949-17AACC463CA4} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{A2CDA945-EF31-4C37-A063-BD1E2B3938EB} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{D11FC318-8F5D-4C8C-9287-AB40A016D13C} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{7FDF9571-B7DF-4F09-BD5E-12BDDF4FA520} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6} = {F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -29,4 +29,4 @@ artifacts:
type: zip
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

Просмотреть файл

@ -1,43 +1,70 @@
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<ItemGroup>
<ItemGroup Condition="'$(BUILD_NET40)'=='1'">
<ProjectsWithDefaultFramework Include="src/fsharp-library-build.proj" />
<ProjectsWithDefaultFramework Include="src/fsharp-compiler-build.proj" />
<ProjectsWithDefaultFramework Include="src/fsharp-typeproviders-build.proj" />
</ItemGroup>
<ItemGroup>
<ProjectsWithDefaultFramework Include="src/fsharp-library-unittests-build.proj" Condition="'$(TEST_NET40_COREUNIT)'=='1'" />
<ProjectsWithDefaultFramework Include="src/fsharp-compiler-unittests-build.proj" Condition="'$(TEST_COMPILERUNIT)'=='1'" />
<ProjectsWithDefaultFramework Include="tests/fsharp/FSharp.Tests.fsproj" Condition="'$(TEST_FSHARP_SUITE)'=='1'" />
</ItemGroup>
<ItemGroup>
<ProjectsWithPortableFramework Include="src/fsharp-library-build.proj" Condition="'$(BUILD_PORTABLE)'=='1'"/>
<ProjectsWithPortableFramework Include="src/fsharp-library-unittests-build.proj" Condition="'$(TEST_PORTABLE_COREUNIT)'=='1'" />
</ItemGroup>
<ItemGroup>
<ProjectsWithDefaultFramework Include="src/fsharp-typeproviders-build.proj" Condition="'$(BUILD_FSHARP_DATA_TYPEPROVIDERS)'=='1'" />
</ItemGroup>
<ItemGroup Condition="'$(BUILD_VS)'=='1'">
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-src-build.proj" />
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-project-templates-build.proj" />
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-item-templates-build.proj" />
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-deployment-build.proj" />
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-unittests-build.proj" />
<ProjectsWithDefaultFramework Include="src/fsharp-library-unittests-build.proj" />
<ProjectsWithDefaultFramework Include="src/fsharp-compiler-unittests-build.proj" />
<ProjectsWithDefaultFramework Include="tests/fsharp/FSharp.Tests.fsproj" />
<ProjectsWithPortableFramework Include="src/fsharp-library-build.proj" />
<ProjectsWithPortableFramework Include="src/fsharp-library-unittests-build.proj" />
</ItemGroup>
<ItemGroup>
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-unittests-build.proj" Condition="'$(TEST_VS)'=='1'" />
</ItemGroup>
<ItemGroup Condition="'$(BUILD_CORECLR)'=='1'">
<ProjectsWithCoreClr Include="src/fsharp-library-build.proj" />
<ProjectsWithCoreClr Include="src/fsharp-compiler-build.proj" />
</ItemGroup>
<ItemGroup>
<ProjectsWithCoreClr Include="src/fsharp-library-unittests-build.proj" Condition="'$(TEST_CORECLR)'=='1'" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Build" BuildInParallel="true"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable47"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable7"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable78"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable259"/>
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Build" BuildInParallel="true" Properties="Configuration=$(Configuration)" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable7" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable47" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable78" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable259" />
<MSBuild Projects="@(ProjectsWithCoreClr)" Targets="Build" BuildInParallel="false" Properties="Configuration=$(Configuration);TargetFramework=coreclr" />
</Target>
<Target Name="Rebuild">
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Rebuild" BuildInParallel="true"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable47"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable7"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable78"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable259"/>
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Rebuild" BuildInParallel="true" Properties="Configuration=$(Configuration)" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable7" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable47" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable78" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable259" />
<MSBuild Projects="@(ProjectsWithCoreClr)" Targets="Rebuild" BuildInParallel="false" Properties="Configuration=$(Configuration);TargetFramework=coreclr" />
</Target>
<Target Name="Clean">
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Clean" BuildInParallel="true"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable47"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable7"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable78"/>
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable259"/>
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Clean" BuildInParallel="true" Properties="Configuration=$(Configuration)" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable7" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable47" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable78" />
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="Configuration=$(Configuration);TargetFramework=portable259" />
<MSBuild Projects="@(ProjectsWithCoreClr)" Targets="Clean" BuildInParallel="false" Properties="Configuration=$(Configuration);TargetFramework=coreclr" />
</Target>
</Project>

Просмотреть файл

@ -31,7 +31,6 @@ set BUILD_NET40=1
set BUILD_CORECLR=0
set BUILD_PORTABLE=0
set BUILD_VS=0
set BUILD_FSHARP_DATA_TYPEPROVIDERS=0
set BUILD_CONFIG=release
set BUILD_CONFIG_LOWERCASE=release
@ -80,7 +79,6 @@ if /i '%ARG%' == 'all' (
set BUILD_PROTO=1
set BUILD_PORTABLE=1
set BUILD_VS=1
set BUILD_FSHARP_DATA_TYPEPROVIDERS=1
set TEST_COMPILERUNIT=1
set TEST_PORTABLE_COREUNIT=1
set TEST_VS=1
@ -94,7 +92,6 @@ if /i '%ARG%' == 'ci' (
set BUILD_CORECLR=1
set BUILD_PORTABLE=1
set BUILD_VS=1
set BUILD_FSHARP_DATA_TYPEPROVIDERS=1
set TEST_COMPILERUNIT=1
set TEST_NET40_COREUNIT=1
@ -112,7 +109,6 @@ if /i '%ARG%' == 'ci_part1' (
set BUILD_CORECLR=1
set BUILD_PORTABLE=1
set BUILD_VS=1
set BUILD_FSHARP_DATA_TYPEPROVIDERS=1
set TEST_COMPILERUNIT=1
set TEST_NET40_COREUNIT=1
@ -125,7 +121,6 @@ if /i '%ARG%' == 'ci_part1' (
if /i '%ARG%' == 'ci_part2' (
set SKIP_EXPENSIVE_TESTS=1
set BUILD_PORTABLE=1
set BUILD_FSHARP_DATA_TYPEPROVIDERS=1
set TEST_FSHARPQA_SUITE=1
set TEST_FSHARP_SUITE=1
)
@ -180,7 +175,6 @@ echo BUILD_NET40=%BUILD_NET40%
echo BUILD_CORECLR=%BUILD_CORECLR%
echo BUILD_PORTABLE=%BUILD_PORTABLE%
echo BUILD_VS=%BUILD_VS%
echo BUILD_FSHARP_DATA_TYPEPROVIDERS=%BUILD_FSHARP_DATA_TYPEPROVIDERS%
echo BUILD_CONFIG=%BUILD_CONFIG%
echo BUILD_CONFIG_LOWERCASE=%BUILD_CONFIG_LOWERCASE%
echo.
@ -285,85 +279,7 @@ if '%BUILD_PROTO%' == '1' (
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure
)
%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure
if '%BUILD_FSHARP_DATA_TYPEPROVIDERS%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: type provider build failed && goto :failure
)
if '%BUILD_CORECLR%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: library coreclr build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: compiler coreclr build failed && goto :failure
if '%TEST_CORECLR%' == '1' (
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
)
)
if '%BUILD_PORTABLE%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :failure
)
if '%TEST_COMPILERUNIT%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-compiler-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: compiler unittests build failed && goto :failure
)
if '%TEST_NET40_COREUNIT%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
)
if '%TEST_PORTABLE_COREUNIT%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
)
if '%BUILD_VS%' == '1' (
%_msbuildexe% %msbuildflags% vsintegration/fsharp-vsintegration-src-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: VS integration src build failed && goto :failure
%_msbuildexe% %msbuildflags% vsintegration/fsharp-vsintegration-project-templates-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: VS integration project templates build failed && goto :failure
%_msbuildexe% %msbuildflags% vsintegration/fsharp-vsintegration-item-templates-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: VS integration item templates build failed && goto :failure
%_msbuildexe% %msbuildflags% vsintegration/fsharp-vsintegration-deployment-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: VS integration deployment build failed && goto :failure
if '%TEST_VS%' == '1' (
%_msbuildexe% %msbuildflags% vsintegration/fsharp-vsintegration-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: VS integration unittests build failed && goto :failure
)
)
%_msbuildexe% %msbuildflags% build-everything.proj /p:Configuration=%BUILD_CONFIG%
@echo on
call src\update.cmd %BUILD_CONFIG_LOWERCASE% -ngen

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -19,7 +19,7 @@
<Choose>
<When Condition="'$(ProjectLanguage)' == 'FSharp'">
<Choose>
<When Condition="'$(AssemblyName)' == 'FSharp.Core' or '$(AssemblyName)' == 'FSharp.Build' or '$(AssemblyName)' == 'FSharp.Compiler' or '$(AssemblyName)' == 'FSharp.Compiler.Interactive.Settings' or '$(AssemblyName)' == 'FSharp.Compiler.Server.Shared' or '$(AssemblyName)' == 'fsc' or '$(AssemblyName)' == 'fsi' or '$(AssemblyName)' == 'FsiAnyCPU' or '$(AssemblyName)' == 'FSharp.Data.TypeProviders' or '$(AssemblyName)' == 'FSharp.Compiler.Unittests'" >
<When Condition="'$(AssemblyName)' == 'FSharp.Core' or '$(AssemblyName)' == 'FSharp.Build' or '$(AssemblyName)' == 'FSharp.Compiler' or '$(AssemblyName)' == 'FSharp.Compiler.Interactive.Settings' or '$(AssemblyName)' == 'FSharp.Compiler.Server.Shared' or '$(AssemblyName)' == 'fsc' or '$(AssemblyName)' == 'fsi' or '$(AssemblyName)' == 'FsiAnyCPU' or '$(AssemblyName)' == 'FSharp.Compiler.Unittests'" >
<PropertyGroup Condition="'$(AssemblyName)' == 'FSharp.Core' and ('$(TargetFramework)' == 'portable47' or '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' or '$(TargetFramework)' == 'coreclr')">
<IsPortableProfile>true</IsPortableProfile>
</PropertyGroup>

Просмотреть файл

@ -1,20 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp
open System.Reflection
open System.Runtime.InteropServices
[<assembly:AssemblyDescription("FSharp.Data.TypeProviders.dll")>]
[<assembly:AssemblyCompany("Microsoft Corporation")>]
[<assembly:AssemblyTitle("FSharp.Data.TypeProviders.dll")>]
[<assembly:AssemblyCopyright("\169 Microsoft Corporation. All rights reserved.")>]
[<assembly:AssemblyProduct("Microsoft\174 F#")>]
[<assembly:ComVisible(false)>]
do()
#if NO_STRONG_NAMES
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests")>]
#else
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
#endif
do()

Просмотреть файл

@ -53,7 +53,7 @@ try
let nugetArgs = sprintf "pack %s -BasePath \"%s\" -OutputDirectory \"%s\" -ExcludeEmptyDirectories -prop licenseUrl=\"%s\" -prop version=\"%s\" -prop authors=\"%s\" -prop projectURL=\"%s\" -prop tags=\"%s\" -Verbosity detailed"
nuspec
bindir
layouts
output
licenseUrl
version

Просмотреть файл

@ -1,19 +0,0 @@
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0">
<PropertyGroup>
<TargetFramework Condition="'$(TargetFramework)'==''">net40</TargetFramework>
</PropertyGroup>
<!-- Type providers assembly -->
<ItemGroup Condition=" '$(TargetFramework)' != 'sl3-wp' and '$(TargetFramework)' != 'sl5'">
<ProjectFiles Include="fsharp/FSharp.Data.TypeProviders/FSharp.Data.TypeProviders.fsproj"/>
</ItemGroup>
<Import Project="root.traversal.targets"/>
<!-- Insert any customizations for targets here -->
</Project>

Просмотреть файл

@ -27,8 +27,6 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Server.Shar
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.Unittests", "fsharp\FSharp.Core.Unittests\FSharp.Core.Unittests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Data.TypeProviders", "fsharp\FSharp.Data.TypeProviders\FSharp.Data.TypeProviders.fsproj", "{CB7D20C4-6506-406D-9144-5342C3595F03}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsiAnyCPU", "fsharp\fsiAnyCpu\FsiAnyCPU.fsproj", "{8B3E283D-B5FE-4055-9D80-7E3A32F3967B}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Unittests", "fsharp\FSharp.Compiler.Unittests\FSharp.Compiler.Unittests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}"
@ -77,10 +75,6 @@ Global
{88E2D422-6852-46E3-A740-83E391DC7973}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88E2D422-6852-46E3-A740-83E391DC7973}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88E2D422-6852-46E3-A740-83E391DC7973}.Release|Any CPU.Build.0 = Release|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Any CPU.Build.0 = Release|Any CPU
{8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Debug|Any CPU.ActiveCfg = Debug|x86
{8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Release|Any CPU.ActiveCfg = Release|x86
{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

Просмотреть файл

@ -30,7 +30,9 @@ let mkFlexibleFormatTypar m tys dflt =
let mkFlexibleIntFormatTypar g m =
mkFlexibleFormatTypar m [ g.byte_ty; g.int16_ty; g.int32_ty; g.int64_ty; g.sbyte_ty; g.uint16_ty; g.uint32_ty; g.uint64_ty;g.nativeint_ty;g.unativeint_ty; ] g.int_ty
let mkFlexibleDecimalFormatTypar g m =
mkFlexibleFormatTypar m [ g.decimal_ty ] g.decimal_ty
let mkFlexibleFloatFormatTypar g m =
mkFlexibleFormatTypar m [ g.float_ty; g.float32_ty; g.decimal_ty ] g.float_ty
@ -235,9 +237,9 @@ let parseFormatStringInternal (m:range) g (source: string option) fmt bty cty =
| ('h' | 'H') ->
failwithf "%s" <| FSComp.SR.forHIsUnnecessary()
| 'M' ->
| 'M' ->
collectSpecifierLocation relLine relCol
parseLoop ((posi, g.decimal_ty) :: acc) (i+1, relLine, relCol+1)
parseLoop ((posi, mkFlexibleDecimalFormatTypar g m) :: acc) (i+1, relLine, relCol+1)
| ('f' | 'F' | 'e' | 'E' | 'g' | 'G') ->
collectSpecifierLocation relLine relCol

Просмотреть файл

@ -102,7 +102,6 @@ exception DeprecatedCommandLineOptionNoDescription of string * range
exception InternalCommandLineOption of string * range
exception HashLoadedSourceHasIssues of (*warnings*) exn list * (*errors*) exn list * range
exception HashLoadedScriptConsideredSource of range
exception InvalidInternalsVisibleToAssemblyName of (*badName*)string * (*fileName option*) string option
let GetRangeOfError(err:PhasedError) =
@ -3548,7 +3547,7 @@ let WriteOptimizationData (tcGlobals, file, ccu,modulInfo) =
// Abstraction for project reference
type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyRefs) =
let externalSigAndOptData = ["FSharp.Core";"FSharp.LanguageService.Compiler"]
let externalSigAndOptData = ["FSharp.Core"]
interface IRawFSharpAssemblyData with
member __.GetAutoOpenAttributes(ilg) = GetAutoOpenAttributes ilg ilModule
member __.GetInternalsVisibleToAttributes(ilg) = GetInternalsVisibleToAttributes ilg ilModule
@ -3701,6 +3700,13 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
| Some(importsBase)-> importsBase.GetDllInfos() @ dllInfos
| None -> dllInfos
member tcImports.AllAssemblyResolutions() =
CheckDisposed()
let ars = resolutions.GetAssemblyResolutions()
match importsBase with
| Some(importsBase)-> importsBase.AllAssemblyResolutions() @ ars
| None -> ars
member tcImports.TryFindDllInfo (m,assemblyName,lookupOnly) =
CheckDisposed()
let rec look (t:TcImports) =
@ -4036,7 +4042,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
{ resolutionFolder = tcConfig.implicitIncludeDir
outputFile = tcConfig.outputFile
showResolutionMessages = tcConfig.showExtensionTypeMessages
referencedAssemblies = [| for r in resolutions.GetAssemblyResolutions() -> r.resolvedPath |]
referencedAssemblies = Array.distinct [| for r in tcImports.AllAssemblyResolutions() -> r.resolvedPath |]
temporaryFolder = FileSystem.GetTempPathShim() }
// The type provider should not hold strong references to disposed
@ -4585,17 +4591,19 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
/// Process #r in F# Interactive.
/// Adds the reference to the tcImports and add the ccu to the type checking environment.
let RequireDLL (tcImports:TcImports) tcEnv m file =
let RequireResolved = function
| ResolvedImportedAssembly(ccuinfo) -> ccuinfo
| UnresolvedImportedAssembly(assemblyName) -> error(Error(FSComp.SR.buildCouldNotResolveAssemblyRequiredByFile(assemblyName,file),m))
let RequireDLL (tcImports:TcImports, tcEnv, thisAssemblyName, m, file) =
let resolutions = CommitOperationResult(tcImports.TryResolveAssemblyReference(AssemblyReference(m,file,None),ResolveAssemblyReferenceMode.ReportErrors))
let dllinfos,ccuinfos = tcImports.RegisterAndImportReferencedAssemblies(resolutions)
let ccuinfos = ccuinfos |> List.map RequireResolved
let asms =
ccuinfos |> List.map (function
| ResolvedImportedAssembly(asm) -> asm
| UnresolvedImportedAssembly(assemblyName) -> error(Error(FSComp.SR.buildCouldNotResolveAssemblyRequiredByFile(assemblyName,file),m)))
let g = tcImports.GetTcGlobals()
let amap = tcImports.GetImportMap()
let tcEnv = ccuinfos |> List.fold (fun tcEnv ccuinfo -> Tc.AddCcuToTcEnv(g,amap,m,tcEnv,ccuinfo.FSharpViewOfMetadata,ccuinfo.AssemblyAutoOpenAttributes,false)) tcEnv
tcEnv,(dllinfos,ccuinfos)
let tcEnv = (tcEnv, asms) ||> List.fold (fun tcEnv asm -> Tc.AddCcuToTcEnv(g,amap,m,tcEnv,thisAssemblyName,asm.FSharpViewOfMetadata,asm.AssemblyAutoOpenAttributes,asm.AssemblyInternalsVisibleToAttributes))
tcEnv,(dllinfos,asms)
@ -5013,29 +5021,16 @@ type LoadClosure with
//--------------------------------------------------------------------------
/// Build the initial type checking environment
let GetInitialTcEnv (assemblyName:string option, initm:range, tcConfig:TcConfig, tcImports:TcImports, tcGlobals) =
let GetInitialTcEnv (thisAssemblyName:string, initm:range, tcConfig:TcConfig, tcImports:TcImports, tcGlobals) =
let initm = initm.StartRange
let internalsAreVisibleHere (asm:ImportedAssembly) =
match assemblyName with
| None -> false
| Some assemblyName ->
let isTargetAssemblyName (visibleTo:string) =
try
System.Reflection.AssemblyName(visibleTo).Name = assemblyName
with e ->
warning(InvalidInternalsVisibleToAssemblyName(visibleTo,asm.FSharpViewOfMetadata.FileName))
false
let internalsVisibleTos = asm.AssemblyInternalsVisibleToAttributes
List.exists isTargetAssemblyName internalsVisibleTos
let ccus =
tcImports.GetImportedAssemblies()
|> List.map (fun asm -> asm.FSharpViewOfMetadata, asm.AssemblyAutoOpenAttributes, asm |> internalsAreVisibleHere)
|> List.map (fun asm -> asm.FSharpViewOfMetadata, asm.AssemblyAutoOpenAttributes, asm.AssemblyInternalsVisibleToAttributes)
let amap = tcImports.GetImportMap()
let tcEnv = Tc.CreateInitialTcEnv(tcGlobals, amap, initm, ccus)
let tcEnv = Tc.CreateInitialTcEnv(tcGlobals, amap, initm, thisAssemblyName, ccus)
let tcEnv =
if tcConfig.checkOverflow then

Просмотреть файл

@ -649,7 +649,7 @@ val WriteOptimizationData : TcGlobals * string * CcuThunk * Optimizer.LazyModul
/// Process #r in F# Interactive.
/// Adds the reference to the tcImports and add the ccu to the type checking environment.
val RequireDLL : TcImports -> TcEnv -> range -> string -> TcEnv * (ImportedBinary list * ImportedAssembly list)
val RequireDLL : TcImports * TcEnv * thisAssemblyName: string * referenceRange: range * file: string -> TcEnv * (ImportedBinary list * ImportedAssembly list)
/// Processing # commands
val ProcessMetaCommandsFromInput :
@ -690,7 +690,7 @@ val ParseOneInputFile : TcConfig * Lexhelp.LexResourceManager * string list * st
/// Get the initial type checking environment including the loading of mscorlib/System.Core, FSharp.Core
/// applying the InternalsVisibleTo in referenced assemblies and opening 'Checked' if requested.
val GetInitialTcEnv : string option * range * TcConfig * TcImports * TcGlobals -> TcEnv
val GetInitialTcEnv : assemblyName: string * range * TcConfig * TcImports * TcGlobals -> TcEnv
[<Sealed>]
/// Represents the incremental type checking state for a set of inputs

Просмотреть файл

@ -2004,7 +2004,7 @@ and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNam
let missingArgs = List.drop nReqd cmeth.AllUnnamedCalledArgs
match NamesOfCalledArgs missingArgs with
| [] -> (false, "")
| names -> (true, String.concat ";" (List.map textOfId names))
| names -> (true, String.concat ";" (pathOfLid names))
else (false, "")
match suggestNamesForMissingArguments with

Просмотреть файл

@ -1291,3 +1291,4 @@ estApplyStaticArgumentsForMethodNotImplemented,"A type provider implemented GetS
3194,optsResponseFileNotFound,"Response file '%s' not found in '%s'"
3195,optsResponseFileNameInvalid,"Response file name '%s' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long"
3196,fsharpCoreNotFoundToBeCopied,"Cannot find FSharp.Core.dll in compiler's directory"
3197,etMissingStaticArgumentsToMethod,"This provided method requires static parameters"

Просмотреть файл

@ -1,12 +1,12 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.FSharp.Compiler.Host.netcore</id>
<description>
netcore compatible version of the fsharp compiler fsc.exe.
Supported Platforms:
- .NET Core (dnxcore50)
- .NET Core (netstandard1.5)
</description>
<language>en-US</language>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
@ -16,7 +16,7 @@
<projectUrl>$projectUrl$</projectUrl>
<tags>$tags$</tags>
<dependencies>
<group>
<group targetFramework=".NETStandard1.5">
<dependency id="Microsoft.NETCore.Platforms" version="1.0.1-rc2-23911" />
<dependency id="Microsoft.NETCore.Runtime.CoreCLR" version="1.0.2-rc2-23911" />
<dependency id="Microsoft.NETCore" version="5.0.1-rc2-23911" />

Просмотреть файл

@ -21,7 +21,7 @@
</FsSrGen>
<Compile Include="InternalsVisibleTo.fs"/>
<Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Compiler.Interactive.Settings.dll.fs">
<Link>Utilities/assemblyinfo.FSharp.Compiler.Interactive.Settings.dll.fs</Link>
<Link>assemblyinfo.FSharp.Compiler.Interactive.Settings.dll.fs</Link>
</Compile>
<Compile Include="..\..\utils\reshapedreflection.fs">
<Link>Reflection/reshapedreflection.fs</Link>

Просмотреть файл

@ -14,6 +14,6 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": { }
"netstandard1.5": { }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,10 +1,10 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.FSharp.Compiler.netcore</id>
<description>
netcore compatible version of the fsharp compiler fsc.exe.
Supported Platforms: - .NET Core (dnxcore50)
Supported Platforms: - .NET Core (.netstandard1.5)
</description>
<language>en-US</language>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
@ -14,7 +14,7 @@
<projectUrl>$projectUrl$</projectUrl>
<tags>$tags$</tags>
<dependencies>
<group>
<group targetFramework=".NETStandard1.5">
<dependency id="Microsoft.FSharp.Core.netcore" version="$version$" />
<dependency id="Microsoft.NETCore.Platforms" version="1.0.1-rc2-23911" />
<dependency id="NETStandard.Library" version="1.5.0-rc2-23911" />
@ -41,10 +41,10 @@
</dependencies>
</metadata>
<files>
<file src="fsc.exe" target="lib/DNXCore50" />
<file src="FSharp.Compiler.dll" target="lib/DNXCore50" />
<file src="fsc.exe" target="lib/netstandard1.5" />
<file src="FSharp.Compiler.dll" target="lib/netstandard1.5" />
<file src="default.win32manifest" target="runtimes/any/native/" />
<file src="fsi.exe" target="lib/DNXCore50" />
<file src="FSharp.Compiler.Interactive.Settings.dll" target="lib/DNXCore50" />
<file src="fsi.exe" target="lib/netstandard1.5" />
<file src="FSharp.Compiler.Interactive.Settings.dll" target="lib/netstandard1.5" />
</files>
</package>

Просмотреть файл

@ -62,11 +62,10 @@ try
let fsharpCompilerFiles =
seq {
yield Path.Combine(bindir, "fsc.exe")
yield Path.Combine(bindir, "FSharp.Core.dll")
yield Path.Combine(bindir, "FSharp.Compiler.dll")
yield Path.Combine(bindir, "FSharp.Core.sigdata")
yield Path.Combine(bindir, "FSharp.Core.optdata")
yield Path.Combine(bindir, "default.win32manifest")
yield Path.Combine(bindir, "fsi.exe")
yield Path.Combine(bindir, "FSharp.Compiler.Interactive.Settings.dll")
}
//Clean intermediate directoriy

Просмотреть файл

@ -4,8 +4,6 @@ namespace Microsoft.FSharp
open System.Reflection
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Fsc, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Build, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.QuickSearch, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Model, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Fsi, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FsiAnyCPU, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.LanguageService, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]

Просмотреть файл

@ -30,7 +30,7 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": {
"netstandard1.5": {
"imports": "portable-net45+win8"
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -18,6 +18,6 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": { }
"netstandard1.5": { }
}
}

Просмотреть файл

@ -590,28 +590,98 @@ namespace Microsoft.FSharp.Collections
let tryFindIndexBack f list = list |> toArray |> Array.tryFindIndexBack f
[<CompiledName("Sum")>]
let inline sum (list:list<_>) = Seq.sum list
let inline sum (list:list<'T>) =
match list with
| [] -> LanguagePrimitives.GenericZero< 'T >
| t ->
let mutable acc = LanguagePrimitives.GenericZero< 'T >
for x in t do
acc <- Checked.(+) acc x
acc
[<CompiledName("SumBy")>]
let inline sumBy f (list:list<_>) = Seq.sumBy f list
let inline sumBy (f: 'T -> 'U) (list:list<'T>) =
match list with
| [] -> LanguagePrimitives.GenericZero< 'U >
| t ->
let mutable acc = LanguagePrimitives.GenericZero< 'U >
for x in t do
acc <- Checked.(+) acc (f x)
acc
[<CompiledName("Max")>]
let inline max (list:list<_>) = Seq.max list
let inline max (list:list<_>) =
match list with
| [] -> invalidArg "list" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
| h::t ->
let mutable acc = h
for x in t do
if x > acc then
acc <- x
acc
[<CompiledName("MaxBy")>]
let inline maxBy f (list:list<_>) = Seq.maxBy f list
let inline maxBy f (list:list<_>) =
match list with
| [] -> invalidArg "list" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
| h::t ->
let mutable acc = h
let mutable accv = f h
for x in t do
let currv = f x
if currv > accv then
acc <- x
accv <- currv
acc
[<CompiledName("Min")>]
let inline min (list:list<_>) = Seq.min list
let inline min (list:list<_>) =
match list with
| [] -> invalidArg "list" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
| h::t ->
let mutable acc = h
for x in t do
if x < acc then
acc <- x
acc
[<CompiledName("MinBy")>]
let inline minBy f (list:list<_>) = Seq.minBy f list
let inline minBy f (list:list<_>) =
match list with
| [] -> invalidArg "list" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
| h::t ->
let mutable acc = h
let mutable accv = f h
for x in t do
let currv = f x
if currv < accv then
acc <- x
accv <- currv
acc
[<CompiledName("Average")>]
let inline average (list:list<_>) = Seq.average list
let inline average (list:list<'T>) =
match list with
| [] -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
| xs ->
let mutable sum = LanguagePrimitives.GenericZero< 'T >
let mutable count = 0
for x in xs do
sum <- Checked.(+) sum x
count <- count + 1
LanguagePrimitives.DivideByInt sum count
[<CompiledName("AverageBy")>]
let inline averageBy f (list:list<_>) = Seq.averageBy f list
let inline averageBy (f : 'T -> 'U) (list:list<'T>) =
match list with
| [] -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
| xs ->
let mutable sum = LanguagePrimitives.GenericZero< 'U >
let mutable count = 0
for x in xs do
sum <- Checked.(+) sum (f x)
count <- count + 1
LanguagePrimitives.DivideByInt sum count
[<CompiledName("Collect")>]
let collect f list = Microsoft.FSharp.Primitives.Basics.List.collect f list

Просмотреть файл

@ -17,6 +17,6 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": { }
"netstandard1.5": { }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DefineConstants>$(DefineConstants);TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Configuration" />
<Reference Include="System.ServiceModel" />
</ItemGroup>
<ItemGroup>
<FilesToLocalize Include="$(OutDir)$(AssemblyName).dll">
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
<HasLceComments>false</HasLceComments>
<InProject>false</InProject>
</FilesToLocalize>
</ItemGroup>
<ItemGroup>
<FsSrGen Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\FSData.txt" >
<Link>FSData.txt</Link>
<Visible>true</Visible>
</FsSrGen>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\Util.fsi">
<Link>Util.fsi</Link>
<Visible>true</Visible>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\Util.fs">
<Link>Util.fs</Link>
<Visible>true</Visible>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\InternalsVisibleTo.fs">
<Link>InternalsVisibleTo.fs</Link>
<Visible>true</Visible>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\TypeProviderEmit.fsi">
<Link>TypeProviderEmit.fsi</Link>
<Visible>true</Visible>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\TypeProviderEmit.fs">
<Link>TypeProviderEmit.fs</Link>
<Visible>true</Visible>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\TypeProvidersImpl.fs">
<Link>TypeProvidersImpl.fs</Link>
<Visible>true</Visible>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\TypeProviders.fs">
<Link>TypeProviders.fs</Link>
<Visible>true</Visible>
</Compile>
</ItemGroup>
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
<ItemGroup>
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).dll" />
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
<FilesToSign Include="@(BinariesToBeSigned)">
<Authenticode>Microsoft</Authenticode>
<StrongName>StrongName</StrongName>
</FilesToSign>
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FSharpSourcesRoot>..\..</FSharpSourcesRoot>
</PropertyGroup>
<Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AssemblyName>FSharp.Data.TypeProviders</AssemblyName>
<AllowCrossTargeting>true</AllowCrossTargeting>
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v4.0</TargetFrameworkVersion>
<ProjectGuid>{cb7d20c4-6506-406d-9144-5342c3595f03}</ProjectGuid>
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
</PropertyGroup>
<Import Project="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\FSharp.Data.TypeProviders.Shared.fsproj"
Condition="'$(TargetFramework)' != 'sl5' AND
'$(TargetFramework)' != 'portable47' AND
'$(TargetFramework)' != 'sl3-wp'" />
<ItemGroup>
<!--This is used for compiling the runtime type provider DLL for WP7, Silverlight etc. -->
<!--This is the only file used. -->
<Compile Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\TypeProviderRuntimeAttribute.fs" Condition="'$(TargetFramework)' == 'net20' or '$(TargetFramework)' == 'sl3-wp' or '$(TargetFramework)'=='sl4' ">
<Link>TypeProviderRuntimeAttribute.fs</Link>
<Visible>true</Visible>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="$(FSharpSourcesRoot)\assemblyinfo\assemblyinfo.FSharp.Data.TypeProviders.dll.fs">
<Link>assemblyinfo.FSharp.Data.TypeProviders.dll.fs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Configuration" />
<Reference Include="System.ServiceModel" />
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" >
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
<Name>FSharp.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets"/>
</Project>

Просмотреть файл

@ -1,9 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp
open System.Reflection
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
do()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,267 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
namespace Internal.Utilities.TypeProvider.Emit
#else
namespace Microsoft.FSharp.TypeProvider.Emit
#endif
open System
open System.Reflection
open System.Linq.Expressions
open Microsoft.FSharp.Core.CompilerServices
/// Represents an erased provided parameter
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
type internal ProvidedParameter =
#else
type ProvidedParameter =
#endif
inherit System.Reflection.ParameterInfo
new : parameterName: string * parameterType: Type * ?isOut:bool * ?optionalValue:obj -> ProvidedParameter
/// Represents an erased provided constructor.
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
type internal ProvidedConstructor =
#else
type ProvidedConstructor =
#endif
inherit System.Reflection.ConstructorInfo
/// Create a new provided constructor. It is not initially associated with any specific provided type definition.
new : parameters: ProvidedParameter list -> ProvidedConstructor
/// Add XML documentation information to this provided constructor
member AddXmlDoc : xmlDoc: string -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary
member AddXmlDocDelayed : xmlDocFunction: (unit -> string) -> unit
/// Add XML documentation information to this provided constructor, where the documentation is re-computed every time it is required.
member AddXmlDocComputed : xmlDocFunction: (unit -> string) -> unit
/// Set the quotation used to compute the implementation of invocations of this constructor.
member InvokeCode : (Quotations.Expr list -> Quotations.Expr) with set
/// Set the function used to compute the implementation of invocations of this constructor.
member InvokeCodeInternal : (Quotations.Expr[] -> Quotations.Expr) with get,set
/// Add definition location information to the provided constructor.
member AddDefinitionLocation : line:int * column:int * filePath:string -> unit
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
type internal ProvidedMethod =
#else
type ProvidedMethod =
#endif
inherit System.Reflection.MethodInfo
/// Create a new provided method. It is not initially associated with any specific provided type definition.
new : methodName:string * parameters: ProvidedParameter list * returnType: Type -> ProvidedMethod
/// Add XML documentation information to this provided constructor
member AddXmlDoc : xmlDoc: string -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary
member AddXmlDocDelayed : xmlDocFunction: (unit -> string) -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary
/// The documentation is re-computed every time it is required.
member AddXmlDocComputed : xmlDocFunction: (unit -> string) -> unit
/// Set the method attributes of the method. By default these are simple 'MethodAttributes.Public'
member SetMethodAttrs : attributes:MethodAttributes -> unit
/// Get or set a flag indicating if the property is static.
member IsStaticMethod : bool with get, set
/// Set the quotation used to compute the implementation of invocations of this method.
member InvokeCode : (Quotations.Expr list -> Quotations.Expr) with set
/// Set the function used to compute the implementation of invocations of this method.
member InvokeCodeInternal : (Quotations.Expr[] -> Quotations.Expr) with get,set
/// Add definition location information to the provided type definition.
member AddDefinitionLocation : line:int * column:int * filePath:string -> unit
/// Represents an erased provided property.
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
type internal ProvidedProperty =
#else
type ProvidedProperty =
#endif
inherit System.Reflection.PropertyInfo
/// Create a new provided type. It is not initially associated with any specific provided type definition.
new : propertyName: string * propertyType: Type * ?parameters:ProvidedParameter list -> ProvidedProperty
/// Add XML documentation information to this provided constructor
member AddXmlDoc : xmlDoc: string -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary
member AddXmlDocDelayed : xmlDocFunction: (unit -> string) -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary
/// The documentation is re-computed every time it is required.
member AddXmlDocComputed : xmlDocFunction: (unit -> string) -> unit
/// Get or set a flag indicating if the property is static.
member IsStatic : bool with set
/// Set the quotation used to compute the implementation of invocations of this constructor.
member GetterCode : (Quotations.Expr list -> Quotations.Expr) with set
/// Set the function used to compute the implementation of invocations of this constructor.
member GetterCodeInternal : (Quotations.Expr[] -> Quotations.Expr) with get,set
/// Set the function used to compute the implementation of invocations of the property setter
member SetterCode : (Quotations.Expr list -> Quotations.Expr) with set
/// Set the function used to compute the implementation of invocations of this constructor.
member SetterCodeInternal : (Quotations.Expr[] -> Quotations.Expr) with get,set
/// Add definition location information to the provided type definition.
member AddDefinitionLocation : line:int * column:int * filePath:string -> unit
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
#else
/// Represents an erased provided property.
[<Class>]
type ProvidedMeasureBuilder =
/// The ProvidedMeasureBuilder for building measures.
static member Default : ProvidedMeasureBuilder
/// e.g. 1
member One : System.Type
/// e.g. m * kg
member Product : measure1: System.Type * measure1: System.Type -> System.Type
/// e.g. 1 / kg
member Inverse : denominator: System.Type -> System.Type
/// e.g. kg / m
member Ratio : numerator: System.Type * denominator: System.Type -> System.Type
/// e.g. m * m
member Square : ``measure``: System.Type -> System.Type
/// the SI unit from the F# core library, where the string is in capitals and US spelling, e.g. Meter
member SI : string -> System.Type
/// e.g. float<kg>, Vector<int, kg>
member AnnotateType : basic: System.Type * argument: System.Type list -> System.Type
#endif //TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
/// Represents an erased provided parameter
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
type internal ProvidedStaticParameter =
#else
type ProvidedStaticParameter =
#endif
inherit System.Reflection.ParameterInfo
new : parameterName: string * parameterType:Type * ?parameterDefaultValue:obj -> ProvidedStaticParameter
/// Represents an erased provided type definition.
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
type internal ProvidedTypeDefinition =
#else
type ProvidedTypeDefinition =
#endif
inherit System.Type
/// Create a new provided type definition in a namespace.
new : assembly: Assembly * namespaceName: string * className: string * baseType: Type option -> ProvidedTypeDefinition
/// Create a new provided type definition, to be located as a nested type in some type definition.
new : className : string * baseType: Type option -> ProvidedTypeDefinition
/// Add the given type as an implemented interface.
member AddInterfaceImplementation : interfaceType: Type -> unit
/// Specifies that the given method body implements the given method declaration.
member DefineMethodOverride : methodInfoBody: ProvidedMethod * methodInfoDeclaration: MethodInfo -> unit
/// Add XML documentation information to this provided constructor
member AddXmlDoc : xmlDoc: string -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary.
/// The documentation is only computed once.
member AddXmlDocDelayed : xmlDocFunction: (unit -> string) -> unit
/// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary
/// The documentation is re-computed every time it is required.
member AddXmlDocComputed : xmlDocFunction: (unit -> string) -> unit
/// Set the attributes on the provided type. This fully replaces the default TypeAttributes.
member SetAttributes : System.Reflection.TypeAttributes -> unit
/// Add a method, property, nested type or other member to a ProvidedTypeDefinition
member AddMember : memberInfo:MemberInfo -> unit
/// Add a set of members to a ProvidedTypeDefinition
member AddMembers : memberInfos:list<#MemberInfo> -> unit
/// Add a member to a ProvidedTypeDefinition, delaying computation of the members until required by the compilation context.
member AddMemberDelayed : memberFunction:(unit -> #MemberInfo) -> unit
/// Add a set of members to a ProvidedTypeDefinition, delaying computation of the members until required by the compilation context.
member AddMembersDelayed : (unit -> list<#MemberInfo>) -> unit
/// Add the types of the generated assembly as generative types, where types in namespaces get hierarchically positioned as nested types.
member AddAssemblyTypesAsNestedTypesDelayed : assemblyFunction:(unit -> System.Reflection.Assembly) -> unit
// Parametric types
member DefineStaticParameters : parameters: ProvidedStaticParameter list * instantiationFunction: (string -> obj[] -> ProvidedTypeDefinition) -> unit
/// Add definition location information to the provided type definition.
member AddDefinitionLocation : line:int * column:int * filePath:string -> unit
/// Suppress System.Object entries in intellisense menus in instances of this provided type
member HideObjectMethods : bool with set
/// Emit the given provided type definition and its nested type definitions into an assembly
/// and adjust the 'Assembly' property of all provided type definitions to return that
/// assembly.
///
/// The assembly is only emitted when the Assembly property on the root type is accessed for the first time.
member ConvertToGenerated : assemblyFileName:string * ?reportAssembly: (Assembly * byte[] -> unit) -> unit
/// Get or set a flag indicating if the ProvidedTypeDefinition is erased
member IsErased : bool with get,set
/// Get or set a flag indicating if the ProvidedTypeDefinition has type-relocation suppressed
[<Experimental("SuppressRelocation is a workaround and likely to be removed")>]
member SuppressRelocation : bool with get,set
#if PROVIDER_TRANSFORMATIONS
[<Sealed;Class;AbstractClass>]
type ProviderTransformations =
static member FilterTypes : types: Type list * ?methodFilter : (MethodInfo -> bool) * ?eventFilter : (EventInfo -> bool) * ?propertyFilter : (PropertyInfo -> bool) * ?constructorFilter : (ConstructorInfo -> bool) * ?fieldFilter : (FieldInfo -> bool) * ?baseTypeTransform : (Type -> Type option) -> Type list
#endif
#if TPEMIT_INTERNAL_AND_MINIMAL_FOR_TYPE_CONTAINERS
#else
type TypeProviderForNamespaces =
/// A base type providing default implementations of type provider functionality when all provided types are of type ProvidedTypeDefinition
// A TypeProvider boiler plate type.
// 1. Inherit supplying the "providedNamespaces"
// 2. Add [<Microsoft.FSharp.Core.CompilerServices.TypeProvider>] to type.
// 3. Add [<assembly:TypeProviderAssembly>] do() to assembly.
/// Initializes a type provider to provide the types in the given namespace.
new : namespaceName:string * types: ProvidedTypeDefinition list -> TypeProviderForNamespaces
/// Initializes a type provider
new : unit -> TypeProviderForNamespaces
/// Add a namespace of provided types.
member AddNamespace : namespaceName:string * types: ProvidedTypeDefinition list -> unit
/// Invalidate the information provided by the provider
member Invalidate : unit -> unit
interface ITypeProvider
#endif

Просмотреть файл

@ -1,11 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Data.TypeProviders.DesignTime
open Microsoft.FSharp.Core.CompilerServices
// This says that this assembly is a runtime DLL for a particular platform, where the design-time
// DLL is found alongside this DLL and has the given name.
[<assembly:TypeProviderAssemblyAttribute("FSharp.Data.TypeProviders.DesignTime.dll") >]
do()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,896 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Data.TypeProviders.DesignTime
open System
open System.IO
open System.Reflection
open System.Collections.Generic
open System.Linq
open System.Xml.Linq
open System.Net
open System.Configuration
open Microsoft.FSharp.Data.TypeProviders.Utility
[<AutoOpen>]
module internal Utilities =
let validateSchemaFileExtension localSchemaFile ext =
// treat extensions that differ only in case as equal
if not (Path.GetExtension(localSchemaFile).Equals("."+ext, StringComparison.OrdinalIgnoreCase)) then
failwith (FSData.SR.errorInvalidExtensionSchema(Path.GetFileName(localSchemaFile),ext))
/// Use a local schema file if the 'localSchemaFile' parameter is present (IsNullOrWhiteSpace). Otherwise,
/// use a temporary file to hold the metadata description of the service. Always force the update
/// of the file if 'forceUpdate' is true and the downloaded contents have changed.
let tryUseLocalSchemaFile (localSchemaFile, forceUpdate, ext) loader =
let useTempFile = String.IsNullOrWhiteSpace localSchemaFile
let schemaFile = if useTempFile then Util.TemporaryFile ext else Util.ExistingFile localSchemaFile
// Check if the extension of LocalSchema matches the given "ext"
if not useTempFile then validateSchemaFileExtension localSchemaFile ext
if useTempFile || forceUpdate || not (File.Exists schemaFile.Path) then
let metadataText = Util.TemporaryFile ext |> loader
// Only write if it's actually changed
if useTempFile || (try File.ReadAllText schemaFile.Path with _ -> null) <> metadataText then
try
File.WriteAllText(schemaFile.Path, metadataText)
with :? System.IO.IOException as e -> failwith (FSData.SR.errorWritingLocalSchemaFile(e.Message))
schemaFile
// tricky moment that error message can spread through multiple lines
// so we:
// - walk through lines until we met first line with error code, save this line
// - traverse lines till the next error code (or EOF). append every line to the buffer
// - flush buffer on every line with error code (or at the end)
let private selectLines hasErrorCode (arr : string[]) =
// sqlmetal\edmgen pads inner exceptions with tabs so if line starts with tab - this is not beginning of the message
// svcutil pads inner exceptions with ' ' so this is not message start as well
let (|MessageStart|_|) line =
if not (System.String.IsNullOrEmpty line) && line.[0] <> '\t' && not (line.StartsWith " ") && hasErrorCode line then Some () else None
let (|EmptyLine|_|) line =
if String.IsNullOrEmpty line then Some () else None
[|
let buf = System.Text.StringBuilder()
for line in arr do
match line with
| MessageStart ->
// return accumulated result with the prevous message
if buf.Length <> 0 then
yield buf.ToString()
buf.Length <- 0
// start new message
buf.Append(line.Trim()) |> ignore
| EmptyLine ->
// // we assume that messages cannot contain embedded empty lines so empty line terminates current message
if buf.Length <> 0 then
yield buf.ToString()
buf.Length <- 0
| l ->
// if we already started writing the message - then interleave lines in buffer with spaces
// if buffer.Length = 0 - this means that we previous error has already ended but MessageStart for the new one wasn't yet met.
// in this case we discard this line - it is probably header or footer of output
if buf.Length <> 0 then
buf
.Append(" ")
.Append(l.Trim()) |> ignore
// flush remaining content
if buf.Length <> 0 then
yield buf.ToString()
|]
// Defines the main pattern for matching messages.
// taken from vsproject\xmake\shared\canonicalerror.cs
let private canonicalMessageRegex =
new System.Text.RegularExpressions.Regex
(
// Beginning of line and any amount of whitespace.
@"^\s*" +
// Match a [optional project number prefix 'ddd>'], single letter + colon + remaining filename, or
// string with no colon followed by a colon.
@"(((?<ORIGIN>(((\d+>)?[a-zA-Z]?:[^:]*)|([^:]*))):)" +
// Origin may also be empty. In this case there's no trailing colon.
"|())" +
// Match the empty string or a string without a colon that ends with a space
"(?<SUBCATEGORY>(()|([^:]*? )))" +
// Match 'error' or 'warning'.
@"(?<CATEGORY>(error|warning))" +
// Match anything starting with a space that's not a colon/space, followed by a colon.
// Error code is optional in which case "error"/"warning" can be followed immediately by a colon.
@"( \s*(?<CODE>[^: ]*))?\s*:" +
// Whatever's left on this line, including colons.
"(?<TEXT>.*)$",
System.Text.RegularExpressions.RegexOptions.IgnoreCase ||| System.Text.RegularExpressions.RegexOptions.Compiled
)
// Defines the additional pattern for matching messages which may contain localized strings.
// Note that the string "error|warning" from canonicalMessageRegex is simply replaced by "\w+"
// to match both any localized strings and PLOC'd strings.
// It has some group misalignment for PLOC'd strings, but as a whole, it works as expected.
let private structuralMessageRegex =
new System.Text.RegularExpressions.Regex
(
// Beginning of line and any amount of whitespace.
@"^\s*" +
// Match a [optional project number prefix 'ddd>'], single letter + colon + remaining filename, or
// string with no colon followed by a colon.
@"(((?<ORIGIN>(((\d+>)?[a-zA-Z]?:[^:]*)|([^:]*))):)" +
// Origin may also be empty. In this case there's no trailing colon.
"|())" +
// Match the empty string or a string without a colon that ends with a space
"(?<SUBCATEGORY>(()|([^:]*? )))" +
// Match localized 'error' or 'warning'.
@"(?<CATEGORY>(\w+))" +
// Match anything starting with a space that's not a colon/space, followed by a colon.
// Error code is optional in which case "error"/"warning" can be followed immediately by a colon.
// constraints for CODE here is more restrictive than in cannonical case - here we match only alphanumeric chars
@"( \s*(?<CODE>\w*))?\s*:" +
// Whatever's left on this line, including colons.
"(?<TEXT>.*)$",
System.Text.RegularExpressions.RegexOptions.IgnoreCase ||| System.Text.RegularExpressions.RegexOptions.Compiled
)
let formatErr (stdout: string[]) (stderr: string[]) : unit =
let getErrors s =
Array.ofSeq s
|> selectLines (fun s ->
if canonicalMessageRegex.IsMatch s then true
else
// structural regex can produce false positives when line contain ':' chars
// to reduce amount of false positives we'll mangle the most frequent scenario when ':' can be met - urls.
// In addition, "!" which wraps PLOC'd strings will be also replaced to "_" to make the matching easier.
let escapedLine = s.Replace("://", "_").Replace("!","_")
structuralMessageRegex.IsMatch escapedLine
)
|> Array.map Failure
let exns =
Array.concat
[
getErrors stdout
getErrors stderr
]
assert (exns.Length <> 0)
raise (AggregateException exns)
/// Run SQLMetal and strip out a decent error message
let sqlmetal args = Util.shell (Path.GetTempPath(), Util.sdkUtil "SqlMetal.exe", args, Some formatErr)
let inline handleReadingSchemaError (e : exn) =
match e with
| :? AggregateException as ae ->
let inners =
ae.InnerExceptions
|> Seq.map (fun e -> Failure(FSData.SR.errorReadingSchema(e.Message)))
|> Seq.toArray
raise(AggregateException(inners))
| e -> failwith (FSData.SR.errorReadingSchema(e.Message))
// will exists forever - but I guess we can live with it as the leak is minor
// CSharpCodeProvider is IDisposable -
// Dispose is inherited from Component: removes component from the ISite and unsubscribes from events - we don't use any of this features
let private csCodeProvider = new Microsoft.CSharp.CSharpCodeProvider()
let validateDataContextClassName name =
if not(String.IsNullOrWhiteSpace name) && not (csCodeProvider.IsValidIdentifier name) then
failwith (FSData.SR.invalidDataContextClassName(name))
type UC = System.Globalization.UnicodeCategory
let sanitizeDataContextFileName (name : string) =
if String.IsNullOrEmpty name then failwith (FSData.SR.invalidDataContextClassName(name))
/// tests if specified character is valid start character for C# identifier
let isValidStartChar c = Char.IsLetter c || c = '_'
/// tests if specified character is valid non-start character for C# identifier
let isValidNonStartChar c =
if Char.IsLetterOrDigit c || c = '_' then true
else
match Char.GetUnicodeCategory(c) with
| UC.NonSpacingMark | UC.ConnectorPunctuation | UC.SpacingCombiningMark -> true
| _ -> false
let buf = System.Text.StringBuilder()
let name =
// convert given identifier to the uniform representation
// 1. make it all lower-cased
// 2. convert all word starting letters to upper-case + remove whitespaces
let name = name.ToLower()
let buf = System.Text.StringBuilder()
let rec capitalizeFirstLetters i convertNextLetterToUpper =
if i >= name.Length then buf.ToString()
else
let c = name.[i]
if Char.IsWhiteSpace c then
// whitespace - set convertNextLetterToUpper to true and proceed to the next character (thus removing whitespace from the result buffer)
capitalizeFirstLetters (i + 1) true
else
// check if we see whitespace before.
// if yes and current character is letter - it should be converted it to upper case before appending character to the result buffer
let c = if Char.IsLetter c && convertNextLetterToUpper then Char.ToUpper c else c
buf.Append(c) |> ignore
capitalizeFirstLetters (i + 1) false
capitalizeFirstLetters 0 true
let startIndex =
let first = name.[0]
if isValidStartChar first then
// if first character is valid start character for C# identifier => append it to the result buffer
buf.Append(first) |> ignore
1
elif isValidNonStartChar first then
// first character in name is not valid start character but valid as non-start. => it should be prepended with '_'
buf.Append('_').Append(first) |> ignore
1
else
// first character is invalid for usage in C# identifier => let loop below do all job (this char will be replaced with '_')
0
// check char by char if they can be used in C# identifier. invalid characters are replaced with '_'
for i=startIndex to (name.Length - 1) do
let c = name.[i]
let c = if isValidNonStartChar c then c else '_'
buf.Append(c) |> ignore
// pad result with underscores if it occasionaly matches some C# keyword or reserved word
csCodeProvider.CreateValidIdentifier(buf.ToString())
module internal ConfigFiles =
type ConfigFileSearchResult =
| StandardFound of string
| CustomFound of string
| StandardNotFound
| CustomNotFound of string
/// searches for the configuration file that will be used by TP
/// designTimeDirectory- root folder
/// configFileName - full path to the custom configuration file
let findConfigFile (designTimeDirectory, configFileName) =
if String.IsNullOrWhiteSpace configFileName then
let appConfig = System.IO.Path.Combine(designTimeDirectory,"app.config")
let webConfig = System.IO.Path.Combine(designTimeDirectory,"web.config")
if System.IO.File.Exists appConfig then StandardFound appConfig
elif System.IO.File.Exists webConfig then StandardFound webConfig
else StandardNotFound
else
if System.IO.File.Exists configFileName then
CustomFound configFileName
else
CustomNotFound configFileName
[<RequireQualifiedAccess>]
type ConnectionStringReadResult =
| Ok of ConnectionStringSettings
| NotFound
| Error of exn
/// reads ConnectionStringSettings with name <connectionStringName> from the specified file
/// returns either ConnectionStringReadResult.Ok (cs : ConnectionStringSettings) (cs is not null)
/// or ConnectionStringReadResult.NotFound if configuration file doesn't contain ConnectionStringSettings with specified name
/// or ConnectionStringReadResult.Error if reading of the file ends with error
let tryReadConnectionString (configFileName : string, connectionStringName : string) =
try
// copy original file to avoid its locking
let text = System.IO.File.ReadAllText configFileName
use tmpConfigFile = Util.TemporaryFile "config"
do System.IO.File.WriteAllText(tmpConfigFile.Path,text)
let map = ExeConfigurationFileMap(ExeConfigFilename = tmpConfigFile.Path)
let config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
let connString = config.ConnectionStrings.ConnectionStrings.[connectionStringName]
if connString <> null then ConnectionStringReadResult.Ok connString
else ConnectionStringReadResult.NotFound
with exn ->
ConnectionStringReadResult.Error exn
let computeStaticConnectionString (name,checkForSqlClientProvider, connectionString, connectionStringName, configFileName, absoluteDataDirectoryParam, designTimeDirectory) =
let connectionString, usingConfigFileInfo =
if String.IsNullOrWhiteSpace connectionString then
let configFileName, configFileBaseNameOpt =
match findConfigFile (designTimeDirectory, configFileName) with
| StandardFound path ->
let name = Path.GetFileName path
path, Some name
| CustomFound path -> path, None
| StandardNotFound -> failwith (FSData.SR.noConfigFileFound1())
| CustomNotFound name -> failwith (FSData.SR.noConfigFileFound2(name))
if String.IsNullOrWhiteSpace connectionStringName then
failwith (FSData.SR.noConnectionStringOrConnectionStringName(name))
let mkReadConnectionStringError msg =
FSData.SR.errorWhileReadingConnectionStringInConfigFile (connectionStringName, configFileName, msg)
|> Choice2Of2
let result =
match tryReadConnectionString(configFileName, connectionStringName) with
| ConnectionStringReadResult.Ok connString ->
if checkForSqlClientProvider && connString.ProviderName <> "System.Data.SqlClient" then
Choice2Of2 (FSData.SR.invalidProviderInConfigFile (connString.ProviderName, connectionStringName, configFileName))
else
let result = connString.ConnectionString
if String.IsNullOrWhiteSpace result then
Choice2Of2 (FSData.SR.invalidConnectionStringInConfigFile (result, connectionStringName, configFileName))
else
Choice1Of2 result
| ConnectionStringReadResult.NotFound ->
FSData.SR.connectionStringNotFound(connectionStringName)
|> mkReadConnectionStringError
| ConnectionStringReadResult.Error exn ->
mkReadConnectionStringError exn.Message
match result with
| Choice1Of2 r -> r, Some (connectionStringName, configFileBaseNameOpt)
| Choice2Of2 msg -> failwith msg
else
if not (String.IsNullOrWhiteSpace connectionStringName) then
failwith (FSData.SR.notBothConnectionStringOrConnectionStringName())
connectionString, None
// Always do |DataDirectory| substitution
let connectionString =
let absoluteDataDirectory =
if String.IsNullOrWhiteSpace absoluteDataDirectoryParam then
designTimeDirectory
else
if not (System.IO.Directory.Exists absoluteDataDirectoryParam) then
failwith (FSData.SR.dataDirectoryNotFound(absoluteDataDirectoryParam))
absoluteDataDirectoryParam
connectionString.Replace("|DataDirectory|", absoluteDataDirectory)
connectionString, usingConfigFileInfo
module internal Dbml =
let buildType (dbmlFileContent: string, contextTypeName:string, serializable:bool) =
validateDataContextClassName contextTypeName
// Remove the Database/Connection element if exist, which can be created by the O/R Designer
// Its attributes, "SettingsObjectName" and "SettingsPropertyName" can cause sqlmetal to generate a problematic csharp file
let dbmlFileContent =
if dbmlFileContent.Contains("Connection") then
let xdoc = XDocument.Parse dbmlFileContent
xdoc.Elements()
|> Seq.filter (fun xnode -> xnode.Name.LocalName = "Database")
|> Seq.choose (fun xnode ->
match xnode.Elements(xnode.Name.Namespace + "Connection") with
| null -> None
| s -> Some (s))
|> Seq.iter (fun xchild -> xchild.Remove())
xdoc.ToString()
else dbmlFileContent
use csFile = Util.TemporaryFile "cs"
use dbmlFile = Util.TemporaryFile "dbml"
File.WriteAllText (dbmlFile.Path, dbmlFileContent)
let sqlMetalArgs =
let command = sprintf "/code:\"%s\" /language:C# \"%s\"" csFile.Path dbmlFile.Path
let command = if not (String.IsNullOrWhiteSpace contextTypeName) then sprintf "%s /context:\"%s\" " command contextTypeName else command
let command = if serializable then sprintf "%s /serialization:Unidirectional" command else command
command
sqlmetal sqlMetalArgs
let assemblyFile = Util.TemporaryFile "dll" // TODO: load in-memory and clean up this file
let cscCommand = sprintf "/nologo /target:library /out:\"%s\" \"%s\"" assemblyFile.Path csFile.Path
Util.shell(Path.GetTempPath(), Util.cscExe(), cscCommand, None)
assemblyFile
module internal SqlConnection =
let getDbml (dbmlFile: Util.FileResource, connString, flagPluralize, flagViews, flagFunctions, flagStoredProcs, flagTimeout, contextTypeName) =
validateDataContextClassName contextTypeName
let sqlMetalArgs =
let command = sprintf "/conn:\"%s\" /dbml:\"%s\"" connString dbmlFile.Path
let command = if flagPluralize then sprintf "%s /pluralize" command else command
let command = if flagViews then sprintf "%s /views" command else command
let command = if flagFunctions then sprintf "%s /functions" command else command
let command = if flagStoredProcs then sprintf "%s /sprocs" command else command
let command = if not (String.IsNullOrWhiteSpace contextTypeName) then sprintf "%s /context:\"%s\" " command contextTypeName else command
let command = sprintf "%s /timeout:%d" command flagTimeout
command
sqlmetal sqlMetalArgs
File.ReadAllText dbmlFile.Path
let buildType (connectionString, connectionStringName:string, configFileName:string, absoluteDataDirectory:string, localSchemaFile:string, forceUpdate:bool, flagPluralize, flagViews, flagFunctions, flagStoredProcs, flagTimeout, contextTypeName, serializable, designTimeDirectory) =
let connectionString, usingConfigFileInfo = ConfigFiles.computeStaticConnectionString ("SqlDataConnection", true, connectionString, connectionStringName, configFileName, absoluteDataDirectory, designTimeDirectory)
// parses connection string on components, validates only syntax
let connStringBuilder = System.Data.Common.DbConnectionStringBuilder()
connStringBuilder.ConnectionString <- connectionString
let contextTypeName =
// if context is not explicitly set - try to infer context name from database filename
if String.IsNullOrWhiteSpace(contextTypeName) then
let dbFileNameOpt =
// SqlCE allows usage of both 'Data Source' and 'DataSource' names and treats them as equivalent
// however SqlMetal doesn't recognize 'DataSource' and always looks for 'Data Source'
// so to figure out if given connection string is SqlCE - we'll get value of 'Data Source' and check if it ends with .sdf
// NOTE: we cannot just use SqlConnectionStringBuilder because it rejects some SqlCE specific parameter names
match connStringBuilder.TryGetValue ("Data Source") with
| true, (:? string as ds) when ds.EndsWith(".sdf", System.StringComparison.OrdinalIgnoreCase) -> Some ds // SqlCE
| _ ->
// SqlServer
let sqlConnString = System.Data.SqlClient.SqlConnectionStringBuilder(connectionString)
if not (String.IsNullOrEmpty sqlConnString.AttachDBFilename) then
Some (sqlConnString.AttachDBFilename)
else
None
match dbFileNameOpt with
| Some f -> Path.GetFileNameWithoutExtension f |> sanitizeDataContextFileName
| None -> contextTypeName
else
contextTypeName
use dbmlFile =
tryUseLocalSchemaFile
(localSchemaFile, forceUpdate, "dbml")
(fun dbmlFile ->
try
getDbml (dbmlFile,connectionString, flagPluralize, flagViews, flagFunctions, flagStoredProcs, flagTimeout, contextTypeName)
with
e -> handleReadingSchemaError e)
use csFile = Util.TemporaryFile "cs"
let sqlMetalArgs =
let command = sprintf "/code:\"%s\" /language:C# \"%s\"" csFile.Path dbmlFile.Path
let command = if not (String.IsNullOrWhiteSpace contextTypeName) then sprintf "%s /context:\"%s\" " command contextTypeName else command
let command = if serializable then sprintf "%s /serialization:Unidirectional" command else command
command
sqlmetal sqlMetalArgs
let assemblyFile = Util.TemporaryFile "dll" // TODO: load in-memory and clean up this file
let cscCommand = sprintf "/nologo /target:library /out:\"%s\" \"%s\"" assemblyFile.Path csFile.Path
Util.shell(Path.GetTempPath(), Util.cscExe(), cscCommand, None)
assemblyFile, usingConfigFileInfo
module internal DataSvcUtil =
type MetadataError = FixedQueryNotSupported | DataQualityServiceNotSupported
module Metadata =
let private edmx = XNamespace.Get "http://schemas.microsoft.com/ado/2007/06/edmx"
let private dr = XNamespace.Get "http://schemas.microsoft.com/dallas/2010/04"
let private edm08 = XNamespace.Get "http://schemas.microsoft.com/ado/2009/08/edm"
let private edm05 = XNamespace.Get "http://schemas.microsoft.com/ado/2007/05/edm"
let private get (name : XName) (c : XContainer) =
match c.Element name with
| null -> None
| el -> Some (el :> XContainer)
/// Analyzes given metadata file and tries to find evidence of specific cases that may cause datasvcutil to fail
let TryPredictError (path : string) =
try
let xdoc = XDocument.Load(path)
let error =
defaultArg (get (edmx + "Edmx") xdoc) (xdoc :> XContainer)
|> get (edmx + "DataServices")
|> Option.bind (fun ds ->
match get (edm08 + "Schema") ds with
| Some el -> Some (el, edm08)
| None ->
match get (edm05 + "Schema") ds with
| Some el -> Some (el, edm05)
| None -> None
)
|> Option.bind (fun (schema, ns) ->
// check if metadata contains node
// <Using Namespace="Microsoft.DQS">
// this indicates that target service implements DataQuality API - datasvcutil cannot consume it correctly
let isDQS =
match get (ns + "Using") schema with
| Some (:? XElement as e) ->
match e.Attribute(XName.Get "Namespace") with
| null -> false
| attr -> attr.Value = "Microsoft.DQS"
| _ -> false
if isDQS then Some DataQualityServiceNotSupported
else
// check all EntityType nodes
// if all of them has <Property Queryable='false'> - then it may indicate that service support fixed query
let entityTypes = schema.Elements(ns + "EntityType")
let isFixed =
entityTypes.Elements (ns + "Property")
|> Seq.forall (fun el ->
let attr = el.Attribute(dr + "Queryable")
attr <> null && attr.Value = "false"
)
if isFixed then Some FixedQueryNotSupported
else None
)
error
with _ -> None // swallow this error (if datasvcutil will fail - we'll report errors from the output)
/// Add the default service URI to the generated CS file by inserting it as the argument
/// to the default data context constructor, also drop the namespace declaration.
let addDefaultUriToDataSvcUtilCSharpFile uri csFile =
let csText = File.ReadAllLines csFile
let (|DataContextClass|_|) (line:string) =
let trimmed = line.Trim('{',' ','\t')
let starting = "public partial class "
let ending = "System.Data.Services.Client.DataServiceContext"
if trimmed.StartsWith starting && trimmed.Contains ":" && trimmed.EndsWith ending then
let s = trimmed.Substring starting.Length
Some (s.Substring(0, s.IndexOf ' '), line.Contains "{")
else None
let doctoredText =
[| // Was the last line a namespace?
let prevNS = ref false
let foundDataContextClass = ref None
for line in csText do
match line with
| _ when prevNS.Value -> prevNS := false // note, the line after the namespace is dropped
| _ when line.StartsWith "namespace" -> prevNS := true // note, the namespace declaration is dropped
| DataContextClass (className, endsWithBrace) ->
foundDataContextClass := Some (className, endsWithBrace)
yield line
| _ ->
match line.Trim(), foundDataContextClass.Value with
| "{", Some(className, false)
| "", Some(className, true) ->
yield line
yield sprintf "public %s() : this(new global::System.Uri(\"%s\")) {}" className uri
foundDataContextClass := None
| _ when line <> "}" -> yield line
| _ -> ()
|]
File.WriteAllLines(csFile, doctoredText)
let buildTypeFromMetadataUri (uri : string, localSchemaFile:string, forceUpdate:bool, dataServiceCollection) =
use csdlFile =
tryUseLocalSchemaFile (localSchemaFile, forceUpdate, "csdl") (fun _ ->
try
let metadataUri =
if uri.EndsWith "/" then uri + "$metadata"
else uri + "/$metadata"
let metadataText =
use c = new WebClient(UseDefaultCredentials=true) // TODO: consider adding schema credentials here
c.DownloadString metadataUri
metadataText
with e -> handleReadingSchemaError e)
let expectedError = Metadata.TryPredictError csdlFile.Path
use csFile = Util.TemporaryFile "cs"
let dataSvcUtilArgs =
let args = sprintf "/nologo /in:\"%s\" /out:\"%s\" /language:CSharp /version:2.0" csdlFile.Path csFile.Path
let args = if dataServiceCollection then sprintf "%s /DataServiceCollection" args else args
args
try
Util.shell(Path.GetTempPath(), Util.dataSvcUtilExe(), dataSvcUtilArgs, Some formatErr)
with
_ ->
// check if we expect errors in this file
match expectedError with
| Some FixedQueryNotSupported -> failwith (FSData.SR.fixedQueriesNotSupported())
| Some DataQualityServiceNotSupported -> failwith (FSData.SR.dqsServicesNotSupported())
| None -> reraise()
addDefaultUriToDataSvcUtilCSharpFile uri csFile.Path
let assemblyFile = Util.TemporaryFile "dll" // TODO: load in-memory and clean up this file
let cscCommand = sprintf "/nologo /target:library /r:System.Data.Services.Client.dll /out:\"%s\" \"%s\"" assemblyFile.Path csFile.Path
Util.shell(Path.GetTempPath(), Util.cscExe(), cscCommand, None)
assemblyFile
module internal SvcUtil =
let serviceMetadataFilesXName = XName.Get "ServiceMetadataFiles"
let serviceMetadataFileXName = XName.Get "ServiceMetadataFile"
let fileNameXName = XName.Get "name"
/// assumes that destFolder is already created
let private unpackFolder (sourceFile : string) (destFolder : string) =
let xml = XDocument.Load sourceFile
for fileNode in xml.Root.Elements(serviceMetadataFileXName) do
let name = fileNode.Attribute(fileNameXName)
let resultPath = Path.Combine(destFolder, name.Value)
let root =
fileNode.Elements()
|> Seq.tryFind(fun _ -> true) // pick first element
match root with
| Some root -> root.Save(resultPath)
| None -> failwith (FSData.SR.serviceMetadataFileElementIsEmpty())
let private packFolder sourceFolder (destFile : string) patterns =
let root =XElement(serviceMetadataFilesXName)
let doc = XDocument(root)
let append pat =
for f in Directory.GetFiles(sourceFolder, pat) do
let xml = XDocument.Load(f)
let node = XElement(serviceMetadataFileXName)
let fileName = Path.GetFileName f
// add attribute with the name of source file
node.Add(XAttribute(fileNameXName, fileName))
// append file content
node.Add(xml.Root)
root.Add(node)
for pat in patterns do
append pat
doc.Save(destFile)
let validateWsdlUri uri =
if String.IsNullOrWhiteSpace uri then
failwith (FSData.SR.invalidWsdlUri())
let buildTypeFromWsdlUri (namespaceName, wsdlUri : string, localSchemaFile:string, forceUpdate:bool, messageContract, enableDataBinding, serializable, async, collectionType) =
validateWsdlUri wsdlUri
use metadataDir =
let tempFolder = Util.TemporaryDirectory()
let schemaFileSet = not (String.IsNullOrWhiteSpace localSchemaFile)
let schemaFileExists = schemaFileSet && ( try File.Exists(localSchemaFile) with _ -> false )
if schemaFileSet then validateSchemaFileExtension localSchemaFile "wsdlschema"
// downloads metadata to the specified temp folder
// if localSchemaFile is set - pack downloaded content as localSchemaFile
let downloadMetadata () =
if (try System.IO.Directory.Exists tempFolder.Path with _ -> false) then
(try System.IO.Directory.Delete (tempFolder.Path, true) with _ -> ())
if not (System.IO.Directory.Exists tempFolder.Path) then
System.IO.Directory.CreateDirectory tempFolder.Path |> ignore
let svcUtilArgs =
let args = sprintf "/nologo /t:metadata \"%s\"" wsdlUri
args
Util.shell(tempFolder.Path, Util.svcUtilExe(), svcUtilArgs, Some formatErr)
if schemaFileSet then
packFolder tempFolder.Path localSchemaFile ["*.wsdl"; "*.xsd"]
if not (schemaFileExists) || forceUpdate then
downloadMetadata()
else
// reraise exceptions if local schema file is corrupted
try
unpackFolder localSchemaFile tempFolder.Path
with
e -> failwith (FSData.SR.errorReadingSchema(e.Message))
tempFolder
use configFile = Util.TemporaryFile "config" //Util.ExistingFile (System.IO.Path.Combine(metadataDir.Path, configFileName))
use csFile = Util.TemporaryFile "cs"
let svcUtilArgs =
let args = sprintf "/nologo /out:\"%s\" /config:\"%s\" /language:CSharp /serializer:Auto /fault" csFile.Path configFile.Path
let args = if System.IO.Directory.EnumerateFiles(metadataDir.Path, "*.wsdl") |> Seq.isEmpty then args else sprintf "%s \"%s\"" args (Path.Combine(metadataDir.Path,"*.wsdl"))
let args = if System.IO.Directory.EnumerateFiles(metadataDir.Path, "*.xsd") |> Seq.isEmpty then args else sprintf "%s \"%s\"" args (Path.Combine(metadataDir.Path,"*.xsd"))
let args = if messageContract then sprintf "%s /messageContract" args else args
let args = if enableDataBinding then sprintf "%s /enableDataBinding" args else args
let args = if serializable then sprintf "%s /serializable" args else args
let args = if async then sprintf "%s /async" args else args
let args = if not (String.IsNullOrWhiteSpace collectionType) then sprintf "%s /collectionType:%s" args collectionType else args
args
Util.shell(Path.GetTempPath(), Util.svcUtilExe(), svcUtilArgs, Some formatErr)
let assemblyFile = Util.TemporaryFile "dll" // TODO: load in-memory and clean up this file
let cscCommand = sprintf "/nologo /target:library /resource:\"%s\",%s.config,public /out:\"%s\" \"%s\"" configFile.Path namespaceName assemblyFile.Path csFile.Path
Util.shell(Path.GetTempPath(), Util.cscExe(), cscCommand, None)
let endPointNames =
try
let config = ConfigurationManager.OpenMappedExeConfiguration(ExeConfigurationFileMap(ExeConfigFilename = configFile.Path), ConfigurationUserLevel.None);
[ for ep in ((config.GetSectionGroup "system.serviceModel").Sections.["client"] :?> System.ServiceModel.Configuration.ClientSection).Endpoints do
yield ep.Name ]
with _ ->
[]
assemblyFile, endPointNames
module internal Edmx =
type private EdmxNamespaceGroup = { Edmx : XNamespace; Edm : XNamespace; Ssdl :XNamespace; Msl : XNamespace; RequireDotNet45 : bool }
let private makeGroup (edmx : string, edm : string, ssdl : string, msl : string, requireDotNet45)=
{ Edmx = XNamespace.Get edmx
Edm = XNamespace.Get edm
Ssdl = XNamespace.Get ssdl
Msl = XNamespace.Get msl
RequireDotNet45 = requireDotNet45 }
let private ns45 =
makeGroup
(
"http://schemas.microsoft.com/ado/2009/11/edmx",
"http://schemas.microsoft.com/ado/2009/11/edm",
"http://schemas.microsoft.com/ado/2009/11/edm/ssdl",
"http://schemas.microsoft.com/ado/2009/11/mapping/cs",
true
)
let private ns40 =
makeGroup
(
"http://schemas.microsoft.com/ado/2008/10/edmx",
"http://schemas.microsoft.com/ado/2008/09/edm",
"http://schemas.microsoft.com/ado/2009/02/edm/ssdl",
"http://schemas.microsoft.com/ado/2008/09/mapping/cs",
false
)
let private ns20 =
makeGroup
(
"http://schemas.microsoft.com/ado/2007/06/edmx",
"http://schemas.microsoft.com/ado/2006/04/edm",
"http://schemas.microsoft.com/ado/2006/04/edm/ssdl",
"urn:schemas-microsoft-com:windows:storage:mapping:CS",
false
)
let loadEdmxFile path =
let getElement (c : XContainer) (name : string) (ns : XNamespace) =
match c.Element (ns + name) with
| null -> failwith (FSData.SR.fileDoesNotContainXMLElement(path, name))
| el -> el
let xdoc =
match XDocument.Load path with
| null -> failwith (FSData.SR.failedToLoadFileAsXML(path))
| xdoc -> xdoc
let extractEdmxComponents (nsGroup : EdmxNamespaceGroup) =
let edmxNode = getElement xdoc "Edmx" nsGroup.Edmx
let runtimeNode = getElement edmxNode "Runtime" nsGroup.Edmx
let csdlNode =
let conceptualModelNode = getElement runtimeNode "ConceptualModels" nsGroup.Edmx
getElement conceptualModelNode "Schema" nsGroup.Edm
let ssdlNode =
let storageModelNode = getElement runtimeNode "StorageModels" nsGroup.Edmx
getElement storageModelNode "Schema" nsGroup.Ssdl
let mslNode =
let mappingsNode = getElement runtimeNode "Mappings" nsGroup.Edmx
getElement mappingsNode "Mapping" nsGroup.Msl
(csdlNode.ToString()), (ssdlNode.ToString()), (mslNode.ToString()), nsGroup.RequireDotNet45
// tries to process given edmx using supplied set of namespace groups
let rec load = function
| [] -> assert false; failwith "impossible"
| x::xs ->
try extractEdmxComponents x
with e ->
match xs with
| [] -> reraise() // we were not able to load file - raise exception
| _ -> load xs
load [ns45; ns40; ns20]
let buildTypeFromEdmxFile (edmxFile, isTargetingDotNet45) =
use csDir = Util.TemporaryDirectory()
let baseContainerName = Path.GetFileNameWithoutExtension edmxFile
let csFile = Path.Combine(csDir.Path, baseContainerName + ".cs")
let csdlFileName = baseContainerName + ".csdl"
let mslFileName = baseContainerName + ".msl"
let ssdlFileName = baseContainerName + ".ssdl"
let csdlFile = Path.Combine(csDir.Path, csdlFileName)
let mslFile = Path.Combine(csDir.Path, mslFileName)
let ssdlFile = Path.Combine(csDir.Path, ssdlFileName)
let csdlContent, ssdlContent, mslContent, requireDotNet45 = loadEdmxFile edmxFile
if requireDotNet45 && not isTargetingDotNet45 then
failwith (FSData.SR.edmxFileRequiresDotNet45(edmxFile))
File.WriteAllText(csdlFile, csdlContent)
File.WriteAllText(mslFile, mslContent)
File.WriteAllText(ssdlFile, ssdlContent)
let edmGenArgs =
let args = sprintf "/mode:EntityClassGeneration /incsdl:\"%s\" /outobjectlayer:\"%s\" /nologo" csdlFile csFile
let args = if isTargetingDotNet45 then sprintf "%s /targetversion:4.5" args else args
args
Util.shell(csDir.Path, Util.edmGenExe(), edmGenArgs, Some formatErr)
let assemblyFile = Util.TemporaryFile "dll" // TODO: load in-memory and clean up this file
let cscCommand = sprintf "/nologo /resource:\"%s\",\"%s\" /resource:\"%s\",\"%s\" /resource:\"%s\",\"%s\" /target:library /r:System.Data.Entity.dll /out:\"%s\" \"%s\"" csdlFile csdlFileName mslFile mslFileName ssdlFile ssdlFileName assemblyFile.Path csFile
Util.shell(csDir.Path, Util.cscExe(), cscCommand, None)
assemblyFile
module internal SqlEntityConnection =
let getSsdl (namespaceName, ssdlFile: Util.FileResource, provider, connString, flagPluralize, flagSuppressForeignKeyProperties, isTargetingDotNet45) =
let edmGenArgs =
let args = sprintf "/namespace:\"%s\" /project:\"%s\" /outssdl:\"%s\" /mode:FullGeneration /connectionstring:\"%s\" " namespaceName (Path.GetFileNameWithoutExtension ssdlFile.Path) ssdlFile.Path connString
let args = if not (String.IsNullOrWhiteSpace provider) then sprintf "%s /provider:%s" args provider else args
let args = if flagPluralize then sprintf "%s /pluralize" args else args
let args = if flagSuppressForeignKeyProperties then sprintf "%s /SuppressForeignKeyProperties" args else args
let args = if isTargetingDotNet45 then sprintf "%s /targetversion:4.5" args else args
args
Util.shell(System.IO.Path.GetDirectoryName ssdlFile.Path, Util.edmGenExe(), edmGenArgs, Some formatErr)
File.ReadAllText ssdlFile.Path
let computeEntityContainerName (entityContainer:string) =
if String.IsNullOrWhiteSpace entityContainer then
"EntityContainer"
else
entityContainer
let buildType (namespaceName, connectionString, connectionStringName, configFileName, absoluteDataDirectory, localSchemaFile:string, provider:string, entityContainer:string, forceUpdate:bool, flagPluralize, flagSuppressForeignKeyProperties, designTimeDirectory, isTargetingDotNet45) =
let connectionString, usingConfigFileInfo = ConfigFiles.computeStaticConnectionString ("SqlEntityConnection", false, connectionString, connectionStringName, configFileName, absoluteDataDirectory, designTimeDirectory)
let entityContainer = computeEntityContainerName entityContainer
use ssdlFile =
tryUseLocalSchemaFile
(localSchemaFile, forceUpdate, "ssdl")
(fun ssdlFile ->
try
getSsdl (namespaceName, ssdlFile, provider, connectionString, flagPluralize, flagSuppressForeignKeyProperties, isTargetingDotNet45)
with
e -> handleReadingSchemaError e)
use csFile = Util.TemporaryFile "cs"
use csdlFile = Util.TemporaryFile "csdl"
use mslFile = Util.TemporaryFile "msl"
use viewsFile = Util.TemporaryFile "Views.cs"
let edmGenArgs =
let args = sprintf "/mode:FromSsdlGeneration /entitycontainer:\"%s\" /namespace:\"%s\" /project:\"%s\" /inssdl:\"%s\" /outobjectlayer:\"%s\" /outcsdl:\"%s\" /outmsl:\"%s\" /outviews:\"%s\" /language:CSharp" entityContainer namespaceName (Path.GetFileNameWithoutExtension ssdlFile.Path) ssdlFile.Path csFile.Path csdlFile.Path mslFile.Path viewsFile.Path
let args = if not (String.IsNullOrWhiteSpace provider) then sprintf "%s /provider:%s" args provider else args
let args = if flagPluralize then sprintf "%s /pluralize" args else args
let args = if flagSuppressForeignKeyProperties then sprintf "%s /SuppressForeignKeyProperties" args else args
let args = if isTargetingDotNet45 then sprintf "%s /targetversion:4.5" args else args
args
Util.shell(System.IO.Path.GetDirectoryName ssdlFile.Path, Util.edmGenExe(), edmGenArgs, Some formatErr)
let assemblyFile = Util.TemporaryFile "dll"
let csdlFileName = namespaceName + ".csdl"
let mslFileName = namespaceName + ".msl"
let ssdlFileName = namespaceName + ".ssdl"
let cscCommand = sprintf "/r:System.Data.Entity.dll /nologo /resource:\"%s\",\"%s\" /resource:\"%s\",\"%s\" /resource:\"%s\",\"%s\" /nologo /target:library /out:\"%s\" \"%s\"" csdlFile.Path csdlFileName mslFile.Path mslFileName ssdlFile.Path ssdlFileName assemblyFile.Path csFile.Path
Util.shell(Path.GetTempPath(), Util.cscExe(), cscCommand, None)
assemblyFile, usingConfigFileInfo

Просмотреть файл

@ -1,223 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Data.TypeProviders.Utility
module internal Util =
open System
open System.IO
open System.Collections.Generic
open System.Reflection
type ProcessResult = { exitCode : int; stdout : string[] ; stderr : string[] }
let executeProcess (workingDirectory,exe,cmdline) =
try
// External tools (like edmgen.exe) run as part of default OS locale/codepage/LCID. We need to ensure we translate their output
// accordingly, by setting up the correct encoding on the stdout/stderr streams.
let encodingToTranslateToolOutput = System.Text.Encoding.Default
let psi = new System.Diagnostics.ProcessStartInfo(exe,cmdline)
psi.WorkingDirectory <- workingDirectory
psi.UseShellExecute <- false
psi.RedirectStandardOutput <- true
psi.RedirectStandardError <- true
psi.CreateNoWindow <- true
psi.StandardOutputEncoding <- encodingToTranslateToolOutput
psi.StandardErrorEncoding <- encodingToTranslateToolOutput
let p = System.Diagnostics.Process.Start(psi)
let output = ResizeArray()
let error = ResizeArray()
// nulls are skipped because they act as signal that redirected stream is closed and not as part of output data
p.OutputDataReceived.Add(fun args -> if args.Data <> null then output.Add(args.Data))
p.ErrorDataReceived.Add(fun args -> if args.Data <> null then error.Add(args.Data))
p.BeginErrorReadLine()
p.BeginOutputReadLine()
p.WaitForExit()
{ exitCode = p.ExitCode; stdout = output.ToArray(); stderr = error.ToArray() }
with
| :? System.IO.FileNotFoundException
| :? System.ComponentModel.Win32Exception -> failwith (FSData.SR.requiredToolNotFound(exe))
| _ -> reraise()
let shell (workingDirectory,exe,cmdline,formatError) =
// printfn "execute: %s %s" exe cmdline
let result = executeProcess(workingDirectory,exe,cmdline)
if result.exitCode > 0 then
//failwithf "The command\n%s %s\n failed.\n\nError:%s\n\nOutput: %s\n" exe cmdline result.stderr result.stdout
match formatError with
| None ->
let merge lines = String.concat Environment.NewLine lines
failwith ((merge result.stderr) + Environment.NewLine + (merge result.stdout))
| Some f -> f result.stdout result.stderr
else
// printfn "<--command-->\n%s %s\n<-- success --><-- stdout -->\n%s<-- stderr -->\n%s\n" exe cmdline result.stdout result.stderr
()
let cscExe () =
let toolPath =
//if System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion().StartsWith("v4.0") then
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
//else
// Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), @"..\v3.5")
Path.Combine(toolPath, "csc.exe")
let dataSvcUtilExe () =
let toolPath =
//if System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion().StartsWith("v4.0") then
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
//else
// Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), @"..\v4.0.30319")
Path.Combine(toolPath, "DataSvcUtil.exe")
let edmGenExe () =
let toolPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
Path.Combine(toolPath, "edmgen.exe")
let sdkPath () =
let tryResult (key: Microsoft.Win32.RegistryKey) =
match key with
| null -> None
| _ ->
let installFolder = key.GetValue("InstallationFolder") :?> string
if Directory.Exists installFolder then
Some installFolder
else
None
// Annoyingly, the F# 2.0 decoding of 'use key = ...' on a registry key doesn't use an null check on the
// key before calling Dispose. THis is because the key type doesn't use the IDisposable pattern.
let useKey keyName f =
// Look for WinSDK reg keys under the 32bit view of the registry.
let reg32view = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry32)
let key = reg32view.OpenSubKey keyName
try f key
finally
match key with
| null -> ()
| _ -> key.Dispose()
reg32view.Dispose() // if reg32view were really null, we would not be here and the user would have more serious issues not being able to access HKLM
let SDK_REGPATHS = [ @"Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools"
@"Software\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools"
@"Software\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools"
@"Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools"
@"Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" ]
SDK_REGPATHS
|> Seq.tryPick (fun p -> useKey p tryResult)
|> function
| Some p -> p
| _ -> raise <| System.NotSupportedException(FSData.SR.unsupportedFramework())
let sdkUtil name = Path.Combine(sdkPath(), name)
let svcUtilExe () = sdkUtil "svcutil.exe"
let xsdExe () = sdkUtil "xsd.exe"
type FileResource =
abstract member Path : string
inherit IDisposable
let ExistingFile(fileName : string) =
{ new FileResource with
member this.Path = fileName
interface IDisposable with
member this.Dispose() = () }
let TemporaryFile(extension : string) =
let filename =
let fs = Path.GetTempFileName()
let fs' = Path.ChangeExtension(fs, extension)
if fs <> fs' then
File.Delete fs
fs'
{ new FileResource with
member this.Path = filename
interface IDisposable with
member this.Dispose() = File.Delete(filename) }
type DirectoryResource =
abstract member Path : string
inherit IDisposable
let TemporaryDirectory() =
let dirName =
let fs = Path.GetTempFileName()
File.Delete fs
Directory.CreateDirectory fs |> ignore
fs
{ new DirectoryResource with
member this.Path = dirName
interface IDisposable with
member this.Dispose() =
for f in Directory.EnumerateFiles dirName do File.Delete f
Directory.Delete dirName }
let ExistingDirectory(dirName : string) =
{ new DirectoryResource with
member this.Path = dirName
interface IDisposable with
member this.Dispose() = () }
type MemoizationTable<'T,'U when 'T : equality>(f) =
let createdDB = new Dictionary<'T,'U>()
member x.Contents = (createdDB :> IDictionary<_,_>)
member x.Apply typeName =
let found,result = createdDB.TryGetValue typeName
if found then
result
else
let ty = f typeName
createdDB.[typeName] <- ty
ty
open System.Threading
let WithExclusiveAccessToFile (fileName : string) f =
// file name is not specified - run function directly
if String.IsNullOrWhiteSpace fileName then f()
else
// convert filename to the uniform representation: full path + no backslashes + upper case
// MSDN: In Silverlight for Windows Phone, private object namespaces are not supported.
// In the .NET Framework, object namespaces are supported and because of this the backslash (\) is considered a delimiter and is not supported in the name parameter.
// In Silverlight for Windows Phone you can use a backslash (\) in the name parameter.
let fileName = Path.GetFullPath(fileName)
let fileName = fileName.Replace('\\', '_')
let fileName = fileName.ToUpper()
// MSDN: On a server that is running Terminal Services, a named system mutex can have two levels of visibility.
// If its name begins with the prefix "Global\", the mutex is visible in all terminal server sessions.
// Since we use mutex to protect access to file - use Global prefix to cover all terminal sessions
let fileName = @"Global\" + fileName
use mutex =
let mutable createdNew = false
let mutex = new Mutex(initiallyOwned = true, name = fileName, createdNew = &createdNew)
// createdNew = true - we created and immediately acquired mutex - can continue
// createdNew = false - mutex already exists and we do not own it - must wait until it is released
if createdNew then mutex
else
try
mutex.WaitOne() |> ignore
mutex
with
| :? AbandonedMutexException ->
// if thread that owns mutex was terminated abnormally - then WaitOne will raise AbandonedMutexException
// MSDN: The next thread to request ownership of the mutex can handle this exception and proceed,
// provided that the integrity of the data structures can be verified.
// Current thread still owns mutex so we can return it
mutex
| _ ->
mutex.Dispose()
reraise()
try f()
finally mutex.ReleaseMutex()

Просмотреть файл

@ -1,41 +0,0 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Data.TypeProviders.Utility
module internal Util =
open System
open System.Reflection
open System.Collections.Generic
type ProcessResult = { exitCode : int; stdout : string[]; stderr : string[] }
val executeProcess : workingDirectory: string * exe:string * cmdline:string -> ProcessResult
/// Throws on failure
val shell : workingDirectory: string * exe:string * cmdline:string * formatError:(string[] -> string[] -> unit) option -> unit
val cscExe : unit -> string
val dataSvcUtilExe : unit -> string
val edmGenExe : unit -> string
val svcUtilExe : unit -> string
val sdkUtil : string -> string
type FileResource =
abstract member Path : string
inherit IDisposable
val TemporaryFile : extension:string -> FileResource
val ExistingFile : fileName:string -> FileResource
type DirectoryResource =
abstract member Path : string
inherit IDisposable
val TemporaryDirectory : unit -> DirectoryResource
val ExistingDirectory : dirName:string -> DirectoryResource
type MemoizationTable<'T,'U when 'T : equality> =
new : ('T -> 'U) -> MemoizationTable<'T,'U>
member Apply : 'T -> 'U
member Contents : IDictionary<'T, 'U>
val WithExclusiveAccessToFile : string -> (unit -> 'T)-> 'T

Просмотреть файл

@ -551,8 +551,7 @@
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
<Import Project="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FSharp.PowerPack.targets" />
<PropertyGroup>
<OtherFlags>$(OtherFlags) /warnon:1182 --sig:$(IntermediateOutputPath)\$(AssemblyName).sig</OtherFlags>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);CopyToBuiltBin</PrepareForRunDependsOn>
<OtherFlags>$(OtherFlags) /warnon:1182</OtherFlags>
</PropertyGroup>
<Target Name="CopyToBuiltBin">
<Copy SourceFiles="$(IntermediateOutputPath)\FSharp.LanguageService.Compiler.sigdata" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true">

Просмотреть файл

@ -4,8 +4,6 @@ namespace Microsoft.FSharp
open System.Reflection
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Fsc, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Build, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.QuickSearch, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Model, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Fsi, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FsiAnyCPU, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.LanguageService, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
@ -18,5 +16,6 @@ open System.Reflection
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Salsa, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
do()

Просмотреть файл

@ -12,6 +12,6 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": { }
"netstandard1.5": { }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -164,8 +164,8 @@ type Item =
| Event of EventInfo
/// Represents the resolution of a name to a property
| Property of string * PropInfo list
/// Represents the resolution of a name to a group of methods
| MethodGroup of string * MethInfo list
/// Represents the resolution of a name to a group of methods.
| MethodGroup of displayName: string * methods: MethInfo list * uninstantiatedMethodOpt: MethInfo option
/// Represents the resolution of a name to a constructor
| CtorGroup of string * MethInfo list
/// Represents the resolution of a name to the fake constructor simulated for an interface type.
@ -195,7 +195,7 @@ type Item =
static member MakeMethGroup (nm,minfos:MethInfo list) =
let minfos = minfos |> List.sortBy (fun minfo -> minfo.NumArgs |> List.sum)
Item.MethodGroup (nm,minfos)
Item.MethodGroup (nm,minfos,None)
static member MakeCtorGroup (nm,minfos:MethInfo list) =
let minfos = minfos |> List.sortBy (fun minfo -> minfo.NumArgs |> List.sum)
@ -212,7 +212,7 @@ type Item =
| Item.ILField finfo -> finfo.FieldName
| Item.Event einfo -> einfo.EventName
| Item.Property(nm,_) -> nm
| Item.MethodGroup(nm,_) -> nm
| Item.MethodGroup(nm,_,_) -> nm
| Item.CtorGroup(nm,_) -> DemangleGenericTypeName nm
| Item.FakeInterfaceCtor (AbbrevOrAppTy tcref)
| Item.DelegateCtor (AbbrevOrAppTy tcref) -> DemangleGenericTypeName tcref.DisplayName
@ -1106,7 +1106,7 @@ type ItemOccurence =
type ITypecheckResultsSink =
abstract NotifyEnvWithScope : range * NameResolutionEnv * AccessorDomain -> unit
abstract NotifyExprHasType : pos * TType * Tastops.DisplayEnv * NameResolutionEnv * AccessorDomain * range -> unit
abstract NotifyNameResolution : pos * Item * Item * ItemOccurence * Tastops.DisplayEnv * NameResolutionEnv * AccessorDomain * range -> unit
abstract NotifyNameResolution : pos * Item * Item * ItemOccurence * Tastops.DisplayEnv * NameResolutionEnv * AccessorDomain * range * bool -> unit
abstract NotifyFormatSpecifierLocation : range -> unit
abstract CurrentSource : string option
@ -1140,12 +1140,12 @@ let rec (|FSharpPropertyUse|_|) (item : Item) =
let (|MethodUse|_|) (item : Item) =
match item with
| Item.MethodGroup(_, [minfo]) -> Some(minfo)
| Item.MethodGroup(_, [minfo],_) -> Some(minfo)
| _ -> None
let (|FSharpMethodUse|_|) (item : Item) =
match item with
| Item.MethodGroup(_, [ValRefOfMeth vref]) -> Some(vref)
| Item.MethodGroup(_, [ValRefOfMeth vref],_) -> Some(vref)
| Item.Value(vref) when vref.IsMember -> Some(vref)
| _ -> None
@ -1346,7 +1346,7 @@ type TcResultsSinkImpl(g, ?source: string) =
if allowedRange m then
capturedExprTypings.Add((endPos,ty,denv,nenv,ad,m))
member sink.NotifyNameResolution(endPos,item,itemMethodGroup,occurenceType,denv,nenv,ad,m) =
member sink.NotifyNameResolution(endPos,item,itemMethodGroup,occurenceType,denv,nenv,ad,m,replace) =
// Desugaring some F# constructs (notably computation expressions with custom operators)
// results in duplication of textual variables. So we ensure we never record two name resolutions
// for the same identifier at the same location.
@ -1365,6 +1365,10 @@ type TcResultsSinkImpl(g, ?source: string) =
res
| _ -> false
if replace then
capturedNameResolutions.RemoveAll(fun cnr -> cnr.Range = m) |> ignore
capturedMethodGroupResolutions.RemoveAll(fun cnr -> cnr.Range = m) |> ignore
if not alreadyDone then
capturedNameResolutions.Add(CapturedNameResolution(endPos,item,occurenceType,denv,nenv,ad,m))
capturedMethodGroupResolutions.Add(CapturedNameResolution(endPos,itemMethodGroup,occurenceType,denv,nenv,ad,m))
@ -1405,7 +1409,12 @@ let CallEnvSink (sink:TcResultsSink) (scopem,nenv,ad) =
let CallNameResolutionSink (sink:TcResultsSink) (m:range,nenv,item,itemMethodGroup,occurenceType,denv,ad) =
match sink.CurrentSink with
| None -> ()
| Some sink -> sink.NotifyNameResolution(m.End,item,itemMethodGroup,occurenceType,denv,nenv,ad,m)
| Some sink -> sink.NotifyNameResolution(m.End,item,itemMethodGroup,occurenceType,denv,nenv,ad,m,false)
let CallNameResolutionSinkReplacing (sink:TcResultsSink) (m:range,nenv,item,itemMethodGroup,occurenceType,denv,ad) =
match sink.CurrentSink with
| None -> ()
| Some sink -> sink.NotifyNameResolution(m.End,item,itemMethodGroup,occurenceType,denv,nenv,ad,m,true)
/// Report a specific expression typing at a source range
let CallExprHasTypeSink (sink:TcResultsSink) (m:range,nenv,typ,denv,ad) =
@ -1434,7 +1443,7 @@ let CheckAllTyparsInferrable amap m item =
let free = Zset.diff freeInDeclaringType.FreeTypars freeInArgsAndRetType.FreeTypars
free.IsEmpty)
| Item.MethodGroup(_,minfos) ->
| Item.MethodGroup(_,minfos,_) ->
minfos |> List.forall (fun minfo ->
minfo.IsExtensionMember ||
let fminst = minfo.FormalMethodInst
@ -2571,15 +2580,15 @@ let ComputeItemRange wholem (lid: Ident list) rest =
let FilterMethodGroups (ncenv:NameResolver) itemRange item staticOnly =
match item with
| Item.MethodGroup(nm, minfos) ->
| Item.MethodGroup(nm, minfos, orig) ->
let minfos = minfos |> List.filter (fun minfo ->
staticOnly = (minfo.GetObjArgTypes(ncenv.amap, itemRange, minfo.FormalMethodInst) |> isNil))
Item.MethodGroup(nm, minfos)
Item.MethodGroup(nm, minfos, orig)
| item -> item
let NeedsOverloadResolution namedItem =
match namedItem with
| Item.MethodGroup(_,_::_::_)
| Item.MethodGroup(_,_::_::_,_)
| Item.CtorGroup(_,_::_::_)
| Item.Property(_,_::_::_) -> true
| _ -> false
@ -2632,7 +2641,7 @@ let ResolveLongIdentAsExprAndComputeRange (sink:TcResultsSink) (ncenv:NameResolv
let (|NonOverridable|_|) namedItem =
match namedItem with
| Item.MethodGroup(_,minfos) when minfos |> List.exists(fun minfo -> minfo.IsVirtual || minfo.IsAbstract) -> None
| Item.MethodGroup(_,minfos,_) when minfos |> List.exists(fun minfo -> minfo.IsVirtual || minfo.IsAbstract) -> None
| Item.Property(_,pinfos) when pinfos |> List.exists(fun pinfo -> pinfo.IsVirtualProperty) -> None
| _ -> Some ()
@ -2905,16 +2914,34 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
AllMethInfosOfTypeInScope ncenv.InfoReader nenv (None,ad) PreferOverrides m typ
|> List.filter minfoFilter
let addersAndRemovers =
pinfoItems
|> List.map (function Item.Event(FSEvent(_,_,addValRef,removeValRef)) -> [addValRef.LogicalName;removeValRef.LogicalName] | _ -> [])
|> List.concat
let minfos =
let addersAndRemovers =
pinfoItems
|> List.map (function Item.Event(FSEvent(_,_,addValRef,removeValRef)) -> [addValRef.LogicalName;removeValRef.LogicalName] | _ -> [])
|> List.concat
|> set
match addersAndRemovers with
| [] -> minfos
| addersAndRemovers ->
let isNotAdderOrRemover (minfo: MethInfo) = not(addersAndRemovers |> List.exists (fun ar -> ar = minfo.LogicalName))
List.filter isNotAdderOrRemover minfos
if addersAndRemovers.IsEmpty then minfos
else minfos |> List.filter (fun minfo -> not (addersAndRemovers.Contains minfo.LogicalName))
#if EXTENSIONTYPING
// Filter out the ones with mangled names from applying static parameters
let minfos =
let methsWithStaticParams =
minfos
|> List.filter (fun minfo ->
match minfo.ProvidedStaticParameterInfo with
| Some (_methBeforeArguments, staticParams) -> staticParams.Length <> 0
| _ -> false)
|> List.map (fun minfo -> minfo.DisplayName)
if methsWithStaticParams.IsEmpty then minfos
else minfos |> List.filter (fun minfo ->
let nm = minfo.LogicalName
not (nm.Contains "," && methsWithStaticParams |> List.exists (fun m -> nm.StartsWith(m))))
#endif
minfos
else []
// Partition methods into overload sets

Просмотреть файл

@ -55,7 +55,7 @@ type Item =
| ILField of ILFieldInfo
| Event of EventInfo
| Property of string * PropInfo list
| MethodGroup of string * MethInfo list
| MethodGroup of displayName: string * methods: MethInfo list * uninstantiatedMethodOpt: MethInfo option
| CtorGroup of string * MethInfo list
| FakeInterfaceCtor of TType
| DelegateCtor of TType
@ -261,7 +261,7 @@ type ITypecheckResultsSink =
abstract NotifyExprHasType : pos * TType * DisplayEnv * NameResolutionEnv * AccessorDomain * range -> unit
/// Record that a name resolution occurred at a specific location in the source
abstract NotifyNameResolution : pos * Item * Item * ItemOccurence * DisplayEnv * NameResolutionEnv * AccessorDomain * range -> unit
abstract NotifyNameResolution : pos * Item * Item * ItemOccurence * DisplayEnv * NameResolutionEnv * AccessorDomain * range * bool -> unit
/// Record that a printf format specifier occurred at a specific location in the source
abstract NotifyFormatSpecifierLocation : range -> unit
@ -301,6 +301,9 @@ val internal CallEnvSink : TcResultsSink -> range * NameResolutio
/// Report a specific name resolution at a source range
val internal CallNameResolutionSink : TcResultsSink -> range * NameResolutionEnv * Item * Item * ItemOccurence * DisplayEnv * AccessorDomain -> unit
/// Report a specific name resolution at a source range, replacing any previous resolutions
val internal CallNameResolutionSinkReplacing : TcResultsSink -> range * NameResolutionEnv * Item * Item * ItemOccurence * DisplayEnv * AccessorDomain -> unit
/// Report a specific name resolution at a source range
val internal CallExprHasTypeSink : TcResultsSink -> range * NameResolutionEnv * TType * DisplayEnv * AccessorDomain -> unit

Просмотреть файл

@ -107,6 +107,7 @@ exception OverrideInIntrinsicAugmentation of range
exception OverrideInExtrinsicAugmentation of range
exception NonUniqueInferredAbstractSlot of TcGlobals * DisplayEnv * string * MethInfo * MethInfo * range
exception StandardOperatorRedefinitionWarning of string * range
exception InvalidInternalsVisibleToAssemblyName of (*badName*)string * (*fileName option*) string option
// Identify any security attributes
@ -422,7 +423,16 @@ let OpenModulesOrNamespaces tcSink g amap scopem root env mvvs =
let AddRootModuleOrNamespaceRefs g amap m env modrefs =
ModifyNameResEnv (fun nenv -> AddModuleOrNamespaceRefsToNameEnv g amap m true env.eAccessRights nenv modrefs) env
let AddNonLocalCcu g amap scopem env (ccu:CcuThunk,internalsVisible) =
let AddNonLocalCcu g amap scopem env assemblyName (ccu:CcuThunk, internalsVisibleToAttributes) =
let internalsVisible =
internalsVisibleToAttributes |> List.exists (fun visibleTo ->
try
System.Reflection.AssemblyName(visibleTo).Name = assemblyName
with e ->
warning(InvalidInternalsVisibleToAssemblyName(visibleTo,ccu.FileName))
false)
let env = if internalsVisible then addInternalsAccessibility env ccu else env
// Compute the top-rooted module or namespace references
let modrefs = ccu.RootModulesAndNamespaces |> List.map (mkNonLocalCcuRootEntityRef ccu)
@ -724,10 +734,10 @@ type AfterTcOverloadResolution =
| AfterOverloadResolution.DoNothing ->
AfterTcOverloadResolution.DoNothing
| AfterOverloadResolution.SendToSink(callSink,fallback) ->
AfterTcOverloadResolution.SendToSink ((fun (minfo,_) -> Item.MethodGroup(minfo.LogicalName,[minfo]) |> callSink), fallback)
| AfterOverloadResolution.ReplaceWithOverrideAndSendToSink (Item.MethodGroup(_,overridenMinfos), callSink,fallback) ->
AfterTcOverloadResolution.SendToSink ((fun (minfo,_) -> Item.MethodGroup(minfo.LogicalName,[minfo],None) |> callSink), fallback)
| AfterOverloadResolution.ReplaceWithOverrideAndSendToSink (Item.MethodGroup(_,overridenMinfos,_orig), callSink,fallback) ->
AfterTcOverloadResolution.ReplaceWithOverrideAndSendToSink
((List.map (fun minfo -> minfo,None) overridenMinfos),(fun (minfo,_) -> Item.MethodGroup(minfo.LogicalName,[minfo]) |> callSink),fallback)
((overridenMinfos |> List.map (fun minfo -> minfo,None)),(fun (minfo,_) -> Item.MethodGroup(minfo.LogicalName,[minfo],None) |> callSink),fallback)
| _ -> error(InternalError("Name resolution does not match overriden for method groups", range0))
static member ForProperties name gettersOrSetters afterOverloadResolution =
@ -1735,9 +1745,9 @@ let MakeAndPublishSimpleVals cenv env m names mergeNamesInOneNameresEnv =
let sink =
{ new ITypecheckResultsSink with
member this.NotifyEnvWithScope(_, _, _) = () // ignore EnvWithScope reports
member this.NotifyNameResolution(pos, a, b, occurence, denv, nenv, ad, m) =
member this.NotifyNameResolution(pos, a, b, occurence, denv, nenv, ad, m, replacing) =
if not m.IsSynthetic then
nameResolutions.Add(pos, a, b, occurence, denv, nenv, ad, m)
nameResolutions.Add(pos, a, b, occurence, denv, nenv, ad, m, replacing)
member this.NotifyExprHasType(_, _, _, _, _, _) = assert false // no expr typings in MakeSimpleVals
member this.NotifyFormatSpecifierLocation _ = ()
member this.CurrentSource = None }
@ -1746,11 +1756,11 @@ let MakeAndPublishSimpleVals cenv env m names mergeNamesInOneNameresEnv =
MakeSimpleVals cenv env names
if nameResolutions.Count <> 0 then
let (_, _, _, _, _, _, ad, m1) = nameResolutions.[0]
let (_, _, _, _, _, _, ad, m1, _replacing) = nameResolutions.[0]
// mergedNameEnv - name resolution env that contains all names
// mergedRange - union of ranges of names
let mergedNameEnv, mergedRange =
((env.NameEnv, m1), nameResolutions) ||> Seq.fold (fun (nenv, merged) (_pos, item, _b, _occurence, _denv, _nenv, _ad, m) ->
((env.NameEnv, m1), nameResolutions) ||> Seq.fold (fun (nenv, merged) (_pos, item, _b, _occurence, _denv, _nenv, _ad, m, _) ->
// MakeAndPublishVal creates only Item.Value
let item = match item with Item.Value(item) -> item | _ -> failwith "impossible"
(AddFakeNamedValRefToNameEnv item.DisplayName nenv item), (unionRanges m merged)
@ -1758,7 +1768,7 @@ let MakeAndPublishSimpleVals cenv env m names mergeNamesInOneNameresEnv =
// send notification about mergedNameEnv
CallEnvSink cenv.tcSink (mergedRange, mergedNameEnv, ad)
// call CallNameResolutionSink for all captured name resolutions using mergedNameEnv
for (_, item, b, occurence, denv, _nenv, ad, m) in nameResolutions do
for (_, item, b, occurence, denv, _nenv, ad, m, _replacing) in nameResolutions do
CallNameResolutionSink cenv.tcSink (m, mergedNameEnv, item, b, occurence, denv, ad)
values,vspecMap
@ -4357,10 +4367,9 @@ and TcTypesOrMeasures optKinds cenv newOk checkCxs occ env tpenv args m =
| None ->
List.mapFold (TcTypeOrMeasure None cenv newOk checkCxs occ env) tpenv args
| Some kinds ->
if List.length kinds = List.length args
then List.mapFold (fun tpenv (arg,kind) -> TcTypeOrMeasure (Some kind) cenv newOk checkCxs occ env tpenv arg) tpenv (List.zip args kinds)
else if kinds.Length = 0
then error(Error(FSComp.SR.tcUnexpectedTypeArguments(), m))
if List.length kinds = List.length args then
List.mapFold (fun tpenv (arg,kind) -> TcTypeOrMeasure (Some kind) cenv newOk checkCxs occ env tpenv arg) tpenv (List.zip args kinds)
elif kinds.Length = 0 then error(Error(FSComp.SR.tcUnexpectedTypeArguments(), m))
else error(Error(FSComp.SR.tcTypeParameterArityMismatch((List.length kinds), (List.length args)), m))
and TcTyparConstraints cenv newOk checkCxs occ env tpenv wcs =
@ -8125,7 +8134,7 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution
// call to ResolveLongIdentAsExprAndComputeRange
error(Error(FSComp.SR.tcInvalidUseOfTypeName(),mItem))
| Item.MethodGroup (methodName,minfos) ->
| Item.MethodGroup (methodName,minfos,_) ->
// Static method calls Type.Foo(arg1,...,argn)
let meths = List.map (fun minfo -> minfo,None) minfos
let afterTcOverloadResolution = afterOverloadResolution |> AfterTcOverloadResolution.ForMethods
@ -8133,15 +8142,21 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution
| (DelayedApp (atomicFlag, arg, mExprAndArg)::otherDelayed) ->
TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false meths afterTcOverloadResolution NormalValUse [arg] atomicFlag otherDelayed
| (DelayedTypeApp(tys, mTypeArgs, mExprAndTypeArgs) :: DelayedApp(atomicFlag, arg, mExprAndArg) :: otherDelayed) ->
| (DelayedTypeApp(tys, mTypeArgs, mExprAndTypeArgs) :: otherDelayed) ->
#if EXTENSIONTYPING
match TryTcMethodAppToStaticConstantArgs cenv env tpenv (minfos, Some (tys, mTypeArgs), mExprAndArg, mItem) with
match TryTcMethodAppToStaticConstantArgs cenv env tpenv (minfos, Some (tys, mTypeArgs), mExprAndTypeArgs, mItem) with
| Some minfoAfterStaticArguments ->
// // NOTE: This doesn't take instantiation into account
// CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs,env.NameEnv,item (* ! *), item, ItemOccurence.Use,env.DisplayEnv,env.eAccessRights)
TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterTcOverloadResolution NormalValUse [arg] atomicFlag otherDelayed
// Replace the resolution including the static parameters, plus the extra information about the original method info
let item = Item.MethodGroup(methodName, [minfoAfterStaticArguments], Some minfos.[0])
CallNameResolutionSinkReplacing cenv.tcSink (mItem, env.NameEnv, item, item, ItemOccurence.Use, env.DisplayEnv, env.eAccessRights)
match otherDelayed with
| DelayedApp(atomicFlag, arg, mExprAndArg) :: otherDelayed ->
TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterTcOverloadResolution NormalValUse [arg] atomicFlag otherDelayed
| _ ->
TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndTypeArgs mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterTcOverloadResolution NormalValUse [] ExprAtomicFlag.Atomic otherDelayed
| None ->
#endif
@ -8150,8 +8165,17 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution
// NOTE: This doesn't take instantiation into account
CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs,env.NameEnv,item (* ! *), item, ItemOccurence.Use,env.DisplayEnv,env.eAccessRights)
TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndArg mItem methodName ad NeverMutates false meths afterTcOverloadResolution NormalValUse [arg] atomicFlag otherDelayed
match otherDelayed with
| DelayedApp(atomicFlag, arg, mExprAndArg) :: otherDelayed ->
TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndArg mItem methodName ad NeverMutates false meths afterTcOverloadResolution NormalValUse [arg] atomicFlag otherDelayed
| _ ->
TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndTypeArgs mItem methodName ad NeverMutates false meths afterTcOverloadResolution NormalValUse [] ExprAtomicFlag.Atomic otherDelayed
| _ ->
#if EXTENSIONTYPING
if not minfos.IsEmpty && minfos.[0].ProvidedStaticParameterInfo.IsSome then
error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(),mItem))
#endif
TcMethodApplicationThen cenv env overallTy None tpenv None [] mItem mItem methodName ad NeverMutates false meths afterTcOverloadResolution NormalValUse [] ExprAtomicFlag.Atomic delayed
| Item.CtorGroup(nm,minfos) ->
@ -8417,6 +8441,8 @@ and GetSynMemberApplicationArgs delayed tpenv =
atomicFlag, None, [arg], otherDelayed, tpenv
| DelayedTypeApp(tyargs, mTypeArgs, _) :: DelayedApp (atomicFlag, arg, _mExprAndArg) :: otherDelayed ->
(atomicFlag, Some (tyargs,mTypeArgs), [arg], otherDelayed, tpenv)
| DelayedTypeApp(tyargs, mTypeArgs, _) :: otherDelayed ->
(ExprAtomicFlag.Atomic, Some (tyargs,mTypeArgs), [], otherDelayed, tpenv)
| otherDelayed ->
(ExprAtomicFlag.NonAtomic, None, [], otherDelayed, tpenv)
@ -8451,7 +8477,7 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela
let delayed = delayRest rest mExprAndItem delayed
match item with
| Item.MethodGroup (methodName,minfos) ->
| Item.MethodGroup (methodName,minfos,_) ->
let atomicFlag,tyargsOpt,args,delayed,tpenv = GetSynMemberApplicationArgs delayed tpenv
let afterTcOverloadResolution = afterOverloadResolution |> AfterTcOverloadResolution.ForMethods
@ -8461,8 +8487,15 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela
#if EXTENSIONTYPING
match TryTcMethodAppToStaticConstantArgs cenv env tpenv (minfos, tyargsOpt, mExprAndItem, mItem) with
| Some minfo -> TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItem methodName ad mutates false [(minfo, None)] afterTcOverloadResolution NormalValUse args atomicFlag delayed
| Some minfoAfterStaticArguments ->
// Replace the resolution including the static parameters, plus the extra information about the original method info
let item = Item.MethodGroup(methodName, [minfoAfterStaticArguments], Some minfos.[0])
CallNameResolutionSinkReplacing cenv.tcSink (mExprAndItem,env.NameEnv, item, item, ItemOccurence.Use, env.DisplayEnv, env.eAccessRights)
TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItem methodName ad mutates false [(minfoAfterStaticArguments, None)] afterTcOverloadResolution NormalValUse args atomicFlag delayed
| None ->
if not minfos.IsEmpty && minfos.[0].ProvidedStaticParameterInfo.IsSome then
error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(),mItem))
#endif
let tyargsOpt,tpenv = TcMemberTyArgsOpt cenv env tpenv tyargsOpt
@ -15521,8 +15554,8 @@ let ApplyAssemblyLevelAutoOpenAttributeToTcEnv g amap (ccu: CcuThunk) scopem env
| Some _ -> OpenModulesOrNamespaces TcResultsSink.NoSink g amap scopem root env [modref]
// Add the CCU and apply the "AutoOpen" attributes
let AddCcuToTcEnv(g,amap,scopem,env,ccu,autoOpens,internalsVisible) =
let env = AddNonLocalCcu g amap scopem env (ccu,internalsVisible)
let AddCcuToTcEnv(g,amap,scopem,env,assemblyName,ccu,autoOpens,internalsVisible) =
let env = AddNonLocalCcu g amap scopem env assemblyName (ccu,internalsVisible)
// See https://fslang.uservoice.com/forums/245727-f-language/suggestions/6107641-make-microsoft-prefix-optional-when-using-core-f
// "Microsoft" is opened by default in FSharp.Core
@ -15539,8 +15572,8 @@ let AddCcuToTcEnv(g,amap,scopem,env,ccu,autoOpens,internalsVisible) =
let env = (env,autoOpens) ||> List.fold (ApplyAssemblyLevelAutoOpenAttributeToTcEnv g amap ccu scopem)
env
let CreateInitialTcEnv(g,amap,scopem,ccus) =
List.fold (fun env (ccu,autoOpens,internalsVisible) -> AddCcuToTcEnv(g,amap,scopem,env,ccu,autoOpens,internalsVisible)) (emptyTcEnv g) ccus
let CreateInitialTcEnv(g,amap,scopem,assemblyName,ccus) =
List.fold (fun env (ccu,autoOpens,internalsVisible) -> AddCcuToTcEnv(g,amap,scopem,env,assemblyName,ccu,autoOpens,internalsVisible)) (emptyTcEnv g) ccus
type ConditionalDefines =
string list

Просмотреть файл

@ -26,8 +26,8 @@ type TcEnv =
member NameEnv : NameResolution.NameResolutionEnv
member AccessRights : AccessorDomain
val CreateInitialTcEnv : TcGlobals * ImportMap * range * (CcuThunk * string list * bool) list -> TcEnv
val AddCcuToTcEnv : TcGlobals * ImportMap * range * TcEnv * CcuThunk * autoOpens: string list * bool -> TcEnv
val CreateInitialTcEnv : TcGlobals * ImportMap * range * assemblyName: string * (CcuThunk * string list * string list) list -> TcEnv
val AddCcuToTcEnv : TcGlobals * ImportMap * range * TcEnv * assemblyName: string * ccu: CcuThunk * autoOpens: string list * internalsVisibleToAttributes: string list -> TcEnv
val AddLocalRootModuleOrNamespace : NameResolution.TcResultsSink -> TcGlobals -> ImportMap -> range -> TcEnv -> ModuleOrNamespaceType -> TcEnv
val TcOpenDecl : NameResolution.TcResultsSink -> TcGlobals -> ImportMap -> range -> range -> TcEnv -> Ast.LongIdent -> TcEnv
@ -103,6 +103,7 @@ exception OverrideInExtrinsicAugmentation of range
exception NonUniqueInferredAbstractSlot of TcGlobals * DisplayEnv * string * MethInfo * MethInfo * range
exception StandardOperatorRedefinitionWarning of string * range
exception ParameterlessStructCtor of range
exception InvalidInternalsVisibleToAssemblyName of (*badName*)string * (*fileName option*) string option
val TcFieldInit : range -> ILFieldInit -> Tast.Const

Просмотреть файл

@ -1150,7 +1150,7 @@ module DispatchSlotChecking =
|> List.filter (OverrideImplementsDispatchSlot g amap m dispatchSlot) with
| [ovd] ->
if not ovd.IsCompilerGenerated then
let item = Item.MethodGroup(ovd.LogicalName,[dispatchSlot])
let item = Item.MethodGroup(ovd.LogicalName,[dispatchSlot],None)
CallNameResolutionSink sink (ovd.Range,nenv,item,item,ItemOccurence.Implemented,denv,AccessorDomain.AccessibleFromSomewhere)
sink |> ignore
()

Просмотреть файл

@ -1412,7 +1412,7 @@ type ParsedSigFile =
let ident (s,r) = new Ident(s,r)
let textOfId (id:Ident) = id.idText
let pathOfLid lid = List.map textOfId lid
let arrPathOfLid lid = Array.ofList (List.map textOfId lid)
let arrPathOfLid lid = Array.ofList (pathOfLid lid)
let textOfPath path = String.concat "." path
let textOfArrPath path = String.concat "." (List.ofArray path)
let textOfLid lid = textOfPath (pathOfLid lid)

Просмотреть файл

@ -440,7 +440,7 @@ let GetTcImportsFromCommandLine
ReportTime tcConfig "Typecheck"
use unwindParsePhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.TypeCheck)
let tcEnv0 = GetInitialTcEnv (Some assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
let tcEnv0 = GetInitialTcEnv (assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
// typecheck
let inputs = inputs |> List.map fst
@ -637,15 +637,13 @@ let EncodeInterfaceData(tcConfig:TcConfig,tcGlobals,exportRemapping,generatedCcu
let resource = WriteSignatureData (tcConfig,tcGlobals,exportRemapping,generatedCcu,outfile)
if verbose then dprintf "Generated interface data attribute!\n";
// REVIEW: need a better test for this
let outFileNoExtension = Filename.chopExtension outfile
let isCompilerServiceDll = outFileNoExtension.Contains("FSharp.LanguageService.Compiler")
if (tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib || isCompilerServiceDll) && not isIncrementalBuild then
if (tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib) && not isIncrementalBuild then
let sigDataFileName = (Filename.chopExtension outfile)+".sigdata"
File.WriteAllBytes(sigDataFileName,resource.Bytes);
let sigAttr = mkSignatureDataVersionAttr tcGlobals (IL.parseILVersion Internal.Utilities.FSharpEnvironment.FSharpBinaryMetadataFormatRevision)
// The resource gets written to a file for FSharp.Core
let resources =
[ if not tcGlobals.compilingFslib && not isCompilerServiceDll then
[ if not tcGlobals.compilingFslib then
yield resource ]
[sigAttr], resources
else
@ -665,15 +663,13 @@ let EncodeOptimizationData(tcGlobals,tcConfig,outfile,exportRemapping,data) =
let data = map2Of2 (Optimizer.RemapOptimizationInfo tcGlobals exportRemapping) data
if verbose then dprintn "Generating optimization data attribute...";
// REVIEW: need a better test for this
let outFileNoExtension = Filename.chopExtension outfile
let isCompilerServiceDll = outFileNoExtension.Contains("FSharp.LanguageService.Compiler")
if tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib || isCompilerServiceDll then
if tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib then
let ccu,modulInfo = data
let bytes = TastPickle.pickleObjWithDanglingCcus outfile tcGlobals ccu Optimizer.p_CcuOptimizationInfo modulInfo
let optDataFileName = (Filename.chopExtension outfile)+".optdata"
File.WriteAllBytes(optDataFileName,bytes);
// As with the sigdata file, the optdata gets written to a file for FSharp.Core, FSharp.Compiler.Silverlight and FSharp.LanguageService.Compiler
if tcGlobals.compilingFslib || isCompilerServiceDll then
// As with the sigdata file, the optdata gets written to a file for FSharp.Core
if tcGlobals.compilingFslib then
[]
else
let (ccu, optData) =

Просмотреть файл

@ -0,0 +1,3 @@
{
"runtimeOptions": {}
}

Просмотреть файл

@ -1,10 +1,10 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.FSharp.Core.netcore</id>
<description>
netcore compatible version of the fsharp core library fsharp.core.dll
Supported Platforms: - .NET Core (dnxcore50)
Supported Platforms: - .NET Core (netstandard1.5)
</description>
<language>en-US</language>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
@ -14,7 +14,7 @@
<projectUrl>$projectUrl$</projectUrl>
<tags>$tags$</tags>
<dependencies>
<group>
<group targetFramework=".NETStandard1.5">
<dependency id="Microsoft.NETCore.Platforms" version="1.0.1-rc2-23911" />
<dependency id="NETStandard.Library" version="1.5.0-rc2-23911" />
<dependency id="System.Linq.Expressions" version="4.0.11-rc2-23911" />
@ -30,11 +30,12 @@
</dependencies>
</metadata>
<files>
<file src="FSharp.Core.dll" target="lib/DNXCore50" />
<file src="FSharp.Core.sigdata" target="lib/DNXCore50" />
<file src="FSharp.Core.optdata" target="lib/DNXCore50" />
<file src="FSharp.Core.sigdata" target="content/any/DNXCore50" />
<file src="FSharp.Core.optdata" target="content/any/DNXCore50" />
<file src="FSharp.Core.dll" target="lib/netstandard1.5" />
<file src="FSharp.Core.sigdata" target="lib/netstandard1.5" />
<file src="FSharp.Core.optdata" target="lib/netstandard1.5" />
<file src="FSharp.Core.runtimeconfig.json" target="lib/netstandard1.5" />
<file src="FSharp.Core.sigdata" target="content/any/netstandard1.5" />
<file src="FSharp.Core.optdata" target="content/any/netstandard1.5" />
<file src="FSharp.Core.sigdata" target="runtimes/any/native/" />
<file src="FSharp.Core.optdata" target="runtimes/any/native/" />
</files>

Просмотреть файл

@ -62,6 +62,7 @@ try
yield Path.Combine(bindir, "FSharp.Core.dll")
yield Path.Combine(bindir, "FSharp.Core.sigdata")
yield Path.Combine(bindir, "FSharp.Core.optdata")
yield Path.Combine( __SOURCE_DIRECTORY__ , "FSharp.Core.runtimeconfig.json")
}
//Clean intermediate directoriy

Просмотреть файл

@ -39,7 +39,7 @@
<Link>FSIstrings.txt</Link>
</FsSrGen>
<Compile Include="..\..\assemblyinfo\assemblyinfo.fsi.exe.fs">
<Link>Utilities/assemblyinfo.fsi.exe.fs</Link>
<Link>assemblyinfo.fsi.exe.fs</Link>
</Compile>
<Compile Include="..\..\utils\reshapedreflection.fs">
<Link>Reflection/reshapedreflection.fs</Link>

Просмотреть файл

@ -1030,7 +1030,7 @@ type internal FsiDynamicCompiler
let tcState = istate.tcState
let tcEnv,(_dllinfos,ccuinfos) =
try
RequireDLL tcImports tcState.TcEnvFromImpls m path
RequireDLL (tcImports, tcState.TcEnvFromImpls, assemblyName, m, path)
with e ->
tcConfigB.RemoveReferencedAssemblyByPath(m,path)
reraise()
@ -1096,7 +1096,7 @@ type internal FsiDynamicCompiler
let tcConfig = TcConfig.Create(tcConfigB,validate=false)
let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals)
let emEnv = ILRuntimeWriter.emEnv0
let tcEnv = GetInitialTcEnv (None, rangeStdin, tcConfig, tcImports, tcGlobals)
let tcEnv = GetInitialTcEnv (assemblyName, rangeStdin, tcConfig, tcImports, tcGlobals)
let ccuName = assemblyName
let tcState = GetInitialTcState (rangeStdin, ccuName, tcConfig, tcGlobals, tcImports, niceNameGen, tcEnv)

Просмотреть файл

@ -17,6 +17,6 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": { }
"netstandard1.5": { }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -3306,6 +3306,8 @@ declExpr:
| declExpr INFIX_COMPARE_OP declExpr { mkSynInfix (rhs parseState 2) $1 $2 $3 }
| declExpr DOLLAR declExpr { mkSynInfix (rhs parseState 2) $1 "$" $3 }
| declExpr LESS declExpr { mkSynInfix (rhs parseState 2) $1 "<" $3 }
| declExpr LESS recover { if not $3 then reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnfinishedExpression("<"));
exprFromParseError (mkSynInfix (rhs parseState 2) $1 "<" (arbExpr("declExprInfix",(rhs parseState 3).StartRange))) }
| declExpr GREATER declExpr { mkSynInfix (rhs parseState 2) $1 ">" $3 }
| declExpr INFIX_AT_HAT_OP declExpr { mkSynInfix (rhs parseState 2) $1 $2 $3 }
| declExpr PERCENT_OP declExpr { mkSynInfix (rhs parseState 2) $1 $2 $3 }

Просмотреть файл

@ -1405,7 +1405,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
errorLogger.Warning(e)
frameworkTcImports
let tcEnvAtEndOfFile = GetInitialTcEnv (Some assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
let tcEnvAtEndOfFile = GetInitialTcEnv (assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
let tcState = GetInitialTcState (rangeStartup, assemblyName, tcConfig, tcGlobals, tcImports, niceNameGen, tcEnvAtEndOfFile)
let tcAcc =
{ tcGlobals=tcGlobals

Просмотреть файл

@ -150,7 +150,7 @@ module internal ItemDescriptionsImpl =
| Item.CustomOperation (_,_,Some minfo) -> rangeOfMethInfo g preferFlag minfo
| Item.TypeVar (_,tp) -> Some tp.Range
| Item.ModuleOrNamespaces(modrefs) -> modrefs |> List.tryPick (rangeOfEntityRef preferFlag >> Some)
| Item.MethodGroup(_,minfos)
| Item.MethodGroup(_,minfos,_)
| Item.CtorGroup(_,minfos) -> minfos |> List.tryPick (rangeOfMethInfo g preferFlag)
| Item.ActivePatternResult(APInfo _,_, _, m) -> Some m
| Item.SetterArg (_,item) -> rangeOfItem g preferFlag item
@ -195,7 +195,7 @@ module internal ItemDescriptionsImpl =
| Item.ArgName (_,_,Some (ArgumentContainer.Method minfo)) -> ccuOfMethInfo g minfo
| Item.MethodGroup(_,minfos)
| Item.MethodGroup(_,minfos,_)
| Item.CtorGroup(_,minfos) -> minfos |> List.tryPick (ccuOfMethInfo g)
| Item.CustomOperation (_,_,Some minfo) -> ccuOfMethInfo g minfo
@ -390,12 +390,13 @@ module internal ItemDescriptionsImpl =
| Item.Property(_,(pinfo :: _)) -> mkXmlComment (GetXmlDocSigOfProp infoReader m pinfo)
| Item.Event(einfo) -> mkXmlComment (GetXmlDocSigOfEvent infoReader m einfo)
| Item.MethodGroup(_,minfo :: _) -> mkXmlComment (GetXmlDocSigOfMethInfo infoReader m minfo)
| Item.MethodGroup(_,minfo :: _,_) -> mkXmlComment (GetXmlDocSigOfMethInfo infoReader m minfo)
| Item.CtorGroup(_,minfo :: _) -> mkXmlComment (GetXmlDocSigOfMethInfo infoReader m minfo)
| Item.ArgName(_, _, Some argContainer) -> match argContainer with
| ArgumentContainer.Method(minfo) -> mkXmlComment (GetXmlDocSigOfMethInfo infoReader m minfo)
| ArgumentContainer.Type(tcref) -> mkXmlComment (GetXmlDocSigOfEntityRef infoReader m tcref)
| ArgumentContainer.UnionCase(ucinfo) -> mkXmlComment (GetXmlDocSigOfUnionCaseInfo ucinfo)
| Item.ArgName(_, _, Some argContainer) ->
match argContainer with
| ArgumentContainer.Method minfo -> mkXmlComment (GetXmlDocSigOfMethInfo infoReader m minfo)
| ArgumentContainer.Type tcref -> mkXmlComment (GetXmlDocSigOfEntityRef infoReader m tcref)
| ArgumentContainer.UnionCase ucinfo -> mkXmlComment (GetXmlDocSigOfUnionCaseInfo ucinfo)
| _ -> FSharpXmlDoc.None
/// Produce an XmlComment with a signature or raw text.
@ -509,7 +510,7 @@ module internal ItemDescriptionsImpl =
(nm1 = nm2) && typarRefEq tp1 tp2
| Wrap(Item.ModuleOrNamespaces(modref1 :: _)), Wrap(Item.ModuleOrNamespaces(modref2 :: _)) -> fullDisplayTextOfModRef modref1 = fullDisplayTextOfModRef modref2
| Wrap(Item.SetterArg(id1,_)), Wrap(Item.SetterArg(id2,_)) -> (id1.idRange, id1.idText) = (id2.idRange, id2.idText)
| Wrap(Item.MethodGroup(_, meths1)), Wrap(Item.MethodGroup(_, meths2)) ->
| Wrap(Item.MethodGroup(_, meths1,_)), Wrap(Item.MethodGroup(_, meths2,_)) ->
Seq.zip meths1 meths2 |> Seq.forall (fun (minfo1, minfo2) ->
MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2)
| Wrap(Item.Value vref1 | Item.CustomBuilder (_,vref1)), Wrap(Item.Value vref2 | Item.CustomBuilder (_,vref2)) -> valRefEq g vref1 vref2
@ -541,7 +542,7 @@ module internal ItemDescriptionsImpl =
| Wrap(Item.CustomOperation (_,_,None)) -> 1
| Wrap(Item.ModuleOrNamespaces(modref :: _)) -> hash (fullDisplayTextOfModRef modref)
| Wrap(Item.SetterArg(id,_)) -> hash (id.idRange, id.idText)
| Wrap(Item.MethodGroup(_, meths)) -> meths |> List.fold (fun st a -> st + a.ComputeHashCode()) 0
| Wrap(Item.MethodGroup(_, meths,_)) -> meths |> List.fold (fun st a -> st + a.ComputeHashCode()) 0
| Wrap(Item.CtorGroup(name, meths)) -> name.GetHashCode() + (meths |> List.fold (fun st a -> st + a.ComputeHashCode()) 0)
| Wrap(Item.Value vref | Item.CustomBuilder (_,vref)) -> hash vref.LogicalName
| Wrap(Item.ActivePatternCase(APElemRef(_apinfo, vref, idx))) -> hash (vref.LogicalName, idx)
@ -607,7 +608,8 @@ module internal ItemDescriptionsImpl =
| Item.Property(_,(pinfo::_)) -> bufs (fun os -> NicePrint.outputTyconRef denv os (tcrefOfAppTy g pinfo.EnclosingType); bprintf os ".%s" pinfo.PropertyName)
| Item.CustomOperation (customOpName,_,_) -> customOpName
| Item.CtorGroup(_,minfo :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef)
| Item.MethodGroup(_,minfo :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName)
| Item.MethodGroup(_,_,Some minfo) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName)
| Item.MethodGroup(_,minfo :: _,_) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName)
| Item.UnqualifiedType (tcref :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os tcref)
| Item.FakeInterfaceCtor typ
| Item.DelegateCtor typ
@ -623,7 +625,7 @@ module internal ItemDescriptionsImpl =
| Item.UnqualifiedType([])
| Item.Types(_,[])
| Item.CtorGroup(_,[])
| Item.MethodGroup(_,[])
| Item.MethodGroup(_,[],_)
| Item.ModuleOrNamespaces []
| Item.Property(_,[]) -> ""
@ -802,7 +804,7 @@ module internal ItemDescriptionsImpl =
// F# constructors and methods
| Item.CtorGroup(_,minfos)
| Item.MethodGroup(_,minfos) ->
| Item.MethodGroup(_,minfos,_) ->
FormatOverloadsToList infoReader m denv d minfos
// The 'fake' zero-argument constructors of .NET interfaces.
@ -937,7 +939,7 @@ module internal ItemDescriptionsImpl =
let layout = (NicePrint.layoutPrettifiedTypeAndConstraints denv [] rty)
bufferL os layout
| Item.CustomOperation (_,_,Some minfo)
| Item.MethodGroup(_,(minfo :: _))
| Item.MethodGroup(_,(minfo :: _),_)
| Item.CtorGroup(_,(minfo :: _)) ->
let rty = minfo.GetFSharpReturnTy(amap, m, minfo.FormalMethodInst)
bufferL os (NicePrint.layoutPrettifiedTypeAndConstraints denv [] rty)
@ -1097,9 +1099,10 @@ module internal ItemDescriptionsImpl =
| ProvidedMeth _::_ -> None
#endif
| Item.CustomOperation (_,_,Some minfo) -> getKeywordForMethInfo minfo
| Item.MethodGroup(_,minfo :: _) -> getKeywordForMethInfo minfo
| Item.MethodGroup(_,_,Some minfo) -> getKeywordForMethInfo minfo
| Item.MethodGroup(_,minfo :: _,_) -> getKeywordForMethInfo minfo
| Item.SetterArg (_, propOrField) -> GetF1Keyword propOrField
| Item.MethodGroup(_,[])
| Item.MethodGroup(_,[],_)
| Item.CustomOperation (_,_,None) // "into"
| Item.NewDef _ // "let x$yz = ..." - no keyword
| Item.ArgName _ // no keyword on named parameters
@ -1303,7 +1306,7 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[]) =
let isOpItem(nm,item) =
match item with
| [Item.Value _]
| [Item.MethodGroup(_,[_])] ->
| [Item.MethodGroup(_,[_],_)] ->
(IsOpName nm) && nm.[0]='(' && nm.[nm.Length-1]=')'
| [Item.UnionCase _] -> IsOpName nm
| _ -> false

Просмотреть файл

@ -7,12 +7,7 @@ open Microsoft.FSharp.Compiler.Range
open Microsoft.FSharp.Compiler.Ast
[<Sealed>]
type FSharpNoteworthyParamInfoLocations(longId : string list,
longIdRange: range,
openParenLocation : pos,
tupleEndLocations : pos list,
isThereACloseParen : bool,
namedParamNames : string list) =
type FSharpNoteworthyParamInfoLocations(longId: string list, longIdRange: range, openParenLocation: pos, tupleEndLocations: pos list, isThereACloseParen: bool, namedParamNames: string list) =
let tupleEndLocations = Array.ofList tupleEndLocations
let namedParamNames = Array.ofList namedParamNames
@ -43,15 +38,20 @@ module internal NoteworthyParamInfoLocationsImpl =
| SynType.LongIdent _ -> true // NOTE: this is not a static constant, but it is a prefix of incomplete code, e.g. "TP<42,Arg3" is a prefix of "TP<42,Arg3=6>" and Arg3 shows up as a LongId
| _ -> false
let rec digOutIdentFromApp synExpr =
/// Dig out an identifier from an expression that used in an application
let rec digOutIdentFromFuncExpr synExpr =
// we found it, dig out ident
match synExpr with
| SynExpr.Ident(id) -> Some ([id.idText], id.idRange)
| SynExpr.LongIdent(_, LongIdentWithDots(lid,_), _, lidRange) -> Some (lid |> List.map textOfId, lidRange)
| SynExpr.DotGet(_expr, _dotm, LongIdentWithDots(lid,_), range) -> Some (lid |> List.map textOfId, range)
| SynExpr.TypeApp(synExpr, _, _synTypeList, _commas, _, _, _range) -> digOutIdentFromApp synExpr
| SynExpr.LongIdent(_, LongIdentWithDots(lid,_), _, lidRange)
| SynExpr.DotGet(_, _, LongIdentWithDots(lid,_), lidRange) -> Some (pathOfLid lid, lidRange)
| SynExpr.TypeApp(synExpr, _, _synTypeList, _commas, _, _, _range) -> digOutIdentFromFuncExpr synExpr
| _ -> None
type FindResult =
| Found of openParen: pos * commasAndCloseParen: (pos * string) list * hasClosedParen: bool
| NotFound
let digOutIdentFromStaticArg synType =
match synType with
| SynType.StaticConstantNamed(SynType.LongIdent(LongIdentWithDots([id],_)),_,_) -> id.idText
@ -77,66 +77,65 @@ module internal NoteworthyParamInfoLocationsImpl =
let getTypeName(synType) =
match synType with
| SynType.LongIdent(LongIdentWithDots(ids,_)) -> ids |> List.map textOfId
| SynType.LongIdent(LongIdentWithDots(ids,_)) -> ids |> pathOfLid
| _ -> [""] // TODO type name for other cases, see also unit test named "ParameterInfo.LocationOfParams.AfterQuicklyTyping.CallConstructorViaLongId.Bug94333"
let handleSingleArg traverseSynExpr (pos, synExpr, parenRange, rpRangeOpt : _ option) =
let inner = traverseSynExpr synExpr
match inner with
| None ->
if AstTraversal.rangeContainsPosEdgesExclusive parenRange pos then
Found (parenRange.Start, [(parenRange.End, getNamedParamName synExpr)], rpRangeOpt.IsSome), None
else
NotFound, None
| _ -> NotFound, None
// This method returns a tuple, where the second element is
// Some(cache) if the implementation called 'traverseSynExpr expr', then 'cache' is the result of that call
// None otherwise
// so that callers can avoid recomputing 'traverseSynExpr expr' if it's already been done. This is very important for perf,
// see bug 345385.
let rec astFindNoteworthyParamInfoLocationsSynExprExactParen traverseSynExpr pos expr =
let handleSingleArg(synExpr, parenRange, rpRangeOpt : _ option) =
let inner = traverseSynExpr synExpr
match inner with
| None ->
if AstTraversal.rangeContainsPosEdgesExclusive parenRange pos then
let r = parenRange.Start, [parenRange.End, getNamedParamName synExpr], rpRangeOpt.IsSome
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found single arg paren range %+A from %+A" r expr)
Some r, None
else
None, None
| _ -> None, None
let rec searchSynArgExpr traverseSynExpr pos expr =
match expr with
| SynExprParen((SynExpr.Tuple(synExprList, commaRanges, _tupleRange) as synExpr), _lpRange, rpRangeOpt, parenRange) -> // tuple argument
let inner = traverseSynExpr synExpr
match inner with
| None ->
if AstTraversal.rangeContainsPosEdgesExclusive parenRange pos then
let r = parenRange.Start, ((synExprList,commaRanges@[parenRange]) ||> List.map2 (fun e c -> c.End, getNamedParamName e)), rpRangeOpt.IsSome
let commasAndCloseParen = ((synExprList,commaRanges@[parenRange]) ||> List.map2 (fun e c -> c.End, getNamedParamName e))
let r = Found (parenRange.Start, commasAndCloseParen, rpRangeOpt.IsSome)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found paren tuple ranges %+A from %+A" r expr)
Some r, None
r, None
else
None, None
| _ -> None, None
NotFound, None
| _ -> NotFound, None
| SynExprParen(SynExprParen(SynExpr.Tuple(_,_,_),_,_,_) as synExpr, _, rpRangeOpt, parenRange) -> // f((x,y)) is special, single tuple arg
handleSingleArg(synExpr,parenRange,rpRangeOpt)
handleSingleArg traverseSynExpr (pos,synExpr,parenRange,rpRangeOpt)
// dig into multiple parens
| SynExprParen(SynExprParen(_,_,_,_) as synExpr, _, _, _parenRange) ->
let r,_cacheOpt = astFindNoteworthyParamInfoLocationsSynExprExactParen traverseSynExpr pos synExpr
let r,_cacheOpt = searchSynArgExpr traverseSynExpr pos synExpr
r, None
| SynExprParen(synExpr, _lpRange, rpRangeOpt, parenRange) -> // single argument
handleSingleArg(synExpr,parenRange,rpRangeOpt)
handleSingleArg traverseSynExpr (pos, synExpr, parenRange, rpRangeOpt)
| SynExpr.ArbitraryAfterError(_debugStr, range) -> // single argument when e.g. after open paren you hit EOF
if AstTraversal.rangeContainsPosEdgesExclusive range pos then
let r = range.Start, [range.End, null], false
let r = Found (range.Start, [range.End, null], false)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found ArbitraryAfterError range %+A from %+A" r expr)
Some r, None
r, None
else
None, None
NotFound, None
| SynExpr.Const(SynConst.Unit, unitRange) ->
if AstTraversal.rangeContainsPosEdgesExclusive unitRange pos then
let r = unitRange.Start, [unitRange.End, null], true
let r = Found (unitRange.Start, [unitRange.End, null], true)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found unit range %+A from %+A" r expr)
Some r, None
r, None
else
None, None
NotFound, None
| e ->
let inner = traverseSynExpr e
@ -144,41 +143,61 @@ module internal NoteworthyParamInfoLocationsImpl =
| None ->
if AstTraversal.rangeContainsPosEdgesExclusive e.Range pos then
// any other expression doesn't start with parens, so if it was the target of an App, then it must be a single argument e.g. "f x"
let r = e.Range.Start, [e.Range.End, null], false
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found non-parenthesized single arg range %+A from %+A" r expr)
Some r, Some inner
Found (e.Range.Start, [e.Range.End, null], false), Some inner
else
None, Some inner
| _ -> None, Some inner
NotFound, Some inner
| _ -> NotFound, Some inner
let traverseInput(pos,parseTree) : FSharpNoteworthyParamInfoLocations option =
let traverseInput(pos,parseTree) =
AstTraversal.Traverse(pos,parseTree, { new AstTraversal.AstVisitorBase<_>() with
member this.VisitExpr(_path, traverseSynExpr, defaultTraverse, expr) =
let expr = expr // fix debug locals
match expr with
| SynExpr.New(_, synType, synExpr, _range) -> // TODO walk SynType
let constrArgsResult,cacheOpt = astFindNoteworthyParamInfoLocationsSynExprExactParen traverseSynExpr pos synExpr
// new LID<tyarg1,....,tyargN>(...) and error recovery of these
| SynExpr.New(_, synType, synExpr, _range) ->
let constrArgsResult,cacheOpt = searchSynArgExpr traverseSynExpr pos synExpr
match constrArgsResult,cacheOpt with
| Some(parenLoc,args,isThereACloseParen), _ ->
let typename = getTypeName synType
let r = FSharpNoteworthyParamInfoLocations(typename, synType.Range, parenLoc, args |> List.map fst, isThereACloseParen, args |> List.map snd)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found 'new' call with ranges %+A from %+A" r expr)
Some(r)
| None, Some(cache) ->
| Found(parenLoc,args,isThereACloseParen), _ ->
let typeName = getTypeName synType
Some (FSharpNoteworthyParamInfoLocations(typeName, synType.Range, parenLoc, args |> List.map fst, isThereACloseParen, args |> List.map snd))
| NotFound, Some cache ->
cache
| _ ->
traverseSynExpr synExpr
| SynExpr.App(_exprAtomicFlag, isInfix, synExpr, synExpr2, _range) ->
// EXPR< = error recovery of a form of half-written TypeApp
| SynExpr.App(_, _, SynExpr.App(_, true, SynExpr.Ident op, synExpr, openm), SynExpr.ArbitraryAfterError _, wholem) when op.idText = "op_LessThan" ->
// Look in the function expression
let fResult = traverseSynExpr synExpr
match fResult with
| Some(_) -> fResult
| Some _ -> fResult
| _ ->
let xResult,cacheOpt = astFindNoteworthyParamInfoLocationsSynExprExactParen traverseSynExpr pos synExpr2
let typeArgsm = mkRange openm.FileName openm.Start wholem.End
if AstTraversal.rangeContainsPosEdgesExclusive typeArgsm pos then
// We found it, dig out ident
match digOutIdentFromFuncExpr synExpr with
| Some(lid,lidRange) -> Some (FSharpNoteworthyParamInfoLocations(lid, lidRange, op.idRange.Start, [ wholem.End ], false, []))
| None -> None
else
None
// EXPR EXPR2
| SynExpr.App(_exprAtomicFlag, isInfix, synExpr, synExpr2, _range) ->
// Look in the function expression
let fResult = traverseSynExpr synExpr
match fResult with
| Some _ -> fResult
| _ ->
// Search the argument
let xResult,cacheOpt = searchSynArgExpr traverseSynExpr pos synExpr2
match xResult,cacheOpt with
| Some(parenLoc,args,isThereACloseParen),_ ->
// we found it, dig out ident
match digOutIdentFromApp synExpr with
| Found(parenLoc,args,isThereACloseParen),_ ->
// We found it, dig out ident
match digOutIdentFromFuncExpr synExpr with
| Some(lid,lidRange) ->
assert(isInfix = (posLt parenLoc lidRange.End))
if isInfix then
@ -187,28 +206,20 @@ module internal NoteworthyParamInfoLocationsImpl =
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found apparent infix operator, ignoring dug-out ident from %+A" expr)
None
else
let r = FSharpNoteworthyParamInfoLocations(lid, lidRange, parenLoc, args |> List.map fst, isThereACloseParen, args |> List.map snd)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found app with ranges %+A from %+A" r expr)
Some r
| x ->
ignore(x)
None
| None, Some(cache) -> cache
Some (FSharpNoteworthyParamInfoLocations(lid, lidRange, parenLoc, args |> List.map fst, isThereACloseParen, args |> List.map snd))
| None -> None
| NotFound, Some cache -> cache
| _ -> traverseSynExpr synExpr2
// ID<tyarg1,....,tyargN> and error recovery of these
| SynExpr.TypeApp(synExpr, openm, tyArgs, commas, closemOpt, _, wholem) as seta ->
match traverseSynExpr synExpr with
| Some _ as r -> r
| None ->
let typeArgsm = mkRange openm.FileName openm.Start wholem.End
if AstTraversal.rangeContainsPosEdgesExclusive typeArgsm pos && tyArgs |> List.forall isStaticArg then
let r = FSharpNoteworthyParamInfoLocations(["dummy"], // TODO synExpr, but LongId?
synExpr.Range,
openm.Start,
[ for c in commas -> c.End
yield wholem.End ],
closemOpt.IsSome,
tyArgs |> List.map digOutIdentFromStaticArg)
let commasAndCloseParen = [ for c in commas -> c.End ] @ [ wholem.End ]
let r = FSharpNoteworthyParamInfoLocations(["dummy"], synExpr.Range, openm.Start, commasAndCloseParen, closemOpt.IsSome, tyArgs |> List.map digOutIdentFromStaticArg)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found SynExpr.TypeApp with ranges %+A from %+A" r seta)
Some r
else
@ -222,13 +233,8 @@ module internal NoteworthyParamInfoLocationsImpl =
let lidm = lidwd.Range
let betweenTheBrackets = mkRange wholem.FileName openm.Start wholem.End
if AstTraversal.rangeContainsPosEdgesExclusive betweenTheBrackets pos && args |> List.forall isStaticArg then
let r = FSharpNoteworthyParamInfoLocations(lid |> List.map textOfId, lidm, openm.Start,
[ for c in commas -> c.End
yield wholem.End ],
closemOpt.IsSome,
args |> List.map digOutIdentFromStaticArg)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found type abbrev ty-app with ranges %+A from %+A" r tyAbbrevRhs)
Some r
let commasAndCloseParen = [ for c in commas -> c.End ] @ [ wholem.End ]
Some (FSharpNoteworthyParamInfoLocations(pathOfLid lid, lidm, openm.Start, commasAndCloseParen, closemOpt.IsSome, args |> List.map digOutIdentFromStaticArg))
else
None
| _ ->
@ -241,15 +247,14 @@ module internal NoteworthyParamInfoLocationsImpl =
let inheritm = mkRange m.FileName m.Start m.End
if AstTraversal.rangeContainsPosEdgesExclusive inheritm pos then
// inherit ty(expr) --- treat it like an application (constructor call)
let xResult,_cacheOpt = astFindNoteworthyParamInfoLocationsSynExprExactParen defaultTraverse pos expr
let xResult,_cacheOpt = searchSynArgExpr defaultTraverse pos expr
match xResult with
| Some(parenLoc,args,isThereACloseParen) ->
| Found(parenLoc,args,isThereACloseParen) ->
// we found it, dig out ident
let typename = getTypeName ty
let r = FSharpNoteworthyParamInfoLocations(typename, ty.Range, parenLoc, args |> List.map fst, isThereACloseParen, args |> List.map snd)
Trace.PrintLine("LanguageServiceParamInfo", fun () -> sprintf "Found app with ranges %+A from %+A" r expr)
let typeName = getTypeName ty
let r = FSharpNoteworthyParamInfoLocations(typeName, ty.Range, parenLoc, args |> List.map fst, isThereACloseParen, args |> List.map snd)
Some r
| _ -> None
| NotFound -> None
else None
})

Просмотреть файл

@ -16,9 +16,12 @@ type internal FSharpNoteworthyParamInfoLocations =
member LongIdStartLocation : pos
member LongIdEndLocation : pos
member OpenParenLocation : pos
member TupleEndLocations : pos[] // locations of commas and close parenthesis (or, last char of last arg, if no final close parenthesis)
member IsThereACloseParen : bool // false if either this is a call without parens "f x" or the parser recovered as in "f(x,y"
member NamedParamNames : string[] // null, or a name if an actual named parameter; f(0,a=4,?b=None) would be [|null;"a";"b"|]
/// locations of commas and close parenthesis (or, last char of last arg, if no final close parenthesis)
member TupleEndLocations : pos[]
/// false if either this is a call without parens "f x" or the parser recovered as in "f(x,y"
member IsThereACloseParen : bool
/// empty or a name if an actual named parameter; f(0,a=4,?b=None) would be [|null;"a";"b"|]
member NamedParamNames : string[]
static member Find : pos * Ast.ParsedInput -> FSharpNoteworthyParamInfoLocations option

Просмотреть файл

@ -609,7 +609,7 @@ module UntypedParseImpl =
type TS = AstTraversal.TraverseStep
/// try to determine completion context for the given pair (row, columns)
/// Try to determine completion context for the given pair (row, columns)
let TryGetCompletionContext (pos, untypedParseOpt: FSharpParseFileResults option) : CompletionContext option =
let parsedInputOpt =
match untypedParseOpt with
@ -675,7 +675,7 @@ module UntypedParseImpl =
| false, false, true -> Struct
| _ -> Invalid
let getCompletionContextForInheritSynMember ((ComponentInfo(synAttributes, _, _, _,_, _, _, _)), typeDefnKind : SynTypeDefnKind, completionPath) =
let GetCompletionContextForInheritSynMember ((ComponentInfo(synAttributes, _, _, _,_, _, _, _)), typeDefnKind : SynTypeDefnKind, completionPath) =
let success k = Some (Inherit (k, completionPath))
@ -863,7 +863,7 @@ module UntypedParseImpl =
match synType with
| SynType.LongIdent lidwd ->
match parseLid lidwd with
| Some (completionPath) -> getCompletionContextForInheritSynMember (componentInfo, typeDefnKind, completionPath)
| Some (completionPath) -> GetCompletionContextForInheritSynMember (componentInfo, typeDefnKind, completionPath)
| None -> Some (CompletionContext.Invalid) // A $ .B -> no completion list
| _ -> None }
AstTraversal.Traverse(pos, pt, walker)

Просмотреть файл

@ -420,11 +420,11 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
let fsMeth = FSMeth (cenv.g, entityTy, v, None)
let item =
if fsMeth.IsConstructor then Item.CtorGroup (fsMeth.DisplayName, [fsMeth])
else Item.MethodGroup (fsMeth.DisplayName, [fsMeth])
else Item.MethodGroup (fsMeth.DisplayName, [fsMeth], None)
yield FSharpMemberOrFunctionOrValue(cenv, M fsMeth, item)
else
for minfo in GetImmediateIntrinsicMethInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy do
yield FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName,[minfo]))
yield FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName,[minfo],None))
let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
let events = cenv.infoReader.GetImmediateIntrinsicEventsOfType (None, AccessibleFromSomeFSharpCode, range0, entityTy)
for pinfo in props do
@ -1117,11 +1117,11 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
let nm = (match v with VRefNonLocal n -> n.ItemKey.PartialKey.LogicalName | _ -> "<local>")
invalidOp (sprintf "The value or member '%s' does not exist or is in an unresolved assembly." nm)
let mkMethSym minfo = FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName,[minfo]))
let mkMethSym minfo = FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName, [minfo], None))
let mkEventSym einfo = FSharpMemberOrFunctionOrValue(cenv, E einfo, Item.Event einfo)
new (cenv, vref) = FSharpMemberFunctionOrValue(cenv, V vref, Item.Value vref)
new (cenv, minfo) = FSharpMemberFunctionOrValue(cenv, M minfo, Item.MethodGroup(minfo.LogicalName, [minfo]))
new (cenv, minfo) = FSharpMemberFunctionOrValue(cenv, M minfo, Item.MethodGroup(minfo.LogicalName, [minfo], None))
member __.IsUnresolved =
isUnresolved()
@ -1137,7 +1137,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
match d with
| M m ->
match item with
| Item.MethodGroup (_name, methodInfos) ->
| Item.MethodGroup (_name, methodInfos, _) ->
let methods =
if matchParameterNumber then
methodInfos
@ -2071,7 +2071,7 @@ type FSharpSymbol with
| Item.Property(_,pinfo :: _) ->
FSharpMemberOrFunctionOrValue(cenv, P pinfo, item) :> _
| Item.MethodGroup(_,minfo :: _) ->
| Item.MethodGroup(_,minfo :: _, _) ->
FSharpMemberOrFunctionOrValue(cenv, M minfo, item) :> _
| Item.CtorGroup(_,cinfo :: _) ->
@ -2117,7 +2117,7 @@ type FSharpSymbol with
| Item.UnqualifiedType []
| Item.ModuleOrNamespaces []
| Item.Property (_,[])
| Item.MethodGroup (_,[])
| Item.MethodGroup (_,[],_)
| Item.CtorGroup (_,[])
// These cases cover misc. corned cases (non-symbol types)
| Item.Types _

Просмотреть файл

@ -143,19 +143,77 @@ module internal Params =
(args,argsL) ||> List.zip |> List.map mkParam
#if EXTENSIONTYPING
let (|ItemIsTypeWithStaticArguments|_|) g item =
let (|ItemIsProvidedType|_|) g item =
match item with
| Item.Types(_name,tys) ->
match tys with
| [Microsoft.FSharp.Compiler.Tastops.AppTy g (tyconRef,_typeInst)] ->
| [AppTy g (tyconRef,_typeInst)] ->
if tyconRef.IsProvidedErasedTycon || tyconRef.IsProvidedGeneratedTycon then
Some tyconRef
else
None
| _ -> None
| _ -> None
let (|ItemIsProvidedTypeWithStaticArguments|_|) m g item =
match item with
| Item.Types(_name,tys) ->
match tys with
| [AppTy g (tyconRef,_typeInst)] ->
if tyconRef.IsProvidedErasedTycon || tyconRef.IsProvidedGeneratedTycon then
let typeBeforeArguments =
match tyconRef.TypeReprInfo with
| TProvidedTypeExtensionPoint info -> info.ProvidedType
| _ -> failwith "unreachable"
let staticParameters = typeBeforeArguments.PApplyWithProvider((fun (typeBeforeArguments,provider) -> typeBeforeArguments.GetStaticParameters(provider)), range=m)
let staticParameters = staticParameters.PApplyArray(id, "GetStaticParameters",m)
Some staticParameters
else
None
| _ -> None
| _ -> None
let (|ItemIsProvidedMethodWithStaticArguments|_|) item =
match item with
// Prefer the static parameters from the uninstantiated method info
| Item.MethodGroup(_,_,Some minfo) ->
match minfo.ProvidedStaticParameterInfo with
| Some (_,staticParameters) -> Some staticParameters
| _ -> None
| Item.MethodGroup(_,[minfo],_) ->
match minfo.ProvidedStaticParameterInfo with
| Some (_,staticParameters) -> Some staticParameters
| _ -> None
| _ -> None
let (|ItemIsWithStaticArguments|_|) m g item =
match item with
| ItemIsProvidedTypeWithStaticArguments m g staticParameters -> Some staticParameters
| ItemIsProvidedMethodWithStaticArguments staticParameters -> Some staticParameters
| _ -> None
#endif
let StaticParamsOfItem (infoReader:InfoReader) m denv d =
let amap = infoReader.amap
let g = infoReader.g
match d with
#if EXTENSIONTYPING
| ItemIsWithStaticArguments m g staticParameters ->
staticParameters
|> Array.map (fun sp ->
let typ = Import.ImportProvidedType amap m (sp.PApply((fun x -> x.ParameterType),m))
let spKind = NicePrint.stringOfTy denv typ
let spName = sp.PUntaint((fun sp -> sp.Name), m)
let spOpt = sp.PUntaint((fun sp -> sp.IsOptional), m)
FSharpMethodGroupItemParameter(
name = spName,
canonicalTypeTextForSorting = spKind,
display = sprintf "%s%s: %s" (if spOpt then "?" else "") spName spKind))
#endif
| _ -> [| |]
let rec ParamsOfItem (infoReader:InfoReader) m denv d =
let amap = infoReader.amap
let g = infoReader.g
@ -207,7 +265,7 @@ module internal Params =
let rty = pinfo.GetPropertyType(amap,m)
ParamsOfParamDatas g denv paramDatas rty
| Item.CtorGroup(_,(minfo :: _))
| Item.MethodGroup(_,(minfo :: _)) ->
| Item.MethodGroup(_,(minfo :: _),_) ->
let paramDatas = minfo.GetParamDatas(amap, m, minfo.FormalMethodInst) |> List.head
let rty = minfo.GetFSharpReturnTy(amap, m, minfo.FormalMethodInst)
ParamsOfParamDatas g denv paramDatas rty
@ -229,39 +287,19 @@ module internal Params =
| Item.DelegateCtor delty ->
let (SigOfFunctionForDelegate(_, _, _, fty)) = GetSigOfFunctionForDelegate infoReader delty m AccessibleFromSomeFSharpCode
ParamsOfParamDatas g denv [ParamData(false, false, NotOptional, None, ReflectedArgInfo.None, fty)] delty
#if EXTENSIONTYPING
| ItemIsTypeWithStaticArguments g tyconRef ->
// similar code to TcProvidedTypeAppToStaticConstantArgs
let typeBeforeArguments =
match tyconRef.TypeReprInfo with
| TProvidedTypeExtensionPoint info -> info.ProvidedType
| _ -> failwith "unreachable"
let staticParameters = typeBeforeArguments.PApplyWithProvider((fun (typeBeforeArguments,provider) -> typeBeforeArguments.GetStaticParameters(provider)), range=m)
let staticParameters = staticParameters.PApplyArray(id, "GetStaticParameters",m)
staticParameters
|> Array.map (fun sp ->
let typ = Import.ImportProvidedType amap m (sp.PApply((fun x -> x.ParameterType),m))
let spKind = NicePrint.stringOfTy denv typ
let spName = sp.PUntaint((fun sp -> sp.Name), m)
let spOpt = sp.PUntaint((fun sp -> sp.IsOptional), m)
FSharpMethodGroupItemParameter(
name = spName,
canonicalTypeTextForSorting = spKind,
display = sprintf "%s%s: %s" (if spOpt then "?" else "") spName spKind))
|> Array.toList
#endif
| _ -> []
/// A single method for Intellisense completion
[<Sealed; NoEquality; NoComparison>]
// Note: instances of this type do not hold any references to any compiler resources.
type FSharpMethodGroupItem(description: FSharpToolTipText, typeText: string, parameters: FSharpMethodGroupItemParameter[], isStaticArguments: bool) =
type FSharpMethodGroupItem(description: FSharpToolTipText, typeText: string, parameters: FSharpMethodGroupItemParameter[], hasParameters: bool, staticParameters: FSharpMethodGroupItemParameter[]) =
member __.Description = description
member __.TypeText = typeText
member __.Parameters = parameters
// is this not really a method, but actually a static arguments list, like TP<42,"foo"> ?
member __.IsStaticArguments = isStaticArguments
member __.HasParameters = hasParameters
// Does the type name or method support a static arguments list, like TP<42,"foo"> or conn.CreateCommand<42, "foo">(arg1, arg2)?
member __.StaticParameters = staticParameters
/// A table of methods for Intellisense completion
@ -282,7 +320,7 @@ type FSharpMethodGroup( name: string, unsortedMethods: FSharpMethodGroupItem[] )
|> Array.map (fun meth ->
let parms = meth.Parameters
if parms.Length = 1 && parms.[0].CanonicalTypeTextForSorting="Microsoft.FSharp.Core.Unit" then
FSharpMethodGroupItem(meth.Description,meth.TypeText,[||],meth.IsStaticArguments)
FSharpMethodGroupItem(meth.Description,meth.TypeText,[||],true,meth.StaticParameters)
else
meth)
// Fix the order of methods, to be stable for unit testing.
@ -304,7 +342,6 @@ type FSharpMethodGroup( name: string, unsortedMethods: FSharpMethodGroupItem[] )
#endif
let items =
match item with
| Item.MethodGroup(nm,minfos) -> List.map (fun minfo -> Item.MethodGroup(nm,[minfo])) minfos
| Item.CtorGroup(nm,cinfos) -> List.map (fun minfo -> Item.CtorGroup(nm,[minfo])) cinfos
| Item.FakeInterfaceCtor _
| Item.DelegateCtor _ -> [item]
@ -323,8 +360,9 @@ type FSharpMethodGroup( name: string, unsortedMethods: FSharpMethodGroupItem[] )
let pinfo = List.head pinfos
if pinfo.IsIndexer then [item] else []
#if EXTENSIONTYPING
| Params.ItemIsTypeWithStaticArguments g _ -> [item] // we pretend that provided-types-with-static-args are method-like in order to get ParamInfo for them
| Params.ItemIsWithStaticArguments m g _ -> [item] // we pretend that provided-types-with-static-args are method-like in order to get ParamInfo for them
#endif
| Item.MethodGroup(nm,minfos,orig) -> minfos |> List.map (fun minfo -> Item.MethodGroup(nm,[minfo],orig))
| Item.CustomOperation(_name, _helpText, _minfo) -> [item]
| Item.TypeVar _ -> []
| Item.CustomBuilder _ -> []
@ -333,10 +371,11 @@ type FSharpMethodGroup( name: string, unsortedMethods: FSharpMethodGroupItem[] )
let methods =
items |> Array.ofList |> Array.map (fun item ->
FSharpMethodGroupItem(
description=FSharpToolTipText [FormatDescriptionOfItem true infoReader m denv item],
typeText= (FormatReturnTypeOfItem infoReader m denv item),
parameters = Array.ofList (Params.ParamsOfItem infoReader m denv item),
isStaticArguments = (match item with | Item.Types _ -> true | _ -> false)
description = FSharpToolTipText [FormatDescriptionOfItem true infoReader m denv item],
typeText = FormatReturnTypeOfItem infoReader m denv item,
parameters = (Params.ParamsOfItem infoReader m denv item |> Array.ofList),
hasParameters = (match item with Params.ItemIsProvidedTypeWithStaticArguments m g _ -> false | _ -> true),
staticParameters = Params.StaticParamsOfItem infoReader m denv item
))
#if FX_ATLEAST_40
methodOverloadsCache.Add(item, methods)
@ -539,8 +578,11 @@ type TypeCheckInfo
Trace.PrintLine("CompilerServicesVerbose", fun () -> sprintf "GetPreciseItemsFromNameResolution: endOfNamesPos = %s\n" (stringOfPos endOfNamesPos))
let quals =
(match resolveOverloads with ResolveOverloads.Yes -> sResolutions.CapturedNameResolutions | ResolveOverloads.No -> sResolutions.CapturedMethodGroupResolutions)
|> ResizeArray.filter (fun cnr -> posEq cnr.Pos endOfNamesPos)
match resolveOverloads with
| ResolveOverloads.Yes -> sResolutions.CapturedNameResolutions
| ResolveOverloads.No -> sResolutions.CapturedMethodGroupResolutions
let quals = quals |> ResizeArray.filter (fun cnr -> posEq cnr.Pos endOfNamesPos)
quals
@ -623,7 +665,7 @@ type TypeCheckInfo
let props = ResolveCompletionsInType ncenv nenv ResolveCompletionTargets.SettablePropertiesAndFields m ad false ctor.EnclosingType
let parameters = CollectParameters ctors amap m
Some (denv, m, props @ parameters)
| CNR(_, Item.MethodGroup(_, methods), _, denv, nenv, ad, m)::_ ->
| CNR(_, Item.MethodGroup(_, methods, _), _, denv, nenv, ad, m)::_ ->
let props =
methods
|> List.collect (fun meth ->
@ -728,7 +770,7 @@ type TypeCheckInfo
else GetPreciseCompletionListFromExprTypingsResult.None
/// Find items in the best naming environment.
let GetEnvironmentLookupResolutions(cursorPos,plid,filterCtors,showObsolete) =
let GetEnvironmentLookupResolutions(cursorPos, plid, filterCtors, showObsolete) =
let (nenv,ad),m = GetBestEnvForPos cursorPos
let items = NameResolution.ResolvePartialLongIdent ncenv nenv (ConstraintSolver.IsApplicableMethApprox g amap m) m ad plid showObsolete
let items = items |> RemoveDuplicateItems g
@ -753,75 +795,68 @@ type TypeCheckInfo
//
// The overall aim is to resolve as accurately as possible based on what we know from type inference
let GetDeclItemsForNamesAtPosition(parseResultsOpt : FSharpParseFileResults option,
origLongIdentOpt: string list option, residueOpt:string option, line:int, lineStr:string, colAtEndOfNamesAndResidue, filterCtors, resolveOverloads, hasTextChangedSinceLastTypecheck: (obj * range -> bool)) =
let GetBaseClassCandidates = function
| Item.ModuleOrNamespaces _ -> true
| Item.Types(_, ty::_) when (isClassTy g ty) && not (isSealedTy g ty) -> true
| _ -> false
let GetBaseClassCandidates (denv : DisplayEnv) = function
| Item.ModuleOrNamespaces _ -> true
| Item.Types(_, ty::_) when (isClassTy denv.g ty) && not (isSealedTy denv.g ty) -> true
| _ -> false
let GetInterfaceCandidates = function
| Item.ModuleOrNamespaces _ -> true
| Item.Types(_, ty::_) when (isInterfaceTy g ty) -> true
| _ -> false
let GetInterfaceCandidates (denv : DisplayEnv) = function
| Item.ModuleOrNamespaces _ -> true
| Item.Types(_, ty::_) when (isInterfaceTy denv.g ty) -> true
| _ -> false
/// Post-filter items to make sure they have precisely the right name
/// This also checks that there are some remaining results
/// exactMatchResidue = Some _ -- means that we are looking for exact matches
let FilterRelevantItemsBy (exactMatchResidue : _ option) f (items, denv, m) =
// Return only items with the specified name
let FilterDeclItemsByResidue residue (items: Item list) =
items |> List.filter (fun item ->
let n1 = item.DisplayName
match item with
| Item.Types _ | Item.CtorGroup _ -> residue + "Attribute" = n1 || residue = n1
| _ -> residue = n1 )
// can throw if type is in located in non-resolved CCU: i.e. bigint if reference to System.Numerics is absent
let f denv item = try f denv item with _ -> false
/// Post-filter items to make sure they have precisely the right name
/// This also checks that there are some remaining results
/// exactMatchResidueOpt = Some _ -- means that we are looking for exact matches
let FilterRelevantItemsBy (exactMatchResidueOpt : _ option) check (items, denv, m) =
// can throw if type is in located in non-resolved CCU: i.e. bigint if reference to System.Numerics is absent
let safeCheck item = try check item with _ -> false
// Return only items with the specified name
let filterDeclItemsByResidue residue (items: Item list) =
items |> List.filter (fun item ->
let n1 = item.DisplayName
if not (f denv item) then false
else
match item with
| Item.Types _ | Item.CtorGroup _ -> residue + "Attribute" = n1 || residue = n1
| _ -> residue = n1 )
// Are we looking for items with precisely the given name?
if nonNil items && exactMatchResidue.IsSome then
let items = items |> filterDeclItemsByResidue exactMatchResidue.Value
if nonNil items then Some(items,denv,m) else None
else
// When (items = []) we must returns Some([],..) and not None
// because this value is used if we want to stop further processing (e.g. let x.$ = ...)
let items = List.filter (f denv) items
Some(items, denv, m)
// Are we looking for items with precisely the given name?
if nonNil items && exactMatchResidueOpt.IsSome then
let items = items |> FilterDeclItemsByResidue exactMatchResidueOpt.Value |> List.filter safeCheck
if nonNil items then Some(items, denv, m) else None
else
// When (items = []) we must returns Some([],..) and not None
// because this value is used if we want to stop further processing (e.g. let x.$ = ...)
let items = items |> List.filter safeCheck
Some(items, denv, m)
let loc =
match colAtEndOfNamesAndResidue with
| pastEndOfLine when pastEndOfLine >= lineStr.Length -> lineStr.Length
| atDot when lineStr.[atDot] = '.' -> atDot + 1
| atStart when atStart = 0 -> 0
| otherwise -> otherwise - 1
/// Post-filter items to make sure they have precisely the right name
/// This also checks that there are some remaining results
let (|FilterRelevantItems|_|) exactMatchResidueOpt orig =
FilterRelevantItemsBy exactMatchResidueOpt (fun _ -> true) orig
let FindInEnv(plid, showObsolete) = GetEnvironmentLookupResolutions(mkPos line loc,plid,filterCtors, showObsolete)
let FindRecordFieldsInEnv(plid, residue) = GetClassOrRecordFieldsEnvironmentLookupResolutions(mkPos line loc, plid, residue)
let getDeclaredItems isInRangeOperator =
let findFirstNonWsPos i =
if i >= lineStr.Length then None
else
let mutable p = i
while p >= 0 && System.Char.IsWhiteSpace(lineStr.[p]) do
p <- p - 1
if p >= 0 then Some p else None
/// Find the first non-whitespace postion in a line prior to the given character
let FindFirstNonWhitespacePosition (lineStr: string) i =
if i >= lineStr.Length then None
else
let mutable p = i
while p >= 0 && System.Char.IsWhiteSpace(lineStr.[p]) do
p <- p - 1
if p >= 0 then Some p else None
// are last two chars (except whitespaces) = ".."
let GetDeclaredItems (parseResultsOpt: FSharpParseFileResults option, lineStr: string, origLongIdentOpt, colAtEndOfNamesAndResidue, residueOpt, line, loc, filterCtors,resolveOverloads, hasTextChangedSinceLastTypecheck, isInRangeOperator) =
// Are the last two chars (except whitespaces) = ".."
let isLikeRangeOp =
match findFirstNonWsPos (colAtEndOfNamesAndResidue - 1) with
match FindFirstNonWhitespacePosition lineStr (colAtEndOfNamesAndResidue - 1) with
| Some x when x >= 1 && lineStr.[x] = '.' && lineStr.[x - 1] = '.' -> true
| _ -> false
// if last two chars are .. and we are not in range operator context - no completion
if isLikeRangeOp && not isInRangeOperator then None
else
if isLikeRangeOp && not isInRangeOperator then None else
// Try to use the exact results of name resolution during type checking to generate the results
// This is based on position (i.e. colAtEndOfNamesAndResidue). This is not used if a residueOpt is given.
@ -838,9 +873,9 @@ type TypeCheckInfo
// TODO: this code would be a lot simpler if we just passed in colAtEndOfNames in
// the first place. colAtEndOfNamesAndResidue serves no purpose. The cracking below is
// inaccurate and incomplete in any case since it only works on a single line.
match findFirstNonWsPos (colAtEndOfNamesAndResidue - 1) with
match FindFirstNonWhitespacePosition lineStr (colAtEndOfNamesAndResidue - 1) with
| Some p when lineStr.[p] = '.' ->
match findFirstNonWsPos (p - 1) with
match FindFirstNonWhitespacePosition lineStr (p - 1) with
| Some colAtEndOfNames ->
let colAtEndOfNames = colAtEndOfNames + 1 // convert 0-based to 1-based
GetPreciseItemsFromNameResolution(line, colAtEndOfNames, Some(residue), filterCtors,resolveOverloads, hasTextChangedSinceLastTypecheck)
@ -859,15 +894,10 @@ type TypeCheckInfo
let plid, residue = List.frontAndBack origLongIdent
plid, Some residue
/// Post-filter items to make sure they have precisely the right name
/// This also checks that there are some remaining results
let (|FilterRelevantItems|_|) orig =
FilterRelevantItemsBy exactMatchResidueOpt (fun _ _ -> true) orig
match nameResItems with
| NameResResult.TypecheckStaleAndTextChanged -> None // second-chance intellisense will try again
| NameResResult.Cancel(denv,m) -> Some([], denv, m)
| NameResResult.Members(FilterRelevantItems(items)) ->
| NameResResult.Members(FilterRelevantItems exactMatchResidueOpt items) ->
Trace.PrintLine("CompilerServices", fun _ -> sprintf "GetDeclItemsForNamesAtPosition: lookup based on name resolution results successful, #items = %d, exists ctor = %b\n" (p13 items).Length (items |> p13 |> List.exists (function Item.CtorGroup _ -> true | _ -> false)))
Some items
| _ ->
@ -878,8 +908,7 @@ type TypeCheckInfo
Trace.PrintLine("CompilerServices", fun _ -> sprintf "GetDeclItemsForNamesAtPosition: plid = %+A, residue = %+A, colAtEndOfNamesAndResidue = %+A\n" plid exactMatchResidueOpt colAtEndOfNamesAndResidue)
// Try to use the type of the expression on the left to help generate a completion list
let mutable thereIsADotInvolved = false
let qualItems =
let qualItems, thereIsADotInvolved =
match parseResultsOpt with
| None ->
// Note, you will get here if the 'reason' is not CompleteWord/MemberSelect/DisplayMemberList, as those are currently the
@ -887,26 +916,20 @@ type TypeCheckInfo
// if you do QuickInfo hovering over A in "f(x).A()", you will only get a tip if typechecking has a name-resolution recorded
// for A, not if merely we know the capturedExpressionTyping of f(x) and you very recently typed ".A()" - in that case,
// you won't won't get a tip until the typechecking catches back up.
GetPreciseCompletionListFromExprTypingsResult.None
| Some(upi) ->
GetPreciseCompletionListFromExprTypingsResult.None, false
| Some parseResults ->
// See ServiceUntypedParse - GetRangeOfExprLeftOfDot and TryFindExpressionASTLeftOfDotLeftOfCursor are similar, but different, can we refactor commonality?
// match UntypedParseImpl.GetRangeOfExprLeftOfDot(line,colAtEndOfNamesAndResidue,upi.ParseTree) with
// | Some((_,_),(el,ec)) ->
// thereIsADotInvolved <- true
// GetPreciseCompletionListFromExprTypings(upi, el-1, ec, filterCtors)
match UntypedParseImpl.TryFindExpressionASTLeftOfDotLeftOfCursor(mkPos line colAtEndOfNamesAndResidue,upi.ParseTree) with
match UntypedParseImpl.TryFindExpressionASTLeftOfDotLeftOfCursor(mkPos line colAtEndOfNamesAndResidue,parseResults.ParseTree) with
| Some(pos,_) ->
thereIsADotInvolved <- true
GetPreciseCompletionListFromExprTypings(upi, pos, filterCtors, hasTextChangedSinceLastTypecheck)
GetPreciseCompletionListFromExprTypings(parseResults, pos, filterCtors, hasTextChangedSinceLastTypecheck), true
| None ->
// Can get here in a case like: if "f xxx yyy" is legal, and we do "f xxx y"
// We have no interest in expression typings, those are only useful for dot-completion. We want to fallback
// to "Use an environment lookup as the last resort" below
GetPreciseCompletionListFromExprTypingsResult.None
GetPreciseCompletionListFromExprTypingsResult.None, false
match qualItems,thereIsADotInvolved with
| GetPreciseCompletionListFromExprTypingsResult.Some(FilterRelevantItems(items)), _
| GetPreciseCompletionListFromExprTypingsResult.Some(FilterRelevantItems exactMatchResidueOpt items), _
// Initially we only use the expression typings when looking up, e.g. (expr).Nam or (expr).Name1.Nam
// These come through as an empty plid and residue "". Otherwise we try an environment lookup
// and then return to the qualItems. This is because the expression typings are a little inaccurate, primarily because
@ -927,9 +950,9 @@ type TypeCheckInfo
// Second-chance intellisense will bring up the correct list in a moment.
None
| _ ->
// Use an environment lookup as the last resort
let envItems = FindInEnv(plid, residueOpt.IsSome)
// Use an environment lookup as the last resort
let envItems = GetEnvironmentLookupResolutions(mkPos line loc, plid, filterCtors, residueOpt.IsSome)
match nameResItems, envItems, qualItems with
// First, use unfiltered name resolution items, if they're not empty
@ -939,43 +962,71 @@ type TypeCheckInfo
// If we have nonempty items from environment that were resolved from a type, then use them...
// (that's better than the next case - here we'd return 'int' as a type)
| _, FilterRelevantItems(items, denv, m), _ when nonNil items ->
| _, FilterRelevantItems exactMatchResidueOpt (items, denv, m), _ when nonNil items ->
Trace.PrintLine("CompilerServices", fun _ -> sprintf "GetDeclItemsForNamesAtPosition: lookup based on name and environment successful\n")
Some(items, denv, m)
// Try again with the qualItems
| _, _, GetPreciseCompletionListFromExprTypingsResult.Some(FilterRelevantItems(items)) ->
| _, _, GetPreciseCompletionListFromExprTypingsResult.Some(FilterRelevantItems exactMatchResidueOpt items) ->
Some(items)
| _ -> None
/// Get the auto-complete items at a particular location.
let GetDeclItemsForNamesAtPosition(parseResultsOpt: FSharpParseFileResults option, origLongIdentOpt: string list option, residueOpt:string option, line:int, lineStr:string, colAtEndOfNamesAndResidue, filterCtors, resolveOverloads, hasTextChangedSinceLastTypecheck: (obj * range -> bool)) =
let loc =
match colAtEndOfNamesAndResidue with
| pastEndOfLine when pastEndOfLine >= lineStr.Length -> lineStr.Length
| atDot when lineStr.[atDot] = '.' -> atDot + 1
| atStart when atStart = 0 -> 0
| otherwise -> otherwise - 1
// Look for a "special" completion context
match UntypedParseImpl.TryGetCompletionContext(mkPos line colAtEndOfNamesAndResidue, parseResultsOpt) with
// Invalid completion locations
| Some CompletionContext.Invalid -> None
// Completion at 'inherit C(...)"
| Some (CompletionContext.Inherit(InheritanceContext.Class, (plid, _))) ->
FindInEnv(plid, false)
GetEnvironmentLookupResolutions(mkPos line loc, plid, filterCtors, false)
|> FilterRelevantItemsBy None GetBaseClassCandidates
// Completion at 'interface ..."
| Some (CompletionContext.Inherit(InheritanceContext.Interface, (plid, _))) ->
FindInEnv(plid, false)
GetEnvironmentLookupResolutions(mkPos line loc, plid, filterCtors, false)
|> FilterRelevantItemsBy None GetInterfaceCandidates
// Completion at 'implement ..."
| Some (CompletionContext.Inherit(InheritanceContext.Unknown, (plid, _))) ->
FindInEnv(plid, false)
|> FilterRelevantItemsBy None (fun denv t -> (GetBaseClassCandidates denv t) || (GetInterfaceCandidates denv t))
GetEnvironmentLookupResolutions(mkPos line loc, plid, filterCtors, false)
|> FilterRelevantItemsBy None (fun t -> GetBaseClassCandidates t || GetInterfaceCandidates t)
// Completion at ' { XXX = ... } "
| Some(CompletionContext.RecordField(RecordContext.New(plid, residue))) ->
FindRecordFieldsInEnv(plid, residue)
GetClassOrRecordFieldsEnvironmentLookupResolutions(mkPos line loc, plid, residue)
|> Some
// Completion at ' { XXX = ... with ... } "
| Some(CompletionContext.RecordField(RecordContext.CopyOnUpdate(r, (plid, residue)))) ->
match GetRecdFieldsForExpr(r) with
| None ->
FindRecordFieldsInEnv(plid, residue)
GetClassOrRecordFieldsEnvironmentLookupResolutions(mkPos line loc, plid, residue)
|> Some
| x -> x
// Completion at ' { XXX = ... with ... } "
| Some(CompletionContext.RecordField(RecordContext.Constructor(typeName))) ->
FindRecordFieldsInEnv([typeName], None)
GetClassOrRecordFieldsEnvironmentLookupResolutions(mkPos line loc, [typeName], None)
|> Some
// Completion at ' SomeMethod( ... ) ' with named arguments
| Some(CompletionContext.ParameterList (endPos, fields)) ->
let results = GetNamedParametersAndSettableFields endPos hasTextChangedSinceLastTypecheck
let declaredItems = getDeclaredItems false
let declaredItems = GetDeclaredItems (parseResultsOpt, lineStr, origLongIdentOpt, colAtEndOfNamesAndResidue, residueOpt, line, loc, filterCtors, resolveOverloads, hasTextChangedSinceLastTypecheck, false)
match results with
| NameResResult.Members(items, denv, m) ->
@ -988,178 +1039,56 @@ type TypeCheckInfo
| None -> Some (items, denv, m)
| Some (declItems, declaredDisplayEnv, declaredRange) -> Some (filtered @ declItems, declaredDisplayEnv, declaredRange)
| _ -> declaredItems
// Other completions
| cc ->
#if OLD
let isInRangeOperator = (match cc with Some (CompletionContext.RangeOperator) -> true | _ -> false)
let declaredItems = GetDeclaredItems (parseResultsOpt, lineStr, origLongIdentOpt, colAtEndOfNamesAndResidue, residueOpt, line, loc, filterCtors,resolveOverloads, hasTextChangedSinceLastTypecheck, isInRangeOperator)
declaredItems
// are last two chars (except whitespaces) = ".."
let isLikeRangeOp =
match findFirstNonWsPos (colAtEndOfNamesAndResidue - 1) with
| Some x when x >= 1 && lineStr.[x] = '.' && lineStr.[x - 1] = '.' -> true
| _ -> false
// if last two chars are .. and we are not in range operator context - no completion
if isLikeRangeOp && not (cc = Some (CompletionContext.RangeOperator)) then None
else
// Try to use the exact results of name resolution during type checking to generate the results
// This is based on position (i.e. colAtEndOfNamesAndResidue).
let nameResItems =
match residueOpt with
| None -> GetPreciseItemsFromNameResolution(line, colAtEndOfNamesAndResidue, None, filterCtors,resolveOverloads, hasTextChangedSinceLastTypecheck)
| Some residue ->
// deals with cases when we have spaces between dot and\or identifier, like A . $
// if this is our case - then wen need to locate end position of the name skipping whitespaces
// this allows us to handle cases like: let x . $ = 1
// colAtEndOfNamesAndResidue is 1-based so at first we need to convert it to 0-based
//
// TODO: this code would be a lot simpler if we just passed in colAtEndOfNames in
// the first place. colAtEndOfNamesAndResidue serves no purpose. The cracking below is
// inaccurate and incomplete in any case since it only works on a single line.
match findFirstNonWsPos (colAtEndOfNamesAndResidue - 1) with
| Some p when lineStr.[p] = '.' ->
match findFirstNonWsPos (p - 1) with
| Some colAtEndOfNames ->
let colAtEndOfNames = colAtEndOfNames + 1 // convert 0-based to 1-based
GetPreciseItemsFromNameResolution(line, colAtEndOfNames, Some(residue), filterCtors,resolveOverloads, hasTextChangedSinceLastTypecheck)
| None -> NameResResult.Empty
| _ -> NameResResult.Empty
// Normalize to form A.B.C.D where D is the residue. It may be empty for "A.B.C."
// residueOpt = Some when we are looking for the exact match
let plid, exactMatchResidueOpt =
match origLongIdentOpt, residueOpt with
| None, _ -> [], None
| Some(origLongIdent), Some _ -> origLongIdent, None
| Some(origLongIdent), None ->
assert (nonNil origLongIdent)
// note: as above, this happens when we are called for "precise" resolution - (F1 keyword, data tip etc..)
let plid, residue = List.frontAndBack origLongIdent
plid, Some residue
/// Post-filter items to make sure they have precisely the right name
/// This also checks that there are some remaining results
let (|FilterRelevantItems|_|) orig =
FilterRelevantItemsBy exactMatchResidueOpt (fun _ _ -> true) orig
match nameResItems with
| NameResResult.TypecheckStaleAndTextChanged -> None // second-chance intellisense will try again
| NameResResult.Cancel(denv,m) -> Some([], denv, m)
| NameResResult.Members(FilterRelevantItems(items)) ->
Some items
| _ ->
match origLongIdentOpt with
| None -> None
| Some _ ->
// Try to use the type of the expression on the left to help generate a completion list
let mutable thereIsADotInvolved = false
let qualItems =
match parseResultsOpt with
| None ->
// Note, you will get here if the 'reason' is not CompleteWord/MemberSelect/DisplayMemberList, as those are currently the
// only reasons we do a sync parse to have the most precise and likely-to-be-correct-and-up-to-date info. So for example,
// if you do QuickInfo hovering over A in "f(x).A()", you will only get a tip if typechecking has a name-resolution recorded
// for A, not if merely we know the capturedExpressionTyping of f(x) and you very recently typed ".A()" - in that case,
// you won't won't get a tip until the typechecking catches back up.
GetPreciseCompletionListFromExprTypingsResult.None
| Some(upi) ->
// See ServiceUntypedParse - GetRangeOfExprLeftOfDot and TryFindExpressionASTLeftOfDotLeftOfCursor are similar, but different, can we refactor commonality?
// match UntypedParseImpl.GetRangeOfExprLeftOfDot(line,colAtEndOfNamesAndResidue,upi.ParseTree) with
// | Some((_,_),(el,ec)) ->
// thereIsADotInvolved <- true
// GetPreciseCompletionListFromExprTypings(upi, el-1, ec, filterCtors)
match UntypedParseImpl.TryFindExpressionASTLeftOfDotLeftOfCursor(mkPos line colAtEndOfNamesAndResidue,upi.ParseTree) with
| Some(pos,_) ->
thereIsADotInvolved <- true
GetPreciseCompletionListFromExprTypings(upi, pos, filterCtors, hasTextChangedSinceLastTypecheck)
| None ->
// Can get here in a case like: if "f xxx yyy" is legal, and we do "f xxx y"
// We have no interest in expression typings, those are only useful for dot-completion. We want to fallback
// to "Use an environment lookup as the last resort" below
GetPreciseCompletionListFromExprTypingsResult.None
match qualItems,thereIsADotInvolved with
| GetPreciseCompletionListFromExprTypingsResult.Some(FilterRelevantItems(items)), _
// Initially we only use the expression typings when looking up, e.g. (expr).Nam or (expr).Name1.Nam
// These come through as an empty plid and residue "". Otherwise we try an environment lookup
// and then return to the qualItems. This is because the expression typings are a little inaccurate, primarily because
// it appears we're getting some typings recorded for non-atomic expressions like "f x"
when (match plid with [] -> true | _ -> false) ->
Some items
| GetPreciseCompletionListFromExprTypingsResult.NoneBecauseThereWereTypeErrors, _ ->
// There was an error, e.g. we have "<expr>." and there is an error determining the type of <expr>
// In this case, we don't want any of the fallback logic, rather, we want to produce zero results.
None
| GetPreciseCompletionListFromExprTypingsResult.NoneBecauseTypecheckIsStaleAndTextChanged, _ ->
// we want to report no result and let second-chance intellisense kick in
None
| _, true when (match plid with [] -> true | _ -> false) ->
// If the user just pressed '.' after an _expression_ (not a plid), it is never right to show environment-lookup top-level completions.
// The user might by typing quickly, and the LS didn't have an expression type right before the dot yet.
// Second-chance intellisense will bring up the correct list in a moment.
None
| _ ->
// Use an environment lookup as the last resort
let envItems = FindInEnv(plid, residueOpt.IsSome)
match nameResItems, envItems, qualItems with
// First, use unfiltered name resolution items, if they're not empty
| NameResResult.Members(items, denv, m), _, _ when nonNil items ->
Some(items, denv, m)
// If we have nonempty items from environment that were resolved from a type, then use them...
// (that's better than the next case - here we'd return 'int' as a type)
| _, FilterRelevantItems(items, denv, m), _ when nonNil items ->
Some(items, denv, m)
// Try again with the qualItems
| _, _, GetPreciseCompletionListFromExprTypingsResult.Some(FilterRelevantItems(items)) ->
Some(items)
| _ -> None
#endif
getDeclaredItems (match cc with Some (CompletionContext.RangeOperator) -> true | _ -> false)
// Return 'false' if this is not a completion item valid in an interface file.
/// Return 'false' if this is not a completion item valid in an interface file.
let IsValidSignatureFileItem item =
match item with
| Item.Types _ | Item.ModuleOrNamespaces _ -> true
| _ -> false
let filterIntellisenseCompletionsBasedOnParseContext parseResultsOpt (pos:pos) items =
match parseResultsOpt with
| None -> items
| Some t ->
// visitor to see if we are in an "open" declaration in the parse tree
let visitor = { new AstTraversal.AstVisitorBase<int>() with
override this.VisitExpr(_path, _traverseSynExpr, defaultTraverse, expr) = None // don't need to keep going, 'open' declarations never appear inside Exprs
override this.VisitModuleDecl(defaultTraverse, decl) =
match decl with
| SynModuleDecl.Open(_longIdent, m) ->
// in theory, this means we're "in an open"
// in practice, because the parse tree/walkers do not handle attributes well yet, need extra check below to ensure not e.g. $here$
// open System
// [<Attr$
// let f() = ()
// inside an attribute on the next item
let pos = mkPos pos.Line (pos.Column - 1) // -1 because for e.g. "open System." the dot does not show up in the parse tree
if rangeContainsPos m pos then
Some 0
else
None
| _ -> defaultTraverse decl }
match AstTraversal.Traverse(pos, t, visitor) with
| None -> items
| Some _ ->
items |> List.filter (function | Item.ModuleOrNamespaces _ -> true | _ -> false)
/// Check if we are at an "open" declaration
let IsAtOpenDeclaration (parseResults, pos: pos) =
// visitor to see if we are in an "open" declaration in the parse tree
let visitor = { new AstTraversal.AstVisitorBase<bool>() with
override this.VisitExpr(_path, _traverseSynExpr, defaultTraverse, expr) = None // don't need to keep going, 'open' declarations never appear inside Exprs
override this.VisitModuleDecl(defaultTraverse, decl) =
match decl with
| SynModuleDecl.Open(_longIdent, m) ->
// in theory, this means we're "in an open"
// in practice, because the parse tree/walkers do not handle attributes well yet, need extra check below to ensure not e.g. $here$
// open System
// [<Attr$
// let f() = ()
// inside an attribute on the next item
let pos = mkPos pos.Line (pos.Column - 1) // -1 because for e.g. "open System." the dot does not show up in the parse tree
if rangeContainsPos m pos then
Some true
else
None
| _ -> defaultTraverse decl }
match AstTraversal.Traverse(pos, parseResults, visitor) with
| None -> false
| Some res -> res
member x.GetDeclarations (parseResultsOpt:FSharpParseFileResults option, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck) =
/// If an AST is available, then determine if we are at a "special" position in the AST such as an "open". If so restrict
/// or augment the autocompletes available at that point.
let FilterAutoCompletesBasedOnParseContext (parseResultsOpt: FSharpParseFileResults option) (pos:pos) items =
match parseResultsOpt |> Option.bind (fun parseResults -> parseResults.ParseTree) with
| None -> items
| Some parseTree ->
if IsAtOpenDeclaration (parseTree, pos) then
items |> List.filter (function Item.ModuleOrNamespaces _ -> true | _ -> false)
else
items
/// Get the auto-complete items at a location
member x.GetDeclarations (parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck) =
let isInterfaceFile = SourceFileImpl.IsInterfaceFile mainInputFileName
ErrorScope.Protect
Range.range0
@ -1167,12 +1096,13 @@ type TypeCheckInfo
match GetDeclItemsForNamesAtPosition(parseResultsOpt, Some qualifyingNames, Some partialName, line, lineStr, colAtEndOfNamesAndResidue, ResolveTypeNamesToCtors, ResolveOverloads.Yes, hasTextChangedSinceLastTypecheck) with
| None -> FSharpDeclarationListInfo.Empty
| Some(items,denv,m) ->
let items = items |> filterIntellisenseCompletionsBasedOnParseContext (parseResultsOpt |> Option.bind (fun x -> x.ParseTree)) (mkPos line colAtEndOfNamesAndResidue)
let items = items |> FilterAutoCompletesBasedOnParseContext parseResultsOpt (mkPos line colAtEndOfNamesAndResidue)
let items = if isInterfaceFile then items |> List.filter IsValidSignatureFileItem else items
FSharpDeclarationListInfo.Create(infoReader,m,denv,items,reactorOps,checkAlive))
(fun msg -> FSharpDeclarationListInfo.Error msg)
member x.GetDeclarationListSymbols (parseResultsOpt:FSharpParseFileResults option, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck) =
/// Get the symbols for auto-complete items at a location
member x.GetDeclarationListSymbols (parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck) =
let isInterfaceFile = SourceFileImpl.IsInterfaceFile mainInputFileName
ErrorScope.Protect
Range.range0
@ -1180,7 +1110,7 @@ type TypeCheckInfo
match GetDeclItemsForNamesAtPosition(parseResultsOpt, Some qualifyingNames, Some partialName, line, lineStr, colAtEndOfNamesAndResidue, ResolveTypeNamesToCtors, ResolveOverloads.Yes, hasTextChangedSinceLastTypecheck) with
| None -> List.Empty
| Some(items,_denv,_m) ->
let items = items |> filterIntellisenseCompletionsBasedOnParseContext (parseResultsOpt |> Option.bind (fun x -> x.ParseTree)) (mkPos line colAtEndOfNamesAndResidue)
let items = items |> FilterAutoCompletesBasedOnParseContext parseResultsOpt (mkPos line colAtEndOfNamesAndResidue)
let items = if isInterfaceFile then items |> List.filter IsValidSignatureFileItem else items
//do filtering like Declarationset
@ -1216,7 +1146,7 @@ type TypeCheckInfo
let isOpItem(nm,item) =
match item with
| [Item.Value _]
| [Item.MethodGroup(_,[_])] ->
| [Item.MethodGroup(_,[_],_)] ->
(IsOpName nm) && nm.[0]='(' && nm.[nm.Length-1]=')'
| [Item.UnionCase _] -> IsOpName nm
| _ -> false
@ -1240,6 +1170,7 @@ type TypeCheckInfo
items)
(fun _msg -> [])
/// Get the "reference resolution" tooltip for at a location
member scope.GetReferenceResolutionToolTipText(line,col) =
let pos = mkPos line col
let lineIfExists(append) =
@ -1376,7 +1307,7 @@ type TypeCheckInfo
items
|> List.collect (fun item ->
match item with
| Item.MethodGroup(nm,minfos) -> minfos |> List.map (fun minfo -> Item.MethodGroup(nm,[minfo]))
| Item.MethodGroup(nm,minfos,orig) -> minfos |> List.map (fun minfo -> Item.MethodGroup(nm,[minfo],orig))
| Item.CtorGroup(nm,cinfos) -> cinfos |> List.map (fun minfo -> Item.CtorGroup(nm,[minfo]))
| Item.FakeInterfaceCtor _
| Item.DelegateCtor _ -> [item]
@ -1391,7 +1322,7 @@ type TypeCheckInfo
let pinfo = List.head pinfos
if pinfo.IsIndexer then [item] else []
#if EXTENSIONTYPING
| Params.ItemIsTypeWithStaticArguments g _ -> [item] // we pretend that provided-types-with-static-args are method-like in order to get ParamInfo for them
| Params.ItemIsWithStaticArguments m g _ -> [item] // we pretend that provided-types-with-static-args are method-like in order to get ParamInfo for them
#endif
| Item.CustomOperation(_name, _helpText, _minfo) -> [item]
| Item.TypeVar _ -> []
@ -1414,7 +1345,7 @@ type TypeCheckInfo
// This is probably old code from when we supported 'go to definition' generating IL metadata.
let item =
match item with
| Item.MethodGroup (_, (ILMeth (_,ilinfo,_)) :: _)
| Item.MethodGroup (_, (ILMeth (_,ilinfo,_)) :: _, _)
| Item.CtorGroup (_, (ILMeth (_,ilinfo,_)) :: _) -> Item.Types ("", [ ilinfo.ApparentEnclosingType ])
| Item.ILField (ILFieldInfo (typeInfo, _)) -> Item.Types ("", [ typeInfo.ToType ])
| Item.ImplicitOp(_, {contents = Some(TraitConstraintSln.FSMethSln(_, vref, _))}) -> Item.Value(vref)
@ -1423,9 +1354,9 @@ type TypeCheckInfo
let fail defaultReason =
match item with
#if EXTENSIONTYPING
| Params.ItemIsTypeWithStaticArguments g (tcref) -> FSharpFindDeclResult.DeclNotFound (FSharpFindDeclFailureReason.ProvidedType(tcref.DisplayName))
| Params.ItemIsProvidedType g (tcref) -> FSharpFindDeclResult.DeclNotFound (FSharpFindDeclFailureReason.ProvidedType(tcref.DisplayName))
| Item.CtorGroup(name, ProvidedMeth(_)::_)
| Item.MethodGroup(name, ProvidedMeth(_)::_)
| Item.MethodGroup(name, ProvidedMeth(_)::_, _)
| Item.Property(name, ProvidedProp(_)::_) -> FSharpFindDeclResult.DeclNotFound (FSharpFindDeclFailureReason.ProvidedMember(name))
| Item.Event(ProvidedEvent(_) as e) -> FSharpFindDeclResult.DeclNotFound (FSharpFindDeclFailureReason.ProvidedMember(e.EventName))
| Item.ILField(ProvidedField(_) as f) -> FSharpFindDeclResult.DeclNotFound (FSharpFindDeclFailureReason.ProvidedMember(f.FieldName))

Просмотреть файл

@ -43,8 +43,11 @@ type internal FSharpMethodGroupItem =
/// The parameters of the method in the overload set
member Parameters: FSharpMethodGroupItemParameter[]
/// Indicates that this not really a method, but actually a static arguments list, like TP<42,"foo">
member IsStaticArguments: bool
/// Does the method support an arguments list? This is always true except for static type instantiations like TP<42,"foo">.
member HasParameters: bool
/// Does the type name or method support a static arguments list, like TP<42,"foo"> or conn.CreateCommand<42, "foo">(arg1, arg2)?
member StaticParameters: FSharpMethodGroupItemParameter[]
/// Represents a group of methods (or other items) returned by GetMethods.
[<Sealed>]

Просмотреть файл

@ -45,7 +45,6 @@ rem Disable strong-name validation for F# binaries built from open source that a
%SN32% -Vr FSharp.Build,b03f5f7f11d50a3a
%SN32% -Vr FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a
%SN32% -Vr FSharp.Compiler.Hosted,b03f5f7f11d50a3a
%SN32% -Vr FSharp.Data.TypeProviders,b03f5f7f11d50a3a
%SN32% -Vr fsc,b03f5f7f11d50a3a
%SN32% -Vr fsi,b03f5f7f11d50a3a
@ -70,7 +69,6 @@ if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
%SN64% -Vr FSharp.Build,b03f5f7f11d50a3a
%SN64% -Vr FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a
%SN64% -Vr FSharp.Compiler.Hosted,b03f5f7f11d50a3a
%SN64% -Vr FSharp.Data.TypeProviders,b03f5f7f11d50a3a
%SN64% -Vr fsc,b03f5f7f11d50a3a
%SN64% -Vr fsi,b03f5f7f11d50a3a

Просмотреть файл

@ -236,7 +236,6 @@ if exist "%FSCBinPath%\..\..\portable47\bin\FSharp.Core.dll" set FSCOREDLLPORTAB
if exist "%FSCBinPath%\..\..\portable7\bin\FSharp.Core.dll" set FSCOREDLLNETCOREPATH=%FSCBinPath%\..\..\portable7\bin
IF exist "%FSCBinPath%\..\..\portable78\bin\FSharp.Core.dll" set FSCOREDLLNETCORE78PATH=%FSCBinPath%\..\..\portable78\bin
IF exist "%FSCBinPath%\..\..\portable259\bin\FSharp.Core.dll" set FSCOREDLLNETCORE259PATH=%FSCBinPath%\..\..\portable259\bin
if exist "%FSCBinPath%\FSharp.Data.TypeProviders.dll" set FSDATATPPATH=%FSCBinPath%
set FSCOREDLLPATH=%FSCOREDLLPATH%\FSharp.Core.dll
set FSCOREDLL20PATH=%FSCOREDLL20PATH%\FSharp.Core.dll
@ -244,7 +243,6 @@ set FSCOREDLLPORTABLEPATH=%FSCOREDLLPORTABLEPATH%\FSharp.Core.dll
set FSCOREDLLNETCOREPATH=%FSCOREDLLNETCOREPATH%\FSharp.Core.dll
set FSCOREDLLNETCORE78PATH=%FSCOREDLLNETCORE78PATH%\FSharp.Core.dll
set FSCOREDLLNETCORE259PATH=%FSCOREDLLNETCORE259PATH%\FSharp.Core.dll
set FSDATATPPATH=%FSDATATPPATH%\FSharp.Data.TypeProviders.dll
set FSCOREDLLVPREVPATH=%FSCOREDLLVPREVPATH%\FSharp.Core.dll
for /d %%i in (%WINDIR%\Microsoft.NET\Framework\v4.0.?????) do set CORDIR=%%i

Просмотреть файл

@ -277,7 +277,6 @@ IF EXIST "%FSCBinPath%\..\..\portable47\bin\FSharp.Core.dll" set FSCOREDLLPORTAB
IF EXIST "%FSCBinPath%\..\..\portable7\bin\FSharp.Core.dll" set FSCOREDLLNETCOREPATH=%FSCBinPath%\..\..\portable7\bin
IF EXIST "%FSCBinPath%\..\..\portable78\bin\FSharp.Core.dll" set FSCOREDLLNETCORE78PATH=%FSCBinPath%\..\..\portable78\bin
IF EXIST "%FSCBinPath%\..\..\portable259\bin\FSharp.Core.dll" set FSCOREDLLNETCORE259PATH=%FSCBinPath%\..\..\portable259\bin
IF EXIST "%FSCBinPath%\FSharp.Data.TypeProviders.dll" set FSDATATPPATH=%FSCBinPath%
set FSCOREDLLPATH=%FSCOREDLLPATH%\FSharp.Core.dll
set FSCOREDLL20PATH=%FSCOREDLL20PATH%\FSharp.Core.dll

Просмотреть файл

@ -90,11 +90,6 @@ let private GetFSLibPaths env osArch fscBinPath =
| Some d when fileExists (d/"FSharp.Core.dll") -> FSCOREDLLNETCORE259PATH <- d
| Some _ | None -> ()
// IF EXIST "%FSCBinPath%\FSharp.Data.TypeProviders.dll" set FSDATATPPATH=%FSCBinPath%
match fscBinPath with
| Some d when fileExists (d/"FSharp.Data.TypeProviders.dll") -> FSDATATPPATH <- d
| Some _ | None -> ()
// set FSCOREDLLPATH=%FSCOREDLLPATH%\FSharp.Core.dll
FSCOREDLLPATH <- FSCOREDLLPATH/"FSharp.Core.dll"
// set FSCOREDLL20PATH=%FSCOREDLL20PATH%\FSharp.Core.dll
@ -107,8 +102,6 @@ let private GetFSLibPaths env osArch fscBinPath =
FSCOREDLLNETCORE78PATH <- FSCOREDLLNETCORE78PATH/"FSharp.Core.dll"
// set FSCOREDLLNETCORE259PATH=%FSCOREDLLNETCORE259PATH%\FSharp.Core.dll
FSCOREDLLNETCORE259PATH <- FSCOREDLLNETCORE259PATH/"FSharp.Core.dll"
// set FSDATATPPATH=%FSDATATPPATH%\FSharp.Data.TypeProviders.dll
FSDATATPPATH <- FSDATATPPATH/"FSharp.Data.TypeProviders.dll"
// set FSCOREDLLVPREVPATH=%FSCOREDLLVPREVPATH%\FSharp.Core.dll
FSCOREDLLVPREVPATH <- FSCOREDLLVPREVPATH/"FSharp.Core.dll"

Просмотреть файл

@ -91,7 +91,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="typeProviders\build-typeprovider-test.fs" />
<Compile Include="typeProviders\builtin\copyFSharpDataTypeProviderDLL.fs" />
<Compile Include="typeProviders\tests_typeProviders.fs" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -1,69 +0,0 @@
@if "%_echo%"=="" echo off
setlocal
REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
if EXIST build.ok DEL /f /q build.ok
call %~d0%~p0..\..\..\config.bat
if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" (
ECHO Skipping test for FSI.EXE
goto Skip
)
rem fsc.exe building
"%FSC%" %fsc_flags% -o:test.exe -g test.fsx
@if ERRORLEVEL 1 goto Error
"%PEVERIFY%" test.exe
@if ERRORLEVEL 1 goto Error
"%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
@if ERRORLEVEL 1 goto Error
"%PEVERIFY%" test--optimize.exe
@if ERRORLEVEL 1 goto Error
REM ==
REM == Disabled until Don checks in the missing files
REM ==
GOTO :SkipMultiPartTests
"%FSC%" %fsc_flags% -a -o:testlib.dll -r:System.Data.Services.Client.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs @if ERRORLEVEL 1 goto Error
"%PEVERIFY%" testlib.dll
@if ERRORLEVEL 1 goto Error
"%FSC%" %fsc_flags% -r:testlib.dll -o:testapp.exe -r:System.Data.Services.Client.dll -g test-part2.fs
@if ERRORLEVEL 1 goto Error
"%PEVERIFY%" testapp.exe
@if ERRORLEVEL 1 goto Error
"%FSC%" %fsc_flags% -o:testtwoparts.exe -r:System.Data.Services.Client.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs test-part2.fs
@if ERRORLEVEL 1 goto Error
"%PEVERIFY%" testtwoparts.exe
@if ERRORLEVEL 1 goto Error
:SkipMultiPartTests
:Ok
echo Built fsharp %~f0 ok.
echo. > build.ok
endlocal
exit /b 0
:Skip
echo Skipped %~f0
endlocal
exit /b 0
:Error
endlocal
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,78 +0,0 @@
@if "%_echo%"=="" echo off
setlocal
dir build.ok > NUL ) || (
@echo 'build.ok' not found.
goto :ERROR
)
call %~d0%~p0..\..\..\config.bat
REM fsi.exe testing
echo TestC
if exist test.ok (del /f /q test.ok)
"%FSI%" %fsi_flags% test.fsx
if NOT EXIST test.ok goto SetError
REM fsc.exe testing
echo TestD
if exist test.ok (del /f /q test.ok)
%CLIX% test.exe
@if ERRORLEVEL 1 goto Error
if NOT EXIST test.ok goto SetError
if exist test.ok (del /f /q test.ok)
%CLIX% test--optimize.exe
@if ERRORLEVEL 1 goto Error
if NOT EXIST test.ok goto SetError
REM ==
REM == Disabled until Don checks in the missing files
REM ==
GOTO :SkipMultiPartTests
if exist test.ok (del /f /q test.ok)
%CLIX% testapp.exe
@if ERRORLEVEL 1 goto Error
if NOT EXIST test.ok goto SetError
if exist test.ok (del /f /q test.ok)
%CLIX% testtwoparts.exe
@if ERRORLEVEL 1 goto Error
if NOT EXIST test.ok goto SetError
if exist test.ok (del /f /q test.ok)
%CLIX% testapp.exe
@if ERRORLEVEL 1 goto Error
if NOT EXIST test.ok goto SetError
if exist test.ok (del /f /q test.ok)
%CLIX% testtwoparts.exe
@if ERRORLEVEL 1 goto Error
if NOT EXIST test.ok goto SetError
:SkipMultiPartTests
:Ok
echo Ran fsharp %~f0 ok.
endlocal
exit /b 0
:Skip
echo Skipped %~f0
endlocal
exit /b 0
:Error
echo Test Script Failed (perhaps test did not emit test.ok signal file?)
endlocal
exit /b %ERRORLEVEL%
:SETERROR
set NonexistentErrorLevel 2> nul
goto Error

Просмотреть файл

@ -1,145 +0,0 @@
// #Quotations
#nowarn "57"
#r "System.Data.Services.Client.dll"
#r "FSharp.Data.TypeProviders.dll"
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Data.TypeProviders
open System
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.ExprShape
open Microsoft.FSharp.Linq.RuntimeHelpers
[<AutoOpen>]
module Infrastructure =
let mutable failures = []
let reportFailure s =
stderr.WriteLine " NO"; failures <- s :: failures
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then
let cultureString = argv.[2]
let culture = new System.Globalization.CultureInfo(cultureString)
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
do SetCulture()
let check s v1 v2 =
if v1 = v2 then
printfn "test %s...passed " s
else
failures <- failures @ [(s, box v1, box v2)]
printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
let test s b = check s b true
let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
check s (q1 |> Seq.toList) (q2 |> Seq.toList)
let checkCommuteVal s q1 q2 =
check s q1 q2
type Northwest = ODataService< "http://services.odata.org/V2/Northwind/Northwind.svc/",LocalSchemaFile="schema1.csdl",ForceUpdate=false >
module Test = begin end
module DuplicateTypes =
type Northwest = ODataService< "http://services.odata.org/V2/Northwind/Northwind.svc/",LocalSchemaFile="schema2.csdl",ForceUpdate=false >
type Northwest2 = ODataService< "http://services.odata.org/V2/Northwind/Northwind.svc/",LocalSchemaFile="schema3.csdl",ForceUpdate=false >
open System
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.ExprShape
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Linq.RuntimeHelpers
module Queryable =
let db = Northwest.GetDataContext()
let urlCapture = new System.Text.StringBuilder()
db.DataContext.SendingRequest.Add (fun x -> printfn "yurl = %A" x.Request.RequestUri; urlCapture.Append x.Request.RequestUri |> ignore)
let checkODataUrlTextForValue s (q1: unit -> 'T) (text:string) =
urlCapture.Clear() |> ignore
q1() |> ignore
let url = urlCapture.ToString()
check s url text
let allCustomersQuery =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for c in db.Customers do select c } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Customers()"
let allEmployeesQuery =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for c in db.Employees do select c } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Employees()"
let allProductsQuery =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for c in db.Products do select c } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Products()"
let allOrdersQuery =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for c in db.Orders do select c } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Orders()"
let firstFiveOrders =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for c in db.Orders do take 5; select c } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Orders()?$top=5"
let ordersSortedByShipDateLatestFirst =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for o in db.Orders do sortByNullableDescending o.ShippedDate; select (o.OrderID, o.ShippedDate) } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Orders()?$orderby=ShippedDate desc&$select=OrderID,ShippedDate"
let ordersSortedByShipDateEarliestFirst =
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for o in db.Orders do sortByNullable o.ShippedDate; select (o.OrderID, o.ShippedDate) } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Orders()?$orderby=ShippedDate&$select=OrderID,ShippedDate"
let ordersSortedByCustomerIDAndShipDateLatestFirst=
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for o in db.Orders do sortBy o.CustomerID; thenByNullableDescending o.ShippedDate; select (o.CustomerID, o.OrderID, o.ShippedDate) } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Orders()?$orderby=CustomerID,ShippedDate desc&$select=CustomerID,OrderID,ShippedDate"
let ordersSortedByCustomerIDAndShipDateEarliestFirst=
checkODataUrlTextForValue "vwe4yuwe09uu"
(fun () -> query { for o in db.Orders do sortBy o.CustomerID; thenByNullable o.ShippedDate; select (o.CustomerID, o.OrderID, o.ShippedDate) } |> Seq.length)
"http://services.odata.org/V2/Northwind/Northwind.svc/Orders()?$orderby=CustomerID,ShippedDate&$select=CustomerID,OrderID,ShippedDate"
#if COMPILED
[<System.STAThread>]
do()
#endif
let _ =
if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1)
else (stdout.WriteLine "Test Passed";
System.IO.File.WriteAllText("test.ok","ok");
exit 0)

Просмотреть файл

@ -1929,78 +1929,6 @@ module QueriesOverIQueryable =
module QueriesOverOData =
let build cfg dir = attempt {
let exec p = Command.exec dir cfg.EnvironmentVariables { Output = Inherit; Input = None; } p >> checkResult
let fsc = Printf.ksprintf (Commands.fsc exec cfg.FSC)
let peverify = Commands.peverify exec cfg.PEVERIFY "/nologo"
// "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
do! fsc "%s -o:test.exe -g" cfg.fsc_flags ["test.fsx"]
// "%PEVERIFY%" test.exe
do! peverify "test.exe"
// "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
do! fsc "%s --optimize -o:test--optimize.exe -g" cfg.fsc_flags ["test.fsx"]
// "%PEVERIFY%" test--optimize.exe
do! peverify "test--optimize.exe"
}
let run cfg dir = attempt {
let exec p = Command.exec dir cfg.EnvironmentVariables { Output = Inherit; Input = None; } p >> checkResult
let fsi = Printf.ksprintf (Commands.fsi exec cfg.FSI)
let fileguard = (Commands.getfullpath dir) >> FileGuard.create
// REM fsi.exe testing
// echo TestC
log "TestC"
// if exist test.ok (del /f /q test.ok)
use testOkFile = fileguard "test.ok"
// "%FSI%" %fsi_flags% test.fsx
do! fsi "%s" cfg.fsi_flags ["test.fsx"]
// if NOT EXIST test.ok goto SetError
do! testOkFile |> NUnitConf.checkGuardExists
// REM fsc.exe testing
// echo TestD
log "TestD"
// if exist test.ok (del /f /q test.ok)
use testOkFile2 = fileguard "test.ok"
// %CLIX% test.exe
do! exec ("."/"test.exe") ""
// if NOT EXIST test.ok goto SetError
do! testOkFile2 |> NUnitConf.checkGuardExists
// if exist test.ok (del /f /q test.ok)
use testOkFile3 = fileguard "test.ok"
// %CLIX% test--optimize.exe
do! exec ("."/"test--optimize.exe") ""
// if NOT EXIST test.ok goto SetError
do! testOkFile3 |> NUnitConf.checkGuardExists
}
[<Test; FSharpSuiteTest("core/queriesOverOData")>]
let queriesOverOData () = check (attempt {
let { Directory = dir; Config = cfg } = testContext ()
do! build cfg dir
do! run cfg dir
})
module QuotesDebugInfo =
let build cfg dir = attempt {

Просмотреть файл

@ -27,6 +27,6 @@
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": { }
"netstandard1.5": { }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

2
tests/fsharp/typeProviders/.gitignore поставляемый
Просмотреть файл

@ -33,6 +33,4 @@ wedgeAssembly/providedJ.dll
wedgeAssembly/providedK.dll
wedgeAssembly/provider.dll
builtin/SqlDataConnection/DataDirectory
builtin/SqlDataConnection/ExampleResolutionFolder

29
tests/fsharp/typeProviders/builtin/.gitignore поставляемый
Просмотреть файл

@ -1,29 +0,0 @@
FSharp.Data.TypeProviders.dll
EdmxFile/SampleModel01.edmx
EdmxFile/*.exe.config
EdmxFile/*.dll.config
ODataService/*.exe.config
ODataService/*.dll.config
ODataService/svc.csdl
ODataService/svc2.csdl
SqlDataConnection/*.exe.config
SqlDataConnection/*.dll.config
SqlDataConnection/app.config
SqlDataConnection/NORTHWND.mdf
SqlDataConnection/NORTHWND_log.ldf
SqlDataConnection/nwind2.dbml
SqlDataConnection/nwind3.dbml
SqlDataConnection/test.config
SqlEntityConnection/*.exe.config
SqlEntityConnection/*.dll.config
WsdlService/*.exe.config
WsdlService/*.dll.config
WsdlService/sfile.wsdlschema
WsdlService/sfile2.wsdlschema

Просмотреть файл

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" Namespace="SampleModel01.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005">
<EntityContainer Name="SampleModel01TargetContainer" >
</EntityContainer>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="SampleModel01" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntityContainer Name="SampleModel01Container" annotation:LazyLoadingEnabled="true">
<EntitySet Name="Orders" EntityType="SampleModel01.Orders" />
<EntitySet Name="Persons" EntityType="SampleModel01.Persons" />
<AssociationSet Name="CustomersOrders" Association="SampleModel01.CustomersOrders">
<End Role="Customers" EntitySet="Persons" />
<End Role="Orders" EntitySet="Orders" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Customers" BaseType="SampleModel01.Persons">
<Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<NavigationProperty Name="Orders" Relationship="SampleModel01.CustomersOrders" FromRole="Customers" ToRole="Orders" />
</EntityType>
<EntityType Name="Orders">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Type="Int32" Name="CustomersId" Nullable="false" />
<NavigationProperty Name="Customer" Relationship="SampleModel01.CustomersOrders" FromRole="Orders" ToRole="Customers" />
</EntityType>
<EntityType Name="Persons">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Type="Int32" Name="ID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Type="String" Name="FirstName" Nullable="false" />
<Property Type="String" Name="LastName" Nullable="false" />
</EntityType>
<Association Name="CustomersOrders">
<End Type="SampleModel01.Customers" Role="Customers" Multiplicity="1" />
<End Type="SampleModel01.Orders" Role="Orders" Multiplicity="*" />
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs" Space="C-S">
<Alias Key="Model" Value="SampleModel01" />
<Alias Key="Target" Value="SampleModel01.Store" />
<EntityContainerMapping CdmEntityContainer="SampleModel01Container" StorageEntityContainer="SampleModel01TargetContainer">
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
<edmx:Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</edmx:Connection>
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="True" />
</DesignerInfoPropertySet>
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram Name="SampleModel01" >
<EntityTypeShape EntityType="SampleModel01.Customers" Width="1.5" PointX="3.3072142933063273" PointY="8.50035328068787" />
<InheritanceConnector EntityType="SampleModel01.Customers" />
<EntityTypeShape EntityType="SampleModel01.Orders" Width="1.5" PointX="3.25" PointY="6.5" Height="1.4279589843749996" />
<EntityTypeShape EntityType="SampleModel01.Persons" Width="1.5" PointX="8.4623833040065986" PointY="12.312999537360389" />
<AssociationConnector Association="SampleModel01.CustomersOrders" >
<ConnectorPoint PointX="2.25" PointY="5.9374994999999995" />
<ConnectorPoint PointX="4" PointY="5.9374994999999995" />
<ConnectorPoint PointX="4" PointY="6.5" />
</AssociationConnector>
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

Просмотреть файл

@ -1,8 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
call %~d0%~p0..\..\..\single-test-build.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,7 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\..\..\single-test-run.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,143 +0,0 @@
// #Conformance #TypeProviders #EdmxFile
#r "FSharp.Data.TypeProviders.dll"
open Microsoft.FSharp.Core.CompilerServices
open System.IO
[<AutoOpen>]
module Infrastructure =
let failures = ref false
let reportFailure () = stderr.WriteLine " NO"; failures := true
let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else reportFailure()
let check s v1 v2 = stderr.Write(s:string); if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A " v2 v1; reportFailure()
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then begin
let cultureString = argv.[2] in
let culture = new System.Globalization.CultureInfo(cultureString) in
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
end
do SetCulture()
module CheckEdmxfileTypeProvider =
let checkHostedType (hostedType: System.Type) =
test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
check "ceklc09wlkm2" hostedType.DeclaringType null
check "ceklc09wlkm3" hostedType.DeclaringMethod null
check "ceklc09wlkm4" hostedType.FullName "SampleModel01.EdmxFileApplied"
check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
check "ceklc09wlkm9" (hostedType.GetMethods()) [| |]
check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
check "ceklc09wlkm12"
(set [ for x in hostedType.GetNestedTypes() -> x.Name ])
(set ["SampleModel01"])
let hostedServiceTypes = hostedType.GetNestedTypes().[0]
check "ceklc09wlkm12b" (hostedServiceTypes.GetMethods()) [| |]
check "ceklc09wlkm12c"
(set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ])
(set ["Customers"; "Orders"; "Persons"; "SampleModel01Container"])
// Deep check on one type: Customers
let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Customers"))
check "ceklc09wlkm131" (set [ for x in customersType.GetProperties() -> x.Name ]) (set [| "Id"; "Orders"; "ID"; "FirstName"; "LastName"; "EntityState"; "EntityKey" |])
check "ceklc09wlkm133a" (set [ for x in customersType.GetFields() -> x.Name ]) (set [| |])
check "ceklc09wlkm133b" (set [ for x in customersType.GetFields(System.Reflection.BindingFlags.Static ||| System.Reflection.BindingFlags.Public ||| System.Reflection.BindingFlags.FlattenHierarchy) -> x.Name ])
(set [ "EntityKeyPropertyName"] )
check "ceklc09wlkm134" (set [ for x in customersType.GetMethods() -> x.Name ])
(set ["CreateCustomers"; "get_Id"; "set_Id"; "get_Orders"; "set_Orders"; "get_ID"; "set_ID"; "get_FirstName"; "set_FirstName"; "get_LastName"; "set_LastName";
"get_EntityState"; "get_EntityKey"; "set_EntityKey"; "add_PropertyChanged"; "remove_PropertyChanged"; "add_PropertyChanging"; "remove_PropertyChanging"; "ToString"; "Equals";
"GetHashCode"; "GetType"] )
check "ceklc09wlkm135" (set [ for x in customersType.GetMethods(System.Reflection.BindingFlags.Static ||| System.Reflection.BindingFlags.Public ||| System.Reflection.BindingFlags.FlattenHierarchy) -> x.Name ])
(set [ "CreateCustomers"; "CreatePersons"; "Equals"; "ReferenceEquals" ] )
check "ceklc09wlkm136" (customersType.GetNestedTypes()) [||]
// Not so deep check on another type: SampleModel01Container
let SampleModel01ContainerType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "SampleModel01Container"))
check "ceklc09wlkm141" (set [ for x in SampleModel01ContainerType.GetProperties() -> x.Name ]) (set [|"Orders"; "Persons"; "Connection"; "DefaultContainerName"; "MetadataWorkspace"; "ObjectStateManager"; "CommandTimeout"; "ContextOptions"|])
check "ceklc09wlkm142" (SampleModel01ContainerType.GetFields()) [||]
check "ceklc09wlkm144" (set [ for x in SampleModel01ContainerType.GetMethods() -> x.Name ])
(set [|"get_Orders"; "get_Persons"; "AddToOrders"; "AddToPersons"; "get_Connection"; "get_DefaultContainerName"; "set_DefaultContainerName"; "get_MetadataWorkspace"; "get_ObjectStateManager"; "get_CommandTimeout"; "set_CommandTimeout"; "get_ContextOptions"; "add_SavingChanges"; "remove_SavingChanges"; "add_ObjectMaterialized"; "remove_ObjectMaterialized"; "AcceptAllChanges"; "AddObject"; "LoadProperty"; "LoadProperty"; "LoadProperty"; "LoadProperty"; "ApplyPropertyChanges"; "ApplyCurrentValues"; "ApplyOriginalValues"; "AttachTo"; "Attach"; "CreateEntityKey"; "CreateObjectSet"; "CreateObjectSet"; "CreateQuery"; "DeleteObject"; "Detach"; "Dispose"; "GetObjectByKey"; "Refresh"; "Refresh"; "SaveChanges"; "SaveChanges"; "SaveChanges"; "DetectChanges"; "TryGetObjectByKey"; "ExecuteFunction"; "ExecuteFunction"; "ExecuteFunction"; "CreateProxyTypes"; "CreateObject"; "ExecuteStoreCommand"; "ExecuteStoreQuery"; "ExecuteStoreQuery"; "Translate"; "Translate"; "CreateDatabase"; "DeleteDatabase"; "DatabaseExists"; "CreateDatabaseScript"; "ToString"; "Equals"; "GetHashCode"; "GetType"|])
check "ceklc09wlkm146" (SampleModel01ContainerType.GetNestedTypes()) [||]
let instantiateTypeProviderAndCheckOneHostedType( edmxfile : string, typeFullPath ) =
let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
test "CheckFSharpDataTypeProvidersDLLExist" (File.Exists assemblyFile)
// If/when we care about the "target framework", this mock function will have to be fully implemented
let systemRuntimeContainsType s =
printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
true
let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
// Setup machinery to keep track of the "invalidate event" (see below)
let invalidateEventCount = ref 0
typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
// Load a type provider instance for the type and restart
let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
check "CheckAllTPsAreThere" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
let hostedType1 = hostedNamespace1.ResolveTypeName("EdmxFile")
let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
check "VerifyStaticParam"
(set [ for i in hostedType1StaticParameters -> i.Name ])
(set [ "File"; "ResolutionFolder" ])
let staticParameterValues =
[| for x in hostedType1StaticParameters ->
(match x.Name with
| "File" -> box edmxfile
| _ -> box x.RawDefaultValue) |]
printfn "instantiating type... may take a while for code generation tool to run and csc.exe to run..."
let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
checkHostedType hostedAppliedType1
// Write replacement text into the file and check that the invalidation event is triggered....
let file1NewContents = System.IO.File.ReadAllText(edmxfile).Replace("Customer", "Client") // Rename 'Customer' to 'Client'
do File.WriteAllText(edmxfile, file1NewContents)
// Wait for invalidate event to fire....
for i in 0 .. 30 do
if !invalidateEventCount = 0 then
System.Threading.Thread.Sleep 100
check "VerifyInvalidateEventFired" !invalidateEventCount 1
// Test with absolute path
// Copy the .edmx used for tests to avoid trashing our original (we may overwrite it when testing the event)
let edmxfile = Path.Combine(__SOURCE_DIRECTORY__, "SampleModel01.edmx")
System.IO.File.Copy(Path.Combine(__SOURCE_DIRECTORY__, @"EdmxFiles\SampleModel01.edmx"), edmxfile, true)
System.IO.File.SetAttributes(edmxfile, System.IO.FileAttributes.Normal)
instantiateTypeProviderAndCheckOneHostedType(edmxfile, [| "EdmxFileApplied" |])
// Test with relative path
// Copy the .edmx used for tests to avoid trashing our original (we may overwrite it when testing the event)
System.IO.File.Copy(Path.Combine(__SOURCE_DIRECTORY__, @"EdmxFiles\SampleModel01.edmx"), edmxfile, true)
System.IO.File.SetAttributes(edmxfile, System.IO.FileAttributes.Normal)
instantiateTypeProviderAndCheckOneHostedType( System.IO.Path.GetFileName(edmxfile), [| "EdmxFileApplied" |])
let _ =
if !failures then (stdout.WriteLine "Test Failed"; exit 1)
do (stdout.WriteLine "Test Passed";
File.WriteAllText("test.ok","ok");
exit 0)

Просмотреть файл

@ -1,8 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
call %~d0%~p0..\..\..\single-test-build.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,7 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\..\..\single-test-run.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,149 +0,0 @@
// #Conformance #TypeProviders #ODataService
#r "FSharp.Data.TypeProviders.dll"
open Microsoft.FSharp.Core.CompilerServices
open System.IO
[<AutoOpen>]
module Infrastructure =
let failures = ref false
let reportFailure () = stderr.WriteLine " NO"; failures := true
let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else reportFailure()
let check s v1 v2 = stderr.Write(s:string); if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A " v2 v1; reportFailure()
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then begin
let cultureString = argv.[2] in
let culture = new System.Globalization.CultureInfo(cultureString) in
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
end
do SetCulture()
module CheckODataServiceTypeProvider =
let checkHostedType (hostedType: System.Type) =
//let hostedType = hostedAppliedType1
test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
check "ceklc09wlkm2" hostedType.DeclaringType null
check "ceklc09wlkm3" hostedType.DeclaringMethod null
check "ceklc09wlkm4" hostedType.FullName "Microsoft.FSharp.Data.TypeProviders.ODataServiceApplied"
check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
check "ceklc09wlkm9" [ for m in hostedType.GetMethods() -> m.Name ] [ "GetDataContext" ; "GetDataContext" ]
let m1 = hostedType.GetMethods().[0]
let m2 = hostedType.GetMethods().[1]
check "ceklc09wlkm9b" (m1.GetParameters().Length) 0
check "ceklc09wlkm9b" (m2.GetParameters().Length) 1
check "ceklc09wlkm9b" (m1.ReturnType.Name) "DemoService"
check "ceklc09wlkm9c" (m1.ReturnType.FullName) ("Microsoft.FSharp.Data.TypeProviders.ODataServiceApplied+ServiceTypes+SimpleDataContextTypes+DemoService")
check "ceklc09wlkm9d" (m1.ReturnType.GetProperties().Length) 5
check "ceklc09wlkm9e" (set [ for p in m1.ReturnType.GetProperties() -> p.Name ]) (set ["Categories"; "Credentials"; "DataContext"; "Products"; "Suppliers"])
check "ceklc09wlkm9f" (set [ for p in m1.ReturnType.GetProperties() -> p.PropertyType.Name ]) (set ["DataServiceQuery`1"; "DataServiceQuery`1";"DataServiceQuery`1";"ICredentials"; "DataServiceContext"])
// We expose some getters and 1 setter on the simpler data context
check "ceklc09wlkm9g" (m1.ReturnType.GetMethods().Length) 6
check "ceklc09wlkm9h" (set [ for p in m1.ReturnType.GetMethods() -> p.Name ]) (set ["get_Categories"; "get_Credentials"; "get_DataContext"; "get_Products"; "get_Suppliers"; "set_Credentials"])
check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
check "ceklc09wlkm12"
(set [ for x in hostedType.GetNestedTypes() -> x.Name ])
(set ["ServiceTypes"])
let hostedServiceTypes = hostedType.GetNestedTypes().[0]
check "ceklc09wlkm11" (hostedServiceTypes.GetNestedTypes().Length) 6
check "ceklc09wlkm12"
(set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ])
(set ["Address"; "Category"; "DemoService"; "Product"; "SimpleDataContextTypes"; "Supplier"])
let productType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Product"))
check "ceklc09wlkm13" (productType.GetProperties().Length) 9
check "ceklc09wlkm14"
(set [ for x in productType.GetProperties() -> x.Name ])
(set ["ID"; "Name"; "Description"; "ReleaseDate"; "DiscontinuedDate"; "Rating"; "Price"; "Category"; "Supplier"])
let instantiateTypeProviderAndCheckOneHostedType(useLocalSchemaFile: string option, useForceUpdate: bool option, typeFullPath:string[]) =
//let useLocalSchemaFile : string option = None
//let useForceUpdate : bool option = None
let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
test "cnlkenkewe" (File.Exists assemblyFile)
// If/when we care about the "target framework", this mock function will have to be fully implemented
let systemRuntimeContainsType s =
printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
true
let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
let invalidateEventCount = ref 0
typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
// Load a type provider instance for the type and restart
let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
let hostedType1 = hostedNamespace1.ResolveTypeName("ODataService")
let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
check "eenewioinw2"
(set [ for i in hostedType1StaticParameters -> i.Name ])
(set ["ServiceUri"; "LocalSchemaFile"; "ForceUpdate"; "ResolutionFolder"; "DataServiceCollection"])
let serviceUri = "http://services.odata.org/V2/OData/OData.svc/"
let staticParameterValues =
[| for x in hostedType1StaticParameters ->
(match x.Name with
| "ServiceUri" -> box serviceUri
| "LocalSchemaFile" when useLocalSchemaFile.IsSome -> box useLocalSchemaFile.Value
| "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
| _ -> box x.RawDefaultValue) |]
printfn "instantiating service type... may take a while for OData service metadata to be downloaded, code generation tool to run and csc.exe to run..."
try
let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
checkHostedType hostedAppliedType1
with
| e ->
printfn "%s" (e.ToString())
reportFailure()
instantiateTypeProviderAndCheckOneHostedType(None, None, [| "ODataServiceApplied" |])
let schemaFile2 = Path.Combine(__SOURCE_DIRECTORY__, "svc.csdl")
(try File.Delete schemaFile2 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(Some (Path.Combine(__SOURCE_DIRECTORY__, "svc.csdl")), Some true, [| "ODataServiceApplied" |])
// schemaFile2 should now exist
check "eoinew0c9e" (File.Exists schemaFile2)
// Reuse the CSDL just created
instantiateTypeProviderAndCheckOneHostedType(Some (Path.Combine(__SOURCE_DIRECTORY__, "svc.csdl")), Some false, [| "ODataServiceApplied" |])
// schemaFile2 should now still exist
check "eoinew0c9e" (File.Exists schemaFile2)
let schemaFile3 = Path.Combine(__SOURCE_DIRECTORY__, "svc2.csdl")
(try File.Delete schemaFile3 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(Some schemaFile3, None, [| "ODataServiceApplied" |])
// schemaFile3 should now exist
check "eoinew0c9e" (File.Exists schemaFile3)
let _ =
if !failures then (stdout.WriteLine "Test Failed"; exit 1)
do (stdout.WriteLine "Test Passed";
File.WriteAllText("test.ok","ok");
exit 0)

Двоичный файл не отображается.

Просмотреть файл

@ -1,8 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
call %~d0%~p0..\..\..\single-test-build.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,17 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\..\..\..\config.bat
IF /I "%INSTALL_SKU%" NEQ "ULTIMATE" (
echo Test not supported except on Ultimate
exit /b 0
)
IF EXIST test.exe (
echo Running test.exe to warm up SQL
test.exe > nul 2> nul
)
call %~d0%~p0..\..\..\single-test-run.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,255 +0,0 @@
// #Conformance #TypeProviders #SqlDataConnection
#r "FSharp.Data.TypeProviders.dll"
#r "System.Management.dll"
open Microsoft.FSharp.Core.CompilerServices
open System.IO
[<AutoOpen>]
module Infrastructure =
let failures = ref false
let reportFailure () = stderr.WriteLine " NO"; failures := true
let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else reportFailure()
let check s v1 v2 = stderr.Write(s:string); if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A " v2 v1; reportFailure()
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then begin
let cultureString = argv.[2] in
let culture = new System.Globalization.CultureInfo(cultureString) in
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
end
do SetCulture()
module CheckSqlConnectionTypeProvider =
let isSQLExpressInstalled =
let edition = "Express Edition"
let instance = "MSSQL$SQLEXPRESS"
try
let getSqlExpress =
new System.Management.ManagementObjectSearcher("root\\Microsoft\\SqlServer\\ComputerManagement10",
"select * from SqlServiceAdvancedProperty where SQLServiceType = 1 and ServiceName = '" + instance + "' and (PropertyName = 'SKUNAME' or PropertyName = 'SPLEVEL')")
// If nothing is returned, SQL Express isn't installed.
getSqlExpress.Get().Count <> 0
with
| _ -> false
let checkHostedType (hostedType: System.Type) =
//let hostedType = hostedAppliedType1
test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
check "ceklc09wlkm2" hostedType.DeclaringType null
check "ceklc09wlkm3" hostedType.DeclaringMethod null
check "ceklc09wlkm4" hostedType.FullName "Microsoft.FSharp.Data.TypeProviders.SqlDataConnectionApplied"
check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
check "ceklc09wlkm9" [ for m in hostedType.GetMethods() -> m.Name ] [ "GetDataContext" ; "GetDataContext" ]
let m0 = hostedType.GetMethods().[0]
let m1 = hostedType.GetMethods().[1]
check "ceklc09wlkm9b" (m0.GetParameters().Length) 0
check "ceklc09wlkm9b" (m1.GetParameters().Length) 1
check "ceklc09wlkm9b" (m0.ReturnType.Name) "Northwnd"
check "ceklc09wlkm9b" (m0.ReturnType.FullName) "Microsoft.FSharp.Data.TypeProviders.SqlDataConnectionApplied+ServiceTypes+SimpleDataContextTypes+Northwnd"
check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
check "ceklc09wlkm12"
(set [ for x in hostedType.GetNestedTypes() -> x.Name ])
(set ["ServiceTypes"])
let hostedServiceTypes = hostedType.GetNestedTypes().[0]
check "ceklc09wlkm12b" (hostedServiceTypes.GetMethods()) [| |]
check "ceklc09wlkm12c" (hostedServiceTypes.GetNestedTypes().Length) 38
let hostedSimpleDataContextTypes = hostedServiceTypes.GetNestedType("SimpleDataContextTypes")
check "ceklc09wlkm12d" (hostedSimpleDataContextTypes.GetMethods()) [| |]
check "ceklc09wlkm12e" (hostedSimpleDataContextTypes.GetNestedTypes().Length) 1
check "ceklc09wlkm12e" [ for x in hostedSimpleDataContextTypes.GetNestedTypes() -> x.Name] ["Northwnd"]
check "ceklc09wlkm12"
(set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ])
(set ["Northwnd"; "SimpleDataContextTypes"; "AlphabeticalListOfProduct"; "Category"; "CategorySalesFor1997"; "CurrentProductList"; "CustomerAndSuppliersByCity";
"CustomerCustomerDemo"; "CustomerDemographic"; "Customer"; "Employee"; "EmployeeTerritory";
"Invoice"; "OrderDetail"; "OrderDetailsExtended"; "OrderSubtotal"; "Order"; "OrdersQry";
"ProductSalesFor1997"; "Product"; "ProductsAboveAveragePrice"; "ProductsByCategory";
"QuarterlyOrder"; "Region"; "SalesByCategory"; "SalesTotalsByAmount"; "Shipper";
"SummaryOfSalesByQuarter"; "SummaryOfSalesByYear"; "Supplier"; "Territory"; "CustOrderHistResult";
"CustOrdersDetailResult"; "CustOrdersOrdersResult"; "EmployeeSalesByCountryResult"; "SalesByYearResult";
"SalesByCategoryResult"; "TenMostExpensiveProductsResult"])
let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Customer"))
check "ceklc09wlkm13" (customersType.GetProperties().Length) 13
let instantiateTypeProviderAndCheckOneHostedType(connectionStringName, configFile, useDataDirectory, dataDirectory, useLocalSchemaFile: string option, useForceUpdate: bool option, typeFullPath: string[], resolutionFolder:string option) =
let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
test "cnlkenkewe" (File.Exists assemblyFile)
// If/when we care about the "target framework", this mock function will have to be fully implemented
let systemRuntimeContainsType s =
printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
true
let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
let invalidateEventCount = ref 0
typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
// Load a type provider instance for the type and restart
let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
let hostedType1 = hostedNamespace1.ResolveTypeName("SqlDataConnection")
let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
check "eenewioinw2"
(set [ for i in hostedType1StaticParameters -> i.Name ])
(set ["ConnectionString"; "ConnectionStringName"; "DataDirectory"; "ResolutionFolder"; "ConfigFile"; "LocalSchemaFile";
"ForceUpdate"; "Pluralize"; "Views"; "Functions"; "StoredProcedures"; "Timeout";
"ContextTypeName"; "Serializable" ])
let northwind = "NORTHWND.mdf"
let northwindLog = "NORTHWND_log.ldf"
let northwindFile =
let baseFile =
match dataDirectory with
| None -> northwind
| Some dd -> System.IO.Path.Combine(dd,northwind)
match resolutionFolder with
| None ->
match dataDirectory with
| None -> ()
| Some dd -> if not(System.IO.Directory.Exists dd) then System.IO.Directory.CreateDirectory dd |> ignore
baseFile
| Some rf ->
if not(System.IO.Directory.Exists rf) then System.IO.Directory.CreateDirectory rf |> ignore
match dataDirectory with
| None -> ()
| Some dd -> let dd = System.IO.Path.Combine(rf,dd) in if not(System.IO.Directory.Exists dd) then System.IO.Directory.CreateDirectory dd |> ignore
System.IO.Path.Combine(rf,baseFile)
if not(System.IO.File.Exists(northwindFile)) then
System.IO.File.Copy("DB\\northwnd.mdf", northwindFile, false)
System.IO.File.SetAttributes(northwindFile, System.IO.FileAttributes.Normal)
let connectionString =
if useDataDirectory then
if isSQLExpressInstalled then
@"AttachDBFileName = '|DataDirectory|\" + northwind + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
else
"AttachDBFileName = '|DataDirectory|\\" + northwind + "';Server='(localdb)\\MSSQLLocalDB'"
else
if isSQLExpressInstalled then
@"AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
else
"AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='(localdb)\\MSSQLLocalDB'"
match connectionStringName with
| None -> ()
| Some connectionStringName ->
let configFileName = match configFile with None -> "app.config" | Some nm -> nm
let configFileName =
match resolutionFolder with
| None -> configFileName
| Some rf ->
System.IO.Path.Combine(rf,configFileName)
System.IO.File.WriteAllText(configFileName,
sprintf """<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="%s"
connectionString="%s"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
"""
connectionStringName
connectionString)
let staticParameterValues =
[| for x in hostedType1StaticParameters ->
(match x.Name with
| "ConnectionString" when connectionStringName.IsNone -> box connectionString
| "Pluralize" -> box true
| "ConnectionStringName" when connectionStringName.IsSome -> box connectionStringName.Value
| "ResolutionFolder" when resolutionFolder.IsSome -> box resolutionFolder.Value
| "DataDirectory" when dataDirectory.IsSome -> box dataDirectory.Value
| "ConfigFile" when configFile.IsSome -> box configFile.Value
| "ContextTypeName" -> box "Northwnd"
| "LocalSchemaFile" when useLocalSchemaFile.IsSome -> box useLocalSchemaFile.Value
| "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
| "Timeout" -> box 60
| _ -> box x.RawDefaultValue) |]
printfn "instantiating database type... may take a while for db to attach, code generation tool to run and csc.exe to run..."
try
let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
checkHostedType hostedAppliedType1
with
| e ->
printfn "%s" (e.ToString())
reportFailure()
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, None, [| "SqlDataConnectionApplied" |], None)
// Use an implied app.config config file, use the current directory as the DataDirectory
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString1", None, true, None, None, None, [| "SqlDataConnectionApplied" |], None)
// Use a config file, use an explicit relative DataDirectory
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString2", Some "app.config", true, Some "DataDirectory", None, None, [| "SqlDataConnectionApplied" |], None)
// Use a config file, use an explicit relative DataDirectory and an explicit ResolutionFolder.
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString2", Some "app.config", true, Some "DataDirectory", None, None, [| "SqlDataConnectionApplied" |], Some "ExampleResolutionFolder")
// Use an absolute config file, use an absolute DataDirectory
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString3", Some (__SOURCE_DIRECTORY__ + @"\test.config"), true, Some (__SOURCE_DIRECTORY__ + @"\DataDirectory"), None, None, [| "SqlDataConnectionApplied" |], None)
let schemaFile2 = Path.Combine(__SOURCE_DIRECTORY__, "nwind2.dbml")
(try File.Delete schemaFile2 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.dbml")), Some true, [| "SqlDataConnectionApplied" |], None)
// schemaFile2 should now exist
check "eoinew0c9e" (File.Exists schemaFile2)
// Reuse the DBML just created
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.dbml")), Some false, [| "SqlDataConnectionApplied" |], None)
// schemaFile2 should now still exist
check "eoinew0c9e" (File.Exists schemaFile2)
// // A relative path should work....
// instantiateTypeProviderAndCheckOneHostedType(Some "nwind2.dbml", Some false)
// // schemaFile2 should now still exist
// check "eoinew0c9e" (File.Exists schemaFile2)
let schemaFile3 = Path.Combine(__SOURCE_DIRECTORY__, "nwind3.dbml")
(try File.Delete schemaFile3 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some schemaFile3, None, [| "SqlDataConnectionApplied" |], None)
// schemaFile3 should now exist
check "eoinew0c9e" (File.Exists schemaFile3)
let _ =
if !failures then (stdout.WriteLine "Test Failed"; exit 1)
do (stdout.WriteLine "Test Passed";
File.WriteAllText("test.ok","ok");
exit 0)

Двоичный файл не отображается.

Просмотреть файл

@ -1,8 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
call %~d0%~p0..\..\..\single-test-build.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,13 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\..\..\..\config.bat
IF /I "%INSTALL_SKU%" NEQ "ULTIMATE" (
echo Test not supported except on Ultimate
exit /b 0
)
call %~d0%~p0..\..\..\single-test-run.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,243 +0,0 @@
// #Conformance #TypeProviders #SqlEntityConnection
#r "FSharp.Data.TypeProviders.dll"
#r "System.Management.dll"
open Microsoft.FSharp.Core.CompilerServices
open System.IO
[<AutoOpen>]
module Infrastructure =
let failures = ref false
let reportFailure () = stderr.WriteLine " NO"; failures := true
let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else reportFailure()
let check s v1 v2 = stderr.Write(s:string); if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A " v2 v1; reportFailure()
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then begin
let cultureString = argv.[2] in
let culture = new System.Globalization.CultureInfo(cultureString) in
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
end
do SetCulture()
module CheckSqlEntityConnectionTypeProvider =
let isSQLExpressInstalled =
let edition = "Express Edition"
let instance = "MSSQL$SQLEXPRESS"
try
let getSqlExpress =
new System.Management.ManagementObjectSearcher("root\\Microsoft\\SqlServer\\ComputerManagement10",
"select * from SqlServiceAdvancedProperty where SQLServiceType = 1 and ServiceName = '" + instance + "' and (PropertyName = 'SKUNAME' or PropertyName = 'SPLEVEL')")
// If nothing is returned, SQL Express isn't installed.
getSqlExpress.Get().Count <> 0
with
| _ -> false
let checkHostedType (expectedContextTypeName, hostedType: System.Type) =
//let hostedType = hostedAppliedType1
test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
check "ceklc09wlkm2" hostedType.DeclaringType null
check "ceklc09wlkm3" hostedType.DeclaringMethod null
check "ceklc09wlkm4" hostedType.FullName ("SqlEntityConnection1.SqlEntityConnectionApplied")
check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
check "ceklc09wlkm9" [ for m in hostedType.GetMethods() -> m.Name ] [ "GetDataContext" ;"GetDataContext" ]
let m0 = hostedType.GetMethods().[0]
let m1 = hostedType.GetMethods().[1]
check "ceklc09wlkm9b" (m0.GetParameters().Length) 0
check "ceklc09wlkm9c" (m1.GetParameters().Length) 1
check "ceklc09wlkm9d" (m0.ReturnType.Name) expectedContextTypeName
check "ceklc09wlkm9e" (m0.ReturnType.FullName) ("SqlEntityConnection1.SqlEntityConnectionApplied+ServiceTypes+SimpleDataContextTypes+" + expectedContextTypeName)
check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
check "ceklc09wlkm12"
(set [ for x in hostedType.GetNestedTypes() -> x.Name ])
(set ["ServiceTypes"])
let hostedServiceTypes = hostedType.GetNestedTypes().[0]
check "ceklc09wlkm12b" (hostedServiceTypes.GetMethods()) [| |]
check "ceklc09wlkm12c" (hostedServiceTypes.GetNestedTypes().Length) 28
let hostedSimpleDataContextTypes = hostedServiceTypes.GetNestedType("SimpleDataContextTypes")
check "ceklc09wlkm12d" (hostedSimpleDataContextTypes.GetMethods()) [| |]
check "ceklc09wlkm12e" (hostedSimpleDataContextTypes.GetNestedTypes().Length) 1
check "ceklc09wlkm12e" [ for x in hostedSimpleDataContextTypes.GetNestedTypes() -> x.Name] [expectedContextTypeName]
check "ceklc09wlkm12"
(set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ])
(set
(["Territory"; "Supplier"; "Summary_of_Sales_by_Year";
"Summary_of_Sales_by_Quarter"; "Shipper"; "Sales_Totals_by_Amount";
"Sales_by_Category"; "Region"; "Products_by_Category";
"Products_Above_Average_Price"; "Product_Sales_for_1997"; "Product";
"Orders_Qry"; "Order_Subtotal"; "Order_Details_Extended"; "Order_Detail";
"Order"; "Invoice"; "Employee"; "CustomerDemographic";
"Customer_and_Suppliers_by_City"; "Customer"; "Current_Product_List";
"Category_Sales_for_1997"; "Category"; "Alphabetical_list_of_product"; ] @
[expectedContextTypeName] @
[ "SimpleDataContextTypes"]))
let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Customer"))
check "ceklc09wlkm13" (customersType.GetProperties().Length) 15
let instantiateTypeProviderAndCheckOneHostedType(connectionStringName, configFile, useDataDirectory, dataDirectory, entityContainer: string option, localSchemaFile: string option, useForceUpdate: bool option, typeFullPath: string[]) =
let expectedContextTypeName = match entityContainer with None -> "EntityContainer" | Some s -> s
let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
test "cnlkenkewe" (File.Exists assemblyFile)
// If/when we care about the "target framework", this mock function will have to be fully implemented
let systemRuntimeContainsType s =
printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
true
let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
let invalidateEventCount = ref 0
typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
// Load a type provider instance for the type and restart
let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
let hostedType1 = hostedNamespace1.ResolveTypeName("SqlEntityConnection")
let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
check "eenewioinw2"
(set [ for i in hostedType1StaticParameters -> i.Name ])
(set ["ConnectionString"; "ConnectionStringName"; "ResolutionFolder"; "DataDirectory"; "ConfigFile"; "ForceUpdate"; "Provider"; "EntityContainer"; "LocalSchemaFile"; "Pluralize"; "SuppressForeignKeyProperties"] )
let northwind = "NORTHWND.mdf"
let northwindFile =
match dataDirectory with
| None -> northwind
| Some dd ->
if not(System.IO.Directory.Exists dd) then System.IO.Directory.CreateDirectory dd |> ignore
System.IO.Path.Combine(dd,northwind)
if not(System.IO.File.Exists(northwindFile)) then
System.IO.File.Copy("DB\\northwnd.mdf", northwindFile, false)
System.IO.File.SetAttributes(northwindFile, System.IO.FileAttributes.Normal)
let connectionString =
if useDataDirectory then
if isSQLExpressInstalled then
@"AttachDBFileName = '|DataDirectory|\" + northwind + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
else
"AttachDBFileName = '|DataDirectory|\\" + northwind + "';Server='(localdb)\\MSSQLLocalDB'"
else
if isSQLExpressInstalled then
@"AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
else
"AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='(localdb)\\MSSQLLocalDB'"
match connectionStringName with
| None -> ()
| Some connectionStringName ->
let configFileName = match configFile with None -> "app.config" | Some nm -> nm
System.IO.File.WriteAllText(configFileName,
sprintf """<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="%s"
connectionString="%s"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
"""
connectionStringName
connectionString)
let staticParameterValues =
[| for x in hostedType1StaticParameters ->
(match x.Name with
| "ConnectionString" when connectionStringName.IsNone -> box connectionString
| "ConnectionStringName" when connectionStringName.IsSome -> box connectionStringName.Value
| "DataDirectory" when dataDirectory.IsSome -> box dataDirectory.Value
| "ConfigFile" when configFile.IsSome -> box configFile.Value
| "Pluralize" -> box true
| "EntityContainer" when entityContainer.IsSome -> box entityContainer.Value
| "SuppressForeignKeyProperties" -> box false
| "LocalSchemaFile" when localSchemaFile.IsSome -> box localSchemaFile.Value
| "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
| _ -> box x.RawDefaultValue) |]
printfn "instantiating database type... may take a while for db to attach, code generation tool to run and csc.exe to run..."
try
let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
checkHostedType (expectedContextTypeName,hostedAppliedType1 )
with
| e ->
printfn "%s" (e.ToString())
reportFailure()
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, None, None, [| "SqlEntityConnectionApplied" |])
// Use an implied app.config config file, use the current directory as the DataDirectory
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString1", None, true, None, None, None, None, [| "SqlEntityConnectionApplied" |])
// Use a config file, use an explicit relative DataDirectory
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString2", Some "app.config", true, Some "DataDirectory", None, None, None, [| "SqlEntityConnectionApplied" |])
// Use an absolute config file, use an absoltue DataDirectory
instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString3", Some (__SOURCE_DIRECTORY__ + @"\test.config"), true, Some (__SOURCE_DIRECTORY__ + @"\DataDirectory"), None, None, None, [| "SqlEntityConnectionApplied" |])
let schemaFile2 = Path.Combine(__SOURCE_DIRECTORY__, "nwind2.ssdl")
(try File.Delete schemaFile2 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.ssdl")), Some true, [| "SqlEntityConnectionApplied" |])
// schemaFile2 should now exist
check "eoinew0c9e" (File.Exists schemaFile2)
// Reuse the SSDL just created
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.ssdl")), Some false, [| "SqlEntityConnectionApplied" |])
// schemaFile2 should now still exist
check "eoinew0c9e" (File.Exists schemaFile2)
// // A relative path should work....
// instantiateTypeProviderAndCheckOneHostedType(Some "nwind2.ssdl", Some false)
// // schemaFile2 should now still exist
// check "eoinew0c9e" (File.Exists schemaFile2)
let schemaFile3 = Path.Combine(__SOURCE_DIRECTORY__, "nwind3.ssdl")
(try File.Delete schemaFile3 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, Some schemaFile3, None, [| "SqlEntityConnectionApplied" |])
// schemaFile3 should now exist
check "eoinew0c9e" (File.Exists schemaFile3)
let schemaFile4 = Path.Combine(__SOURCE_DIRECTORY__, "nwind4.ssdl")
(try File.Delete schemaFile4 with _ -> ())
instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some "MyEntityContainer", Some schemaFile4, None, [| "SqlEntityConnectionApplied" |])
// schemaFile4 should now exist
check "eoinew0c9e" (File.Exists schemaFile4)
let _ =
if !failures then (stdout.WriteLine "Test Failed"; exit 1)
do (stdout.WriteLine "Test Passed";
File.WriteAllText("test.ok","ok");
exit 0)

Просмотреть файл

@ -1,8 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
call %~d0%~p0..\..\..\single-test-build.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,7 +0,0 @@
@if "%_echo%"=="" echo off
call %~d0%~p0..\..\..\single-test-run.bat
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,210 +0,0 @@
// #Conformance #TypeProviders #WsdlService
#r "FSharp.Data.TypeProviders.dll"
open Microsoft.FSharp.Core.CompilerServices
open System.IO
module Infrastructure =
let failures = ref false
let reportFailure () = stderr.WriteLine " NO"; failures := true
let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else reportFailure()
let check s v1 v2 = stderr.Write(s:string); if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A " v2 v1; reportFailure()
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then begin
let cultureString = argv.[2] in
let culture = new System.Globalization.CultureInfo(cultureString) in
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
end
do SetCulture()
[<AbstractClass>]
type WsdlServiceTest(serviceUri, prefix) =
let check caption a b = Infrastructure.check (prefix + caption) a b
let test caption v = Infrastructure.test (prefix + caption) v
abstract CheckHostedType: System.Type -> unit
member this.InstantiateTypeProviderAndPerformCheck(useLocalSchemaFile : string option, useForceUpdate : bool option, typeFullPath : string[], f) =
let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
test "cnlkenkewe" (File.Exists assemblyFile)
// If/when we care about the "target framework", this mock function will have to be fully implemented
let systemRuntimeContainsType s =
printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
true
let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=true, IsHostedExecution=true)
use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
let invalidateEventCount = ref 0
typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
// Load a type provider instance for the type and restart
let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
let hostedType1 = hostedNamespace1.ResolveTypeName("WsdlService")
let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
check "eenewioinw2"
(set [ for i in hostedType1StaticParameters -> i.Name ])
(set ["ServiceUri"; "LocalSchemaFile"; "ResolutionFolder"; "ForceUpdate"; "Serializable"; "MessageContract"; "EnableDataBinding"; "Async"; "CollectionType";])
let staticParameterValues =
[| for x in hostedType1StaticParameters ->
(match x.Name with
| "ServiceUri" -> box serviceUri
| "LocalSchemaFile" when useLocalSchemaFile.IsSome -> box useLocalSchemaFile.Value
| "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
| _ -> box x.RawDefaultValue) |]
for p in Seq.zip hostedType1StaticParameters staticParameterValues do
printfn "%A" p
printfn "instantiating service type... may take a while for WSDL service metadata to be downloaded, code generation tool to run and csc.exe to run..."
let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
this.CheckHostedType(hostedAppliedType1)
f()
member this.InstantiateTypeProviderAndCheckOneHostedType(useLocalSchemaFile: string option, useForceUpdate: bool option, typeFullPath: string[] ) =
this.InstantiateTypeProviderAndPerformCheck(useLocalSchemaFile, useForceUpdate, typeFullPath, ignore)
member this.Run() =
this.InstantiateTypeProviderAndCheckOneHostedType( None, None, [| "WsdlServiceApplied" |] )
let sfile = "sfile.wsdlschema"
let fullPath s = Path.Combine(__SOURCE_DIRECTORY__, s)
let schemaFile = fullPath sfile
(try File.Delete schemaFile with _ -> ())
this.InstantiateTypeProviderAndCheckOneHostedType(Some sfile, Some true, [| "WsdlServiceApplied" |])
// schemaFile should now exist
test "eoinew0c9e1" (File.Exists schemaFile)
let writeTime = File.GetLastWriteTime(schemaFile)
// Reuse the WsdlSchema just created
this.InstantiateTypeProviderAndCheckOneHostedType(Some sfile, Some false, [| "WsdlServiceApplied" |])
// schemaFile should still exist
test "eoinew0c9e" (File.Exists schemaFile)
check "LastWriteTime_1" (File.GetLastWriteTime(schemaFile)) writeTime
let sfile2 = "sfile2.wsdlschema"
let schemaFile2 = fullPath sfile2
(try File.Delete schemaFile2 with _ -> ())
let check() =
// schemaFile2 should now exist
test "eoinew0c9e" (File.Exists schemaFile2)
// rename schema file
let renamedFile = fullPath "renamed"
// delete existing file
try File.Delete renamedFile with _ -> ()
System.Threading.SpinWait.SpinUntil((fun () -> File.Exists(schemaFile2)), 10000)
|> ignore
test "SchemaFileExists" (File.Exists schemaFile2)
this.InstantiateTypeProviderAndPerformCheck(Some sfile2, Some false, [| "WsdlServiceApplied" |], check)
// corrupt source file
let initial = File.ReadAllText(sfile2)
let text = "123" + File.ReadAllText(sfile2)
File.WriteAllText(sfile2, text)
try
this.InstantiateTypeProviderAndPerformCheck(Some sfile2, Some false, [| "WsdlServiceApplied" |], check)
test "Exception_Expected" false
with
e -> ()
// read all text and verify that it was not overwritten
let newText = File.ReadAllText(sfile2)
test "FileWasNotChanged" (text = newText)
module CheckWsdlServiceTypeProvider =
let private prefix = "ceklc"
type SimpleWsdlTest() =
inherit WsdlServiceTest("http://api.microsofttranslator.com/V2/Soap.svc", prefix)
let check caption a b = Infrastructure.check (prefix + caption) a b
let test caption v = Infrastructure.test (prefix + caption) v
override this.CheckHostedType(hostedType) =
//let hostedType = hostedAppliedType1
test "09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
test "09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
check "09wlkm2" hostedType.DeclaringType null
check "09wlkm3" hostedType.DeclaringMethod null
check "09wlkm4" hostedType.FullName "WsdlService1.WsdlServiceApplied"
check "09wlkm5" (hostedType.GetConstructors()) [| |]
check "09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
check "09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
check "09wlkm7" (hostedType.GetEvents()) [| |]
check "09wlkm8" (hostedType.GetFields()) [| |]
check "09wlkm9" (hostedType.GetMethods() |> Array.map (fun m -> m.Name)) [| "GetBasicHttpBinding_LanguageService"; "GetBasicHttpBinding_LanguageService"|]
check "09wlkm10" (hostedType.GetProperties()) [| |]
check "09wlkm11"
(set [ for x in hostedType.GetNestedTypes() -> x.Name ])
(set ["ServiceTypes"] )
let serviceTypes = hostedType.GetNestedTypes().[0]
check "09wlkm11" (serviceTypes.GetNestedTypes().Length) 5
check "09wlkm12"
(set [ for x in serviceTypes.GetNestedTypes() -> x.Name ])
(set ["LanguageService"; "LanguageServiceChannel"; "LanguageServiceClient"; "Microsoft"; "SimpleDataContextTypes" ] )
let languageServiceType = (serviceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "LanguageService"))
check "09wlkm13" (languageServiceType.GetProperties().Length) 0
(new SimpleWsdlTest()).Run()
module CheckWsdlServiceTypeProviderXIgniteFutures =
let prefix = "qceklc"
type XIgniteWsdlTest() =
inherit WsdlServiceTest("http://www.xignite.com/xFutures.asmx?WSDL", prefix)
let prefix = "xignite"
let check caption a b = Infrastructure.check (prefix + caption) a b
let test caption v = Infrastructure.test (prefix + caption) v
override this.CheckHostedType (hostedType: System.Type) =
test "09wlkm1ad233" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
test "09wlkm1b2ed1" (hostedType.Assembly.FullName.StartsWith "tmp")
check "09wlkm2" hostedType.DeclaringType null
check "09wlkm3" hostedType.DeclaringMethod null
check "09wlkm4" hostedType.FullName "WsdlService1.WsdlServiceApplied"
check "09wlkm5" (hostedType.GetConstructors()) [| |]
check "09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
check "09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
check "09wlkm7" (hostedType.GetEvents()) [| |]
check "09wlkm8" (hostedType.GetFields()) [| |]
check "09wlkm9" (hostedType.GetMethods() |> Array.map (fun m -> m.Name)) [| "GetXigniteFuturesSoap"; "GetXigniteFuturesSoap"; "GetXigniteFuturesSoap12";"GetXigniteFuturesSoap12"|]
check "09wlkm10" (hostedType.GetProperties()) [| |]
let serviceTypes = hostedType.GetNestedTypes().[0]
check "09wlkm11a" (serviceTypes.GetNestedTypes().Length >= 1) true
check "09wlkm11b" (serviceTypes.GetNestedType("www") <> null) true
check "09wlkm11c" (serviceTypes.GetNestedType("www").GetNestedType("xignite") <> null) true
check "09wlkm11d" (serviceTypes.GetNestedType("www").GetNestedType("xignite").GetNestedType("com") <> null) true
check "09wlkm11e" (serviceTypes.GetNestedType("www").GetNestedType("xignite").GetNestedType("com").GetNestedType("services") <> null) true
check "09wlkm11f" (serviceTypes.GetNestedType("www").GetNestedType("xignite").GetNestedType("com").GetNestedType("services").GetNestedTypes().Length >= 1) true
check "09wlkm11g" [ for x in serviceTypes.GetNestedTypes() do if not x.IsNested && x.Namespace = null then yield x.Name ].Length 175
(new XIgniteWsdlTest()).Run()
let _ =
if !Infrastructure.failures then (stdout.WriteLine "Test Failed"; exit 1)
do (stdout.WriteLine "Test Passed";
File.WriteAllText("test.ok","ok");
exit 0)

Просмотреть файл

@ -1,28 +0,0 @@
REM == Find out OS architecture, no matter what cmd prompt
SET OSARCH=%PROCESSOR_ARCHITECTURE%
IF NOT "%PROCESSOR_ARCHITEW6432%"=="" SET OSARCH=%PROCESSOR_ARCHITEW6432%
REM == Find out path to native 'Program Files 32bit', no matter what
REM == architecture we are running on and no matter what command
REM == prompt we came from.
IF /I "%OSARCH%"=="x86" set X86_PROGRAMFILES=%ProgramFiles%
IF /I "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)%
REM == Set path to FSharp.Data.TypeProviders.dll
REM == This binary is frozen at 4.3.0.0 version
set FSDATATYPEPROVIDERSPATH=%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\Type Providers\FSharp.Data.TypeProviders.dll
IF EXIST "%FSCBinPath%\FSharp.Data.TypeProviders.dll" set FSDATATYPEPROVIDERSPATH=%FSCBinPath%\FSharp.Data.TypeProviders.dll
REM == Copy the FSharp.Data.TypeProvider.dll
REM == Note: we need this because we are doing white box testing
IF EXIST "%FSDATATYPEPROVIDERSPATH%" copy /y "%FSDATATYPEPROVIDERSPATH%" .
REM == Copy in config files with needed binding redirects
xcopy /RY "%~dp0test.exe.config" "%cd%\test.exe.config*"
xcopy /RY "%~dp0test.exe.config" "%cd%\testX64.exe.config*"
xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize.exe.config*"
xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize-lib.dll.config*"
xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize-client-of-lib.exe.config*"
xcopy /RY "%~dp0test.exe.config" "%cd%\test--optminus--debug.exe.config*"
xcopy /RY "%~dp0test.exe.config" "%cd%\test--optplus--debug.exe.config*"

Просмотреть файл

@ -1,71 +0,0 @@
module CopyFSharpDataTypeProviderDLL
open System
open System.IO
open NUnit.Framework
open FSharpTestSuiteTypes
open PlatformHelpers
open NUnitConf
let copy (cfg: TestConfig) (dir: string) = attempt {
let fileExists = Commands.fileExists dir >> Option.isSome
let getfullpath = Commands.getfullpath dir
let copy_y a = Commands.copy_y dir a >> checkResult
// REM == Find out OS architecture, no matter what cmd prompt
// SET OSARCH=%PROCESSOR_ARCHITECTURE%
// IF NOT "%PROCESSOR_ARCHITEW6432%"=="" SET OSARCH=%PROCESSOR_ARCHITEW6432%
let osArch = WindowsPlatform.osArch cfg.EnvironmentVariables
// REM == Find out path to native 'Program Files 32bit', no matter what
// REM == architecture we are running on and no matter what command
// REM == prompt we came from.
// IF /I "%OSARCH%"=="x86" set X86_PROGRAMFILES=%ProgramFiles%
// IF /I "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)%
let x86ProgramFiles = WindowsPlatform.x86ProgramFilesDirectory cfg.EnvironmentVariables osArch
// REM == Set path to FSharp.Data.TypeProviders.dll
// REM == This binary is frozen at 4.3.0.0 version
// set FSDATATYPEPROVIDERSPATH=%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\Type Providers\FSharp.Data.TypeProviders.dll
// IF EXIST "%FSCBinPath%\FSharp.Data.TypeProviders.dll" set FSDATATYPEPROVIDERSPATH=%FSCBinPath%\FSharp.Data.TypeProviders.dll
let FSDATATYPEPROVIDERSPATH =
if fileExists (cfg.FSCBinPath/"FSharp.Data.TypeProviders.dll")
then cfg.FSCBinPath/"FSharp.Data.TypeProviders.dll"
else x86ProgramFiles/"Reference Assemblies"/"Microsoft"/"FSharp"/".NETFramework"/"v4.0"/"4.3.0.0"/"Type Providers"/"FSharp.Data.TypeProviders.dll"
// REM == Copy the FSharp.Data.TypeProvider.dll
// REM == Note: we need this because we are doing white box testing
// IF EXIST "%FSDATATYPEPROVIDERSPATH%" copy /y "%FSDATATYPEPROVIDERSPATH%" .
do! if fileExists FSDATATYPEPROVIDERSPATH
then copy_y FSDATATYPEPROVIDERSPATH ("."/"FSharp.Data.TypeProviders.dll")
else Success ()
// REM == Copy in config files with needed binding redirects
let xcopy_ry a b =
let removeReadonly p =
let attr = File.GetAttributes(p)
File.SetAttributes(p, attr &&& (~~~ FileAttributes.ReadOnly))
if fileExists b then removeReadonly (getfullpath b)
copy_y a b
let ``test.exe.config`` = __SOURCE_DIRECTORY__/"test.exe.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\test.exe.config*"
do! xcopy_ry ``test.exe.config`` "test.exe.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\testX64.exe.config*"
do! xcopy_ry ``test.exe.config`` "testX64.exe.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize.exe.config*"
do! xcopy_ry ``test.exe.config`` "test--optimize.exe.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize-lib.dll.config*"
do! xcopy_ry ``test.exe.config`` "test--optimize-lib.dll.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize-client-of-lib.exe.config*"
do! xcopy_ry ``test.exe.config`` "test--optimize-client-of-lib.exe.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\test--optminus--debug.exe.config*"
do! xcopy_ry ``test.exe.config`` "test--optminus--debug.exe.config"
// xcopy /RY "%~dp0test.exe.config" "%cd%\test--optplus--debug.exe.config*"
do! xcopy_ry ``test.exe.config`` "test--optplus--debug.exe.config"
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше