diff --git a/.gitignore b/.gitignore index d3547270cc6..418b3677b36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,6 @@ -# Downloaded packages and build tools. -/lkg -/packages -/Tools +# output location +artifacts/ -/tests/scripts/current -/release -/debug -/Proto packages/ /tests/scripts/current @@ -88,9 +82,6 @@ lib/bootstrap/4.1/policy* obj/ bin/ aclocal.m4 -Debug -Release -Proto sign_temp .libs configure @@ -114,7 +105,6 @@ ossreadme*.txt *.cto *.vstman project.lock.json -Tools/ Backup/ tests/fsharp/core/array/dont.run.peverify tests/fsharp/core/innerpoly/dont.run.peverify @@ -123,7 +113,6 @@ times /tests/fsharpqa/testenv/bin/System.ValueTuple.dll source_link.json .vs/ -/VSRelease/net40/bin System.ValueTuple.dll tests/fsharpqa/testenv/bin/System.ValueTuple.dll */.fake diff --git a/.vsts-pr.yaml b/.vsts-pr.yaml index 37246474bf7..44c277a3943 100644 --- a/.vsts-pr.yaml +++ b/.vsts-pr.yaml @@ -17,7 +17,7 @@ jobs: - script: $(_command) $(_args) - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.SourcesDirectory)/tests/TestResults' + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults' ArtifactName: 'Linux $(_command) $(_args)' publishLocation: Container continueOnError: true @@ -26,7 +26,7 @@ jobs: - job: Windows pool: vmImage: vs2017-win2016 - timeoutInMinutes: 90 + timeoutInMinutes: 120 strategy: maxParallel: 7 matrix: @@ -55,7 +55,7 @@ jobs: - script: $(_command) $(_args) - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.SourcesDirectory)\tests\TestResults' + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults' ArtifactName: 'Windows $(_command) $(_args)' publishLocation: Container continueOnError: true diff --git a/.vsts-signed.yaml b/.vsts-signed.yaml index a628c4d9e6e..823ac20297a 100644 --- a/.vsts-signed.yaml +++ b/.vsts-signed.yaml @@ -36,7 +36,7 @@ jobs: displayName: Publish nightly package to MyGet inputs: scriptName: 'setup\publish-assets.ps1' - arguments: '-binariesPath $(BuildConfiguration) -branchName $(Build.SourceBranch) -apiKey $(FSharp.MyGetApiKey)' + arguments: '-binariesPath artifacts\bin -configuration $(BuildConfiguration) -branchName $(Build.SourceBranch) -apiKey $(FSharp.MyGetApiKey)' condition: and(succeeded(), contains(variables['PB_PublishType'], 'myget')) # Package publish @@ -50,12 +50,12 @@ jobs: displayName: Publish packages to Azure Blob Storage inputs: solution: PublishToBlob.proj - msbuildArguments: '/t:Build /p:Configuration=$(BuildConfiguration) /p:ExpectedFeedUrl=$(PB_PublishBlobFeedUrl) /p:AccountKey=$(PB_PublishBlobFeedKey) /p:ManifestRepouri=$(Build.Repository.Uri) /p:ManifestBranch=$(Build.SourceBranch) /p:ManifestCommit=$(Build.SourceVersion) /p:ManifestBuildId=$(Build.BuildNumber) /bl:$(Build.SourcesDirectory)/$(BuildConfiguration)/log/publish.binlog' + msbuildArguments: '/t:Build /p:Configuration=$(BuildConfiguration) /p:ExpectedFeedUrl=$(PB_PublishBlobFeedUrl) /p:AccountKey=$(PB_PublishBlobFeedKey) /p:ManifestRepouri=$(Build.Repository.Uri) /p:ManifestBranch=$(Build.SourceBranch) /p:ManifestCommit=$(Build.SourceVersion) /p:ManifestBuildId=$(Build.BuildNumber) /bl:$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/pub/publish.binlog' condition: and(succeeded(), contains(variables['PB_PublishType'], 'blob')) - task: PublishBuildArtifacts@1 displayName: Publish publishing bin log inputs: - PathtoPublish: '$(Build.SourcesDirectory)/$(BuildConfiguration)/log' + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/pub' ArtifactName: 'Publish_bin_log' publishLocation: Container continueOnError: true @@ -80,7 +80,7 @@ jobs: - task: PublishBuildArtifacts@1 displayName: Create static drop inputs: - PathtoPublish: '$(BuildConfiguration)' + PathtoPublish: 'artifacts' ArtifactName: '$(Build.BuildNumber)' publishLocation: FilePath TargetPath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)' @@ -94,7 +94,7 @@ jobs: inputs: SymbolsPath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols' SearchPattern: '**\*.dll;**\*.exe;**\*.pdb' - SymbolsFolder: '$(Build.SourcesDirectory)\$(BuildConfiguration)' + SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\SymStore' TreatNotIndexedAsWarning: true SymbolsProduct: '$(Build.DefinitionName)' SymbolsVersion: '$(Build.BuildNumber)' @@ -105,7 +105,7 @@ jobs: - task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1 displayName: Upload VSTS Drop inputs: - DropFolder: '$(Build.SourcesDirectory)\$(BuildConfiguration)\insertion' + DropFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\Insertion' condition: and(succeeded(), contains(variables['PB_PublishType'], 'vsts')) # Execute cleanup tasks @@ -127,7 +127,7 @@ jobs: displayName: Publish symbols to SymWeb inputs: symbolServiceURI: 'https://microsoft.artifacts.visualstudio.com/DefaultCollection' - sourcePath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols' + sourcePath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\SymStore' usePat: false condition: and(succeeded(), contains(variables['PB_PublishType'], 'symweb')) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index b1b0d00cbf5..f7a8531cd2d 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -167,12 +167,12 @@ components installed in that VS installation. You can revert this step by disab For **Debug**, uninstall then reinstall: VSIXInstaller.exe /u:"VisualFSharp" - VSIXInstaller.exe debug\net40\bin\VisualFSharpFull.vsix + VSIXInstaller.exe artifacts\bin\VisualFSharpFull\Debug\net46\VisualFSharpFull.vsix For **Release**, uninstall then reinstall: VSIXInstaller.exe /u:"VisualFSharp" - VSIXInstaller.exe release\net40\bin\VisualFSharpFull.vsix + VSIXInstaller.exe artifacts\bin\VisualFSharpFull\Release\net46\VisualFSharpFull.vsix Restart Visual Studio, it should now be running your freshly-built Visual F# IDE Tools with updated F# Interactive. @@ -237,7 +237,7 @@ If you change error messages you may need to update FSComp.fs in `src\buildfroms To do this, build the non-buildfromsource version of FSharp.Compiler.Private (src\fsharp\FSharp.Compiler.Private) then check its obj\ directory for `FSComp.fs` and manually copy that into the buildfromsource directory. .\build net40 - copy /y src\fsharp\FSharp.Compiler.Private\obj\release\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private\ + copy /y artifacts\obj\FSharp.Compiler.Private\Release\net46\FSComp.* src\buildfromsource\FSharp.Compiler.Private\ If your changes involve modifying the list of language keywords in any way, (e.g. when implementing a new keyword), the XLF localization files need to be synced with the corresponding resx files. This can be done automatically by running diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 81701799796..86f3e9d0974 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -10,9 +10,16 @@ Debug $(MSBuildThisFileDirectory) $(RepoRoot)src - $(RepoRoot)Tools - $(RepoRoot)Proto\net40\bin - $(RepoRoot)Proto\coreclr\bin + $(RepoRoot)artifacts + $(ArtifactsDir)\toolset + $(ArtifactsDir)\bin + $(ArtifactsDir)\obj + $(ArtifactsDir)\packages + $(ArtifactsBinDir)\$(MSBuildProjectName) + $(ArtifactsObjDir)\$(MSBuildProjectName) + $(ArtifactsDir)\SymStore + $(ArtifactsBinDir)\fsc\Proto\net472 + $(ArtifactsBinDir)/fsc/Proto/netcoreapp2.1 4.4.0 diff --git a/FSharpBuild.Directory.Build.targets b/FSharpBuild.Directory.Build.targets index 375416e5cf3..fa39d7498fd 100644 --- a/FSharpBuild.Directory.Build.targets +++ b/FSharpBuild.Directory.Build.targets @@ -34,42 +34,7 @@ - - - - - coreclr - net40 - $(MSBuildProjectDirectory)\$(OutputPath) - $(OutputPath) - $(RepoRoot)$(Configuration)\$(TargetDotnetProfile)\bin - $(RepoRoot)$(Configuration)\$(TargetDotnetProfile)\obj - - - - - - - - - - - - - - - - + diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index eb20065bec2..a8c6542570f 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -1,48 +1,43 @@ - - - <_FSharpCompilerPath>$(MSBuildThisFileDirectory)$(Configuration)/net40/bin - + true - $(_FSharpCompilerPath) + $(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\net472 fsc.exe - $(_FSharpCompilerPath) + $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\net472 fsi.exe - - - <_FSharpCompilerPath>$(MSBuildThisFileDirectory)$(Configuration)/coreclr/bin - + true - $(MSBuildThisFileDirectory)Tools/dotnet20 + + $(MSBuildThisFileDirectory)artifacts\toolset\dotnet dotnet.exe dotnet - $(_FSharpCompilerPath)/fsc.exe + $(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\netcoreapp2.1\fsc.exe - $(MSBuildThisFileDirectory)Tools/dotnet20 + $(MSBuildThisFileDirectory)artifacts\toolset\dotnet dotnet.exe dotnet - $(_FSharpCompilerPath)/fsi.exe + $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\netcoreapp2.1\fsi.exe - $(_FSharpCompilerPath)/Microsoft.FSharp.Targets - $(_FSharpCompilerPath)/Microsoft.FSharp.NetSdk.props - $(_FSharpCompilerPath)/Microsoft.FSharp.NetSdk.targets - $(_FSharpCompilerPath)/Microsoft.FSharp.Overrides.NetSdk.targets - + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net472 + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + $(_FSharpBuildBinPath)\FSharp.Build.dll - - - $(MSBuildThisFileDirectory)$(Configuration)\coreclr\bin\FSharp.Build.dll - $(MSBuildThisFileDirectory)$(Configuration)\net40\bin\FSharp.Build.dll + $(_FSharpBuildBinPath)/Microsoft.FSharp.Targets + $(_FSharpBuildBinPath)/Microsoft.FSharp.NetSdk.props + $(_FSharpBuildBinPath)/Microsoft.FSharp.NetSdk.targets + $(_FSharpBuildBinPath)/Microsoft.FSharp.Overrides.NetSdk.targets - \ No newline at end of file + + diff --git a/Makefile b/Makefile index 35db8f37561..dfb567b394b 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,29 @@ Configuration ?= release DotNetVersion = `cat DotnetCLIToolsVersion.txt` -DotNetExe = "$(CURDIR)/Tools/dotnet20/dotnet" +DotNetToolPath = $(CURDIR)/artifacts/toolset/dotnet +DotNetExe = "$(DotNetToolPath)/dotnet" all: proto restore build test tools: - $(CURDIR)/scripts/dotnet-install.sh --version $(DotNetVersion) --install-dir $(CURDIR)/Tools/dotnet20 + $(CURDIR)/scripts/dotnet-install.sh --version $(DotNetVersion) --install-dir "$(DotNetToolPath)" proto: tools $(DotNetExe) build-server shutdown $(DotNetExe) restore src/buildtools/buildtools.proj $(DotNetExe) restore src/fsharp/FSharp.Build/FSharp.Build.fsproj - $(DotNetExe) restore src/fsharp/Fsc/Fsc.fsproj + $(DotNetExe) restore src/fsharp/fsc/fsc.fsproj $(DotNetExe) build src/buildtools/buildtools.proj -c Proto $(DotNetExe) build src/fsharp/FSharp.Build/FSharp.Build.fsproj -f netstandard2.0 -c Proto - $(DotNetExe) build src/fsharp/Fsc/Fsc.fsproj -f netcoreapp2.1 -c Proto + $(DotNetExe) build src/fsharp/fsc/fsc.fsproj -f netcoreapp2.1 -c Proto restore: $(DotNetExe) restore src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) restore src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) restore src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj - $(DotNetExe) restore src/fsharp/Fsc/Fsc.fsproj + $(DotNetExe) restore src/fsharp/fsc/fsc.fsproj $(DotNetExe) restore src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj - $(DotNetExe) restore src/fsharp/fsi/Fsi.fsproj + $(DotNetExe) restore src/fsharp/fsi/fsi.fsproj $(DotNetExe) restore tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj $(DotNetExe) restore tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj @@ -31,17 +32,15 @@ build: proto restore $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj - $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/Fsc/Fsc.fsproj + $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsc/fsc.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj - $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 src/fsharp/fsi/Fsi.fsproj + $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsi/fsi.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj test: build - $(DotNetExe) test -f netcoreapp2.0 -c $(Configuration) --no-restore --no-build tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Core.UnitTests.coreclr.trx" - $(DotNetExe) test -f netcoreapp2.0 -c $(Configuration) --no-restore --no-build tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Build.UnitTests.coreclr.trx" + $(DotNetExe) test -f netcoreapp2.1 -c $(Configuration) --no-restore --no-build tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Core.UnitTests.coreclr.trx" + $(DotNetExe) test -f netcoreapp2.1 -c $(Configuration) --no-restore --no-build tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Build.UnitTests.coreclr.trx" clean: - rm -rf $(CURDIR)/Proto - rm -rf $(CURDIR)/debug - rm -rf $(CURDIR)/release + rm -rf $(CURDIR)/artifacts diff --git a/PublishToBlob.proj b/PublishToBlob.proj index 5a81152646e..21e8ec6eb6f 100644 --- a/PublishToBlob.proj +++ b/PublishToBlob.proj @@ -17,7 +17,7 @@ - + diff --git a/artifacts/.gitignore b/artifacts/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/artifacts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/build-nuget-packages.proj b/build-nuget-packages.proj index 37a64ed6535..8b279bd8a19 100644 --- a/build-nuget-packages.proj +++ b/build-nuget-packages.proj @@ -3,6 +3,7 @@ + diff --git a/build.cmd b/build.cmd index cb29c798639..84b8390cfb7 100644 --- a/build.cmd +++ b/build.cmd @@ -1,6 +1,5 @@ rem Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. @if "%_echo%"=="" echo off - setlocal enableDelayedExpansion :ARGUMENTS_VALIDATION @@ -63,9 +62,10 @@ set BUILD_CORECLR=0 set BUILD_FROMSOURCE=0 set BUILD_VS=0 set BUILD_FCS=0 -set BUILD_CONFIG=release +set BUILD_CONFIG=Release set BUILD_DIAG= set BUILD_PUBLICSIGN=0 +set BUILD_FSHARP_PROJ=1 set TEST_NET40_COMPILERUNIT_SUITE=0 set TEST_NET40_COREUNIT_SUITE=0 @@ -162,7 +162,6 @@ if /i "%ARG%" == "net40" ( if /i "%ARG%" == "coreclr" ( set _autoselect=0 - set BUILD_PROTO_WITH_CORECLR_LKG=1 set BUILD_CORECLR=1 set BUILD_FROMSOURCE=1 ) @@ -228,8 +227,8 @@ if /i "%ARG%" == "microbuild" ( set CI=1 REM redirecting TEMP directories - set TEMP=%~dp0%BUILD_CONFIG%\TEMP - set TMP=%~dp0%BUILD_CONFIG%\TEMP + set TEMP=%~dp0artifacts\tmp + set TMP=%~dp0artifacts\tmp ) if /i "%ARG%" == "nuget" ( @@ -237,7 +236,7 @@ if /i "%ARG%" == "nuget" ( set BUILD_PROTO=1 set BUILD_NET40_FSHARP_CORE=1 - set BUILD_PROTO_WITH_CORECLR_LKG=1 + set BUILD_NET40=1 set BUILD_CORECLR=1 set BUILD_NUGET=1 ) @@ -319,11 +318,11 @@ if /i "%ARG%" == "diag" ( ) if /i "%ARG%" == "debug" ( - set BUILD_CONFIG=debug + set BUILD_CONFIG=Debug ) if /i "%ARG%" == "release" ( - set BUILD_CONFIG=release + set BUILD_CONFIG=Release ) if /i "%ARG%" == "test-sign" ( @@ -464,10 +463,15 @@ if /i "%TEST_NET40_FSHARP_SUITE" == "1" ( ) rem Decide if Proto need building -if NOT EXIST Proto\net40\bin\fsc.exe ( +if NOT EXIST "%~dp0artifacts\bin\fsc\Proto\net472\fsc.exe" ( set BUILD_PROTO=1 ) +rem decide if FSharp.Proj needs building +if "%BUILD_NET40%"=="0" if "%BUILD_NET40_FSHARP_CORE%"=="0" if "%BUILD_CORECLR%"=="0" if "%BUILD_VS%"=="0" if "%BUILD_FCS%"=="0" if "%TEST_NET40_COMPILERUNIT_SUITE%"=="0" if "%TEST_NET40_COREUNIT_SUITE%"=="0" if "%TEST_NET40_FSHARP_SUITE%"=="0" if "%TEST_NET40_FSHARPQA_SUITE%"=="0" if "%TEST_CORECLR_COREUNIT_SUITE%"=="0" if "%TEST_CORECLR_FSHARP_SUITE%"=="0" if "%TEST_VS_IDEUNIT_SUITE%"=="0" if "%TEST_FCS%"=="0" if "%TEST_END_2_END%"=="0" if "%COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES%"=="0" ( + set BUILD_FSHARP_PROJ=0 +) + rem rem This stops the dotnet cli from hunting around and rem finding the highest possible dotnet sdk version to use. @@ -483,7 +487,6 @@ echo BUILD_PROTO_WITH_CORECLR_LKG=%BUILD_PROTO_WITH_CORECLR_LKG% echo BUILD_NET40=%BUILD_NET40% echo BUILD_NET40_FSHARP_CORE=%BUILD_NET40_FSHARP_CORE% echo BUILD_CORECLR=%BUILD_CORECLR% -echo BUILD_FROMSOURCE=%BUILD_FROMSOURCE% echo BUILD_VS=%BUILD_VS% echo BUILD_FCS=%BUILD_FCS% echo BUILD_SETUP=%BUILD_SETUP% @@ -491,6 +494,8 @@ echo BUILD_NUGET=%BUILD_NUGET% echo BUILD_CONFIG=%BUILD_CONFIG% echo BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% echo BUILD_MICROBUILD=%BUILD_MICROBUILD% +echo BUILD_FROMSOURCE=%BUILD_FROMSOURCE% +echo BUILD_FSHARP_PROJ=%BUILD_FSHARP_PROJ% echo. echo PB_SKIPTESTS=%PB_SKIPTESTS% echo PB_RESTORESOURCE=%PB_RESTORESOURCE% @@ -610,13 +615,13 @@ echo ---------------- Done with prepare, starting package restore -------------- :: Restore the Tools directory call "%~dp0init-tools.cmd" -set _dotnetexe=%~dp0Tools\dotnet20\dotnet.exe -set path=%~dp0Tools\dotnet20\;%path% +set _dotnetexe=%~dp0artifacts\toolset\dotnet\dotnet.exe +set path=%~dp0artifacts\toolset\dotnet;%path% if not "%PB_PackageVersionPropsUrl%" == "" ( echo ----------- do dependency uptake check ----------- - set dependencyUptakeDir=%~dp0Tools\dependencyUptake + set dependencyUptakeDir=%~dp0artifacts\dependencyUptake if not exist "!dependencyUptakeDir!" mkdir "!dependencyUptakeDir!" :: download package version overrides @@ -643,31 +648,31 @@ if "%BUILD_PROTO_WITH_CORECLR_LKG%" == "1" ( ) echo ---------------- Done with package restore, starting proto ------------------------ -set logdir=%~dp0%BUILD_CONFIG%\logs +set logdir=%~dp0artifacts\log\%BUILD_CONFIG% if not exist "!logdir!" mkdir "!logdir!" rem Build Proto if "%BUILD_PROTO%" == "1" ( - rmdir /s /q Proto + rmdir /s /q artifacts/bin/fsc/Proto - echo %_msbuildexe% proto.proj /t:Restore /bl:%~dp0Proto\proto.proj.restore.binlog - %_msbuildexe% proto.proj /t:Restore /bl:%~dp0Proto\proto.proj.restore.binlog + echo %_msbuildexe% proto.proj /t:Restore /bl:%~dp0artifacts\log\Proto\proto.proj.restore.binlog + %_msbuildexe% proto.proj /t:Restore /bl:%~dp0artifacts\log\Proto\proto.proj.restore.binlog @if ERRORLEVEL 1 echo Error restoring proto failed && goto :failure - echo %_msbuildexe% proto.proj /t:Build /bl:%~dp0Proto\proto.proj.build.binlog - %_msbuildexe% proto.proj /t:Build /bl:%~dp0Proto\proto.proj.build.binlog + echo %_msbuildexe% proto.proj /t:Build /bl:%~dp0artifacts\log\Proto\proto.proj.build.binlog + %_msbuildexe% proto.proj /t:Build /bl:%~dp0artifacts\log\Proto\proto.proj.build.binlog @if ERRORLEVEL 1 echo Error building proto failed && goto :failure ) echo ---------------- Done with SDK restore, starting build ------------------------ -if "%BUILD_PHASE%" == "1" ( +if "%BUILD_PHASE%" == "1" if "%BUILD_FSHARP_PROJ%" == "1" ( - echo %_msbuildexe% fsharp.proj /t:Restore /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.restore.binlog - %_msbuildexe% fsharp.proj /t:Restore /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.restore.binlog + echo %_dotnetexe% restore fsharp.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\fsharp.proj.restore.binlog + %_dotnetexe% restore fsharp.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\fsharp.proj.restore.binlog - echo %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.build.binlog - %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.build.binlog + echo %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:!logdir!\fsharp.proj.build.binlog + %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:!logdir!\fsharp.proj.build.binlog @if ERRORLEVEL 1 echo Error build failed && goto :failure ) @@ -677,8 +682,8 @@ set asmvercheckpath=%~dp0tests\fsharpqa\testenv\src\AssemblyVersionCheck if "%BUILD_NET40%" == "1" ( echo #r @"%USERPROFILE%\.nuget\packages\Newtonsoft.Json\9.0.1\lib\net45\Newtonsoft.Json.dll">%asmvercheckpath%\assemblies.fsx - echo "%~dp0%BUILD_CONFIG%\net40\bin\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0%BUILD_CONFIG%" - "%~dp0%BUILD_CONFIG%\net40\bin\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0%BUILD_CONFIG%" + echo "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net472\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts" + "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net472\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts" if ERRORLEVEL 1 echo Error verifying assembly versions and commit hashes. && goto :failure ) @@ -688,56 +693,46 @@ if not "%SIGN_TYPE%" == "" ( echo %_msbuildexe% build\projects\Signing.proj /t:Restore %_msbuildexe% build\projects\Signing.proj /t:Restore - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) echo ---------------- Done with assembly signing, start package creation --------------- -echo %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog - %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog +echo %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:!logdir!\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog + %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:!logdir!\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog if ERRORLEVEL 1 echo Error building NuGet packages && goto :failure if not "%SIGN_TYPE%" == "" ( - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasepath=%~dp0artifacts\packages\%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasepath=%~dp0artifacts\packages\%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) if "%BUILD_SETUP%" == "1" ( - echo %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog - %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog + echo %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog + %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog if ERRORLEVEL 1 echo Error building insertion packages && goto :failure ) if not "%SIGN_TYPE%" == "" ( - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasepath=%~dp0artifacts\VSSetup\%BUILD_CONFIG%\Insertion /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts\VSSetup\%BUILD_CONFIG%\Insertion /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) echo ---------------- Done with signing, building insertion files --------------- if "%BUILD_SETUP%" == "1" ( - echo %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog - %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog + echo %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog + %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog if ERRORLEVEL 1 echo Error building .vsmanproj && goto :failure ) echo ---------------- Done building insertion files, starting pack/update/prepare --------------- -if "%BUILD_NET40_FSHARP_CORE%" == "1" ( - echo ---------------- start update.cmd --------------- - call src\update.cmd %BUILD_CONFIG% -ngen -) - -if "%COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES%" == "1" ( - echo ---------------- copy fscomp resource for build from sources --------------- - copy /y src\fsharp\FSharp.Compiler.Private\obj\%BUILD_CONFIG%\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private -) - set X86_PROGRAMFILES=%ProgramFiles% if "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)% @@ -783,21 +778,19 @@ if not exist "%link_exe%" ( if /I not "%single_threaded%" == "true" (set PARALLEL_ARG=-procs:%NUMBER_OF_PROCESSORS%) else set PARALLEL_ARG=-procs:0 -set FSCBINPATH=%~dp0%BUILD_CONFIG%\net40\bin -set RESULTSDIR=%~dp0tests\TestResults -if not exist "%RESULTSDIR%" (mkdir "%RESULTSDIR%") +set FSCBINPATH=%~dp0artifacts\bin\fsc\%BUILD_CONFIG%\net472 ECHO FSCBINPATH=%FSCBINPATH% -ECHO RESULTSDIR=%RESULTSDIR% ECHO link_exe=%link_exe% REM ---------------- test-net40-fsharp ----------------------- +set TESTLOGDIR=%~dp0artifacts\TestResults\%BUILD_CONFIG% if "%TEST_NET40_FSHARP_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Tests.FSharpSuite.net40.trx - echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" - "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" + set LOGFILE=%TESTLOGDIR%\FSharp.Tests.FSharpSuite_net472.trx + echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo -------------------------------------------------------------- @@ -805,15 +798,22 @@ if "%TEST_NET40_FSHARP_SUITE%" == "1" ( echo -------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- test-fcs ----------------------- if "%TEST_FCS%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Compiler.Service.Tests.net40.trx - echo "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" - "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" + set LOGFILE=%TESTLOGDIR%\FSharp.Compiler.Service.Tests_net46.trx + echo "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo -------------------------------------------------------------- @@ -822,7 +822,14 @@ if "%TEST_FCS%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\FSharp.Compiler.Service.Tests.coreclr.trx + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\FSharp.Compiler.Service.Tests_netcoreapp2.0.trx echo "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" @@ -832,6 +839,13 @@ if "%TEST_FCS%" == "1" ( echo -------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- end2end ----------------------- @@ -867,6 +881,7 @@ if "%TEST_NET40_FSHARPQA_SUITE%" == "1" ( set perlexe=%USERPROFILE%\.nuget\packages\StrawberryPerl64\5.22.2.1\Tools\perl\bin\perl.exe if not exist !perlexe! (echo Error: perl was not downloaded from check the packages directory: !perlexe! && goto :failure ) + set RESULTSDIR=%~dp0artifacts\TestResults\%BUILD_CONFIG% set OUTPUTFILE=test-net40-fsharpqa-results.log set ERRORFILE=test-net40-fsharpqa-errors.log set FAILENV=test-net40-fsharpqa-errors @@ -877,9 +892,10 @@ if "%TEST_NET40_FSHARPQA_SUITE%" == "1" ( popd if ERRORLEVEL 1 ( - type "%RESULTSDIR%\!OUTPUTFILE!" echo ----------------------------------------------------------------- - type "%RESULTSDIR%\!ERRORFILE!" + type "!RESULTSDIR!\!OUTPUTFILE!" + echo ----------------------------------------------------------------- + type "!RESULTSDIR!\!ERRORFILE!" echo ----------------------------------------------------------------- echo Error: Running tests net40-fsharpqa failed, see logs above -- FAILED echo ----------------------------------------------------------------- @@ -891,7 +907,7 @@ REM ---------------- net40-compilerunit ----------------------- if "%TEST_NET40_COMPILERUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Compiler.UnitTests.net40.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Compiler.UnitTests_net472.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" @@ -902,7 +918,14 @@ if "%TEST_NET40_COMPILERUNIT_SUITE%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\FSharp.Build.UnitTests.net40.trx + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\FSharp.Build.UnitTests_net472.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" @@ -912,13 +935,20 @@ if "%TEST_NET40_COMPILERUNIT_SUITE%" == "1" ( echo ----------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- net40-coreunit ----------------------- if "%TEST_NET40_COREUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Core.UnitTests.net40.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Core.UnitTests_net472.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" @@ -928,13 +958,20 @@ if "%TEST_NET40_COREUNIT_SUITE%" == "1" ( echo ----------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- coreclr-coreunit ----------------------- if "%TEST_CORECLR_COREUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Build.UnitTests.coreclr.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Build.UnitTests_netcoreapp2.0.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" @@ -945,7 +982,14 @@ if "%TEST_CORECLR_COREUNIT_SUITE%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\FSharp.Core.UnitTests.coreclr.trx + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\FSharp.Core.UnitTests_netcoreapp2.0.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" @@ -955,14 +999,21 @@ if "%TEST_CORECLR_COREUNIT_SUITE%" == "1" ( echo ------------------------------------------------------------------ goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- coreclr-fsharp ----------------------- if "%TEST_CORECLR_FSHARP_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Tests.FSharpSuite.coreclr.trx - echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\coreclr\bin" - "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\coreclr\bin" + set LOGFILE=%TESTLOGDIR%\FSharp.Tests.FSharpSuite_netcoreapp2.0.trx + echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo ---------------------------------------------------------------- @@ -970,12 +1021,19 @@ if "%TEST_CORECLR_FSHARP_SUITE%" == "1" ( echo ---------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- vs-ideunit ----------------------- if "%TEST_VS_IDEUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\GetTypesVSUnitTests.net40.trx + set LOGFILE=%TESTLOGDIR%\GetTypesVSUnitTests_net472.trx echo "%_dotnetexe%" test "%~dp0vsintegration\tests\GetTypesVSUnitTests\GetTypesVSUnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0vsintegration\tests\GetTypesVSUnitTests\GetTypesVSUnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" @@ -986,21 +1044,36 @@ if "%TEST_VS_IDEUNIT_SUITE%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\VisualFSharp.UnitTests.net40.trx - echo "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" - "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\VisualFSharp.UnitTests_net472.trx + echo "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net472 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo ------------------------------------------------------------ echo Error: Running tests vs-ideunit failed, see file `!LOGFILE!` echo ------------------------------------------------------------ goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) goto :success REM ------ exit ------------------------------------- :failure endlocal +@echo exit /b 1 :success diff --git a/build/config/AssemblySignToolData.json b/build/config/AssemblySignToolData.json index 6857a57f0dd..55163cb5b14 100644 --- a/build/config/AssemblySignToolData.json +++ b/build/config/AssemblySignToolData.json @@ -4,55 +4,45 @@ "certificate": "Microsoft", "strongName": "StrongName", "values": [ - "net40\\bin\\FSharp.Core.dll", - "net40\\bin\\*\\FSharp.Core.resources.dll", - "net40\\bin\\FSharp.Build.dll", - "net40\\bin\\*\\FSharp.Build.resources.dll", - "net40\\bin\\FSharp.Compiler.Private.dll", - "net40\\bin\\*\\FSharp.Compiler.Private.resources.dll", - "net40\\bin\\FSharp.Compiler.Server.Shared.dll", - "net40\\bin\\FSharp.Compiler.Interactive.Settings.dll", - "net40\\bin\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", - "net40\\bin\\fsc.exe", - "net40\\bin\\fsi.exe", - "net40\\bin\\fsiAnyCpu.exe", - "net40\\bin\\FSharp.VS.FSI.dll", - "net40\\bin\\*\\FSharp.VS.FSI.resources.dll", - "net40\\bin\\FSharp.LanguageService.Base.dll", - "net40\\bin\\*\\FSharp.LanguageService.Base.resources.dll", - "net40\\bin\\FSharp.LanguageService.dll", - "net40\\bin\\*\\FSharp.LanguageService.resources.dll", - "net40\\bin\\FSharp.UIResources.dll", - "net40\\bin\\*\\FSharp.UIResources.resources.dll", - "net40\\bin\\FSharp.Editor.dll", - "net40\\bin\\*\\FSharp.Editor.resources.dll", - "net40\\bin\\FSharp.ProjectSystem.Base.dll", - "net40\\bin\\*\\FSharp.ProjectSystem.Base.resources.dll", - "net40\\bin\\FSharp.ProjectSystem.PropertyPages.dll", - "net40\\bin\\*\\FSharp.ProjectSystem.PropertyPages.resources.dll", - "net40\\bin\\FSharp.ProjectSystem.FSharp.dll", - "net40\\bin\\*\\FSharp.ProjectSystem.FSharp.resources.dll", - "net40\\bin\\FSharp.PatternMatcher.dll", - "coreclr\\bin\\FSharp.Core.dll", - "coreclr\\bin\\*\\FSharp.Core.resources.dll", - "coreclr\\bin\\FSharp.Build.dll", - "coreclr\\bin\\*\\FSharp.Build.resources.dll", - "coreclr\\bin\\FSharp.Compiler.Private.dll", - "coreclr\\bin\\*\\FSharp.Compiler.Private.resources.dll", - "coreclr\\bin\\FSharp.Compiler.Interactive.Settings.dll", - "coreclr\\bin\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", - "coreclr\\bin\\fsc.exe", - "coreclr\\bin\\fsi.exe" + "bin\\FSharp.Core\\*\\*\\FSharp.Core.dll", + "bin\\FSharp.Core\\*\\*\\*\\FSharp.Core.resources.dll", + "bin\\FSharp.Build\\*\\*\\FSharp.Build.dll", + "bin\\FSharp.Build\\*\\*\\*\\FSharp.Build.resources.dll", + "bin\\FSharp.Compiler.Private\\*\\*\\FSharp.Compiler.Private.dll", + "bin\\FSharp.Compiler.Private\\*\\*\\*\\FSharp.Compiler.Private.resources.dll", + "bin\\FSharp.Compiler.Server.Shared\\*\\*\\FSharp.Compiler.Server.Shared.dll", + "bin\\FSharp.Compiler.Interactive.Settings\\*\\*\\FSharp.Compiler.Interactive.Settings.dll", + "bin\\FSharp.Compiler.Interactive.Settings\\*\\*\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", + "bin\\fsc\\*\\*\\fsc.exe", + "bin\\fsi\\*\\*\\fsi.exe", + "bin\\fsiAnyCpu\\*\\*\\fsiAnyCpu.exe", + "bin\\FSharp.VS.FSI\\*\\*\\FSharp.VS.FSI.dll", + "bin\\FSharp.VS.FSI\\*\\*\\*\\FSharp.VS.FSI.resources.dll", + "bin\\FSharp.LanguageService.Base\\*\\*\\FSharp.LanguageService.Base.dll", + "bin\\FSharp.LanguageService.Base\\*\\*\\*\\FSharp.LanguageService.Base.resources.dll", + "bin\\FSharp.LanguageService\\*\\*\\FSharp.LanguageService.dll", + "bin\\FSharp.LanguageService\\*\\*\\*\\FSharp.LanguageService.resources.dll", + "bin\\FSharp.UIResources\\*\\*\\FSharp.UIResources.dll", + "bin\\FSharp.UIResources\\*\\*\\*\\FSharp.UIResources.resources.dll", + "bin\\FSharp.Editor\\*\\*\\FSharp.Editor.dll", + "bin\\FSharp.Editor\\*\\*\\*\\FSharp.Editor.resources.dll", + "bin\\FSharp.PatternMatcher\\*\\*\\FSharp.PatternMatcher.dll", + "bin\\FSharp.PropertiesPages\\*\\*\\FSharp.ProjectSystem.PropertyPages.dll", + "bin\\FSharp.PropertiesPages\\*\\*\\*\\FSharp.ProjectSystem.PropertyPages.resources.dll", + "bin\\ProjectSystem\\*\\*\\FSharp.ProjectSystem.FSharp.dll", + "bin\\ProjectSystem\\*\\*\\*\\FSharp.ProjectSystem.FSharp.resources.dll", + "bin\\ProjectSystem.Base\\*\\*\\FSharp.ProjectSystem.Base.dll", + "bin\\ProjectSystem.Base\\*\\*\\*\\FSharp.ProjectSystem.Base.resources.dll" ] }, { "certificate": "VsixSHA2", "strongName": null, "values": [ - "net40\\bin\\VisualFSharpFull.vsix", - "net40\\bin\\VisualFSharpTemplate.vsix", - "insertion\\Microsoft.FSharp.Dependencies.vsix", - "insertion\\Microsoft.FSharp.VSIX.Full.Resources.*.vsix" + "bin\\VisualFSharpFull\\*\\*VisualFSharpFull.vsix", + "bin\\VisualFSharpTemplates\\*\\*\\VisualFSharpTemplate.vsix", + "VSSetup\\*\\Insertion\\Microsoft.FSharp.Dependencies.vsix", + "VSSetup\\*\\Insertion\\Microsoft.FSharp.VSIX.Full.Resources.*.vsix" ] } ], diff --git a/build/config/InsertionSignToolData.json b/build/config/InsertionSignToolData.json index ec8432ca9ad..d81579b12c9 100644 --- a/build/config/InsertionSignToolData.json +++ b/build/config/InsertionSignToolData.json @@ -4,11 +4,11 @@ "certificate": "VsixSHA2", "strongName": null, "values": [ - "insertion\\Microsoft.FSharp.Compiler.vsix", - "insertion\\Microsoft.FSharp.Compiler.Resources.*.vsix", - "insertion\\Microsoft.FSharp.Dependencies.vsix", - "insertion\\Microsoft.FSharp.IDE.vsix", - "insertion\\Microsoft.FSharp.SDK.vsix" + "Microsoft.FSharp.Compiler.vsix", + "Microsoft.FSharp.Compiler.Resources.*.vsix", + "Microsoft.FSharp.Dependencies.vsix", + "Microsoft.FSharp.IDE.vsix", + "Microsoft.FSharp.SDK.vsix" ] } ], diff --git a/build/config/PackageSignToolData.json b/build/config/PackageSignToolData.json index 20007f59e36..5bc74386355 100644 --- a/build/config/PackageSignToolData.json +++ b/build/config/PackageSignToolData.json @@ -4,8 +4,7 @@ "certificate": "NuGet", "strongName": null, "values": [ - "artifacts\\*.nupkg", - "artifacts\\*\\*.nupkg" + "*.nupkg" ] } ], diff --git a/build/projects/Signing.proj b/build/projects/Signing.proj index 4999fb6d085..9e981e135ec 100644 --- a/build/projects/Signing.proj +++ b/build/projects/Signing.proj @@ -3,7 +3,6 @@ net46 - $(RepoRoot)$(Configuration) $(NuGetPackageRoot)RoslynTools.SignTool\$(RoslynToolsSignToolPackageVersion)\tools\SignTool.exe -msbuildPath "$(MSBuildBinPath)\msbuild.exe" -nugetPackagesPath "$(NuGetPackageRoot.TrimEnd('\'))" -config "$(ConfigFile)" -testSign $(SignToolArgs) @@ -17,11 +16,12 @@ + - + diff --git a/build/targets/AssemblyVersions.props b/build/targets/AssemblyVersions.props index 3e8a9118359..8041d019ad4 100644 --- a/build/targets/AssemblyVersions.props +++ b/build/targets/AssemblyVersions.props @@ -30,7 +30,7 @@ $(FSPackageVersion).0 16 - 0 + 1 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0.0 diff --git a/build/targets/ConvertPortablePdbs.targets b/build/targets/ConvertPortablePdbs.targets index 474fe091a5d..c43042a499e 100644 --- a/build/targets/ConvertPortablePdbs.targets +++ b/build/targets/ConvertPortablePdbs.targets @@ -6,20 +6,33 @@ - $(FinalOutputPath)\ConvertedPdbs $(NuGetPackageRoot)Pdb2Pdb\$(Pdb2PdbPackageVersion)\tools\Pdb2Pdb.exe - "$(TargetPath)" /out "$(ConvertedPdbsDirectory)\$(TargetName).pdb" /srcsvrvar SRC_INDEX=public + "$(TargetPath)" /out "$(SymStoreDirectory)\$(TargetName).pdb" /srcsvrvar SRC_INDEX=public - + + + + $(TargetDir)\$(TargetName).pdb + + + + + + diff --git a/build/targets/GenerateAssemblyAttributes.targets b/build/targets/GenerateAssemblyAttributes.targets index 1be6bdb8315..7b747c9dd92 100644 --- a/build/targets/GenerateAssemblyAttributes.targets +++ b/build/targets/GenerateAssemblyAttributes.targets @@ -82,8 +82,7 @@ Inputs="$(MSBuildThisFileFullPath);$(MSBuildProjectFile)" Outputs="$(GeneratedFSharpAssemblyVersionFile)" DependsOnTargets="PrepareGenerateAssemblyFileVersion;PrepareForBuild" - BeforeTargets="CoreCompile" - Condition="'$(Configuration)' != 'Proto'"> + BeforeTargets="CoreCompile"> + + + + $(windir)\Microsoft.NET\Framework64\v4.0.30319\ngen.exe + $(windir)\Microsoft.NET\Framework\v4.0.30319\ngen.exe + + + + + + + + + + + + + + + + true + false + + + + diff --git a/build/targets/PackageVersions.props b/build/targets/PackageVersions.props index e4c29f52e87..97165c5feeb 100644 --- a/build/targets/PackageVersions.props +++ b/build/targets/PackageVersions.props @@ -19,7 +19,7 @@ $(PB_RestoreSource);$(RestoreSources) - $(MSBuildThisFileDirectory)..\..\Tools\dependencyUptake\PackageVersions.props + $(MSBuildThisFileDirectory)..\..\artifacts\dependencyUptake\PackageVersions.props $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\..\RoslynPackageVersion.txt').Trim()) @@ -133,9 +133,9 @@ 1.0.0 4.3.0 9.0.1 - 3.10.1 - 3.10.0 - 3.10.1 + 3.11.0 + 3.11.2 + 3.11.0 1.0.0-beta2-dev3 5.22.2.1 0.2.0-beta-000081 diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index cdcbdd4b8b3..6535dbd2aea 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -4,17 +4,19 @@ $(HOME)/.nuget/packages/ $(NuGetPackageRoot)\ $(NuGetPackageRoot)/ + $(MSBuildThisFileDirectory)..\artifacts + $(ArtifactsDir)\bin + $(ArtifactsDir)\obj + $(ArtifactsBinDir)\fcs + $(ArtifactsObjDir)\fcs - $(MSBuildThisFileDirectory)..\Proto\net40\bin + $(ArtifactsBinDir)\FSharp.Build\Proto\net46 - $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets diff --git a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj index 5e5c306711f..4f57056e404 100644 --- a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj +++ b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj @@ -7,7 +7,6 @@ net45 true - ..\..\$(Configuration.ToLower())\fcs $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT diff --git a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj index 486b2483294..5bbb337e36a 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj +++ b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj @@ -1,13 +1,9 @@  - - $(MSBuildProjectDirectory)\..\..\src - net45 true - ..\..\$(Configuration.ToLower())\fcs Legacy project file cracker for the F# compiler service. @@ -25,8 +21,8 @@ - - + + diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj index 9dddb1cb616..9f690c58ea1 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj +++ b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj @@ -13,7 +13,6 @@ $(OtherFlags) --staticlink:FSharp.Core true false - ..\..\$(Configuration.ToLower())\fcs diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 86f4f69ed09..55696e34ffe 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -12,6 +12,7 @@ true true false + true true @@ -67,6 +68,12 @@ TokenizerTests.fs + + ServiceUntypedParseTests.fs + + + TreeVisitorTests.fs + Program.fs @@ -77,7 +84,7 @@ - + diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 4e7d3e4573e..8b23b7fa1da 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -12,13 +12,12 @@ $(DefineConstants);COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);NO_STRONG_NAMES - ..\..\$(Configuration.ToLower())\fcs $(TargetFramework)\ $(TargetFramework)\ $(OtherFlags) /warnon:1182 $(OtherFlags) --times $(NoWarn);44;62;69;65;54;61;75;62;9;2003;NU5125 - true + true true true diff --git a/fcs/build.fsx b/fcs/build.fsx index e303edee10d..8549ed86348 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -13,8 +13,8 @@ open Fake.ReleaseNotesHelper #if MONO // prevent incorrect output encoding (e.g. https://github.com/fsharp/FAKE/issues/1196) System.Console.OutputEncoding <- System.Text.Encoding.UTF8 -CleanDir (__SOURCE_DIRECTORY__ + "/../tests/TestResults") -File.WriteAllText(__SOURCE_DIRECTORY__ + "/../tests/TestResults/notestsyet.txt","No tests yet") +CleanDir (__SOURCE_DIRECTORY__ + "/../artifacts/TestResults") +File.WriteAllText(__SOURCE_DIRECTORY__ + "/../artifacts/TestResults/notestsyet.txt","No tests yet") let isMono = true #else let isMono = false @@ -54,7 +54,7 @@ let runCmdIn workDir (exe:string) = Printf.ksprintf (fun (args:string) -> // The rest of the code is standard F# build script // -------------------------------------------------------------------------------------- -let releaseDir = Path.Combine(__SOURCE_DIRECTORY__, "../release/fcs") +let releaseDir = Path.Combine(__SOURCE_DIRECTORY__, "../artifacts/bin/fcs") // Read release notes & version info from RELEASE_NOTES.md let release = LoadReleaseNotes (__SOURCE_DIRECTORY__ + "/RELEASE_NOTES.md") diff --git a/fsharp.proj b/fsharp.proj index 42d2f15b16f..47327528bcf 100644 --- a/fsharp.proj +++ b/fsharp.proj @@ -11,6 +11,7 @@ false false false + false false false @@ -25,6 +26,7 @@ true true true + true true true @@ -36,30 +38,59 @@ true + + + true + true + + - - - - - - - - - - - + + TargetFramework=netstandard1.6 + TargetFramework=net45 + + + TargetFramework=netstandard2.0 + TargetFramework=net472 + + + TargetFramework=netstandard1.6 + TargetFramework=net472 + + + TargetFramework=net472 + + + TargetFramework=netstandard1.6 + TargetFramework=net472 + + + TargetFramework=netcoreapp2.1 + TargetFramework=net472 + + + TargetFramework=netcoreapp2.1 + TargetFramework=net472 + + + TargetFramework=net472 + - - - - - - + + + + + + @@ -69,42 +100,46 @@ + + + + + - + - - - + + + - - - - + + + + - + - - - + + + - - - - + + + - + @@ -116,24 +151,20 @@ - - - - - + - + - + - + diff --git a/init-tools.cmd b/init-tools.cmd index 2c1b6d60bdb..cbdeb27afef 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -2,7 +2,7 @@ setlocal enabledelayedexpansion set /p DOTNET_TOOLS_VERSION=<"%~dp0DotnetCLIToolsVersion.txt" -set DOTNET_TOOLS_PATH=%~dp0Tools\dotnet20 +set DOTNET_TOOLS_PATH=%~dp0artifacts\toolset\dotnet set dotnetexe=%DOTNET_TOOLS_PATH%\dotnet.exe set sdksentinel=%DOTNET_TOOLS_PATH%\sdk-version.txt diff --git a/proto.proj b/proto.proj index 96f223470ec..443d7015fb5 100644 --- a/proto.proj +++ b/proto.proj @@ -7,8 +7,14 @@ - - + + TargetFramework=net472 + TargetFramework=netcoreapp2.1 + + + TargetFramework=net472 + TargetFramework=netcoreapp2.1 + diff --git a/setup/Directory.Build.props b/setup/Directory.Build.props index 64b72eafc9f..bd233e75785 100644 --- a/setup/Directory.Build.props +++ b/setup/Directory.Build.props @@ -1,12 +1,21 @@ - - + true false + $(MSBuildThisFileDirectory) + $(SetupRootFolder)resources + $(SetupRootFolder)..\artifacts\bin + $(ArtifactsDir)\VSSetup\$(Configuration) + $(ArtifactsDir)\VSSetup.obj\$(Configuration)\$(MSBuildProjectName) + $(SetupRootFolder)..\artifacts\VSSetup\$(Configuration) + $(SetupRootFolder)..\artifacts\VSSetup\$(Configuration)\Insertion + + + $(VSMajorVersion).$(VSMinorVersion).$(BUILD_BUILDNUMBER) diff --git a/setup/Directory.Build.targets b/setup/Directory.Build.targets index 0619a12001e..ccd47cc0a9a 100644 --- a/setup/Directory.Build.targets +++ b/setup/Directory.Build.targets @@ -1,4 +1,3 @@ - diff --git a/setup/FSharp.Setup.props b/setup/FSharp.Setup.props deleted file mode 100644 index 25398779040..00000000000 --- a/setup/FSharp.Setup.props +++ /dev/null @@ -1,142 +0,0 @@ - - - - - $(MSBuildThisFileDirectory) - - - - - $(VSMajorVersion).$(VSMinorVersion).$(BUILD_BUILDNUMBER) - - - - Debug - AnyCPU - - - - $(SetupRootFolder)\..\$(Configuration) - $(BinariesDir)\net40\bin\ - $(BinariesDir)\insertion - obj\$(Configuration)\ - $(BinariesDir)\setup - $(BinariesDir)\setup\$(Lang) - - - - - ENU - 1033 - 9 - en - en-US - false - - - CHT - 1028 - 31748 - zh-Hant - zh-TW - true - - - CSY - 1029 - 5 - cs - cs-CZ - true - - - DEU - 1031 - 7 - de - de-DE - true - - - FRA - 1036 - 12 - fr - fr-FR - true - - - ITA - 1040 - 16 - it - it-IT - true - - - JPN - 1041 - 17 - ja - ja-JP - true - - - KOR - 1042 - 18 - ko - ko-KR - true - - - PLK - 1045 - 21 - pl - pl-PL - true - - - PTB - 1046 - 1046 - pt-BR - pt-BR - true - - - RUS - 1049 - 25 - ru - ru-RU - true - - - TRK - 1055 - 31 - tr - tr-TR - true - - - CHS - 2052 - 4 - zh-Hans - zh-CN - true - - - ESN - 3082 - 10 - es - es-ES - true - - - - diff --git a/setup/Localization.props b/setup/Localization.props new file mode 100644 index 00000000000..37c13afcd2c --- /dev/null +++ b/setup/Localization.props @@ -0,0 +1,120 @@ + + + + + + + ENU + 1033 + 9 + en + en-US + false + + + CHT + 1028 + 31748 + zh-Hant + zh-TW + true + + + CSY + 1029 + 5 + cs + cs-CZ + true + + + DEU + 1031 + 7 + de + de-DE + true + + + FRA + 1036 + 12 + fr + fr-FR + true + + + ITA + 1040 + 16 + it + it-IT + true + + + JPN + 1041 + 17 + ja + ja-JP + true + + + KOR + 1042 + 18 + ko + ko-KR + true + + + PLK + 1045 + 21 + pl + pl-PL + true + + + PTB + 1046 + 1046 + pt-BR + pt-BR + true + + + RUS + 1049 + 25 + ru + ru-RU + true + + + TRK + 1055 + 31 + tr + tr-TR + true + + + CHS + 2052 + 4 + zh-Hans + zh-CN + true + + + ESN + 3082 + 10 + es + es-ES + true + + + + diff --git a/setup/Swix/Directory.Build.props b/setup/Swix/Directory.Build.props index 92203d4e217..f64df1d29de 100644 --- a/setup/Swix/Directory.Build.props +++ b/setup/Swix/Directory.Build.props @@ -1,14 +1,14 @@ + + Debug neutral false vsix true - $(FSharpSourcesRoot)\..\$(Configuration) - $(BinariesFolder)\insertion - $(MSBuildProjectDirectory)\obj + $(ArtifactsBinDir) diff --git a/setup/Swix/Directory.Build.targets b/setup/Swix/Directory.Build.targets index 14437118703..974c6da4f1b 100644 --- a/setup/Swix/Directory.Build.targets +++ b/setup/Swix/Directory.Build.targets @@ -1,3 +1,10 @@ + + + + $(ArtifactsDir)\VSSetup\$(Configuration)\Insertion\$(OutputName).vsix + + + diff --git a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr index 464fdd774ee..9fed4387c96 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr @@ -5,7 +5,7 @@ package name=Microsoft.FSharp.Compiler.Resources vs.package.language=$(LocaleSpecificCulture) folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharpCompiler\$(LocaleParentCulture)" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Build.resources.dll" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Compiler.Interactive.Settings.resources.dll" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Core.resources.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.Build.resources.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Interactive.Settings\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.Compiler.Interactive.Settings.resources.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\$(LocaleParentCulture)\FSharp.Core.resources.dll" diff --git a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj index 166cbb2d519..ac8e74d4854 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj +++ b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj @@ -10,6 +10,7 @@ $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) $(PackagePreprocessorDefinitions);LocaleParentCulture=$(LocaleParentCulture) $(PackagePreprocessorDefinitions);LocaleSpecificCulture=$(LocaleSpecificCulture) diff --git a/setup/Swix/Microsoft.FSharp.Compiler/Files.swr b/setup/Swix/Microsoft.FSharp.Compiler/Files.swr index ad63ffe3c2c..f378338eef8 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Compiler/Files.swr @@ -5,34 +5,34 @@ package name=Microsoft.FSharp.Compiler folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp" - file source=$(BinariesFolder)\net40\bin\fsc.exe vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe" - file source="$(BinariesFolder)\net40\bin\fsc.exe.config" + file source=$(BinariesFolder)\fsc\$(Configuration)\net472\fsc.exe vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe" + file source="$(BinariesFolder)\fsc\$(Configuration)\net472\fsc.exe.config" - file source=$(BinariesFolder)\net40\bin\fsi.exe vs.file.ngen=yes vs.file.ngenArchitecture=X86 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsi.exe" - file source="$(BinariesFolder)\net40\bin\fsi.exe.config" + file source=$(BinariesFolder)\fsi\$(Configuration)\net472\fsi.exe vs.file.ngen=yes vs.file.ngenArchitecture=X86 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsi.exe" + file source="$(BinariesFolder)\fsi\$(Configuration)\net472\fsi.exe.config" - file source="$(BinariesFolder)\net40\bin\fsiAnyCpu.exe" vs.file.ngen=yes vs.file.ngenArchitecture=X64 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsiAnyCpu.exe" - file source="$(BinariesFolder)\net40\bin\fsiAnyCpu.exe.config" + file source="$(BinariesFolder)\fsiAnyCpu\$(Configuration)\net472\fsiAnyCpu.exe" vs.file.ngen=yes vs.file.ngenArchitecture=X64 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsiAnyCpu.exe" + file source="$(BinariesFolder)\fsiAnyCpu\$(Configuration)\net472\fsiAnyCpu.exe.config" - file source="$(BinariesFolder)\net40\bin\FSharp.Compiler.Interactive.Settings.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Compiler.Private.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Compiler.Interactive.Settings\$(Configuration)\net472\FSharp.Compiler.Interactive.Settings.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net472\FSharp.Compiler.Private.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Compiler.Server.Shared\$(Configuration)\net472\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Core.optdata" - file source="$(BinariesFolder)\net40\bin\FSharp.Core.sigdata" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.optdata" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata" - file source="$(BinariesFolder)\net40\bin\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 file source="$(PackagesFolder)\Microsoft.VisualFSharp.Type.Providers.Redist\$(MicrosoftVisualFSharpTypeProvidersRedistPackageVersion)\content\4.3.0.0\FSharp.Data.TypeProviders.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.Framework.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.Tasks.Core.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.Utilities.Core.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Portable.FSharp.Targets" - file source="$(BinariesFolder)\net40\bin\System.Collections.Immutable.dll" - file source="$(BinariesFolder)\net40\bin\System.Reflection.Metadata.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.NetSdk.props" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.NetSdk.targets" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.Overrides.NetSdk.targets" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.Targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.Build.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.Build.Framework.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.Build.Tasks.Core.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.Build.Utilities.Core.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.Portable.FSharp.Targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\System.Collections.Immutable.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net472\System.Reflection.Metadata.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.FSharp.NetSdk.props" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.FSharp.NetSdk.targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.FSharp.Overrides.NetSdk.targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net472\Microsoft.FSharp.Targets" diff --git a/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj b/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj index 955da213a71..f256dd46779 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj +++ b/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj @@ -10,6 +10,7 @@ $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);PackagesFolder=$(NuGetPackageRoot) $(PackagePreprocessorDefinitions);FSharpTreeRoot=$(FSharpTreeRoot) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) diff --git a/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr b/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr index 6ded7ba325f..f927497e193 100644 --- a/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr @@ -4,16 +4,11 @@ package name=Microsoft.FSharp.Dependencies version=$(FSharpPackageVersion) folder "InstallDir:MSBuild\Microsoft\VisualStudio\v$(VSGeneralVersion)\FSharp" - file "Microsoft.FSharp.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.Shim.targets" - file "Microsoft.Portable.FSharp.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.Portable.FSharp.Shim.targets" - file "Microsoft.FSharp.NetSdk.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.NetSdk.Shim.targets" - file "Microsoft.FSharp.Overrides.NetSdk.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.Overrides.NetSdk.Shim.targets" - file "Microsoft.FSharp.NetSdk.props" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.NetSdk.Shim.props" - -folder "InstallDir:Common7\IDE\PublicAssemblies" - file source="$(BinariesFolder)\net40\bin\FSharp.Core.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\FSharp.Core.optdata" - file source="$(BinariesFolder)\net40\bin\FSharp.Core.sigdata" + file "Microsoft.FSharp.targets" source="$(SetupShimsDir)\Microsoft.FSharp.Shim.targets" + file "Microsoft.Portable.FSharp.targets" source="$(SetupShimsDir)\Microsoft.Portable.FSharp.Shim.targets" + file "Microsoft.FSharp.NetSdk.targets" source="$(SetupShimsDir)\Microsoft.FSharp.NetSdk.Shim.targets" + file "Microsoft.FSharp.Overrides.NetSdk.targets" source="$(SetupShimsDir)\Microsoft.FSharp.Overrides.NetSdk.Shim.targets" + file "Microsoft.FSharp.NetSdk.props" source="$(SetupShimsDir)\Microsoft.FSharp.NetSdk.Shim.props" folder "InstallDir:Common7\Tools\VsDevCmd\Ext" file source="fsharp.bat" diff --git a/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj b/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj index dd1452bbefc..e30eaaf0fe1 100644 --- a/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj +++ b/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj @@ -10,7 +10,9 @@ $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) + $(PackagePreprocessorDefinitions);SetupShimsDir=$(MSBuildThisFileDirectory)..\..\shims $(PackagePreprocessorDefinitions);TargetFramework=$(TargetFramework) $(PackagePreprocessorDefinitions);VSGeneralVersion=$(VSGeneralVersion) diff --git a/setup/Swix/Microsoft.FSharp.IDE/Files.swr b/setup/Swix/Microsoft.FSharp.IDE/Files.swr index 0d47c502090..2e0ee2bcf3b 100644 --- a/setup/Swix/Microsoft.FSharp.IDE/Files.swr +++ b/setup/Swix/Microsoft.FSharp.IDE/Files.swr @@ -4,10 +4,10 @@ package name=Microsoft.FSharp.IDE version=$(FSharpPackageVersion) folder "InstallDir:Common7\IDE\NewScriptItems" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\Script\NewFSharpScriptItems.vsdir" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\Script\Script.fsx" + file source="$(SetupResourcesDir)\NewFileDialog\Script\NewFSharpScriptItems.vsdir" + file source="$(SetupResourcesDir)\NewFileDialog\Script\Script.fsx" folder "InstallDir:Common7\IDE\NewFileItems" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\General\NewFSharpFileItems.vsdir" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\General\File.fs" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\General\Script.fsx" + file source="$(SetupResourcesDir)\NewFileDialog\General\NewFSharpFileItems.vsdir" + file source="$(SetupResourcesDir)\NewFileDialog\General\File.fs" + file source="$(SetupResourcesDir)\NewFileDialog\General\Script.fsx" diff --git a/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj b/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj index b26924e23c2..223a7262fcb 100644 --- a/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj +++ b/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj @@ -9,8 +9,8 @@ - $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) + $(PackagePreprocessorDefinitions);SetupResourcesDir=$(MSBuildThisFileDirectory)..\..\resources $(PackagePreprocessorDefinitions);TargetFramework=$(TargetFramework) diff --git a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr index a8c5becc80e..61dddfcf048 100644 --- a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr @@ -5,16 +5,16 @@ package name=Microsoft.FSharp.VSIX.Full.Resources vs.package.language=$(LocaleSpecificCulture) folder "InstallDir:Common7\IDE\PublicAssemblies\$(LocaleParentCulture)" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\$(LocaleParentCulture)" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Editor.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.LanguageService.Base.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.LanguageService.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.ProjectSystem.Base.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.ProjectSystem.FSharp.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.ProjectSystem.PropertyPages.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.UIResources.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.VS.FSI.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Editor\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.Editor.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.LanguageService.Base\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.LanguageService.Base.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.LanguageService\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.LanguageService.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\ProjectSystem.Base\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.ProjectSystem.Base.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\ProjectSystem\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.ProjectSystem.FSharp.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.PropertiesPages\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.ProjectSystem.PropertyPages.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.UIResources\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.UIResources.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.VS.FSI\$(Configuration)\net472\$(LocaleParentCulture)\FSharp.VS.FSI.resources.dll" vs.file.ngen=yes diff --git a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj index fd39c147b4c..d8952b40fe7 100644 --- a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj +++ b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj @@ -9,6 +9,7 @@ + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) $(PackagePreprocessorDefinitions);LocaleCode=$(LocaleCode) diff --git a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr index 770d904e226..5de89f0cadd 100644 --- a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr +++ b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr @@ -6,8 +6,8 @@ package name=Microsoft.FSharp.VSIX.Full.Resources folder "InstallDir:Common7\IDE\ProjectTemplates\FSharp\$(LocaleId)" folder "ConsoleApplication" - file source="$(BinariesFolder)\net40\bin\ProjectTemplates\FSharp\$(LocaleParentId)\ConsoleApplication.zip" + file source="$(BinariesFolder)\ConsoleProject\$(Configuration)\$(LocaleParentId)\ConsoleApplication.zip" folder "Library" - file source="$(BinariesFolder)\net40\bin\ProjectTemplates\FSharp\$(LocaleParentId)\Library.zip" + file source="$(BinariesFolder)\LibraryProject\$(Configuration)\$(LocaleParentId)\Library.zip" folder "Tutorial" - file source="$(BinariesFolder)\net40\bin\ProjectTemplates\FSharp\$(LocaleParentId)\Tutorial.zip" + file source="$(BinariesFolder)\TutorialProject\$(Configuration)\$(LocaleParentId)\Tutorial.zip" diff --git a/setup/Swix/Microsoft.FSharp.vsmanproj b/setup/Swix/Microsoft.FSharp.vsmanproj index d2b0388c272..6e6f7d4e7e9 100644 --- a/setup/Swix/Microsoft.FSharp.vsmanproj +++ b/setup/Swix/Microsoft.FSharp.vsmanproj @@ -6,6 +6,7 @@ true true + $(ArtifactsDir)\VSSetup\$(Configuration)\Insertion $(OutputPath) $(FSharpPackageVersion) @@ -23,17 +24,17 @@ - - + + - + - - + + - - - + + + diff --git a/setup/publish-assets.ps1 b/setup/publish-assets.ps1 index 29604698b4c..bfa905bbad9 100644 --- a/setup/publish-assets.ps1 +++ b/setup/publish-assets.ps1 @@ -16,7 +16,8 @@ The API key used to authenticate with MyGet. Param( [string]$binariesPath = $null, [string]$branchName = $null, - [string]$apiKey = $null + [string]$apiKey = $null, + [string]$configuration = $null ) Set-StrictMode -Version 2.0 @@ -40,7 +41,7 @@ try { } $branchName = $branchName.Replace("/", "_") # can't have slashes in the branch name - $vsix = Join-Path $binariesPath "net40\bin\VisualFSharpFull.vsix" + $vsix = Join-Path $binariesPath "VisualFSharpFull\$configuration\net46\VisualFSharpFull.vsix" Write-Host " Uploading '$vsix' to '$requestUrl'." diff --git a/setup/resources/Microsoft.FSharp.NetSdk.Shim.props b/setup/shims/Microsoft.FSharp.NetSdk.Shim.props similarity index 100% rename from setup/resources/Microsoft.FSharp.NetSdk.Shim.props rename to setup/shims/Microsoft.FSharp.NetSdk.Shim.props diff --git a/setup/resources/Microsoft.FSharp.NetSdk.Shim.targets b/setup/shims/Microsoft.FSharp.NetSdk.Shim.targets similarity index 100% rename from setup/resources/Microsoft.FSharp.NetSdk.Shim.targets rename to setup/shims/Microsoft.FSharp.NetSdk.Shim.targets diff --git a/setup/resources/Microsoft.FSharp.Overrides.NetSdk.Shim.targets b/setup/shims/Microsoft.FSharp.Overrides.NetSdk.Shim.targets similarity index 100% rename from setup/resources/Microsoft.FSharp.Overrides.NetSdk.Shim.targets rename to setup/shims/Microsoft.FSharp.Overrides.NetSdk.Shim.targets diff --git a/setup/resources/Microsoft.FSharp.Shim.targets b/setup/shims/Microsoft.FSharp.Shim.targets similarity index 100% rename from setup/resources/Microsoft.FSharp.Shim.targets rename to setup/shims/Microsoft.FSharp.Shim.targets diff --git a/setup/resources/Microsoft.Portable.FSharp.Shim.targets b/setup/shims/Microsoft.Portable.FSharp.Shim.targets similarity index 100% rename from setup/resources/Microsoft.Portable.FSharp.Shim.targets rename to setup/shims/Microsoft.Portable.FSharp.Shim.targets diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 69b0030f910..44261606387 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -41,6 +41,10 @@ let inline isNonNull x = not (isNull x) let inline nonNull msg x = if isNull x then failwith ("null: " + msg) else x let inline (===) x y = LanguagePrimitives.PhysicalEquality x y +/// Per the docs the threshold for the Large Object Heap is 85000 bytes: https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap#how-an-object-ends-up-on-the-large-object-heap-and-how-gc-handles-them +/// We set the limit to slightly under that to allow for some 'slop' +let LOH_SIZE_THRESHOLD_BYTES = 84_900 + //--------------------------------------------------------------------- // Library: ReportTime //--------------------------------------------------------------------- @@ -91,7 +95,7 @@ module Order = let toFunction (pxOrder: IComparer<'U>) x y = pxOrder.Compare(x,y) //------------------------------------------------------------------------- -// Library: arrays,lists,options +// Library: arrays,lists,options,resizearrays //------------------------------------------------------------------------- module Array = @@ -432,6 +436,49 @@ module List = let existsSquared f xss = xss |> List.exists (fun xs -> xs |> List.exists (fun x -> f x)) let mapiFoldSquared f z xss = mapFoldSquared f z (xss |> mapiSquared (fun i j x -> (i,j,x))) +module ResizeArray = + + /// Split a ResizeArray into an array of smaller chunks. + /// This requires `items/chunkSize` Array copies of length `chunkSize` if `items/chunkSize % 0 = 0`, + /// otherwise `items/chunkSize + 1` Array copies. + let chunkBySize chunkSize f (items: ResizeArray<'t>) = + // we could use Seq.chunkBySize here, but that would involve many enumerator.MoveNext() calls that we can sidestep with a bit of math + let itemCount = items.Count + if itemCount = 0 + then [||] + else + let chunksCount = + match itemCount / chunkSize with + | n when itemCount % chunkSize = 0 -> n + | n -> n + 1 // any remainder means we need an additional chunk to store it + + [| for index in 0..chunksCount-1 do + let startIndex = index * chunkSize + let takeCount = min (itemCount - startIndex) chunkSize + + let holder = Array.zeroCreate takeCount + // we take a bounds-check hit here on each access. + // other alternatives here include + // * iterating across an IEnumerator (incurs MoveNext penalty) + // * doing a block copy using `List.CopyTo(index, array, index, count)` (requires more copies to do the mapping) + // none are significantly better. + for i in 0 .. takeCount - 1 do + holder.[i] <- f items.[i] + yield holder |] + + /// Split a large ResizeArray into a series of array chunks that are each under the Large Object Heap limit. + /// This is done to help prevent a stop-the-world collection of the single large array, instead allowing for a greater + /// probability of smaller collections. Stop-the-world is still possible, just less likely. + let mapToSmallArrayChunks f (inp: ResizeArray<'t>) = + let itemSizeBytes = sizeof<'t> + // rounding down here is good because it ensures we don't go over + let maxArrayItemCount = LOH_SIZE_THRESHOLD_BYTES / itemSizeBytes + + /// chunk the provided input into arrays that are smaller than the LOH limit + /// in order to prevent long-term storage of those values + chunkBySize maxArrayItemCount f inp + + /// Because FSharp.Compiler.Service is a library that will target FSharp.Core 4.5.2 for the forseeable future, /// we need to stick these functions in this module rather than using the module functions for ValueOption /// that come after FSharp.Core 4.5.2. diff --git a/src/buildtools/Directory.Build.props b/src/buildtools/Directory.Build.props index bb5b23d29d0..12d9ad073ec 100644 --- a/src/buildtools/Directory.Build.props +++ b/src/buildtools/Directory.Build.props @@ -1,3 +1,3 @@ - + diff --git a/src/buildtools/Directory.Build.targets b/src/buildtools/Directory.Build.targets index bb5b23d29d0..14437118703 100644 --- a/src/buildtools/Directory.Build.targets +++ b/src/buildtools/Directory.Build.targets @@ -1,3 +1,3 @@ - + diff --git a/src/buildtools/buildtools.targets b/src/buildtools/buildtools.targets index 9285a376e88..9b00e18cf72 100644 --- a/src/buildtools/buildtools.targets +++ b/src/buildtools/buildtools.targets @@ -15,7 +15,7 @@ BeforeTargets="CoreCompile"> - $(MSBuildThisFileDirectory)fslex\bin\Proto\netcoreapp2.0\fslex.dll + $(ArtifactsBinDir)\fslex\Proto\netcoreapp2.0\fslex.dll @@ -38,7 +38,7 @@ BeforeTargets="CoreCompile"> - $(MSBuildThisFileDirectory)fsyacc\bin\Proto\netcoreapp2.0\fsyacc.dll + $(ArtifactsBinDir)\fsyacc\Proto\netcoreapp2.0\fsyacc.dll diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 08e74a252e2..0e06f194055 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2356,6 +2356,8 @@ type TcConfigBuilder = mutable tryGetMetadataSnapshot : ILReaderTryGetMetadataSnapshot mutable internalTestSpanStackReferring : bool + + mutable noConditionalErasure : bool } static member Initial = @@ -2493,6 +2495,7 @@ type TcConfigBuilder = shadowCopyReferences = false tryGetMetadataSnapshot = (fun _ -> None) internalTestSpanStackReferring = false + noConditionalErasure = false } static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir, @@ -2954,6 +2957,8 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) = member x.shadowCopyReferences = data.shadowCopyReferences member x.tryGetMetadataSnapshot = data.tryGetMetadataSnapshot member x.internalTestSpanStackReferring = data.internalTestSpanStackReferring + member x.noConditionalErasure = data.noConditionalErasure + static member Create(builder, validate) = use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter TcConfig(builder, validate) @@ -3390,14 +3395,14 @@ let ComputeQualifiedNameOfFileFromUniquePath (m, p: string list) = QualifiedName let QualFileNameOfSpecs filename specs = match specs with - | [SynModuleOrNamespaceSig(modname, _, true, _, _, _, _, m)] -> QualFileNameOfModuleName m filename modname - | [SynModuleOrNamespaceSig(_, _, false, _, _, _, _, m)] -> QualFileNameOfFilename m filename + | [SynModuleOrNamespaceSig(modname, _, kind, _, _, _, _, m)] when kind.IsModule -> QualFileNameOfModuleName m filename modname + | [SynModuleOrNamespaceSig(_, _, kind, _, _, _, _, m)] when not kind.IsModule -> QualFileNameOfFilename m filename | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename let QualFileNameOfImpls filename specs = match specs with - | [SynModuleOrNamespace(modname, _, true, _, _, _, _, m)] -> QualFileNameOfModuleName m filename modname - | [SynModuleOrNamespace(_, _, false, _, _, _, _, m)] -> QualFileNameOfFilename m filename + | [SynModuleOrNamespace(modname, _, kind, _, _, _, _, m)] when kind.IsModule -> QualFileNameOfModuleName m filename modname + | [SynModuleOrNamespace(_, _, kind, _, _, _, _, m)] when not kind.IsModule -> QualFileNameOfFilename m filename | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename let PrepandPathToQualFileName x (QualifiedNameOfFile(q)) = ComputeQualifiedNameOfFileFromUniquePath (q.idRange, pathOfLid x@[q.idText]) @@ -3426,13 +3431,14 @@ let ComputeAnonModuleName check defaultNamespace filename (m: range) = let PostParseModuleImpl (_i, defaultNamespace, isLastCompiland, filename, impl) = match impl with - | ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, isRec, isModule, decls, xmlDoc, attribs, access, m)) -> + | ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, isRec, kind, decls, xmlDoc, attribs, access, m)) -> let lid = match lid with - | [id] when isModule && id.idText = MangledGlobalName -> error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) + | [id] when kind.IsModule && id.idText = MangledGlobalName -> + error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) | id :: rest when id.idText = MangledGlobalName -> rest | _ -> lid - SynModuleOrNamespace(lid, isRec, isModule, decls, xmlDoc, attribs, access, m) + SynModuleOrNamespace(lid, isRec, kind, decls, xmlDoc, attribs, access, m) | ParsedImplFileFragment.AnonModule (defs, m)-> let isLast, isExe = isLastCompiland @@ -3443,24 +3449,26 @@ let PostParseModuleImpl (_i, defaultNamespace, isLastCompiland, filename, impl) | _ -> errorR(Error(FSComp.SR.buildMultiFileRequiresNamespaceOrModule(), trimRangeToLine m)) let modname = ComputeAnonModuleName (not (isNil defs)) defaultNamespace filename (trimRangeToLine m) - SynModuleOrNamespace(modname, false, true, defs, PreXmlDoc.Empty, [], None, m) + SynModuleOrNamespace(modname, false, AnonModule, defs, PreXmlDoc.Empty, [], None, m) - | ParsedImplFileFragment.NamespaceFragment (lid, a, b, c, d, e, m)-> - let lid = + | ParsedImplFileFragment.NamespaceFragment (lid, a, kind, c, d, e, m)-> + let lid, kind = match lid with - | id :: rest when id.idText = MangledGlobalName -> rest - | _ -> lid - SynModuleOrNamespace(lid, a, b, c, d, e, None, m) + | id :: rest when id.idText = MangledGlobalName -> + rest, if List.isEmpty rest then GlobalNamespace else kind + | _ -> lid, kind + SynModuleOrNamespace(lid, a, kind, c, d, e, None, m) let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, filename, intf) = match intf with - | ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, isRec, isModule, decls, xmlDoc, attribs, access, m)) -> + | ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, isRec, kind, decls, xmlDoc, attribs, access, m)) -> let lid = match lid with - | [id] when isModule && id.idText = MangledGlobalName -> error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) + | [id] when kind.IsModule && id.idText = MangledGlobalName -> + error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) | id :: rest when id.idText = MangledGlobalName -> rest | _ -> lid - SynModuleOrNamespaceSig(lid, isRec, isModule, decls, xmlDoc, attribs, access, m) + SynModuleOrNamespaceSig(lid, isRec, NamedModule, decls, xmlDoc, attribs, access, m) | ParsedSigFileFragment.AnonModule (defs, m) -> let isLast, isExe = isLastCompiland @@ -3471,14 +3479,15 @@ let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, filename, intf) | _ -> errorR(Error(FSComp.SR.buildMultiFileRequiresNamespaceOrModule(), m)) let modname = ComputeAnonModuleName (not (isNil defs)) defaultNamespace filename (trimRangeToLine m) - SynModuleOrNamespaceSig(modname, false, true, defs, PreXmlDoc.Empty, [], None, m) + SynModuleOrNamespaceSig(modname, false, AnonModule, defs, PreXmlDoc.Empty, [], None, m) - | ParsedSigFileFragment.NamespaceFragment (lid, a, b, c, d, e, m)-> - let lid = + | ParsedSigFileFragment.NamespaceFragment (lid, a, kind, c, d, e, m)-> + let lid, kind = match lid with - | id :: rest when id.idText = MangledGlobalName -> rest - | _ -> lid - SynModuleOrNamespaceSig(lid, a, b, c, d, e, None, m) + | id :: rest when id.idText = MangledGlobalName -> + rest, if List.isEmpty rest then GlobalNamespace else kind + | _ -> lid, kind + SynModuleOrNamespaceSig(lid, a, kind, c, d, e, None, m) @@ -3522,34 +3531,37 @@ let PostParseModuleSpecs (defaultNamespace, filename, isLastCompiland, ParsedSig ParsedInput.SigFile(ParsedSigFileInput(filename, qualName, scopedPragmas, hashDirectives, specs)) +type ModuleNamesDict = Map> + /// Checks if a module name is already given and deduplicates the name if needed. -let DeduplicateModuleName (moduleNamesDict:IDictionary>) (paths: Set) path (qualifiedNameOfFile: QualifiedNameOfFile) = - let count = if paths.Contains path then paths.Count else paths.Count + 1 - moduleNamesDict.[qualifiedNameOfFile.Text] <- Set.add path paths - let id = qualifiedNameOfFile.Id - if count = 1 then qualifiedNameOfFile else QualifiedNameOfFile(Ident(id.idText + "___" + count.ToString(), id.idRange)) +let DeduplicateModuleName (moduleNamesDict:ModuleNamesDict) fileName (qualNameOfFile: QualifiedNameOfFile) = + let path = Path.GetDirectoryName fileName + let path = if FileSystem.IsPathRootedShim path then try FileSystem.GetFullPathShim path with _ -> path else path + match moduleNamesDict.TryGetValue qualNameOfFile.Text with + | true, paths -> + if paths.ContainsKey path then + paths.[path], moduleNamesDict + else + let count = paths.Count + 1 + let id = qualNameOfFile.Id + let qualNameOfFileT = if count = 1 then qualNameOfFile else QualifiedNameOfFile(Ident(id.idText + "___" + count.ToString(), id.idRange)) + let moduleNamesDictT = moduleNamesDict.Add(qualNameOfFile.Text, paths.Add(path, qualNameOfFileT)) + qualNameOfFileT, moduleNamesDictT + | _ -> + let moduleNamesDictT = moduleNamesDict.Add(qualNameOfFile.Text, Map.empty.Add(path, qualNameOfFile)) + qualNameOfFile, moduleNamesDictT /// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed. -let DeduplicateParsedInputModuleName (moduleNamesDict:IDictionary>) input = +let DeduplicateParsedInputModuleName (moduleNamesDict: ModuleNamesDict) input = match input with - | ParsedInput.ImplFile (ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) -> - let path = Path.GetDirectoryName fileName - match moduleNamesDict.TryGetValue qualifiedNameOfFile.Text with - | true, paths -> - let qualifiedNameOfFile = DeduplicateModuleName moduleNamesDict paths path qualifiedNameOfFile - ParsedInput.ImplFile(ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) - | _ -> - moduleNamesDict.[qualifiedNameOfFile.Text] <- Set.singleton path - input - | ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules)) -> - let path = Path.GetDirectoryName fileName - match moduleNamesDict.TryGetValue qualifiedNameOfFile.Text with - | true, paths -> - let qualifiedNameOfFile = DeduplicateModuleName moduleNamesDict paths path qualifiedNameOfFile - ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules)) - | _ -> - moduleNamesDict.[qualifiedNameOfFile.Text] <- Set.singleton path - input + | ParsedInput.ImplFile (ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualNameOfFile, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) -> + let qualNameOfFileT, moduleNamesDictT = DeduplicateModuleName moduleNamesDict fileName qualNameOfFile + let inputT = ParsedInput.ImplFile(ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualNameOfFileT, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) + inputT, moduleNamesDictT + | ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualNameOfFile, scopedPragmas, hashDirectives, modules)) -> + let qualNameOfFileT, moduleNamesDictT = DeduplicateModuleName moduleNamesDict fileName qualNameOfFile + let inputT = ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualNameOfFileT, scopedPragmas, hashDirectives, modules)) + inputT, moduleNamesDictT let ParseInput (lexer, errorLogger:ErrorLogger, lexbuf:UnicodeLexing.Lexbuf, defaultNamespace, filename, isLastCompiland) = // The assert below is almost ok, but it fires in two cases: @@ -5446,9 +5458,12 @@ let TypeCheckOneInputEventually (checkForErrors, tcConfig:TcConfig, tcImports:Tc if Zset.contains qualNameOfFile tcState.tcsRootImpls then errorR(Error(FSComp.SR.buildImplementationAlreadyGivenDetail(qualNameOfFile.Text), m)) + let conditionalDefines = + if tcConfig.noConditionalErasure then None else Some (tcConfig.conditionalCompilationDefines) + // Typecheck the signature file let! (tcEnv, sigFileType, createsGeneratedProvidedTypes) = - TypeCheckOneSigFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, tcConfig.conditionalCompilationDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcState.tcsTcSigEnv file + TypeCheckOneSigFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, conditionalDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcState.tcsTcSigEnv file let rootSigs = Zmap.add qualNameOfFile sigFileType tcState.tcsRootSigs @@ -5483,9 +5498,12 @@ let TypeCheckOneInputEventually (checkForErrors, tcConfig:TcConfig, tcImports:Tc let tcImplEnv = tcState.tcsTcImplEnv + let conditionalDefines = + if tcConfig.noConditionalErasure then None else Some (tcConfig.conditionalCompilationDefines) + // Typecheck the implementation file let! topAttrs, implFile, _implFileHiddenType, tcEnvAtEnd, createsGeneratedProvidedTypes = - TypeCheckOneImplFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, tcConfig.conditionalCompilationDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcImplEnv rootSigOpt file + TypeCheckOneImplFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, conditionalDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcImplEnv rootSigOpt file let hadSig = rootSigOpt.IsSome let implFileSigType = SigTypeOfImplFile implFile diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 0e9f53c843e..fbacb77738e 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -60,12 +60,13 @@ val ComputeQualifiedNameOfFileFromUniquePath: range * string list -> Ast.Qualifi val PrependPathToInput: Ast.Ident list -> Ast.ParsedInput -> Ast.ParsedInput -/// Checks if a module name is already given and deduplicates the name if needed. -val DeduplicateModuleName: IDictionary> -> Set -> string -> Ast.QualifiedNameOfFile -> Ast.QualifiedNameOfFile +/// State used to de-deuplicate module names along a list of file names +type ModuleNamesDict = Map> /// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed. -val DeduplicateParsedInputModuleName: IDictionary> -> Ast.ParsedInput -> Ast.ParsedInput +val DeduplicateParsedInputModuleName: ModuleNamesDict -> Ast.ParsedInput -> Ast.ParsedInput * ModuleNamesDict +/// Parse a single input (A signature file or implementation file) val ParseInput: (UnicodeLexing.Lexbuf -> Parser.token) * ErrorLogger * UnicodeLexing.Lexbuf * string option * string * isLastCompiland:(bool * bool) -> Ast.ParsedInput //---------------------------------------------------------------------------- @@ -367,6 +368,9 @@ type TcConfigBuilder = /// if true - 'let mutable x = Span.Empty', the value 'x' is a stack referring span. Used for internal testing purposes only until we get true stack spans. mutable internalTestSpanStackReferring : bool + + /// Prevent erasure of conditional attributes and methods so tooling is able analyse them. + mutable noConditionalErasure: bool } static member Initial: TcConfigBuilder diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 6ae18644dea..344c0e1412a 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -848,8 +848,8 @@ let testFlag tcConfigB = | str -> warning(Error(FSComp.SR.optsUnknownArgumentToTheTestSwitch(str),rangeCmdArgs))), None, None) -// not shown in fsc.exe help, no warning on use, motivation is for use from VS -let vsSpecificFlags (tcConfigB: TcConfigBuilder) = +// Not shown in fsc.exe help, no warning on use, motivation is for use from tooling. +let editorSpecificFlags (tcConfigB: TcConfigBuilder) = [ CompilerOption("vserrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.VSErrors), None, None) CompilerOption("validate-type-providers", tagNone, OptionUnit (id), None, None) // preserved for compatibility's sake, no longer has any effect CompilerOption("LCID", tagInt, OptionInt ignore, None, None) @@ -857,7 +857,8 @@ let vsSpecificFlags (tcConfigB: TcConfigBuilder) = CompilerOption("sqmsessionguid", tagNone, OptionString ignore, None, None) CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None) CompilerOption("exename", tagNone, OptionString (fun s -> tcConfigB.exename <- Some(s)), None, None) - CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None) ] + CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None) + CompilerOption("noconditionalerasure", tagNone, OptionUnit (fun () -> tcConfigB.noConditionalErasure <- true), None, None) ] let internalFlags (tcConfigB:TcConfigBuilder) = [ @@ -896,7 +897,7 @@ let internalFlags (tcConfigB:TcConfigBuilder) = CompilerOption("alwayscallvirt",tagNone,OptionSwitch(callVirtSwitch tcConfigB),Some(InternalCommandLineOption("alwayscallvirt",rangeCmdArgs)), None) CompilerOption("nodebugdata",tagNone, OptionUnit (fun () -> tcConfigB.noDebugData<-true),Some(InternalCommandLineOption("--nodebugdata",rangeCmdArgs)), None) testFlag tcConfigB ] @ - vsSpecificFlags tcConfigB @ + editorSpecificFlags tcConfigB @ [ CompilerOption("jit", tagNone, OptionSwitch (jitoptimizeSwitch tcConfigB), Some(InternalCommandLineOption("jit", rangeCmdArgs)), None) CompilerOption("localoptimize", tagNone, OptionSwitch(localoptimizeSwitch tcConfigB),Some(InternalCommandLineOption("localoptimize", rangeCmdArgs)), None) CompilerOption("splitting", tagNone, OptionSwitch(splittingSwitch tcConfigB),Some(InternalCommandLineOption("splitting", rangeCmdArgs)), None) diff --git a/src/fsharp/Directory.Build.props b/src/fsharp/Directory.Build.props index 57c8aa24ba7..151415117e4 100644 --- a/src/fsharp/Directory.Build.props +++ b/src/fsharp/Directory.Build.props @@ -6,6 +6,7 @@ true true false + $(ArtifactsPackagesDir)\$(Configuration) diff --git a/src/fsharp/Directory.Nuget.props b/src/fsharp/Directory.Nuget.props index 97266b7c79d..6521936cfe3 100644 --- a/src/fsharp/Directory.Nuget.props +++ b/src/fsharp/Directory.Nuget.props @@ -20,6 +20,7 @@ tags=$(PackageTags); githeadsha=$(NormalizedGitHeadSha); configuration=$(Configuration); + artifactsbindir=$(ArtifactsBinDir); diff --git a/src/fsharp/Directory.Nuget.targets b/src/fsharp/Directory.Nuget.targets index f3ae171dc38..e30b155faad 100644 --- a/src/fsharp/Directory.Nuget.targets +++ b/src/fsharp/Directory.Nuget.targets @@ -8,14 +8,4 @@ - - - - - - - - - diff --git a/src/fsharp/ErrorResolutionHints.fs b/src/fsharp/ErrorResolutionHints.fs index e674adb6f46..20bcb13fd21 100644 --- a/src/fsharp/ErrorResolutionHints.fs +++ b/src/fsharp/ErrorResolutionHints.fs @@ -43,6 +43,7 @@ let FilterPredictions (idText:string) (suggestionF:ErrorLogger.Suggestions) = name |> Seq.forall (fun c -> c <> ' ') if allSuggestions.Contains idText then [] else // some other parsing error occurred + let dotIdText = "." + idText allSuggestions |> Seq.choose (fun suggestion -> // Because beginning a name with _ is used both to indicate an unused @@ -53,7 +54,7 @@ let FilterPredictions (idText:string) (suggestionF:ErrorLogger.Suggestions) = let suggestion:string = demangle suggestion let suggestedText = suggestion.ToUpperInvariant() let similarity = EditDistance.JaroWinklerDistance uppercaseText suggestedText - if similarity >= highConfidenceThreshold || suggestion.EndsWithOrdinal("." + idText) then + if similarity >= highConfidenceThreshold || suggestion.EndsWithOrdinal(dotIdText) then Some(similarity, suggestion) elif similarity < minThresholdForSuggestions && suggestedText.Length > minStringLengthForThreshold then None diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index cb84565e52d..b7be3a4f364 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -13,6 +13,7 @@ $(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1 true true + true @@ -29,14 +30,16 @@ + + $(BaseOutputPath)\$(Configuration)\$(TargetFramework) + - - - - - - - + + + + + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props index 68113d9e9ca..8093275dba0 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props +++ b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props @@ -6,8 +6,6 @@ netcoreapp2.1 Microsoft.FSharp.Compiler.nuspec - -rtm-$(NuGetPackageVersionSuffix) - $(FSPackageVersion)$(PreReleaseSuffix) diff --git a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets index a20d4be41e6..2721c93a906 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets +++ b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets @@ -1,11 +1,16 @@ + + -rtm-$(NuGetPackageVersionSuffix) + $(FSPackageVersion)$(PreReleaseSuffix) + + - - + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj new file mode 100644 index 00000000000..692e5aba1b2 --- /dev/null +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj @@ -0,0 +1,8 @@ + + + + Microsoft.FSharp.Compiler + true + + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj index eef53d7dc4e..abb19e418fe 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj @@ -2,6 +2,7 @@ Microsoft.FSharp.Compiler + false diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index ac76a4a2403..f10712a641e 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -54,30 +54,30 @@ this approach gives a very small deployment. Which is kind of necessary. --> - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj b/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj index 44a831fed38..aaee9c73942 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj +++ b/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj @@ -2,6 +2,7 @@ Testing.FSharp.Compiler + true diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index ce9fa915f91..6ddda3f2e7e 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -14,6 +14,7 @@ $(DefineConstants);FSHARP_CORE BUILDING_WITH_LKG;$(DefineConstants) $(OtherFlags) --warnon:1182 --compiling-fslib --compiling-fslib-40 --maxerrors:20 --extraoptimizationloops:1 + true diff --git a/src/fsharp/FSharp.Core/FSharp.Core.nuspec b/src/fsharp/FSharp.Core/FSharp.Core.nuspec index 21b484cb8ab..443388a8278 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core/FSharp.Core.nuspec @@ -56,18 +56,18 @@ - - - - + + + + - - - - + + + + - - + + diff --git a/src/fsharp/FSharp.Core/map.fs b/src/fsharp/FSharp.Core/map.fs index 8efc49a1a41..7ef250a0ee9 100644 --- a/src/fsharp/FSharp.Core/map.fs +++ b/src/fsharp/FSharp.Core/map.fs @@ -558,7 +558,7 @@ namespace Microsoft.FSharp.Collections for (KeyValue(x,y)) in this do res <- combineHash res (hash x) res <- combineHash res (Unchecked.hash y) - abs res + res override this.Equals(that) = match that with @@ -744,4 +744,4 @@ namespace Microsoft.FSharp.Collections let empty<'Key,'Value when 'Key : comparison> = Map<'Key,'Value>.Empty [] - let count (table:Map<_,_>) = table.Count \ No newline at end of file + let count (table:Map<_,_>) = table.Count diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 9bd796db143..d027afabeb5 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -764,7 +764,7 @@ let StorageForVal m v eenv = try eenv.valsInScope.[v] with :? KeyNotFoundException -> assert false - errorR(Error(FSComp.SR.ilUndefinedValue(showL(vspecAtBindL v)),m)) + errorR(Error(FSComp.SR.ilUndefinedValue(showL(valAtBindL v)),m)) notlazy (Arg 668(* random value for post-hoc diagnostic analysis on generated tree *) ) v.Force() diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 09ab9e1945b..e39df6094da 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -1213,7 +1213,7 @@ let GetNestedTypesOfType (ad, ncenv:NameResolver, optFilter, staticResInfo, chec //------------------------------------------------------------------------- /// Represents the kind of the occurrence when reporting a name in name resolution -[] +[] type ItemOccurence = /// This is a binding / declaration of the item | Binding @@ -1501,17 +1501,24 @@ type TcSymbolUseData = /// This is a memory-critical data structure - allocations of this data structure and its immediate contents /// is one of the highest memory long-lived data structures in typical uses of IDEs. Not many of these objects /// are allocated (one per file), but they are large because the allUsesOfAllSymbols array is large. -type TcSymbolUses(g, capturedNameResolutions : ResizeArray, formatSpecifierLocations: (range * int)[]) = - +type TcSymbolUses(g, capturedNameResolutions : ResizeArray, formatSpecifierLocations: (range * int)[]) = + // Make sure we only capture the information we really need to report symbol uses - let allUsesOfSymbols = [| for cnr in capturedNameResolutions -> { Item=cnr.Item; ItemOccurence=cnr.ItemOccurence; DisplayEnv=cnr.DisplayEnv; Range=cnr.Range } |] + let allUsesOfSymbols = + capturedNameResolutions + |> ResizeArray.mapToSmallArrayChunks (fun cnr -> { Item=cnr.Item; ItemOccurence=cnr.ItemOccurence; DisplayEnv=cnr.DisplayEnv; Range=cnr.Range }) + let capturedNameResolutions = () do ignore capturedNameResolutions // don't capture this! member this.GetUsesOfSymbol(item) = - [| for symbolUse in allUsesOfSymbols do - if protectAssemblyExploration false (fun () -> ItemsAreEffectivelyEqual g item symbolUse.Item) then - yield symbolUse |] + // This member returns what is potentially a very large array, which may approach the size constraints of the Large Object Heap. + // This is unlikely in practice, though, because we filter down the set of all symbol uses to those specifically for the given `item`. + // Consequently we have a much lesser chance of ending up with an array large enough to be promoted to the LOH. + [| for symbolUseChunk in allUsesOfSymbols do + for symbolUse in symbolUseChunk do + if protectAssemblyExploration false (fun () -> ItemsAreEffectivelyEqual g item symbolUse.Item) then + yield symbolUse |] member this.AllUsesOfSymbols = allUsesOfSymbols diff --git a/src/fsharp/NameResolution.fsi b/src/fsharp/NameResolution.fsi index 8912c8946a5..bed09846767 100755 --- a/src/fsharp/NameResolution.fsi +++ b/src/fsharp/NameResolution.fsi @@ -241,7 +241,7 @@ type TypeNameResolutionInfo = static member ResolveToTypeRefs : TypeNameResolutionStaticArgsInfo -> TypeNameResolutionInfo /// Represents the kind of the occurrence when reporting a name in name resolution -[] +[] type internal ItemOccurence = | Binding | Use @@ -320,7 +320,7 @@ type internal TcSymbolUses = member GetUsesOfSymbol : Item -> TcSymbolUseData[] /// All the uses of all items within the file - member AllUsesOfSymbols : TcSymbolUseData[] + member AllUsesOfSymbols : TcSymbolUseData[][] /// Get the locations of all the printf format specifiers in the file member GetFormatSpecifierLocationsAndArity : unit -> (range * int)[] diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index 9b228d60044..96d94d16e93 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -976,11 +976,11 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi = // Under those checks, the further hidden* checks may be subsumed (meaning, not required anymore). let hiddenTycon, hiddenTyconRepr, hiddenVal, hiddenRecdField, hiddenUnionCase = - Zset.memberOf mhi.mhiTycons, - Zset.memberOf mhi.mhiTyconReprs, - Zset.memberOf mhi.mhiVals, - Zset.memberOf mhi.mhiRecdFields, - Zset.memberOf mhi.mhiUnionCases + Zset.memberOf mhi.HiddenTycons, + Zset.memberOf mhi.HiddenTyconReprs, + Zset.memberOf mhi.HiddenVals, + Zset.memberOf mhi.HiddenRecdFields, + Zset.memberOf mhi.HiddenUnionCases let rec abstractExprInfo ivalue = match ivalue with @@ -3236,7 +3236,7 @@ and OptimizeModuleExpr cenv env x = not (ValueIsUsedOrHasEffect cenv (fun () -> fvs.FreeLocals) (bind, binfo)) && // Check the thing is hidden by the signature (if any) - hidden.mhiVals.Contains bind.Var && + hidden.HiddenVals.Contains bind.Var && // Check the thing is not compiled as a static field or property, since reflected definitions and other reflective stuff might need it not (IsCompiledAsStaticProperty cenv.g bind.Var)) diff --git a/src/fsharp/SignatureConformance.fs b/src/fsharp/SignatureConformance.fs index ed5c04da71f..ac0c23e9709 100644 --- a/src/fsharp/SignatureConformance.fs +++ b/src/fsharp/SignatureConformance.fs @@ -37,8 +37,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = // Used when checking attributes. let sigToImplRemap = let remap = Remap.Empty - let remap = (remapInfo.mrpiEntities,remap) ||> List.foldBack (fun (implTcref ,signTcref) acc -> addTyconRefRemap signTcref implTcref acc) - let remap = (remapInfo.mrpiVals ,remap) ||> List.foldBack (fun (implValRef,signValRef) acc -> addValRemap signValRef.Deref implValRef.Deref acc) + let remap = (remapInfo.RepackagedEntities,remap) ||> List.foldBack (fun (implTcref ,signTcref) acc -> addTyconRefRemap signTcref implTcref acc) + let remap = (remapInfo.RepackagedVals ,remap) ||> List.foldBack (fun (implValRef,signValRef) acc -> addValRemap signValRef.Deref implValRef.Deref acc) remap // For all attributable elements (types, modules, exceptions, record fields, unions, parameters, generic type parameters) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 19414aa5f5b..23242b1aff6 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -3442,7 +3442,7 @@ module DebugPrint = begin let rec MemberL (v:Val) (membInfo:ValMemberInfo) = (aboveListL [ wordL(tagText "compiled_name! = ") ^^ wordL (tagText v.CompiledName) ; wordL(tagText "membInfo-slotsig! = ") ^^ listL slotSigL membInfo.ImplementedSlotSigs ]) - and vspecAtBindL v = + and valAtBindL v = let vL = valL v in let mutL = (if v.IsMutable then wordL(tagText "mutable") ++ vL else vL) mutL --- (aboveListL (List.concat [[wordL(tagText ":") ^^ typeL v.Type]; @@ -3512,7 +3512,7 @@ module DebugPrint = begin then emptyL else let iimplsLs = iimpls |> List.map (fun (ty, _, _) -> wordL(tagText "interface") --- typeL ty) - let adhocLs = adhoc |> List.map (fun vref -> vspecAtBindL vref.Deref) + let adhocLs = adhoc |> List.map (fun vref -> valAtBindL vref.Deref) (wordL(tagText "with") @@-- aboveListL (iimplsLs @ adhocLs)) @@ wordL(tagText "end") let layoutUnionCaseArgTypes argtys = sepListL (wordL(tagText "*")) (List.map typeL argtys) @@ -3559,7 +3559,7 @@ module DebugPrint = begin let vsprs = tycon.MembersOfFSharpTyconSorted |> List.filter (fun v -> v.IsDispatchSlot) - |> List.map (fun vref -> vspecAtBindL vref.Deref) + |> List.map (fun vref -> valAtBindL vref.Deref) let vals = tycon.TrueFieldsAsList |> List.map (fun f -> (if f.IsStatic then wordL(tagText "static") else emptyL) ^^ wordL(tagText "val") ^^ layoutRecdField f) let alldecls = inherits @ vsprs @ vals let emptyMeasure = match tycon.TypeOrMeasureKind with TyparKind.Measure -> isNil alldecls | _ -> false @@ -3590,7 +3590,7 @@ module DebugPrint = begin //-------------------------------------------------------------------------- and bindingL (TBind(v, repr, _)) = - vspecAtBindL v --- (wordL(tagText "=") ^^ exprL repr) + valAtBindL v --- (wordL(tagText "=") ^^ exprL repr) and exprL expr = exprWrapL false expr and atomL expr = exprWrapL true expr // true means bracket if needed to be atomic expr @@ -3628,11 +3628,11 @@ module DebugPrint = begin | ThenDoSeq -> "; (*ThenDo*)" ((exprL x0 ^^ rightL (tagText flag)) @@ exprL x1) |> wrap | Expr.Lambda(_, _, baseValOpt, argvs, body, _, _) -> - let formalsL = spaceListL (List.map vspecAtBindL argvs) in + let formalsL = spaceListL (List.map valAtBindL argvs) in let bindingL = match baseValOpt with | None -> wordL(tagText "lam") ^^ formalsL ^^ rightL(tagText ".") - | Some basev -> wordL(tagText "lam") ^^ (leftL(tagText "base=") ^^ vspecAtBindL basev) --- formalsL ^^ rightL(tagText ".") in + | Some basev -> wordL(tagText "lam") ^^ (leftL(tagText "base=") ^^ valAtBindL basev) --- formalsL ^^ rightL(tagText ".") in (bindingL ++ exprL body) |> wrap | Expr.TyLambda(_, argtyvs, body, _, _) -> ((wordL(tagText "LAM") ^^ spaceListL (List.map typarL argtyvs) ^^ rightL(tagText ".")) ++ exprL body) |> wrap @@ -3727,7 +3727,7 @@ module DebugPrint = begin | Expr.Obj (_lambdaId, ty, basev, ccall, overrides, iimpls, _) -> wordL(tagText "OBJ:") ^^ aboveListL [typeL ty; exprL ccall; - optionL vspecAtBindL basev; + optionL valAtBindL basev; aboveListL (List.map overrideL overrides); aboveListL (List.map iimplL iimpls)] @@ -3812,7 +3812,7 @@ module DebugPrint = begin and tmethodL (TObjExprMethod(TSlotSig(nm, _, _, _, _, _), _, tps, vs, e, _)) = (wordL(tagText "TObjExprMethod") --- (wordL (tagText nm)) ^^ wordL(tagText "=")) -- (wordL(tagText "METH-LAM") --- angleBracketListL (List.map typarL tps) ^^ rightL(tagText ".")) --- - (wordL(tagText "meth-lam") --- tupleL (List.map (List.map vspecAtBindL >> tupleL) vs) ^^ rightL(tagText ".")) --- + (wordL(tagText "meth-lam") --- tupleL (List.map (List.map valAtBindL >> tupleL) vs) ^^ rightL(tagText ".")) --- (atomL e) and overrideL tmeth = wordL(tagText "with") ^^ tmethodL tmeth and iimplL (ty, tmeths) = wordL(tagText "impl") ^^ aboveListL (typeL ty :: List.map tmethodL tmeths) @@ -3850,33 +3850,33 @@ let SigTypeOfImplFile (TImplFile(_, _, mexpr, _, _, _)) = mexpr.Type //-------------------------------------------------------------------------- type SignatureRepackageInfo = - { mrpiVals : (ValRef * ValRef) list; - mrpiEntities: (TyconRef * TyconRef) list } + { RepackagedVals : (ValRef * ValRef) list; + RepackagedEntities: (TyconRef * TyconRef) list } - member remapInfo.ImplToSigMapping = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.mrpiEntities } - static member Empty = { mrpiVals = []; mrpiEntities= [] } + member remapInfo.ImplToSigMapping = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.RepackagedEntities } + static member Empty = { RepackagedVals = []; RepackagedEntities= [] } type SignatureHidingInfo = - { mhiTycons : Zset; - mhiTyconReprs : Zset; - mhiVals : Zset; - mhiRecdFields : Zset; - mhiUnionCases : Zset } + { HiddenTycons : Zset; + HiddenTyconReprs : Zset; + HiddenVals : Zset; + HiddenRecdFields : Zset; + HiddenUnionCases : Zset } static member Empty = - { mhiTycons = Zset.empty tyconOrder; - mhiTyconReprs = Zset.empty tyconOrder; - mhiVals = Zset.empty valOrder; - mhiRecdFields = Zset.empty recdFieldRefOrder; - mhiUnionCases = Zset.empty unionCaseRefOrder } + { HiddenTycons = Zset.empty tyconOrder; + HiddenTyconReprs = Zset.empty tyconOrder; + HiddenVals = Zset.empty valOrder; + HiddenRecdFields = Zset.empty recdFieldRefOrder; + HiddenUnionCases = Zset.empty unionCaseRefOrder } let addValRemap v v' tmenv = { tmenv with valRemap= tmenv.valRemap.Add v (mkLocalValRef v') } let mkRepackageRemapping mrpi = - { valRemap = ValMap.OfList (mrpi.mrpiVals |> List.map (fun (vref, x) -> vref.Deref, x)); + { valRemap = ValMap.OfList (mrpi.RepackagedVals |> List.map (fun (vref, x) -> vref.Deref, x)); tpinst = emptyTyparInst; - tyconRefRemap = TyconRefMap.OfList mrpi.mrpiEntities + tyconRefRemap = TyconRefMap.OfList mrpi.RepackagedEntities removeTraitSolutions = false } //-------------------------------------------------------------------------- @@ -3888,18 +3888,18 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) = match sigtyconOpt with | None -> // The type constructor is not present in the signature. Hence it is hidden. - let mhi = { mhi with mhiTycons = Zset.add entity mhi.mhiTycons } + let mhi = { mhi with HiddenTycons = Zset.add entity mhi.HiddenTycons } (mrpi, mhi) | Some sigtycon -> // The type constructor is in the signature. Hence record the repackage entry let sigtcref = mkLocalTyconRef sigtycon let tcref = mkLocalTyconRef entity - let mrpi = { mrpi with mrpiEntities = ((tcref, sigtcref) :: mrpi.mrpiEntities) } + let mrpi = { mrpi with RepackagedEntities = ((tcref, sigtcref) :: mrpi.RepackagedEntities) } // OK, now look for hidden things let mhi = if (match entity.TypeReprInfo with TNoRepr -> false | _ -> true) && (match sigtycon.TypeReprInfo with TNoRepr -> true | _ -> false) then // The type representation is absent in the signature, hence it is hidden - { mhi with mhiTyconReprs = Zset.add entity mhi.mhiTyconReprs } + { mhi with HiddenTyconReprs = Zset.add entity mhi.HiddenTyconReprs } else // The type representation is present in the signature. // Find the fields that have been hidden or which were non-public anyway. @@ -3912,7 +3912,7 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) = | _ -> // The field is not in the signature. Hence it is regarded as hidden. let rfref = tcref.MakeNestedRecdFieldRef rfield - { mhi with mhiRecdFields = Zset.add rfref mhi.mhiRecdFields }) + { mhi with HiddenRecdFields = Zset.add rfref mhi.HiddenRecdFields }) entity.AllFieldsArray |> List.foldBack (fun (ucase:UnionCase) mhi -> match sigtycon.GetUnionCaseByName ucase.DisplayName with @@ -3922,7 +3922,7 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) = | _ -> // The constructor is not in the signature. Hence it is regarded as hidden. let ucref = tcref.MakeNestedUnionCaseRef ucase - { mhi with mhiUnionCases = Zset.add ucref mhi.mhiUnionCases }) + { mhi with HiddenUnionCases = Zset.add ucref mhi.HiddenUnionCases }) (entity.UnionCasesAsList) (mrpi, mhi) @@ -3931,13 +3931,13 @@ let accSubEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) match sigtyconOpt with | None -> // The type constructor is not present in the signature. Hence it is hidden. - let mhi = { mhi with mhiTycons = Zset.add entity mhi.mhiTycons } + let mhi = { mhi with HiddenTycons = Zset.add entity mhi.HiddenTycons } (mrpi, mhi) | Some sigtycon -> // The type constructor is in the signature. Hence record the repackage entry let sigtcref = mkLocalTyconRef sigtycon let tcref = mkLocalTyconRef entity - let mrpi = { mrpi with mrpiEntities = ((tcref, sigtcref) :: mrpi.mrpiEntities) } + let mrpi = { mrpi with RepackagedEntities = ((tcref, sigtcref) :: mrpi.RepackagedEntities) } (mrpi, mhi) let valLinkageAEquiv g aenv (v1:Val) (v2:Val) = @@ -3955,11 +3955,11 @@ let accValRemap g aenv (msigty:ModuleOrNamespaceType) (implVal:Val) (mrpi, mhi) match sigValOpt with | None -> if verbose then dprintf "accValRemap, hide = %s#%d\n" implVal.LogicalName implVal.Stamp - let mhi = { mhi with mhiVals = Zset.add implVal mhi.mhiVals } + let mhi = { mhi with HiddenVals = Zset.add implVal mhi.HiddenVals } (mrpi, mhi) | Some (sigVal:Val) -> // The value is in the signature. Add the repackage entry. - let mrpi = { mrpi with mrpiVals = (vref, mkLocalValRef sigVal) :: mrpi.mrpiVals } + let mrpi = { mrpi with RepackagedVals = (vref, mkLocalValRef sigVal) :: mrpi.RepackagedVals } (mrpi, mhi) let getCorrespondingSigTy nm (msigty:ModuleOrNamespaceType) = @@ -4053,9 +4053,9 @@ let ComputeRemappingFromImplementationToSignature g mdef msigty = let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi = if not (canAccessFromEverywhere tycon.Accessibility) then // The type constructor is not public, hence hidden at the assembly boundary. - { mhi with mhiTycons = Zset.add tycon mhi.mhiTycons } + { mhi with HiddenTycons = Zset.add tycon mhi.HiddenTycons } elif not (canAccessFromEverywhere tycon.TypeReprAccessibility) then - { mhi with mhiTyconReprs = Zset.add tycon mhi.mhiTyconReprs } + { mhi with HiddenTyconReprs = Zset.add tycon mhi.HiddenTyconReprs } else mhi |> Array.foldBack @@ -4063,7 +4063,7 @@ let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi = if not (canAccessFromEverywhere rfield.Accessibility) then let tcref = mkLocalTyconRef tycon let rfref = tcref.MakeNestedRecdFieldRef rfield - { mhi with mhiRecdFields = Zset.add rfref mhi.mhiRecdFields } + { mhi with HiddenRecdFields = Zset.add rfref mhi.HiddenRecdFields } else mhi) tycon.AllFieldsArray |> List.foldBack @@ -4071,7 +4071,7 @@ let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi = if not (canAccessFromEverywhere ucase.Accessibility) then let tcref = mkLocalTyconRef tycon let ucref = tcref.MakeNestedUnionCaseRef ucase - { mhi with mhiUnionCases = Zset.add ucref mhi.mhiUnionCases } + { mhi with HiddenUnionCases = Zset.add ucref mhi.HiddenUnionCases } else mhi) (tycon.UnionCasesAsList) @@ -4086,7 +4086,7 @@ let accValHidingInfoAtAssemblyBoundary (vspec:Val) mhi = // anything that's not a module or member binding gets assembly visibility not vspec.IsMemberOrModuleBinding then // The value is not public, hence hidden at the assembly boundary. - { mhi with mhiVals = Zset.add vspec mhi.mhiVals } + { mhi with HiddenVals = Zset.add vspec mhi.HiddenVals } else mhi @@ -4121,10 +4121,10 @@ let IsHidden setF accessF remapF debugF = if verbose then dprintf "IsHidden, #mrmi = %d, %s = %b\n" mrmi.Length (showL (debugF x)) res; res -let IsHiddenTycon mrmi x = IsHidden (fun mhi -> mhi.mhiTycons) (fun tc -> tc.Accessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x -let IsHiddenTyconRepr mrmi x = IsHidden (fun mhi -> mhi.mhiTyconReprs) (fun v -> v.TypeReprAccessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x -let IsHiddenVal mrmi x = IsHidden (fun mhi -> mhi.mhiVals) (fun v -> v.Accessibility) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) DebugPrint.valL mrmi x -let IsHiddenRecdField mrmi x = IsHidden (fun mhi -> mhi.mhiRecdFields) (fun rfref -> rfref.RecdField.Accessibility) (fun rpi x -> remapRecdFieldRef rpi.tyconRefRemap x) DebugPrint.recdFieldRefL mrmi x +let IsHiddenTycon mrmi x = IsHidden (fun mhi -> mhi.HiddenTycons) (fun tc -> tc.Accessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x +let IsHiddenTyconRepr mrmi x = IsHidden (fun mhi -> mhi.HiddenTyconReprs) (fun v -> v.TypeReprAccessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x +let IsHiddenVal mrmi x = IsHidden (fun mhi -> mhi.HiddenVals) (fun v -> v.Accessibility) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) DebugPrint.valL mrmi x +let IsHiddenRecdField mrmi x = IsHidden (fun mhi -> mhi.HiddenRecdFields) (fun rfref -> rfref.RecdField.Accessibility) (fun rpi x -> remapRecdFieldRef rpi.tyconRefRemap x) DebugPrint.recdFieldRefL mrmi x //-------------------------------------------------------------------------- diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 0731970c195..badacfda0ea 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -3,26 +3,18 @@ /// Defines derived expression manipulation and construction functions. module internal Microsoft.FSharp.Compiler.Tastops -open System.Text open System.Collections.Generic open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal -open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Rational open Microsoft.FSharp.Compiler.Ast -open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout -open Microsoft.FSharp.Compiler.Lib - -#if !NO_EXTENSIONTYPING -open Microsoft.FSharp.Compiler.ExtensionTyping -#endif //------------------------------------------------------------------------- // Type equivalence @@ -42,10 +34,6 @@ val measureEquiv : TcGlobals -> Measure -> Measure -> bool /// Reduce a type to its more anonical form subject to an erasure flag, inference equations and abbreviations val stripTyEqnsWrtErasure: Erasure -> TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Build common types -//------------------------------------------------------------------------- - /// Build a function type val mkFunTy : TType -> TType -> TType @@ -77,139 +65,232 @@ val stripExpr : Expr -> Expr /// Get the values for a set of bindings val valsOfBinds : Bindings -> Vals -val (|ExprValWithPossibleTypeInst|_|) : Expr -> (ValRef * ValUseFlag * TType list * range) option -//------------------------------------------------------------------------- -// Build decision trees imperatively -//------------------------------------------------------------------------- +/// Look for a use of an F# value, possibly including application of a generic thing to a set of type arguments +val (|ExprValWithPossibleTypeInst|_|) : Expr -> (ValRef * ValUseFlag * TType list * range) option +/// Build decision trees imperatively type MatchBuilder = + + /// Create a new builder new : SequencePointInfoForBinding * range -> MatchBuilder + + /// Add a new destination target member AddTarget : DecisionTreeTarget -> int + + /// Add a new destination target that is an expression result member AddResultTarget : Expr * SequencePointInfoForTarget -> DecisionTree + + /// Finish the targets member CloseTargets : unit -> DecisionTreeTarget list - member Close : DecisionTree * range * TType -> Expr -//------------------------------------------------------------------------- -// Make some special decision graphs -//------------------------------------------------------------------------- + /// Build the overall expression + member Close : DecisionTree * range * TType -> Expr +/// Add an if-then-else boolean conditional node into a decision tree val mkBoolSwitch : range -> Expr -> DecisionTree -> DecisionTree -> DecisionTree + +/// Build a conditional expression val primMkCond : SequencePointInfoForBinding -> SequencePointInfoForTarget -> SequencePointInfoForTarget -> range -> TType -> Expr -> Expr -> Expr -> Expr + +/// Build a conditional expression val mkCond : SequencePointInfoForBinding -> SequencePointInfoForTarget -> range -> TType -> Expr -> Expr -> Expr -> Expr + +/// Build a conditional expression that checks for non-nullness val mkNonNullCond : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -val mkIfThen : TcGlobals -> range -> Expr -> Expr -> Expr -//------------------------------------------------------------------------- -// Generate new locals -//------------------------------------------------------------------------- +/// Build an if-then statement +val mkIfThen : TcGlobals -> range -> Expr -> Expr -> Expr +/// Build an expression corresponding to the use of a value /// Note: try to use exprForValRef or the expression returned from mkLocal instead of this. val exprForVal : range -> Val -> Expr + +/// Build an expression corresponding to the use of a reference to a value val exprForValRef : range -> ValRef -> Expr -/// Return the local and an expression to reference it +/// Make a new local value and build an expression to reference it val mkLocal : range -> string -> TType -> Val * Expr + +/// Make a new compiler-generated local value and build an expression to reference it val mkCompGenLocal : range -> string -> TType -> Val * Expr + +/// Make a new mutable compiler-generated local value and build an expression to reference it val mkMutableCompGenLocal : range -> string -> TType -> Val * Expr -val mkCompGenLocalAndInvisbleBind : TcGlobals -> string -> range -> Expr -> Val * Expr * Binding -//------------------------------------------------------------------------- -// Make lambdas -//------------------------------------------------------------------------- +/// Make a new mutable compiler-generated local value, 'let' bind it to an expression +/// 'invisibly' (no sequence point etc.), and build an expression to reference it +val mkCompGenLocalAndInvisbleBind : TcGlobals -> string -> range -> Expr -> Val * Expr * Binding +/// Build a lambda expression taking multiple values val mkMultiLambda : range -> Val list -> Expr * TType -> Expr + +/// Rebuild a lambda during an expression tree traversal val rebuildLambda : range -> Val option -> Val option -> Val list -> Expr * TType -> Expr + +/// Build a lambda expression taking a single value val mkLambda : range -> Val -> Expr * TType -> Expr + +/// Build a generic lambda expression (type abstraction) val mkTypeLambda : range -> Typars -> Expr * TType -> Expr + +/// Build an object expression val mkObjExpr : TType * Val option * Expr * ObjExprMethod list * (TType * ObjExprMethod list) list * Range.range -> Expr + +/// Build an type-chose expression, indicating that a local free choice of a type variable val mkTypeChoose : range -> Typars -> Expr -> Expr + +/// Build an iterated (curried) lambda expression val mkLambdas : range -> Typars -> Val list -> Expr * TType -> Expr + +/// Build an iterated (tupled+curried) lambda expression val mkMultiLambdasCore : range -> Val list list -> Expr * TType -> Expr * TType + +/// Build an iterated generic (type abstraction + tupled+curried) lambda expression val mkMultiLambdas : range -> Typars -> Val list list -> Expr * TType -> Expr + +/// Build a lambda expression that corresponds to the implementation of a member val mkMemberLambdas : range -> Typars -> Val option -> Val option -> Val list list -> Expr * TType -> Expr +/// Build a 'while' loop expression val mkWhile : TcGlobals -> SequencePointInfoForWhileLoop * SpecialWhileLoopMarker * Expr * Expr * range -> Expr + +/// Build a 'for' loop expression val mkFor : TcGlobals -> SequencePointInfoForForLoop * Val * Expr * ForLoopStyle * Expr * Expr * range -> Expr + +/// Build a 'try/with' expression val mkTryWith : TcGlobals -> Expr * (* filter val *) Val * (* filter expr *) Expr * (* handler val *) Val * (* handler expr *) Expr * range * TType * SequencePointInfoForTry * SequencePointInfoForWith -> Expr -val mkTryFinally: TcGlobals -> Expr * Expr * range * TType * SequencePointInfoForTry * SequencePointInfoForFinally -> Expr -//------------------------------------------------------------------------- -// Make let/letrec -//------------------------------------------------------------------------- - +/// Build a 'try/finally' expression +val mkTryFinally: TcGlobals -> Expr * Expr * range * TType * SequencePointInfoForTry * SequencePointInfoForFinally -> Expr -// Generate a user-level let-bindings +/// Build a user-level value binding val mkBind : SequencePointInfoForBinding -> Val -> Expr -> Binding + +/// Build a user-level let-binding val mkLetBind : range -> Binding -> Expr -> Expr + +/// Build a user-level value sequence of let bindings val mkLetsBind : range -> Binding list -> Expr -> Expr + +/// Build a user-level value sequence of let bindings val mkLetsFromBindings : range -> Bindings -> Expr -> Expr + +/// Build a user-level let expression val mkLet : SequencePointInfoForBinding -> range -> Val -> Expr -> Expr -> Expr + +/// Make a binding that binds a function value to a lambda taking multiple arguments val mkMultiLambdaBind : Val -> SequencePointInfoForBinding -> range -> Typars -> Val list list -> Expr * TType -> Binding // Compiler generated bindings may involve a user variable. // Compiler generated bindings may give rise to a sequence point if they are part of // an SPAlways expression. Compiler generated bindings can arise from for example, inlining. val mkCompGenBind : Val -> Expr -> Binding + +/// Make a set of bindings that bind compiler generated values to corresponding expressions. +/// Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenBinds : Val list -> Exprs -> Bindings + +/// Make a let-expression that locally binds a compiler-generated value to an expression. +/// Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenLet : range -> Val -> Expr -> Expr -> Expr + +/// Make a let-expression that locally binds a compiler-generated value to an expression, where the expression +/// is returned by the given continuation. Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenLetIn: range -> string -> TType -> Expr -> (Val * Expr -> Expr) -> Expr -// Invisible bindings are never given a sequence point and should never have side effects +/// Make a let-expression that locally binds a value to an expression in an "invisible" way. +/// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleLet : range -> Val -> Expr -> Expr -> Expr + +/// Make a binding that binds a value to an expression in an "invisible" way. +/// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleBind : Val -> Expr -> Binding + +/// Make a set of bindings that bind values to expressions in an "invisible" way. +/// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleBinds : Vals -> Exprs -> Bindings + +/// Make a let-rec expression that locally binds values to expressions where self-reference back to the values is possible. val mkLetRecBinds : range -> Bindings -> Expr -> Expr -//------------------------------------------------------------------------- -// Generalization/inference helpers -//------------------------------------------------------------------------- - /// TypeScheme (generalizedTypars, tauTy) /// /// generalizedTypars -- the truly generalized type parameters /// tauTy -- the body of the generalized type. A 'tau' type is one with its type parameters stripped off. type TypeScheme = TypeScheme of Typars * TType +/// Make the right-hand side of a generalized binding, incorporating the generalized generic parameters from the type +/// scheme into the right-hand side as type generalizations. val mkGenericBindRhs : TcGlobals -> range -> Typars -> TypeScheme -> Expr -> Expr -val isBeingGeneralized : Typar -> TypeScheme -> bool -//------------------------------------------------------------------------- -// Make lazy and/or -//------------------------------------------------------------------------- +/// Test if the type parameter is one of those being generalized by a type scheme. +val isBeingGeneralized : Typar -> TypeScheme -> bool +/// Make the expression corresponding to 'expr1 && expr2' val mkLazyAnd : TcGlobals -> range -> Expr -> Expr -> Expr + +/// Make the expression corresponding to 'expr1 || expr2' val mkLazyOr : TcGlobals -> range -> Expr -> Expr -> Expr + +/// Make a byref type val mkByrefTy : TcGlobals -> TType -> TType + +/// Make a byref type with a in/out kind inference parameter val mkByrefTyWithInference : TcGlobals -> TType -> TType -> TType + +/// Make a in-byref type with a in kind parameter val mkInByrefTy : TcGlobals -> TType -> TType -val mkOutByrefTy : TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Make construction operations -//------------------------------------------------------------------------- +/// Make an out-byref type with an out kind parameter +val mkOutByrefTy : TcGlobals -> TType -> TType +/// Make an expression that constructs a union case, e.g. 'Some(expr)' val mkUnionCaseExpr : UnionCaseRef * TypeInst * Exprs * range -> Expr + +/// Make an expression that constructs an exception value val mkExnExpr : TyconRef * Exprs * range -> Expr + +/// Make an expression that is IL assembly code val mkAsmExpr : ILInstr list * TypeInst * Exprs * TTypes * range -> Expr + +/// Make an expression that coerces one expression to another type val mkCoerceExpr : Expr * TType * range * TType -> Expr -val mkReraise : range -> TType -> Expr -val mkReraiseLibCall : TcGlobals -> TType -> range -> Expr +/// Make an expression that re-raises an exception +val mkReraise : range -> TType -> Expr -//------------------------------------------------------------------------- -// Make projection operations -//------------------------------------------------------------------------- +/// Make an expression that re-raises an exception via a library call +val mkReraiseLibCall : TcGlobals -> TType -> range -> Expr +/// Make an expression that gets an item from a tuple val mkTupleFieldGet : TcGlobals -> TupInfo * Expr * TypeInst * int * range -> Expr + +/// Make an expression that gets an item from an anonymous record val mkAnonRecdFieldGet : TcGlobals -> AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr + +/// Make an expression that gets an item from an anonymous record (via the address of the value if it is a struct) val mkAnonRecdFieldGetViaExprAddr : AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr + +/// Make an expression that gets an instance field from a record or class (via the address of the value if it is a struct) val mkRecdFieldGetViaExprAddr : Expr * RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that gets the address of an instance field from a record or class (via the address of the value if it is a struct) val mkRecdFieldGetAddrViaExprAddr : readonly: bool * Expr * RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that gets a static field from a record or class val mkStaticRecdFieldGet : RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that sets a static field in a record or class val mkStaticRecdFieldSet : RecdFieldRef * TypeInst * Expr * range -> Expr + +/// Make an expression that gets the address of a static field in a record or class val mkStaticRecdFieldGetAddr : readonly: bool * RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that sets an instance the field of a record or class (via the address of the value if it is a struct) val mkRecdFieldSetViaExprAddr : Expr * RecdFieldRef * TypeInst * Expr * range -> Expr + +/// Make an expression that gets the tag of a union value (via the address of the value if it is a struct) val mkUnionCaseTagGetViaExprAddr : Expr * TyconRef * TypeInst * range -> Expr /// Make a 'TOp.UnionCaseProof' expression, which proves a union value is over a particular case (used only for ref-unions, not struct-unions) @@ -238,9 +319,13 @@ val mkUnionCaseFieldSet : Expr * UnionCaseRef * TypeInst * int * E /// Like mkUnionCaseFieldGetUnprovenViaExprAddr, but for struct-unions, the input should be a copy of the expression. val mkUnionCaseFieldGetUnproven : TcGlobals -> Expr * UnionCaseRef * TypeInst * int * range -> Expr +/// Make an expression that gets an instance field from an F# exception value val mkExnCaseFieldGet : Expr * TyconRef * int * range -> Expr + +/// Make an expression that sets an instance field in an F# exception value val mkExnCaseFieldSet : Expr * TyconRef * int * Expr * range -> Expr +/// Make an expression that gets the address of an element in an array val mkArrayElemAddress : TcGlobals -> readonly: bool * ILReadonly * bool * ILArrayShape * TType * Expr list * range -> Expr //------------------------------------------------------------------------- @@ -272,49 +357,60 @@ val mkGetTupleItemN : TcGlobals -> range -> int -> ILType -> bool -> Expr -> TTy /// Evaluate the TupInfo to work out if it is a struct or a ref. Currently this is very simple /// but TupInfo may later be used carry variables that infer structness. val evalTupInfoIsStruct : TupInfo -> bool + +/// Evaluate the AnonRecdTypeInfo to work out if it is a struct or a ref. val evalAnonInfoIsStruct : AnonRecdTypeInfo -> bool /// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged val convertToTypeWithMetadataIfPossible : TcGlobals -> TType -> TType - -//------------------------------------------------------------------------- -// Take the address of an expression, or force it into a mutable local. Any allocated -// mutable local may need to be kept alive over a larger expression, hence we return -// a wrapping function that wraps "let mutable loc = Expr in ..." around a larger -// expression. -//------------------------------------------------------------------------- - +/// An exception representing a warning for a defensive copy of an immutable struct exception DefensiveCopyWarning of string * range + type Mutates = AddressOfOp | DefinitelyMutates | PossiblyMutates | NeverMutates + +/// Helper to take the address of an expression val mkExprAddrOfExprAux : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Val * Expr) option * Expr * bool * bool -val mkExprAddrOfExpr : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Expr -> Expr) * Expr * bool * bool -//------------------------------------------------------------------------- -// Tables keyed on values and/or type parameters -//------------------------------------------------------------------------- +/// Take the address of an expression, or force it into a mutable local. Any allocated +/// mutable local may need to be kept alive over a larger expression, hence we return +/// a wrapping function that wraps "let mutable loc = Expr in ..." around a larger +/// expression. +val mkExprAddrOfExpr : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Expr -> Expr) * Expr * bool * bool /// Maps Val to T, based on stamps [] type ValMap<'T> = + member Contents : StampMap<'T> + member Item : Val -> 'T with get + member TryFind : Val -> 'T option + member ContainsVal : Val -> bool + member Add : Val -> 'T -> ValMap<'T> + member Remove : Val -> ValMap<'T> + member IsEmpty : bool + static member Empty : ValMap<'T> + static member OfList : (Val * 'T) list -> ValMap<'T> /// Mutable data structure mapping Val's to T based on stamp keys [] type ValHash<'T> = + member Values : seq<'T> + member TryFind : Val -> 'T option + member Add : Val * 'T -> unit - static member Create : unit -> ValHash<'T> + static member Create : unit -> ValHash<'T> /// Maps Val's to list of T based on stamp keys [] @@ -332,97 +428,126 @@ type ValMultiMap<'T> = static member Empty : ValMultiMap<'T> +/// Maps type parameters to entries based on stamp keys [] -/// Maps Typar to T based on stamp keys type TyparMap<'T> = + /// Get the entry for the given type parameter member Item : Typar -> 'T with get + /// Determine is the map contains an entry for the given type parameter member ContainsKey : Typar -> bool + /// Try to find the entry for the given type parameter member TryFind : Typar -> 'T option + /// Make a new map, containing a new entry for the given type parameter member Add : Typar * 'T -> TyparMap<'T> + /// The empty map static member Empty : TyparMap<'T> -[] /// Maps TyconRef to T based on stamp keys +[] type TyconRefMap<'T> = + /// Get the entry for the given type definition member Item : TyconRef -> 'T with get + /// Try to find the entry for the given type definition member TryFind : TyconRef -> 'T option + /// Determine is the map contains an entry for the given type definition member ContainsKey : TyconRef -> bool + /// Make a new map, containing a new entry for the given type definition member Add : TyconRef -> 'T -> TyconRefMap<'T> + /// Remove the entry for the given type definition, if any member Remove : TyconRef -> TyconRefMap<'T> + /// Determine if the map is empty member IsEmpty : bool + /// The empty map static member Empty : TyconRefMap<'T> + /// Make a new map, containing entries for the given type definitions static member OfList : (TyconRef * 'T) list -> TyconRefMap<'T> /// Maps TyconRef to list of T based on stamp keys [] type TyconRefMultiMap<'T> = + /// Fetch the entries for the given type definition member Find : TyconRef -> 'T list + /// Make a new map, containing a new entry for the given type definition member Add : TyconRef * 'T -> TyconRefMultiMap<'T> + /// The empty map static member Empty : TyconRefMultiMap<'T> + /// Make a new map, containing a entries for the given type definitions static member OfList : (TyconRef * 'T) list -> TyconRefMultiMap<'T> -//------------------------------------------------------------------------- -// Orderings on Tycon, Val, RecdFieldRef, Typar -//------------------------------------------------------------------------- +/// An ordering for value definitions, based on stamp +val valOrder: IComparer -val valOrder : IComparer -val tyconOrder : IComparer -val recdFieldRefOrder : IComparer -val typarOrder : IComparer +/// An ordering for type definitions, based on stamp +val tyconOrder: IComparer -//------------------------------------------------------------------------- -// Equality on Tycon and Val -//------------------------------------------------------------------------- +/// An ordering for record fields, based on stamp +val recdFieldRefOrder: IComparer +/// An ordering for type parameters, based on stamp +val typarOrder: IComparer + +/// Equality for type definition references val tyconRefEq : TcGlobals -> TyconRef -> TyconRef -> bool + +/// Equality for value references val valRefEq : TcGlobals -> ValRef -> ValRef -> bool //------------------------------------------------------------------------- // Operations on types: substitution //------------------------------------------------------------------------- +/// Represents an instantiation where types replace type parameters type TyparInst = (Typar * TType) list +/// Represents an instantiation where type definition references replace other type definition references type TyconRefRemap = TyconRefMap + +/// Represents an instantiation where value references replace other value references type ValRemap = ValMap +/// Represents a combination of substitutions/instantiations where things replace other things during remapping [] type Remap = - { tpinst : TyparInst; - valRemap: ValRemap; - tyconRefRemap : TyconRefRemap; + { tpinst : TyparInst + valRemap: ValRemap + tyconRefRemap : TyconRefRemap removeTraitSolutions: bool } static member Empty : Remap val addTyconRefRemap : TyconRef -> TyconRef -> Remap -> Remap -val addValRemap : Val -> Val -> Remap -> Remap +val addValRemap : Val -> Val -> Remap -> Remap val mkTyparInst : Typars -> TTypes -> TyparInst + val mkTyconRefInst : TyconRef -> TypeInst -> TyparInst + val emptyTyparInst : TyparInst val instType : TyparInst -> TType -> TType + val instTypes : TyparInst -> TypeInst -> TypeInst + val instTyparConstraints : TyparInst -> TyparConstraint list -> TyparConstraint list + val instTrait : TyparInst -> TraitConstraintInfo -> TraitConstraintInfo //------------------------------------------------------------------------- @@ -430,8 +555,11 @@ val instTrait : TyparInst -> TraitConstraintInfo -> TraitConstraint //------------------------------------------------------------------------- val generalizeTypars : Typars -> TypeInst + val generalizeTyconRef : TyconRef -> TTypes * TType + val generalizedTyconRef : TyconRef -> TType + val mkTyparToTyparRenaming : Typars -> Typars -> TyparInst * TTypes //------------------------------------------------------------------------- @@ -439,12 +567,16 @@ val mkTyparToTyparRenaming : Typars -> Typars -> TyparInst * TTypes //------------------------------------------------------------------------- val reduceTyconRefAbbrev : TyconRef -> TypeInst -> TType + val reduceTyconRefMeasureableOrProvided : TcGlobals -> TyconRef -> TypeInst -> TType + val reduceTyconRefAbbrevMeasureable : TyconRef -> Measure /// set bool to 'true' to allow shortcutting of type parameter equation chains during stripping val stripTyEqnsA : TcGlobals -> bool -> TType -> TType + val stripTyEqns : TcGlobals -> TType -> TType + val stripTyEqnsAndMeasureEqns : TcGlobals -> TType -> TType val tryNormalizeMeasureInType : TcGlobals -> TType -> TType @@ -455,7 +587,9 @@ val tryNormalizeMeasureInType : TcGlobals -> TType -> TType /// See through F# exception abbreviations val stripExnEqns : TyconRef -> Tycon + val recdFieldsOfExnDefRef : TyconRef -> RecdField list + val recdFieldTysOfExnDefRef : TyconRef -> TType list //------------------------------------------------------------------------- @@ -464,63 +598,102 @@ val recdFieldTysOfExnDefRef : TyconRef -> TType list //------------------------------------------------------------------------- val destForallTy : TcGlobals -> TType -> Typars * TType + val destFunTy : TcGlobals -> TType -> TType * TType + val destAnyTupleTy : TcGlobals -> TType -> TupInfo * TTypes + val destRefTupleTy : TcGlobals -> TType -> TTypes + val destStructTupleTy : TcGlobals -> TType -> TTypes + val destTyparTy : TcGlobals -> TType -> Typar + val destAnyParTy : TcGlobals -> TType -> Typar + val destMeasureTy : TcGlobals -> TType -> Measure + val tryDestForallTy : TcGlobals -> TType -> Typars * TType val isFunTy : TcGlobals -> TType -> bool + val isForallTy : TcGlobals -> TType -> bool + val isAnyTupleTy : TcGlobals -> TType -> bool + val isRefTupleTy : TcGlobals -> TType -> bool + val isStructTupleTy : TcGlobals -> TType -> bool + val isStructAnonRecdTy : TcGlobals -> TType -> bool + val isAnonRecdTy : TcGlobals -> TType -> bool + val isUnionTy : TcGlobals -> TType -> bool + val isReprHiddenTy : TcGlobals -> TType -> bool + val isFSharpObjModelTy : TcGlobals -> TType -> bool + val isRecdTy : TcGlobals -> TType -> bool + val isFSharpStructOrEnumTy : TcGlobals -> TType -> bool + val isFSharpEnumTy : TcGlobals -> TType -> bool + val isTyparTy : TcGlobals -> TType -> bool + val isAnyParTy : TcGlobals -> TType -> bool + val tryAnyParTy : TcGlobals -> TType -> ValueOption + val tryAnyParTyOption : TcGlobals -> TType -> Typar option + val isMeasureTy : TcGlobals -> TType -> bool val mkAppTy : TyconRef -> TypeInst -> TType val mkProvenUnionCaseTy : UnionCaseRef -> TypeInst -> TType + val isProvenUnionCaseTy : TType -> bool val isAppTy : TcGlobals -> TType -> bool + val tryAppTy : TcGlobals -> TType -> ValueOption + val destAppTy : TcGlobals -> TType -> TyconRef * TypeInst + val tcrefOfAppTy : TcGlobals -> TType -> TyconRef + val tryDestAppTy : TcGlobals -> TType -> ValueOption + val tryDestTyparTy : TcGlobals -> TType -> ValueOption + val tryDestFunTy : TcGlobals -> TType -> ValueOption<(TType * TType)> + val tryDestAnonRecdTy : TcGlobals -> TType -> ValueOption + val argsOfAppTy : TcGlobals -> TType -> TypeInst + val mkInstForAppTy : TcGlobals -> TType -> TyparInst /// Try to get a TyconRef for a type without erasing type abbreviations val tryNiceEntityRefOfTy : TType -> ValueOption -val tryNiceEntityRefOfTyOption : TType -> TyconRef option +val tryNiceEntityRefOfTyOption : TType -> TyconRef option val domainOfFunTy : TcGlobals -> TType -> TType + val rangeOfFunTy : TcGlobals -> TType -> TType + val stripFunTy : TcGlobals -> TType -> TType list * TType + val stripFunTyN : TcGlobals -> int -> TType -> TType list * TType val applyForallTy : TcGlobals -> TType -> TypeInst -> TType val tryDestAnyTupleTy : TcGlobals -> TType -> TupInfo * TType list + val tryDestRefTupleTy : TcGlobals -> TType -> TType list //------------------------------------------------------------------------- @@ -535,7 +708,9 @@ val actualTysOfUnionCaseFields : TyparInst -> UnionCaseRef -> TType list val actualTysOfInstanceRecdFields : TyparInst -> TyconRef -> TType list val actualTyOfRecdField : TyparInst -> RecdField -> TType + val actualTyOfRecdFieldRef : RecdFieldRef -> TypeInst -> TType + val actualTyOfRecdFieldForTycon : Tycon -> TypeInst -> RecdField -> TType //------------------------------------------------------------------------- @@ -545,14 +720,21 @@ val actualTyOfRecdFieldForTycon : Tycon -> TypeInst -> RecdField -> TType //------------------------------------------------------------------------- type UncurriedArgInfos = (TType * ArgReprInfo) list + type CurriedArgInfos = UncurriedArgInfos list val destTopForallTy : TcGlobals -> ValReprInfo -> TType -> Typars * TType + val GetTopTauTypeInFSharpForm : TcGlobals -> ArgReprInfo list list -> TType -> range -> CurriedArgInfos * TType + val GetTopValTypeInFSharpForm : TcGlobals -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType * ArgReprInfo + val IsCompiledAsStaticProperty : TcGlobals -> Val -> bool + val IsCompiledAsStaticPropertyWithField : TcGlobals -> Val -> bool + val GetTopValTypeInCompiledForm : TcGlobals -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType option * ArgReprInfo + val GetFSharpViewOfReturnType : TcGlobals -> TType option -> TType val NormalizeDeclaredTyparsForEquiRecursiveInference : TcGlobals -> Typars -> Typars @@ -568,40 +750,58 @@ val applyTys : TcGlobals -> TType -> TType list * 'T list -> TType //------------------------------------------------------------------------- val emptyFreeTypars : FreeTypars + val unionFreeTypars : FreeTypars -> FreeTypars -> FreeTypars val emptyFreeTycons : FreeTycons + val unionFreeTycons : FreeTycons -> FreeTycons -> FreeTycons val emptyFreeTyvars : FreeTyvars + val isEmptyFreeTyvars : FreeTyvars -> bool + val unionFreeTyvars : FreeTyvars -> FreeTyvars -> FreeTyvars val emptyFreeLocals : FreeLocals + val unionFreeLocals : FreeLocals -> FreeLocals -> FreeLocals type FreeVarOptions val CollectLocalsNoCaching : FreeVarOptions + val CollectTyparsNoCaching : FreeVarOptions + val CollectTyparsAndLocalsNoCaching : FreeVarOptions + val CollectTyparsAndLocals : FreeVarOptions + val CollectLocals : FreeVarOptions + val CollectTypars : FreeVarOptions + val CollectAllNoCaching : FreeVarOptions + val CollectAll : FreeVarOptions val accFreeInTypes : FreeVarOptions -> TType list -> FreeTyvars -> FreeTyvars + val accFreeInType : FreeVarOptions -> TType -> FreeTyvars -> FreeTyvars + val accFreeInTypars : FreeVarOptions -> Typars -> FreeTyvars -> FreeTyvars val freeInType : FreeVarOptions -> TType -> FreeTyvars + val freeInTypes : FreeVarOptions -> TType list -> FreeTyvars + val freeInVal : FreeVarOptions -> Val -> FreeTyvars // This one puts free variables in canonical left-to-right order. val freeInTypeLeftToRight : TcGlobals -> bool -> TType -> Typars + val freeInTypesLeftToRight : TcGlobals -> bool -> TType list -> Typars + val freeInTypesLeftToRightSkippingConstraints : TcGlobals -> TType list -> Typars val freeInModuleTy: ModuleOrNamespaceType -> FreeTyvars @@ -614,25 +814,39 @@ val isDimensionless : TcGlobals -> TType -> bool [] type TypeEquivEnv = - { EquivTypars: TyparMap; + { EquivTypars: TyparMap EquivTycons: TyconRefRemap } static member Empty : TypeEquivEnv + member BindEquivTypars : Typars -> Typars -> TypeEquivEnv + static member FromTyparInst : TyparInst -> TypeEquivEnv + static member FromEquivTypars : Typars -> Typars -> TypeEquivEnv val traitsAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool + val traitsAEquiv : TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool + val typarConstraintsAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool + val typarConstraintsAEquiv : TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool + val typarsAEquiv : TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool + val typeAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool + val typeAEquiv : TcGlobals -> TypeEquivEnv -> TType -> TType -> bool + val returnTypesAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool + val returnTypesAEquiv : TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool + val tcrefAEquiv : TcGlobals -> TypeEquivEnv -> TyconRef -> TyconRef -> bool + val valLinkageAEquiv : TcGlobals -> TypeEquivEnv -> Val -> Val -> bool + val anonInfoEquiv : AnonRecdTypeInfo -> AnonRecdTypeInfo -> bool //------------------------------------------------------------------------- @@ -650,11 +864,17 @@ val getErasedTypes : TcGlobals -> TType -> TType list //------------------------------------------------------------------------- val MeasurePower : Measure -> int -> Measure + val ListMeasureVarOccsWithNonZeroExponents : Measure -> (Typar * Rational) list + val ListMeasureConOccsWithNonZeroExponents : TcGlobals -> bool -> Measure -> (TyconRef * Rational) list + val ProdMeasures : Measure list -> Measure + val MeasureVarExponent : Typar -> Measure -> Rational + val MeasureExprConExponent : TcGlobals -> bool -> TyconRef -> Measure -> Rational + val normalizeMeasure : TcGlobals -> Measure -> Measure @@ -663,19 +883,26 @@ val normalizeMeasure : TcGlobals -> Measure -> Measure //------------------------------------------------------------------------- val GetTypeOfMemberInFSharpForm : TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType * ArgReprInfo + val GetTypeOfMemberInMemberForm : TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType option * ArgReprInfo + val GetTypeOfIntrinsicMemberInCompiledForm : TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType option * ArgReprInfo + val GetMemberTypeInMemberForm : TcGlobals -> MemberFlags -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType option * ArgReprInfo /// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst) val PartitionValTyparsForApparentEnclosingType : TcGlobals -> Val -> (Typars * Typars * Typars * TyparInst * TType list) option + /// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst) val PartitionValTypars : TcGlobals -> Val -> (Typars * Typars * Typars * TyparInst * TType list) option + /// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst) val PartitionValRefTypars : TcGlobals -> ValRef -> (Typars * Typars * Typars * TyparInst * TType list) option val ReturnTypeOfPropertyVal : TcGlobals -> Val -> TType + val ArgInfosOfPropertyVal : TcGlobals -> Val -> UncurriedArgInfos + val ArgInfosOfMember: TcGlobals -> ValRef -> CurriedArgInfos val GetMemberCallInfo : TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * bool * bool * bool * bool * bool @@ -686,68 +913,95 @@ val GetMemberCallInfo : TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * type TyparConstraintsWithTypars = (Typar * TyparConstraint) list - module PrettyTypes = + val NeedsPrettyTyparName : Typar -> bool + val NewPrettyTypars : TyparInst -> Typars -> string list -> Typars * TyparInst + val PrettyTyparNames : (Typar -> bool) -> string list -> Typars -> string list + val PrettifyType : TcGlobals -> TType -> TType * TyparConstraintsWithTypars + val PrettifyInstAndTyparsAndType : TcGlobals -> TyparInst * Typars * TType -> (TyparInst * Typars * TType) * TyparConstraintsWithTypars + val PrettifyTypePair : TcGlobals -> TType * TType -> (TType * TType) * TyparConstraintsWithTypars + val PrettifyTypes : TcGlobals -> TTypes -> TTypes * TyparConstraintsWithTypars + val PrettifyInst : TcGlobals -> TyparInst -> TyparInst * TyparConstraintsWithTypars + val PrettifyInstAndType : TcGlobals -> TyparInst * TType -> (TyparInst * TType) * TyparConstraintsWithTypars + val PrettifyInstAndTypes : TcGlobals -> TyparInst * TTypes -> (TyparInst * TTypes) * TyparConstraintsWithTypars + val PrettifyInstAndSig : TcGlobals -> TyparInst * TTypes * TType -> (TyparInst * TTypes * TType) * TyparConstraintsWithTypars + val PrettifyCurriedTypes : TcGlobals -> TType list list -> TType list list * TyparConstraintsWithTypars + val PrettifyCurriedSigTypes : TcGlobals -> TType list list * TType -> (TType list list * TType) * TyparConstraintsWithTypars + val PrettifyInstAndUncurriedSig : TcGlobals -> TyparInst * UncurriedArgInfos * TType -> (TyparInst * UncurriedArgInfos * TType) * TyparConstraintsWithTypars + val PrettifyInstAndCurriedSig : TcGlobals -> TyparInst * TTypes * CurriedArgInfos * TType -> (TyparInst * TTypes * CurriedArgInfos * TType) * TyparConstraintsWithTypars [] type DisplayEnv = - { includeStaticParametersInTypeNames : bool; - openTopPathsSorted: Lazy; - openTopPathsRaw: string list list; - shortTypeNames: bool; - suppressNestedTypes: bool; - maxMembers : int option; - showObsoleteMembers: bool; - showHiddenMembers: bool; - showTyparBinding: bool; - showImperativeTyparAnnotations: bool; - suppressInlineKeyword:bool; - suppressMutableKeyword:bool; - showMemberContainers: bool; - shortConstraints:bool; - useColonForReturnType:bool; - showAttributes: bool; - showOverrides:bool; - showConstraintTyparAnnotations:bool; - abbreviateAdditionalConstraints: bool; + { includeStaticParametersInTypeNames : bool + openTopPathsSorted: Lazy + openTopPathsRaw: string list list + shortTypeNames: bool + suppressNestedTypes: bool + maxMembers : int option + showObsoleteMembers: bool + showHiddenMembers: bool + showTyparBinding: bool + showImperativeTyparAnnotations: bool + suppressInlineKeyword:bool + suppressMutableKeyword:bool + showMemberContainers: bool + shortConstraints:bool + useColonForReturnType:bool + showAttributes: bool + showOverrides:bool + showConstraintTyparAnnotations:bool + abbreviateAdditionalConstraints: bool showTyparDefaultConstraints: bool g: TcGlobals contextAccessibility: Accessibility generatedValueLayout:(Val -> layout option) } + member SetOpenPaths: string list list -> DisplayEnv + static member Empty: TcGlobals -> DisplayEnv member AddAccessibility : Accessibility -> DisplayEnv + member AddOpenPath : string list -> DisplayEnv + member AddOpenModuleOrNamespace : ModuleOrNamespaceRef -> DisplayEnv val tagEntityRefName: xref: EntityRef -> name: string -> StructuredFormat.TaggedText /// Return the full text for an item as we want it displayed to the user as a fully qualified entity val fullDisplayTextOfModRef : ModuleOrNamespaceRef -> string + val fullDisplayTextOfParentOfModRef : ModuleOrNamespaceRef -> ValueOption + val fullDisplayTextOfValRef : ValRef -> string + val fullDisplayTextOfValRefAsLayout : ValRef -> StructuredFormat.Layout + val fullDisplayTextOfTyconRef : TyconRef -> string + val fullDisplayTextOfTyconRefAsLayout : TyconRef -> StructuredFormat.Layout + val fullDisplayTextOfExnRef : TyconRef -> string + val fullDisplayTextOfExnRefAsLayout : TyconRef -> StructuredFormat.Layout + val fullDisplayTextOfUnionCaseRef : UnionCaseRef -> string + val fullDisplayTextOfRecdFieldRef : RecdFieldRef -> string val ticksAndArgCountTextOfTyconRef : TyconRef -> string @@ -758,22 +1012,23 @@ val qualifiedMangledNameOfTyconRef : TyconRef -> string -> string val trimPathByDisplayEnv : DisplayEnv -> string list -> string val prefixOfStaticReq : TyparStaticReq -> string + val prefixOfRigidTypar : Typar -> string /// Utilities used in simplifying types for visual presentation module SimplifyTypes = + type TypeSimplificationInfo = - { singletons : Typar Zset; - inplaceConstraints : Zmap; - postfixConstraints : TyparConstraintsWithTypars; } + { singletons : Typar Zset + inplaceConstraints : Zmap + postfixConstraints : TyparConstraintsWithTypars } + val typeSimplificationInfo0 : TypeSimplificationInfo - val CollectInfo : bool -> TType list -> TyparConstraintsWithTypars -> TypeSimplificationInfo -//------------------------------------------------------------------------- -// -//------------------------------------------------------------------------- + val CollectInfo : bool -> TType list -> TyparConstraintsWithTypars -> TypeSimplificationInfo val superOfTycon : TcGlobals -> Tycon -> TType + val abstractSlotValsOfTycons : Tycon list -> Val list //------------------------------------------------------------------------- @@ -781,11 +1036,15 @@ val abstractSlotValsOfTycons : Tycon list -> Val list //------------------------------------------------------------------------- val emptyFreeVars : FreeVars + val unionFreeVars : FreeVars -> FreeVars -> FreeVars val accFreeInTargets : FreeVarOptions -> DecisionTreeTarget array -> FreeVars -> FreeVars + val accFreeInExprs : FreeVarOptions -> Exprs -> FreeVars -> FreeVars + val accFreeInSwitchCases : FreeVarOptions -> DecisionTreeCase list -> DecisionTree option -> FreeVars -> FreeVars + val accFreeInDecisionTree : FreeVarOptions -> DecisionTree -> FreeVars -> FreeVars /// Get the free variables in a module definition. @@ -797,277 +1056,382 @@ val freeInExpr : FreeVarOptions -> Expr -> FreeVars /// Get the free variables in the right hand side of a binding. val freeInBindingRhs : FreeVarOptions -> Binding -> FreeVars +/// Check if a set of free type variables are all public val freeTyvarsAllPublic : FreeTyvars -> bool -val freeVarsAllPublic : FreeVars -> bool -//------------------------------------------------------------------------- -// Mark/range/position information from expressions -//------------------------------------------------------------------------- +/// Check if a set of free variables are all public +val freeVarsAllPublic : FreeVars -> bool +/// Get the mark/range/position information from an expression type Expr with member Range : range -//------------------------------------------------------------------------- -// type-of operations on the expression tree -//------------------------------------------------------------------------- - +/// Compute the type of an expression from the expression itself val tyOfExpr : TcGlobals -> Expr -> TType -//------------------------------------------------------------------------- -// Top expressions to implement top types -//------------------------------------------------------------------------- - +/// A flag to govern whether arity inference should be type-directed or syntax-directed when +/// inferring an arity from a lambda expression. [] -type AllowTypeDirectedDetupling = Yes | No +type AllowTypeDirectedDetupling = + | Yes + | No +/// Given a (curried) lambda expression, pull off its arguments val stripTopLambda : Expr * TType -> Typars * Val list list * Expr * TType + +/// Given a lambda expression, extract the ValReprInfo for its arguments and other details val InferArityOfExpr : TcGlobals -> AllowTypeDirectedDetupling -> TType -> Attribs list list -> Attribs -> Expr -> ValReprInfo + +/// Given a lambda binding, extract the ValReprInfo for its arguments and other details val InferArityOfExprBinding : TcGlobals -> AllowTypeDirectedDetupling -> Val -> Expr -> ValReprInfo -//------------------------------------------------------------------------- -// Copy expressions and types -//------------------------------------------------------------------------- - +/// Mutate a value to indicate it should be considered a local rather than a module-bound definition // REVIEW: this mutation should not be needed val setValHasNoArity : Val -> Val +/// Indicate what should happen to value definitions when copying expressions type ValCopyFlag = | CloneAll | CloneAllAndMarkExprValsAsCompilerGenerated - // OnlyCloneExprVals is a nasty setting to reuse the cloning logic in a mode where all - // Tycon and "module/member" Val objects keep their identity, but the Val objects for all Expr bindings - // are cloned. This is used to 'fixup' the TAST created by tlr.fs - // - // This is a fragile mode of use. It's not really clear why TLR needs to create a "bad" expression tree that - // reuses Val objects as multiple value bindings, and its been the cause of several subtle bugs. + + /// OnlyCloneExprVals is a nasty setting to reuse the cloning logic in a mode where all + /// Tycon and "module/member" Val objects keep their identity, but the Val objects for all Expr bindings + /// are cloned. This is used to 'fixup' the TAST created by tlr.fs + /// + /// This is a fragile mode of use. It's not really clear why TLR needs to create a "bad" expression tree that + /// reuses Val objects as multiple value bindings, and its been the cause of several subtle bugs. | OnlyCloneExprVals +/// Remap a reference to a type definition using the given remapping substitution val remapTyconRef : TyconRefRemap -> TyconRef -> TyconRef + +/// Remap a reference to a union case using the given remapping substitution val remapUnionCaseRef : TyconRefRemap -> UnionCaseRef -> UnionCaseRef + +/// Remap a reference to a record field using the given remapping substitution val remapRecdFieldRef : TyconRefRemap -> RecdFieldRef -> RecdFieldRef + +/// Remap a reference to a value using the given remapping substitution val remapValRef : Remap -> ValRef -> ValRef + +/// Remap an expression using the given remapping substitution val remapExpr : TcGlobals -> ValCopyFlag -> Remap -> Expr -> Expr + +/// Remap an attribute using the given remapping substitution val remapAttrib : TcGlobals -> Remap -> Attrib -> Attrib + +/// Remap a (possible generic) type using the given remapping substitution val remapPossibleForallTy : TcGlobals -> Remap -> TType -> TType + +/// Copy an entire module or namespace type using the given copying flags val copyModuleOrNamespaceType : TcGlobals -> ValCopyFlag -> ModuleOrNamespaceType -> ModuleOrNamespaceType + +/// Copy an entire expression using the given copying flags val copyExpr : TcGlobals -> ValCopyFlag -> Expr -> Expr + +/// Copy an entire implementation file using the given copying flags val copyImplFile : TcGlobals -> ValCopyFlag -> TypedImplFile -> TypedImplFile + +/// Copy a method slot signature, including new generic type parameters if the slot signature represents a generic method val copySlotSig : SlotSig -> SlotSig + +/// Instantiate the generic type parameters in a method slot signature, building a new one val instSlotSig : TyparInst -> SlotSig -> SlotSig -val instExpr : TcGlobals -> TyparInst -> Expr -> Expr -//------------------------------------------------------------------------- -// Build the remapping that corresponds to a module meeting its signature -// and also report the set of tycons, tycon representations and values hidden in the process. -//------------------------------------------------------------------------- +/// Instantiate the generic type parameters in an expression, building a new one +val instExpr : TcGlobals -> TyparInst -> Expr -> Expr +/// The remapping that corresponds to a module meeting its signature +/// and also report the set of tycons, tycon representations and values hidden in the process. type SignatureRepackageInfo = - { mrpiVals: (ValRef * ValRef) list; - mrpiEntities: (TyconRef * TyconRef) list } + { /// The list of corresponding values + RepackagedVals: (ValRef * ValRef) list + + /// The list of corresponding modules, namespacea and type definitions + RepackagedEntities: (TyconRef * TyconRef) list } + /// The empty table static member Empty : SignatureRepackageInfo +/// A set of tables summarizing the items hidden by a signature type SignatureHidingInfo = - { mhiTycons : Zset; - mhiTyconReprs : Zset; - mhiVals : Zset; - mhiRecdFields : Zset; - mhiUnionCases : Zset } + { HiddenTycons: Zset + HiddenTyconReprs: Zset + HiddenVals: Zset + HiddenRecdFields: Zset + HiddenUnionCases: Zset } + + /// The empty table representing no hiding static member Empty : SignatureHidingInfo -val ComputeRemappingFromInferredSignatureToExplicitSignature : TcGlobals -> ModuleOrNamespaceType -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo +/// Compute the remapping information implied by a signature being inferred for a particular implementation val ComputeRemappingFromImplementationToSignature : TcGlobals -> ModuleOrNamespaceExpr -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo + +/// Compute the remapping information implied by an explicit signature being given for an inferred signature +val ComputeRemappingFromInferredSignatureToExplicitSignature : TcGlobals -> ModuleOrNamespaceType -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo + +/// Compute the hiding information that corresponds to the hiding applied at an assembly boundary val ComputeHidingInfoAtAssemblyBoundary : ModuleOrNamespaceType -> SignatureHidingInfo -> SignatureHidingInfo + val mkRepackageRemapping : SignatureRepackageInfo -> Remap +/// Wrap one module or namespace implementation in a 'namespace N' outer wrapper val wrapModuleOrNamespaceExprInNamespace : Ident -> CompilationPath -> ModuleOrNamespaceExpr -> ModuleOrNamespaceExpr + +/// Wrap one module or namespace definition in a 'namespace N' outer wrapper val wrapModuleOrNamespaceTypeInNamespace : Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespaceType * ModuleOrNamespace + +/// Wrap one module or namespace definition in a 'module M = ..' outer wrapper val wrapModuleOrNamespaceType : Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespace +/// Given an implementation, fetch its recorded signature val SigTypeOfImplFile : TypedImplFile -> ModuleOrNamespaceType -//------------------------------------------------------------------------- -// Given a list of top-most signatures that together constrain the public compilation units -// of an assembly, compute a remapping that converts local references to non-local references. -// This remapping must be applied to all pickled expressions and types -// exported from the assembly. -//------------------------------------------------------------------------- - - +/// Given a namespace, module or type definition, try to produce a reference to that entity. val tryRescopeEntity : CcuThunk -> Entity -> ValueOption + +/// Given a value definition, try to produce a reference to that value. Fails for local values. val tryRescopeVal : CcuThunk -> Remap -> Val -> ValueOption +/// Make the substitution (remapping) table for viewing a module or namespace 'from the outside' +/// +/// Given the top-most signatures constrains the public compilation units +/// of an assembly, compute a remapping that converts local references to non-local references. +/// This remapping must be applied to all pickled expressions and types +/// exported from the assembly. val MakeExportRemapping : CcuThunk -> ModuleOrNamespace -> Remap + +/// Make a remapping table for viewing a module or namespace 'from the outside' val ApplyExportRemappingToEntity : TcGlobals -> Remap -> ModuleOrNamespace -> ModuleOrNamespace -/// Query SignatureRepackageInfo +/// Determine if a type definition is hidden by a signature val IsHiddenTycon : (Remap * SignatureHidingInfo) list -> Tycon -> bool + +/// Determine if the representation of a type definition is hidden by a signature val IsHiddenTyconRepr : (Remap * SignatureHidingInfo) list -> Tycon -> bool + +/// Determine if a member, function or value is hidden by a signature val IsHiddenVal : (Remap * SignatureHidingInfo) list -> Val -> bool -val IsHiddenRecdField : (Remap * SignatureHidingInfo) list -> RecdFieldRef -> bool -//------------------------------------------------------------------------- -// Adjust marks in expressions -//------------------------------------------------------------------------- +/// Determine if a record field is hidden by a signature +val IsHiddenRecdField : (Remap * SignatureHidingInfo) list -> RecdFieldRef -> bool +/// Adjust marks in expressions, replacing all marks by thegiven mark. +/// Used when inlining. val remarkExpr : range -> Expr -> Expr - -//------------------------------------------------------------------------- -// Make applications -//------------------------------------------------------------------------- +/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments val primMkApp : (Expr * TType) -> TypeInst -> Exprs -> range -> Expr + +/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments. +/// Reduce the application via let-bindings if the function value is a lambda expression. val mkApps : TcGlobals -> (Expr * TType) * TType list list * Exprs * range -> Expr + +/// Build the application of a generic construct to a set of type arguments. +/// Reduce the application via substitution if the function value is a typed lambda expression. val mkTyAppExpr : range -> Expr * TType -> TType list -> Expr +/// Build an expression to mutate a local /// localv <- e val mkValSet : range -> ValRef -> Expr -> Expr + +/// Build an expression to mutate the contents of a local pointer /// *localv_ptr = e val mkAddrSet : range -> ValRef -> Expr -> Expr + +/// Build an expression to dereference a local pointer /// *localv_ptr val mkAddrGet : range -> ValRef -> Expr + +/// Build an expression to take the address of a local /// &localv val mkValAddr : range -> readonly: bool -> ValRef -> Expr -//------------------------------------------------------------------------- -// Note these take the address of the record expression if it is a struct, and -// apply a type instantiation if it is a first-class polymorphic record field. -//------------------------------------------------------------------------- - +/// Build an exression representing the read of an instance class or record field. +/// First take the address of the record expression if it is a struct. val mkRecdFieldGet : TcGlobals -> Expr * RecdFieldRef * TypeInst * range -> Expr -//------------------------------------------------------------------------- -// Get the targets used in a decision graph (for reporting warnings) -//------------------------------------------------------------------------- - +/// Accumulate the targets actually used in a decision graph (for reporting warnings) val accTargetsOfDecisionTree : DecisionTree -> int list -> int list -//------------------------------------------------------------------------- -// Optimizations on decision graphs -//------------------------------------------------------------------------- - +/// Make a 'match' expression applying some peep-hole optimizations along the way, e.g to +/// pre-decide the branch taken at compile-time. val mkAndSimplifyMatch : SequencePointInfoForBinding -> range -> range -> TType -> DecisionTree -> DecisionTreeTarget list -> Expr +/// Make a 'match' expression without applying any peep-hole optimizations. val primMkMatch : SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget array * range * TType -> Expr -//------------------------------------------------------------------------- -// Work out what things on the r.h.s. of a let rec need to be fixed up -//------------------------------------------------------------------------- - +/// Work out what things on the right-han-side of a 'let rec' recursive binding need to be fixed up val IterateRecursiveFixups : TcGlobals -> Val option -> (Val option -> Expr -> (Expr -> Expr) -> Expr -> unit) -> Expr * (Expr -> Expr) -> Expr -> unit -//------------------------------------------------------------------------- -// From lambdas taking multiple variables to lambdas taking a single variable -// of tuple type. -//------------------------------------------------------------------------- - +/// Given a lambda expression taking multiple variables, build a corresponding lambda taking a tuple val MultiLambdaToTupledLambda : TcGlobals -> Val list -> Expr -> Val * Expr -val AdjustArityOfLambdaBody : TcGlobals -> int -> Val list -> Expr -> Val list * Expr -//------------------------------------------------------------------------- -// Make applications, doing beta reduction by introducing let-bindings -//------------------------------------------------------------------------- +/// Given a lambda expression, adjust it to have be one or two lambda expressions (fun a -> (fun b -> ...)) +/// where the first has the given arity. +val AdjustArityOfLambdaBody : TcGlobals -> int -> Val list -> Expr -> Val list * Expr +/// Make an application expression, doing beta reduction by introducing let-bindings val MakeApplicationAndBetaReduce : TcGlobals -> Expr * TType * TypeInst list * Exprs * range -> Expr +/// COmbine two static-resolution requirements on a type parameter val JoinTyparStaticReq : TyparStaticReq -> TyparStaticReq -> TyparStaticReq -//------------------------------------------------------------------------- -// More layout - this is for debugging -//------------------------------------------------------------------------- +/// Layout for internal compiler debugging purposes module DebugPrint = + /// A global flag indicating whether debug output should include ranges val layoutRanges : bool ref + + /// Convert a type to a string for debugging purposes val showType : TType -> string + + /// Convert an expression to a string for debugging purposes val showExpr : Expr -> string + /// Debug layout for a reference to a value val valRefL : ValRef -> layout + + /// Debug layout for a reference to a union case val unionCaseRefL : UnionCaseRef -> layout - val vspecAtBindL : Val -> layout + + /// Debug layout for an value definition at its binding site + val valAtBindL : Val -> layout + + /// Debug layout for an integer val intL : int -> layout + + /// Debug layout for a value definition val valL : Val -> layout + + /// Debug layout for a type parameter definition val typarDeclL : Typar -> layout + + /// Debug layout for a trait constraint val traitL : TraitConstraintInfo -> layout + + /// Debug layout for a type parameter val typarL : Typar -> layout + + /// Debug layout for a set of type parameters val typarsL : Typars -> layout + + /// Debug layout for a type val typeL : TType -> layout + + /// Debug layout for a method slot signature val slotSigL : SlotSig -> layout + + /// Debug layout for the type signature of a module or namespace definition val entityTypeL : ModuleOrNamespaceType -> layout + + /// Debug layout for a module or namespace definition val entityL : ModuleOrNamespace -> layout + + /// Debug layout for the type of a value val typeOfValL : Val -> layout + + /// Debug layout for a binding of an expression to a value val bindingL : Binding -> layout + + /// Debug layout for an expression val exprL : Expr -> layout + + /// Debug layout for a type definition val tyconL : Tycon -> layout + + /// Debug layout for a decision tree val decisionTreeL : DecisionTree -> layout + + /// Debug layout for an implementation file val implFileL : TypedImplFile -> layout + + /// Debug layout for a list of implementation files val implFilesL : TypedImplFile list -> layout - val recdFieldRefL : RecdFieldRef -> layout -//------------------------------------------------------------------------- -// Fold on expressions -//------------------------------------------------------------------------- + /// Debug layout for class and record fields + val recdFieldRefL : RecdFieldRef -> layout +/// A set of function parameters (visitor) for folding over expressions type ExprFolder<'State> = - { exprIntercept : ('State -> Expr -> 'State) -> 'State -> Expr -> 'State option; - valBindingSiteIntercept : 'State -> bool * Val -> 'State; - nonRecBindingsIntercept : 'State -> Binding -> 'State; - recBindingsIntercept : 'State -> Bindings -> 'State; - dtreeIntercept : 'State -> DecisionTree -> 'State; - targetIntercept : ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option; - tmethodIntercept : ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option;} + { exprIntercept : ('State -> Expr -> 'State) -> 'State -> Expr -> 'State option + valBindingSiteIntercept : 'State -> bool * Val -> 'State + nonRecBindingsIntercept : 'State -> Binding -> 'State + recBindingsIntercept : 'State -> Bindings -> 'State + dtreeIntercept : 'State -> DecisionTree -> 'State + targetIntercept : ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option + tmethodIntercept : ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option} + +/// The empty set of actions for folding over expressions val ExprFolder0 : ExprFolder<'State> + +/// Fold over all the expressions in an implementation file val FoldImplFile: ExprFolder<'State> -> ('State -> TypedImplFile -> 'State) + +/// Fold over all the expressions in an expression val FoldExpr : ExprFolder<'State> -> ('State -> Expr -> 'State) #if DEBUG +/// Extract some statistics from an expression val ExprStats : Expr -> string #endif -//------------------------------------------------------------------------- -// Make some common types -//------------------------------------------------------------------------- - +/// Build a nativeptr type val mkNativePtrTy : TcGlobals -> TType -> TType + +/// Build a 'voidptr' type val mkVoidPtrTy : TcGlobals -> TType + +/// Build a single-dimensional array type val mkArrayType : TcGlobals -> TType -> TType + +/// Determine is a type is an option type val isOptionTy : TcGlobals -> TType -> bool + +/// Take apart an option type val destOptionTy : TcGlobals -> TType -> TType + +/// Try to take apart an option type val tryDestOptionTy : TcGlobals -> TType -> ValueOption +/// Determine if a type is a System.Linq.Expression type val isLinqExpressionTy : TcGlobals -> TType -> bool -val destLinqExpressionTy : TcGlobals -> TType -> TType -val tryDestLinqExpressionTy : TcGlobals -> TType -> TType option -(* -val isQuoteExprTy : TcGlobals -> TType -> bool -val destQuoteExprTy : TcGlobals -> TType -> TType -val tryDestQuoteExprTy : TcGlobals -> TType -> TType option -*) +/// Take apart a System.Linq.Expression type +val destLinqExpressionTy : TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Primitives associated with compiling the IEvent idiom to .NET events -//------------------------------------------------------------------------- +/// Try to take apart a System.Linq.Expression type +val tryDestLinqExpressionTy : TcGlobals -> TType -> TType option +/// Determine if a type is an IDelegateEvent type val isIDelegateEventType : TcGlobals -> TType -> bool + +/// Take apart an IDelegateEvent type val destIDelegateEventType : TcGlobals -> TType -> TType + +/// Build an IEvent type val mkIEventType : TcGlobals -> TType -> TType -> TType + +/// Build an IObservable type val mkIObservableType : TcGlobals -> TType -> TType -val mkIObserverType : TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Primitives associated with printf format string parsing -//------------------------------------------------------------------------- +/// Build an IObserver type +val mkIObserverType : TcGlobals -> TType -> TType +/// Build an Lazy type val mkLazyTy : TcGlobals -> TType -> TType + +/// Build an PrintFormat type val mkPrintfFormatTy : TcGlobals -> TType -> TType -> TType -> TType -> TType -> TType //------------------------------------------------------------------------- // Classify types //------------------------------------------------------------------------- +/// Represents metadata extracted from a nominal type type TypeDefMetadata = | ILTypeMetadata of TILObjectReprData | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata @@ -1075,43 +1439,94 @@ type TypeDefMetadata = | ProvidedTypeMetadata of TProvidedTypeInfo #endif +/// Extract metadata from a type definition val metadataOfTycon : Tycon -> TypeDefMetadata + +/// Extract metadata from a type val metadataOfTy : TcGlobals -> TType -> TypeDefMetadata -val isStringTy : TcGlobals -> TType -> bool -val isListTy : TcGlobals -> TType -> bool -val isILAppTy : TcGlobals -> TType -> bool -val isArrayTy : TcGlobals -> TType -> bool -val isArray1DTy : TcGlobals -> TType -> bool -val destArrayTy : TcGlobals -> TType -> TType -val destListTy : TcGlobals -> TType -> TType +/// Determine if a type is the System.String type +val isStringTy : TcGlobals -> TType -> bool + +/// Determine if a type is an F# list type +val isListTy : TcGlobals -> TType -> bool + +/// Determine if a type is a nominal .NET type +val isILAppTy : TcGlobals -> TType -> bool + +/// Determine if a type is any kind of array type +val isArrayTy : TcGlobals -> TType -> bool + +/// Determine if a type is a single-dimensional array type +val isArray1DTy : TcGlobals -> TType -> bool + +/// Get the element type of an array type +val destArrayTy : TcGlobals -> TType -> TType + +/// Get the element type of an F# list type +val destListTy : TcGlobals -> TType -> TType -val mkArrayTy : TcGlobals -> int -> TType -> range -> TType -val isArrayTyconRef : TcGlobals -> TyconRef -> bool +/// Build an array type of the given rank +val mkArrayTy : TcGlobals -> int -> TType -> range -> TType + +/// Check if a type definition is one of the artifical type definitions used for array types of different ranks +val isArrayTyconRef : TcGlobals -> TyconRef -> bool + +/// Determine the rank of one of the artifical type definitions used for array types val rankOfArrayTyconRef : TcGlobals -> TyconRef -> int -val isUnitTy : TcGlobals -> TType -> bool -val isObjTy : TcGlobals -> TType -> bool -val isVoidTy : TcGlobals -> TType -> bool +/// Determine if a type is the F# unit type +val isUnitTy : TcGlobals -> TType -> bool + +/// Determine if a type is the System.Object type +val isObjTy : TcGlobals -> TType -> bool + +/// Determine if a type is the System.Void type +val isVoidTy : TcGlobals -> TType -> bool /// Get the element type of an array type -val destArrayTy : TcGlobals -> TType -> TType +val destArrayTy : TcGlobals -> TType -> TType + /// Get the rank of an array type val rankOfArrayTy : TcGlobals -> TType -> int -val isInterfaceTyconRef : TyconRef -> bool +/// Determine if a reference to a type definition is an interface type +val isInterfaceTyconRef : TyconRef -> bool + +/// Determine if a type is a delegate type +val isDelegateTy : TcGlobals -> TType -> bool + +/// Determine if a type is an interface type +val isInterfaceTy : TcGlobals -> TType -> bool -val isDelegateTy : TcGlobals -> TType -> bool -val isInterfaceTy : TcGlobals -> TType -> bool -val isRefTy : TcGlobals -> TType -> bool -val isSealedTy : TcGlobals -> TType -> bool -val isComInteropTy : TcGlobals -> TType -> bool -val underlyingTypeOfEnumTy : TcGlobals -> TType -> TType -val normalizeEnumTy : TcGlobals -> TType -> TType +/// Determine if a type is a FSharpRef type +val isRefTy : TcGlobals -> TType -> bool + +/// Determine if a type is a sealed type +val isSealedTy : TcGlobals -> TType -> bool + +/// Determine if a type is a ComInterop type +val isComInteropTy : TcGlobals -> TType -> bool + +/// Determine the underlying type of an enum type (normally int32) +val underlyingTypeOfEnumTy : TcGlobals -> TType -> TType + +/// If the input type is an enum type, then convert to its underlying type, otherwise return the input type +val normalizeEnumTy : TcGlobals -> TType -> TType + +/// Determine if a type is a struct type val isStructTy : TcGlobals -> TType -> bool + +/// Determine if a type is an unmanaged type val isUnmanagedTy : TcGlobals -> TType -> bool + +/// Determine if a type is a class type val isClassTy : TcGlobals -> TType -> bool + +/// Determine if a type is an enum type val isEnumTy : TcGlobals -> TType -> bool + +/// Determine if a type is a struct, record or union type val isStructRecordOrUnionTyconTy : TcGlobals -> TType -> bool /// For "type Class as self", 'self' is fixed up after initialization. To support this, @@ -1119,9 +1534,16 @@ val isStructRecordOrUnionTyconTy : TcGlobals -> TType -> bool /// returns the underlying type. val StripSelfRefCell : TcGlobals * ValBaseOrThisInfo * TType -> TType +/// An active pattern to determine if a type is a nominal type, possibly instantiated val (|AppTy|_|) : TcGlobals -> TType -> (TyconRef * TType list) option + +/// An active pattern to match System.Nullable types val (|NullableTy|_|) : TcGlobals -> TType -> TType option + +/// An active pattern to transform System.Nullable types to their input, otherwise leave the input unchanged val (|StripNullableTy|) : TcGlobals -> TType -> TType + +/// Matches any byref type, yielding the target type val (|ByrefTy|_|) : TcGlobals -> TType -> TType option //------------------------------------------------------------------------- @@ -1129,35 +1551,53 @@ val (|ByrefTy|_|) : TcGlobals -> TType -> TType option //------------------------------------------------------------------------- val IsUnionTypeWithNullAsTrueValue: TcGlobals -> Tycon -> bool + val TyconHasUseNullAsTrueValueAttribute : TcGlobals -> Tycon -> bool + val CanHaveUseNullAsTrueValueAttribute : TcGlobals -> Tycon -> bool + val MemberIsCompiledAsInstance : TcGlobals -> TyconRef -> bool -> ValMemberInfo -> Attribs -> bool + val ValSpecIsCompiledAsInstance : TcGlobals -> Val -> bool + val ValRefIsCompiledAsInstanceMember : TcGlobals -> ValRef -> bool + val ModuleNameIsMangled : TcGlobals -> Attribs -> bool val CompileAsEvent : TcGlobals -> Attribs -> bool val TypeNullIsExtraValue : TcGlobals -> range -> TType -> bool + val TypeNullIsTrueValue : TcGlobals -> TType -> bool + val TypeNullNotLiked : TcGlobals -> range -> TType -> bool + val TypeNullNever : TcGlobals -> TType -> bool val TypeSatisfiesNullConstraint : TcGlobals -> range -> TType -> bool + val TypeHasDefaultValue : TcGlobals -> range -> TType -> bool val isAbstractTycon : Tycon -> bool val isUnionCaseRefDefinitelyMutable : UnionCaseRef -> bool + val isRecdOrUnionOrStructTyconRefDefinitelyMutable : TyconRef -> bool + val isExnDefinitelyMutable : TyconRef -> bool + val isUnionCaseFieldMutable : TcGlobals -> UnionCaseRef -> int -> bool + val isExnFieldMutable : TyconRef -> int -> bool + val isRecdOrStructTyconRefReadOnly: TcGlobals -> range -> TyconRef -> bool + val isRecdOrStructTyconRefAssumedImmutable: TcGlobals -> TyconRef -> bool + val isRecdOrStructTyReadOnly: TcGlobals -> range -> TType -> bool val useGenuineField : Tycon -> RecdField -> bool + val ComputeFieldName : Tycon -> RecdField -> string //------------------------------------------------------------------------- @@ -1165,6 +1605,7 @@ val ComputeFieldName : Tycon -> RecdField -> string //------------------------------------------------------------------------- val slotSigHasVoidReturnTy : SlotSig -> bool + val actualReturnTyOfSlotSig : TypeInst -> TypeInst -> SlotSig -> TType option val returnTyOfMethod : TcGlobals -> ObjExprMethod -> TType option @@ -1174,25 +1615,37 @@ val returnTyOfMethod : TcGlobals -> ObjExprMethod -> TType option //------------------------------------------------------------------------- val mkRefCell : TcGlobals -> range -> TType -> Expr -> Expr + val mkRefCellGet : TcGlobals -> range -> TType -> Expr -> Expr + val mkRefCellSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkLazyDelayed : TcGlobals -> range -> TType -> Expr -> Expr -val mkLazyForce : TcGlobals -> range -> TType -> Expr -> Expr +val mkLazyForce : TcGlobals -> range -> TType -> Expr -> Expr val mkRefCellContentsRef : TcGlobals -> RecdFieldRef + val isRefCellTy : TcGlobals -> TType -> bool + val destRefCellTy : TcGlobals -> TType -> TType + val mkRefCellTy : TcGlobals -> TType -> TType val mkSeqTy : TcGlobals -> TType -> TType + val mkIEnumeratorTy : TcGlobals -> TType -> TType + val mkListTy : TcGlobals -> TType -> TType + val mkOptionTy : TcGlobals -> TType -> TType + val mkNoneCase : TcGlobals -> UnionCaseRef + val mkSomeCase : TcGlobals -> UnionCaseRef val mkNil : TcGlobals -> range -> TType -> Expr + val mkCons : TcGlobals -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- @@ -1200,17 +1653,29 @@ val mkCons : TcGlobals -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- val mkSequential : SequencePointInfoForSeq -> range -> Expr -> Expr -> Expr + val mkCompGenSequential : range -> Expr -> Expr -> Expr + val mkSequentials : SequencePointInfoForSeq -> TcGlobals -> range -> Exprs -> Expr + val mkRecordExpr : TcGlobals -> RecordConstructionInfo * TyconRef * TypeInst * RecdFieldRef list * Exprs * range -> Expr + val mkUnbox : TType -> Expr -> range -> Expr + val mkBox : TType -> Expr -> range -> Expr + val mkIsInst : TType -> Expr -> range -> Expr + val mkNull : range -> TType -> Expr + val mkNullTest : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr + val mkNonNullTest : TcGlobals -> range -> Expr -> Expr + val mkIsInstConditional : TcGlobals -> range -> TType -> Expr -> Val -> Expr -> Expr -> Expr + val mkThrow : range -> TType -> Expr -> Expr + val mkGetArg0 : range -> TType -> Expr val mkDefault : range * TType -> Expr @@ -1218,18 +1683,31 @@ val mkDefault : range * TType -> Expr val isThrow : Expr -> bool val mkString : TcGlobals -> range -> string -> Expr + val mkBool : TcGlobals -> range -> bool -> Expr + val mkByte : TcGlobals -> range -> byte -> Expr + val mkUInt16 : TcGlobals -> range -> uint16 -> Expr + val mkTrue : TcGlobals -> range -> Expr + val mkFalse : TcGlobals -> range -> Expr + val mkUnit : TcGlobals -> range -> Expr + val mkInt32 : TcGlobals -> range -> int32 -> Expr + val mkInt : TcGlobals -> range -> int -> Expr + val mkZero : TcGlobals -> range -> Expr + val mkOne : TcGlobals -> range -> Expr + val mkTwo : TcGlobals -> range -> Expr + val mkMinusOne : TcGlobals -> range -> Expr + val destInt32 : Expr -> int32 option //------------------------------------------------------------------------- @@ -1237,8 +1715,11 @@ val destInt32 : Expr -> int32 option //------------------------------------------------------------------------- val isQuotedExprTy : TcGlobals -> TType -> bool + val destQuotedExprTy : TcGlobals -> TType -> TType + val mkQuotedExprTy : TcGlobals -> TType -> TType + val mkRawQuotedExprTy : TcGlobals -> TType //------------------------------------------------------------------------- @@ -1246,9 +1727,13 @@ val mkRawQuotedExprTy : TcGlobals -> TType //------------------------------------------------------------------------- val mspec_Type_GetTypeFromHandle : TcGlobals -> ILMethodSpec + val fspec_Missing_Value : TcGlobals -> ILFieldSpec + val mkInitializeArrayMethSpec: TcGlobals -> ILMethodSpec + val mkByteArrayTy : TcGlobals -> TType + val mkInvalidCastExnNewobj: TcGlobals -> ILInstr @@ -1259,122 +1744,207 @@ val mkInvalidCastExnNewobj: TcGlobals -> ILInstr val mkCallNewFormat : TcGlobals -> range -> TType -> TType -> TType -> TType -> TType -> Expr -> Expr val mkCallUnbox : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallGetGenericComparer : TcGlobals -> range -> Expr + val mkCallGetGenericEREqualityComparer : TcGlobals -> range -> Expr + val mkCallGetGenericPEREqualityComparer : TcGlobals -> range -> Expr val mkCallUnboxFast : TcGlobals -> range -> TType -> Expr -> Expr + val canUseUnboxFast : TcGlobals -> range -> TType -> bool val mkCallDispose : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeq : TcGlobals -> range -> TType -> Expr -> Expr val mkCallTypeTest : TcGlobals -> range -> TType -> Expr -> Expr + val canUseTypeTestFast : TcGlobals -> TType -> bool val mkCallTypeOf : TcGlobals -> range -> TType -> Expr + val mkCallTypeDefOf : TcGlobals -> range -> TType -> Expr val mkCallCreateInstance : TcGlobals -> range -> TType -> Expr + val mkCallCreateEvent : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallArrayLength : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallArrayGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallArray2DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallArray3DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArray4DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArraySet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallArray2DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArray3DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArray4DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallHash : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallBox : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallIsNull : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallIsNotNull : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallRaise : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGenericComparisonWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallGenericEqualityEROuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallGenericEqualityWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallGenericHashWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallNotEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallLessThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallLessThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallGreaterThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallGreaterThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallAdditionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSubtractionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallMultiplyOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallDivisionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallModulusOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallBitwiseAndOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallBitwiseOrOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallBitwiseXorOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallShiftLeftOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallShiftRightOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallUnaryNegOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallUnaryNotOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallAdditionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSubtractionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallMultiplyChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallUnaryNegChecked : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToByteChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToSByteChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToByteOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToSByteOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToSingleOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToDoubleOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToCharOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToEnumOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallDeserializeQuotationFSharp20Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallDeserializeQuotationFSharp40Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallCastQuotation : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallLiftValueWithName : TcGlobals -> range -> TType -> string -> Expr -> Expr + val mkCallLiftValueWithDefn : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqCollect : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr + val mkCallSeqUsing : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr + val mkCallSeqDelay : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqAppend : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSeqFinally : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSeqGenerated : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSeqOfFunctions : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallSeqToArray : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqToList : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqMap : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr + val mkCallSeqSingleton : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqEmpty : TcGlobals -> range -> TType -> Expr + val mkILAsmCeq : TcGlobals -> range -> Expr -> Expr -> Expr + val mkILAsmClt : TcGlobals -> range -> Expr -> Expr -> Expr val mkCallFailInit : TcGlobals -> range -> Expr + val mkCallFailStaticInit : TcGlobals -> range -> Expr + val mkCallCheckThis : TcGlobals -> range -> TType -> Expr -> Expr val mkCase : DecisionTreeTest * DecisionTree -> DecisionTreeCase @@ -1382,13 +1952,17 @@ val mkCase : DecisionTreeTest * DecisionTree -> DecisionTreeCase val mkCallQuoteToLinqLambdaExpression : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGetQuerySourceAsEnumerable : TcGlobals -> range -> TType -> TType -> Expr -> Expr + val mkCallNewQuerySource : TcGlobals -> range -> TType -> TType -> Expr -> Expr val mkArray : TType * Exprs * range -> Expr val mkStaticCall_String_Concat2 : TcGlobals -> range -> Expr -> Expr -> Expr + val mkStaticCall_String_Concat3 : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr + val mkStaticCall_String_Concat4 : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr + val mkStaticCall_String_Concat_Array : TcGlobals -> range -> Expr -> Expr //------------------------------------------------------------------------- @@ -1397,8 +1971,11 @@ val mkStaticCall_String_Concat_Array : TcGlobals -> range -> Expr -> Expr //------------------------------------------------------------------------- val mkDecr : TcGlobals -> range -> Expr -> Expr + val mkIncr : TcGlobals -> range -> Expr -> Expr + val mkLdlen : TcGlobals -> range -> Expr -> Expr + val mkLdelem : TcGlobals -> range -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- @@ -1406,18 +1983,29 @@ val mkLdelem : TcGlobals -> range -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- val TryDecodeILAttribute : TcGlobals -> ILTypeRef -> ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option + val TryFindILAttribute : BuiltinAttribInfo -> ILAttributes -> bool + val TryFindILAttributeOpt : BuiltinAttribInfo option -> ILAttributes -> bool val IsMatchingFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attrib -> bool + val IsMatchingFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attrib -> bool + val HasFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool + val HasFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attribs -> bool + val TryFindFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> Attrib option + val TryFindFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attribs -> Attrib option + val TryFindFSharpBoolAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option + val TryFindFSharpBoolAttributeAssumeFalse : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option + val TryFindFSharpStringAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> string option + val TryFindFSharpInt32Attribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> int32 option /// Try to find a specific attribute on a type definition, where the attribute accepts a string argument. @@ -1438,19 +2026,29 @@ val TryFindAttributeUsageAttribute : TcGlobals -> range -> TyconRef -> bool opti /// returns Some(assemblyName) for success val TryDecodeTypeProviderAssemblyAttr : ILGlobals -> ILAttribute -> string option #endif + val IsSignatureDataVersionAttr : ILAttribute -> bool + val TryFindAutoOpenAttr : IL.ILGlobals -> ILAttribute -> string option + val TryFindInternalsVisibleToAttr : IL.ILGlobals -> ILAttribute -> string option -val IsMatchingSignatureDataVersionAttr : IL.ILGlobals -> ILVersionInfo -> ILAttribute -> bool +val IsMatchingSignatureDataVersionAttr : IL.ILGlobals -> ILVersionInfo -> ILAttribute -> bool val mkCompilationMappingAttr : TcGlobals -> int -> ILAttribute val mkCompilationMappingAttrWithSeqNum : TcGlobals -> int -> int -> ILAttribute + + val mkCompilationMappingAttrWithVariantNumAndSeqNum : TcGlobals -> int -> int -> int -> ILAttribute + val mkCompilationMappingAttrForQuotationResource : TcGlobals -> string * ILTypeRef list -> ILAttribute + val mkCompilationArgumentCountsAttr : TcGlobals -> int list -> ILAttribute + val mkCompilationSourceNameAttr : TcGlobals -> string -> ILAttribute + val mkSignatureDataVersionAttr : TcGlobals -> ILVersionInfo -> ILAttribute + val mkCompilerGeneratedAttr : TcGlobals -> int -> ILAttribute //------------------------------------------------------------------------- @@ -1458,16 +2056,23 @@ val mkCompilerGeneratedAttr : TcGlobals -> int -> ILAtt //------------------------------------------------------------------------- val isInByrefTy : TcGlobals -> TType -> bool + val isOutByrefTy : TcGlobals -> TType -> bool + val isByrefTy : TcGlobals -> TType -> bool val isNativePtrTy : TcGlobals -> TType -> bool + val destByrefTy : TcGlobals -> TType -> TType + val destNativePtrTy : TcGlobals -> TType -> TType val isByrefTyconRef : TcGlobals -> TyconRef -> bool + val isByrefLikeTyconRef : TcGlobals -> range -> TyconRef -> bool + val isSpanLikeTyconRef : TcGlobals -> range -> TyconRef -> bool + val isByrefLikeTy : TcGlobals -> range -> TType -> bool /// Check if the type is a byref-like but not a byref. @@ -1478,33 +2083,37 @@ val isSpanLikeTy : TcGlobals -> range -> TType -> bool //------------------------------------------------------------------------- val isRefTupleExpr : Expr -> bool + val tryDestRefTupleExpr : Expr -> Exprs val mkAnyTupledTy : TcGlobals -> TupInfo -> TType list -> TType + val mkAnyTupled : TcGlobals -> range -> TupInfo -> Exprs -> TType list -> Expr + val mkRefTupled : TcGlobals -> range -> Exprs -> TType list -> Expr + val mkRefTupledNoTypes : TcGlobals -> range -> Exprs -> Expr + val mkRefTupledTy : TcGlobals -> TType list -> TType + val mkRefTupledVarsTy : TcGlobals -> Val list -> TType -val mkRefTupledVars : TcGlobals -> range -> Val list -> Expr -val mkMethodTy : TcGlobals -> TType list list -> TType -> TType +val mkRefTupledVars : TcGlobals -> range -> Val list -> Expr -//------------------------------------------------------------------------- -// Anonymous records -//------------------------------------------------------------------------- +val mkMethodTy : TcGlobals -> TType list list -> TType -> TType val mkAnyAnonRecdTy : TcGlobals -> AnonRecdTypeInfo -> TType list -> TType -val mkAnonRecd : TcGlobals -> range -> AnonRecdTypeInfo -> Exprs -> TType list -> Expr -//------------------------------------------------------------------------- -// -//------------------------------------------------------------------------- +val mkAnonRecd : TcGlobals -> range -> AnonRecdTypeInfo -> Exprs -> TType list -> Expr val AdjustValForExpectedArity : TcGlobals -> range -> ValRef -> ValUseFlag -> ValReprInfo -> Expr * TType + val AdjustValToTopVal : Val -> ParentRef -> ValReprInfo -> unit + val LinearizeTopMatch : TcGlobals -> ParentRef -> Expr -> Expr + val AdjustPossibleSubsumptionExpr : TcGlobals -> Expr -> Exprs -> (Expr * Exprs) option + val NormalizeAndAdjustPossibleSubsumptionExprs : TcGlobals -> Expr -> Expr //------------------------------------------------------------------------- @@ -1514,28 +2123,35 @@ val NormalizeAndAdjustPossibleSubsumptionExprs : TcGlobals -> Expr -> Expr val buildAccessPath : CompilationPath option -> string val XmlDocArgsEnc : TcGlobals -> Typars * Typars -> TType list -> string + val XmlDocSigOfVal : TcGlobals -> string -> Val -> string + val XmlDocSigOfUnionCase : (string list -> string) + val XmlDocSigOfField : (string list -> string) + val XmlDocSigOfProperty : (string list -> string) + val XmlDocSigOfTycon : (string list -> string) + val XmlDocSigOfSubModul : (string list -> string) + val XmlDocSigOfEntity : EntityRef -> string //--------------------------------------------------------------------------- // Resolve static optimizations //------------------------------------------------------------------------- + type StaticOptimizationAnswer = | Yes = 1y | No = -1y | Unknown = 0y + val DecideStaticOptimizations : TcGlobals -> StaticOptimization list -> StaticOptimizationAnswer -val mkStaticOptimizationExpr : TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr -//--------------------------------------------------------------------------- -// Build for loops -//------------------------------------------------------------------------- +val mkStaticOptimizationExpr : TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr +/// Build for loops val mkFastForLoop : TcGlobals -> SequencePointInfoForForLoop * range * Val * Expr * bool * Expr * Expr -> Expr //--------------------------------------------------------------------------- @@ -1546,12 +2162,15 @@ type ActivePatternElemRef with member Name : string val TryGetActivePatternInfo : ValRef -> PrettyNaming.ActivePatternInfo option + val mkChoiceCaseRef : TcGlobals -> range -> int -> int -> UnionCaseRef type PrettyNaming.ActivePatternInfo with + member Names : string list member ResultType : TcGlobals -> range -> TType list -> TType + member OverallType : TcGlobals -> range -> TType -> TType list -> TType val doesActivePatternHaveFreeTypars : TcGlobals -> ValRef -> bool @@ -1562,61 +2181,84 @@ val doesActivePatternHaveFreeTypars : TcGlobals -> ValRef -> bool [] type ExprRewritingEnv = - {PreIntercept: ((Expr -> Expr) -> Expr -> Expr option) option; - PostTransform: Expr -> Expr option; - PreInterceptBinding: ((Expr -> Expr) -> Binding -> Binding option) option; - IsUnderQuotations: bool } + { PreIntercept: ((Expr -> Expr) -> Expr -> Expr option) option + PostTransform: Expr -> Expr option + PreInterceptBinding: ((Expr -> Expr) -> Binding -> Binding option) option + IsUnderQuotations: bool } val RewriteExpr : ExprRewritingEnv -> Expr -> Expr + val RewriteImplFile : ExprRewritingEnv -> TypedImplFile -> TypedImplFile val IsGenericValWithGenericContraints: TcGlobals -> Val -> bool type Entity with + member HasInterface : TcGlobals -> TType -> bool + member HasOverride : TcGlobals -> string -> TType list -> bool + member HasMember : TcGlobals -> string -> TType list -> bool type EntityRef with + member HasInterface : TcGlobals -> TType -> bool + member HasOverride : TcGlobals -> string -> TType list -> bool + member HasMember : TcGlobals -> string -> TType list -> bool val (|AttribBitwiseOrExpr|_|) : TcGlobals -> Expr -> (Expr * Expr) option + val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option + val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option + val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr + val EvaledAttribExprEquality : TcGlobals -> Expr -> Expr -> bool + val IsSimpleSyntacticConstantExpr: TcGlobals -> Expr -> bool val (|ConstToILFieldInit|_|): Const -> ILFieldInit option val (|ExtractAttribNamedArg|_|) : string -> AttribNamedArg list -> AttribExpr option + val (|AttribInt32Arg|_|) : AttribExpr -> int32 option + val (|AttribInt16Arg|_|) : AttribExpr -> int16 option + val (|AttribBoolArg|_|) : AttribExpr -> bool option + val (|AttribStringArg|_|) : AttribExpr -> string option + val (|Int32Expr|_|) : Expr -> int32 option /// Determines types that are potentially known to satisfy the 'comparable' constraint and returns /// a set of residual types that must also satisfy the constraint val (|SpecialComparableHeadType|_|) : TcGlobals -> TType -> TType list option + val (|SpecialEquatableHeadType|_|) : TcGlobals -> TType -> TType list option + val (|SpecialNotEquatableHeadType|_|) : TcGlobals -> TType -> unit option type OptimizeForExpressionOptions = OptimizeIntRangesOnly | OptimizeAllForExpressions + val DetectAndOptimizeForExpression : TcGlobals -> OptimizeForExpressionOptions -> Expr -> Expr val TryEliminateDesugaredConstants : TcGlobals -> range -> Const -> Expr option val MemberIsExplicitImpl : TcGlobals -> ValMemberInfo -> bool + val ValIsExplicitImpl : TcGlobals -> Val -> bool + val ValRefIsExplicitImpl : TcGlobals -> ValRef -> bool val (|LinearMatchExpr|_|) : Expr -> (SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget * Expr * SequencePointInfoForTarget * range * TType) option + val rebuildLinearMatchExpr : (SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget * Expr * SequencePointInfoForTarget * range * TType) -> Expr val mkCoerceIfNeeded : TcGlobals -> tgtTy: TType -> srcTy: TType -> Expr -> Expr diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 0651a6407e4..0239602c496 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -504,8 +504,8 @@ type cenv = /// Used to resolve names nameResolver: NameResolver - /// The set of active conditional defines - conditionalDefines: string list + /// The set of active conditional defines. The value is None when conditional erasure is disabled in tooling. + conditionalDefines: string list option isInternalTestSpanStackReferring: bool } @@ -3004,8 +3004,8 @@ let BuildPossiblyConditionalMethodCall cenv env isMutable m isProp minfo valUseF let conditionalCallDefineOpt = TryFindMethInfoStringAttribute cenv.g m cenv.g.attrib_ConditionalAttribute minfo - match conditionalCallDefineOpt with - | Some d when not (List.contains d cenv.conditionalDefines) -> + match conditionalCallDefineOpt, cenv.conditionalDefines with + | Some d, Some defines when not (List.contains d defines) -> // Methods marked with 'Conditional' must return 'unit' UnifyTypes cenv env m cenv.g.unit_ty (minfo.GetFSharpReturnTy(cenv.amap, m, minst)) @@ -10060,7 +10060,7 @@ and TcMethodApplication | CallerLineNumber, _ when typeEquiv cenv.g currCalledArgTy cenv.g.int_ty -> emptyPreBinder, Expr.Const(Const.Int32(mMethExpr.StartLine), mMethExpr, currCalledArgTy) | CallerFilePath, _ when typeEquiv cenv.g currCalledArgTy cenv.g.string_ty -> - emptyPreBinder, Expr.Const(Const.String(System.IO.Path.GetFullPath(mMethExpr.FileName)), mMethExpr, currCalledArgTy) + emptyPreBinder, Expr.Const(Const.String(FileSystem.GetFullPathShim(mMethExpr.FileName)), mMethExpr, currCalledArgTy) | CallerMemberName, Some(callerName) when (typeEquiv cenv.g currCalledArgTy cenv.g.string_ty) -> emptyPreBinder, Expr.Const(Const.String(callerName), mMethExpr, currCalledArgTy) | _ -> @@ -10099,7 +10099,7 @@ and TcMethodApplication let lineExpr = Expr.Const(Const.Int32(mMethExpr.StartLine), mMethExpr, calledNonOptTy) emptyPreBinder, mkUnionCaseExpr(mkSomeCase cenv.g, [calledNonOptTy], [lineExpr], mMethExpr) | CallerFilePath, _ when typeEquiv cenv.g calledNonOptTy cenv.g.string_ty -> - let filePathExpr = Expr.Const(Const.String(System.IO.Path.GetFullPath(mMethExpr.FileName)), mMethExpr, calledNonOptTy) + let filePathExpr = Expr.Const(Const.String(FileSystem.GetFullPathShim(mMethExpr.FileName)), mMethExpr, calledNonOptTy) emptyPreBinder, mkUnionCaseExpr(mkSomeCase cenv.g, [calledNonOptTy], [filePathExpr], mMethExpr) | CallerMemberName, Some(callerName) when typeEquiv cenv.g calledNonOptTy cenv.g.string_ty -> let memberNameExpr = Expr.Const(Const.String(callerName), mMethExpr, calledNonOptTy) @@ -10828,11 +10828,10 @@ and TcAttribute canFail cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) = let conditionalCallDefineOpt = TryFindTyconRefStringAttribute cenv.g mAttr cenv.g.attrib_ConditionalAttribute tcref - match conditionalCallDefineOpt with - | Some d when not (List.contains d cenv.conditionalDefines) -> + match conditionalCallDefineOpt, cenv.conditionalDefines with + | Some d, Some defines when not (List.contains d defines) -> [], false | _ -> - // REVIEW: take notice of inherited? let validOn, _inherited = let validOnDefault = 0x7fff @@ -16713,7 +16712,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS return env - | SynModuleSigDecl.NamespaceFragment (SynModuleOrNamespaceSig(longId, isRec, isModule, defs, xml, attribs, vis, m)) -> + | SynModuleSigDecl.NamespaceFragment (SynModuleOrNamespaceSig(longId, isRec, kind, defs, xml, attribs, vis, m)) -> do for id in longId do CheckNamespaceModuleOrTypeName cenv.g id @@ -16725,7 +16724,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS // namespace [rec] A.B // module M = ... let enclosingNamespacePath, defs = - if isModule then + if kind.IsModule then let nsp, modName = List.frontAndBack longId let modDecl = [SynModuleSigDecl.NestedModule(ComponentInfo(attribs, [], [], [modName], xml, false, vis, m), false, defs, m)] nsp, modDecl @@ -17022,7 +17021,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv:cenv) parent typeNames scopem return ((fun modDefs -> modDefn :: modDefs), topAttrsNew), env, envAtEnd - | SynModuleDecl.NamespaceFragment(SynModuleOrNamespace(longId, isRec, isModule, defs, xml, attribs, vis, m)) -> + | SynModuleDecl.NamespaceFragment(SynModuleOrNamespace(longId, isRec, kind, defs, xml, attribs, vis, m)) -> if !progress then dprintn ("Typecheck implementation " + textOfLid longId) let endm = m.EndRange @@ -17037,7 +17036,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv:cenv) parent typeNames scopem // namespace [rec] A.B // module M = ... let enclosingNamespacePath, defs = - if isModule then + if kind.IsModule then let nsp, modName = List.frontAndBack longId let modDecl = [SynModuleDecl.NestedModule(ComponentInfo(attribs, [], [], [modName], xml, false, vis, m), false, defs, true, m)] nsp, modDecl @@ -17388,7 +17387,7 @@ let CheckModuleSignature g cenv m denvAtEnd rootSigOpt implFileTypePriorToSig im // Compute the remapping from implementation to signature let remapInfo , _ = ComputeRemappingFromInferredSignatureToExplicitSignature cenv.g implFileTypePriorToSig sigFileType - let aenv = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.mrpiEntities } + let aenv = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.RepackagedEntities } if not (SignatureConformance.Checker(cenv.g, cenv.amap, denv, remapInfo, true).CheckSignature aenv (mkLocalModRef implFileSpecPriorToSig) sigFileType) then ( // We can just raise 'ReportedError' since CheckModuleOrNamespace raises its own error diff --git a/src/fsharp/TypeChecker.fsi b/src/fsharp/TypeChecker.fsi index 3f84e1992fc..aae09544998 100644 --- a/src/fsharp/TypeChecker.fsi +++ b/src/fsharp/TypeChecker.fsi @@ -39,14 +39,14 @@ val EmptyTopAttrs : TopAttribs val CombineTopAttrs : TopAttribs -> TopAttribs -> TopAttribs val TypeCheckOneImplFile : - TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * NameResolution.TcResultsSink * bool + TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines option * NameResolution.TcResultsSink * bool -> TcEnv -> Tast.ModuleOrNamespaceType option -> ParsedImplFileInput -> Eventually val TypeCheckOneSigFile : - TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * NameResolution.TcResultsSink * bool + TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines option * NameResolution.TcResultsSink * bool -> TcEnv -> ParsedSigFileInput -> Eventually diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index f7fbbdd6491..22b960d18c6 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -1409,7 +1409,7 @@ and SynModuleDecl = | ModuleAbbrev of ident:Ident * longId:LongIdent * range:range | NestedModule of SynComponentInfo * isRecursive:bool * SynModuleDecls * bool * range:range - | Let of bool * SynBinding list * range:range + | Let of isRecursive:bool * SynBinding list * range:range | DoExpr of SequencePointInfoForBinding * SynExpr * range:range | Types of SynTypeDefn list * range:range | Exception of SynExceptionDefn * range:range @@ -1462,11 +1462,23 @@ and and SynModuleSigDecls = SynModuleSigDecl list -/// SynModuleOrNamespace(lid,isRec,isModule,decls,xmlDoc,attribs,SynAccess,m) +and + [] + SynModuleOrNamespaceKind = + | NamedModule + | AnonModule + | DeclaredNamespace + | GlobalNamespace + + member x.IsModule = + match x with + | NamedModule | AnonModule -> true + | _ -> false + and [] SynModuleOrNamespace = - | SynModuleOrNamespace of longId:LongIdent * isRecursive:bool * isModule:bool * decls:SynModuleDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range + | SynModuleOrNamespace of longId:LongIdent * isRecursive:bool * kind:SynModuleOrNamespaceKind * decls:SynModuleDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range member this.Range = match this with | SynModuleOrNamespace (range=m) -> m @@ -1474,7 +1486,7 @@ and and [] SynModuleOrNamespaceSig = - | SynModuleOrNamespaceSig of longId:LongIdent * isRecursive:bool * isModule:bool * SynModuleSigDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range + | SynModuleOrNamespaceSig of longId:LongIdent * isRecursive:bool * kind:SynModuleOrNamespaceKind * SynModuleSigDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range and [] ParsedHashDirective = @@ -1484,13 +1496,13 @@ and [] type ParsedImplFileFragment = | AnonModule of SynModuleDecls * range:range | NamedModule of SynModuleOrNamespace - | NamespaceFragment of longId:LongIdent * bool * bool * SynModuleDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range + | NamespaceFragment of longId:LongIdent * bool * SynModuleOrNamespaceKind * SynModuleDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range [] type ParsedSigFileFragment = | AnonModule of SynModuleSigDecls * range:range | NamedModule of SynModuleOrNamespaceSig - | NamespaceFragment of longId:LongIdent * bool * bool * SynModuleSigDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range + | NamespaceFragment of longId:LongIdent * bool * SynModuleOrNamespaceKind * SynModuleSigDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range [] type ParsedFsiInteraction = diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index fa3831018ed..0880f5d1ac2 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1773,11 +1773,9 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, reduceMemor errorRecoveryNoRange e exiter.Exit 1 - let inputs = - // Deduplicate module names - let moduleNamesDict = ConcurrentDictionary>() - inputs - |> List.map (fun (input,x) -> DeduplicateParsedInputModuleName moduleNamesDict input,x) + let inputs, _ = + (Map.empty, inputs) + ||> List.mapFold (fun state (input,x) -> let inputT, stateT = DeduplicateParsedInputModuleName state input in (inputT,x), stateT) if tcConfig.parseOnly then exiter.Exit 0 if not tcConfig.continueAfterParseFailure then @@ -2036,7 +2034,7 @@ let main4 dynamicAssemblyCreator (Args (ctok, tcConfig, tcImports: TcImports, t DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent ctok - let pdbfile = pdbfile |> Option.map (tcConfig.MakePathAbsolute >> Path.GetFullPath) + let pdbfile = pdbfile |> Option.map (tcConfig.MakePathAbsolute >> FileSystem.GetFullPathShim) let normalizeAssemblyRefs (aref:ILAssemblyRef) = match tcImports.TryFindDllInfo (ctok, Range.rangeStartup, aref.Name, lookupOnly=false) with diff --git a/src/fsharp/Fsc/InternalsVisibleTo.fs b/src/fsharp/fsc/InternalsVisibleTo.fs similarity index 100% rename from src/fsharp/Fsc/InternalsVisibleTo.fs rename to src/fsharp/fsc/InternalsVisibleTo.fs diff --git a/src/fsharp/Fsc/app.config b/src/fsharp/fsc/app.config similarity index 100% rename from src/fsharp/Fsc/app.config rename to src/fsharp/fsc/app.config diff --git a/src/fsharp/Fsc/Fsc.fsproj b/src/fsharp/fsc/fsc.fsproj similarity index 98% rename from src/fsharp/Fsc/Fsc.fsproj rename to src/fsharp/fsc/fsc.fsproj index 90c7b05cda4..34498db1df7 100644 --- a/src/fsharp/Fsc/Fsc.fsproj +++ b/src/fsharp/fsc/fsc.fsproj @@ -12,6 +12,7 @@ $(OtherFlags) --maxerrors:20 --extraoptimizationloops:1 true true + true diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 07ddd0e395a..bc0091251b0 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1155,7 +1155,7 @@ type internal FsiDynamicCompiler let i = nextFragmentId() let prefix = mkFragmentPath i let prefixPath = pathOfLid prefix - let impl = SynModuleOrNamespace(prefix,(*isRec*)false, (* isModule: *) true,defs,PreXmlDoc.Empty,[],None,rangeStdin) + let impl = SynModuleOrNamespace(prefix,(*isRec*)false, NamedModule,defs,PreXmlDoc.Empty,[],None,rangeStdin) let input = ParsedInput.ImplFile(ParsedImplFileInput(filename,true, ComputeQualifiedNameOfFileFromUniquePath (rangeStdin,prefixPath),[],[],[impl],(true (* isLastCompiland *), false (* isExe *)) )) let istate,tcEnvAtEndOfLastInput,declaredImpls = ProcessInputs (ctok, errorLogger, istate, [input], showTypes, true, isInteractiveItExpr, prefix) let tcState = istate.tcState diff --git a/src/fsharp/fsi/Fsi.fsproj b/src/fsharp/fsi/fsi.fsproj similarity index 92% rename from src/fsharp/fsi/Fsi.fsproj rename to src/fsharp/fsi/fsi.fsproj index 93b70873742..29916135ac0 100644 --- a/src/fsharp/fsi/Fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -4,7 +4,7 @@ Exe - net472;netcoreapp2.0 + net472;netcoreapp2.1 .exe fsi $(NoWarn);45;55;62;75;1204 @@ -13,6 +13,7 @@ fsi.res true true + true @@ -28,10 +29,10 @@ + - @@ -45,7 +46,7 @@ - + diff --git a/src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj similarity index 93% rename from src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj rename to src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj index 6f47292d9d7..98132bf3c27 100644 --- a/src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj +++ b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj @@ -29,6 +29,7 @@ + diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index de42111b414..b03987165bb 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -675,14 +675,14 @@ fileModuleSpec: (fun (isRec2,path,_) -> if not (isNil path) then errorR(Error(FSComp.SR.parsNamespaceOrModuleNotBoth(),m2)) let lid = path@path2 - ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, (isRec || isRec2), true, $4, xml,$1,vis,m))) } + ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, (isRec || isRec2), NamedModule, $4, xml,$1,vis,m))) } | moduleSpfnsPossiblyEmptyBlock { let m = (rhs parseState 1) (fun (isRec, path, xml) -> match path with | [] -> ParsedSigFileFragment.AnonModule($1, m) - | _ -> ParsedSigFileFragment.NamespaceFragment(path, isRec, false, $1, xml,[],m)) } + | _ -> ParsedSigFileFragment.NamespaceFragment(path, isRec, DeclaredNamespace, $1, xml,[],m)) } moduleSpfnsPossiblyEmptyBlock: @@ -1097,14 +1097,14 @@ fileModuleImpl: (fun (isRec, path, _) -> if not (isNil path) then errorR(Error(FSComp.SR.parsNamespaceOrModuleNotBoth(),m2)) let lid = path@path2 - ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, (isRec || isRec2), true, $4, xml,$1,vis,m))) } + ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, (isRec || isRec2), NamedModule, $4, xml,$1,vis,m))) } | moduleDefnsOrExprPossiblyEmptyOrBlock { let m = (rhs parseState 1) (fun (isRec, path, xml) -> match path with | [] -> ParsedImplFileFragment.AnonModule($1,m) - | _ -> ParsedImplFileFragment.NamespaceFragment(path, isRec, false, $1, xml,[],m)) } + | _ -> ParsedImplFileFragment.NamespaceFragment(path, isRec, DeclaredNamespace, $1, xml,[],m)) } /* A collection/block of definitions or expressions making up a module or namespace, possibly empty */ diff --git a/src/fsharp/range.fs b/src/fsharp/range.fs index c208eee8e1e..485f5882354 100755 --- a/src/fsharp/range.fs +++ b/src/fsharp/range.fs @@ -15,17 +15,20 @@ type FileIndex = int32 [] let columnBitCount = 20 + [] let lineBitCount = 31 let posBitCount = lineBitCount + columnBitCount -let _ = assert (posBitCount <= 64) + let posColumnMask = mask64 0 columnBitCount + let lineColumnMask = mask64 columnBitCount lineBitCount [] [] type pos(code:int64) = + new (l, c) = let l = max 0 l let c = max 0 c @@ -34,63 +37,80 @@ type pos(code:int64) = pos p member p.Line = int32 (uint64 code >>> columnBitCount) + member p.Column = int32 (code &&& posColumnMask) member r.Encoding = code + static member EncodingSize = posBitCount + static member Decode (code:int64) : pos = pos code + override p.Equals(obj) = match obj with :? pos as p2 -> code = p2.Encoding | _ -> false + override p.GetHashCode() = hash code + override p.ToString() = sprintf "(%d,%d)" p.Line p.Column [] let fileIndexBitCount = 24 + [] let startColumnBitCount = columnBitCount // 20 + [] let endColumnBitCount = columnBitCount // 20 [] let startLineBitCount = lineBitCount // 31 + [] let heightBitCount = 27 + [] let isSyntheticBitCount = 1 -#if DEBUG -let _ = assert (fileIndexBitCount + startColumnBitCount + endColumnBitCount <= 64) -let _ = assert (startLineBitCount + heightBitCount + isSyntheticBitCount <= 64) -#endif - + [] let fileIndexShift = 0 + [] let startColumnShift = 24 + [] let endColumnShift = 44 [] let startLineShift = 0 + [] let heightShift = 31 + [] let isSyntheticShift = 58 - [] let fileIndexMask = 0b0000000000000000000000000000000000000000111111111111111111111111L + [] let startColumnMask = 0b0000000000000000000011111111111111111111000000000000000000000000L + [] let endColumnMask = 0b1111111111111111111100000000000000000000000000000000000000000000L [] let startLineMask = 0b0000000000000000000000000000000001111111111111111111111111111111L + [] let heightMask = 0b0000001111111111111111111111111110000000000000000000000000000000L + [] let isSyntheticMask = 0b0000010000000000000000000000000000000000000000000000000000000000L #if DEBUG +let _ = assert (posBitCount <= 64) +let _ = assert (fileIndexBitCount + startColumnBitCount + endColumnBitCount <= 64) +let _ = assert (startLineBitCount + heightBitCount + isSyntheticBitCount <= 64) + let _ = assert (startColumnShift = fileIndexShift + fileIndexBitCount) let _ = assert (endColumnShift = startColumnShift + startColumnBitCount) @@ -105,24 +125,64 @@ let _ = assert (endColumnMask = mask64 endColumnShift endColumnBitCount) let _ = assert (isSyntheticMask = mask64 isSyntheticShift isSyntheticBitCount) #endif -// This is just a standard unique-index table +/// Removes relative parts from any full paths +let normalizeFilePath (filePath: string) = + try + if FileSystem.IsPathRootedShim filePath then + FileSystem.GetFullPathShim filePath + else + filePath + with _ -> filePath + +/// A unique-index table for file names. type FileIndexTable() = let indexToFileTable = new ResizeArray<_>(11) let fileToIndexTable = new ConcurrentDictionary() - member t.FileToIndex f = - let mutable res = 0 - let ok = fileToIndexTable.TryGetValue(f, &res) - if ok then res - else + + // Note: we should likely adjust this code to always normalize. However some testing (and possibly some + // product behaviour) appears to be sensitive to error messages reporting un-normalized file names. + // Currently all names going through 'mkRange' get normalized, while this going through just 'fileIndexOfFile' + // do not. Also any file names which are not put into ranges at all are non-normalized. + // + // TO move forward we should eventually introduce a new type NormalizedFileName that tracks this invariant. + member t.FileToIndex normalize filePath = + match fileToIndexTable.TryGetValue(filePath) with + | true, idx -> idx + | _ -> + + // Try again looking for a normalized entry. + let normalizedFilePath = if normalize then normalizeFilePath filePath else filePath + match fileToIndexTable.TryGetValue(normalizedFilePath) with + | true, idx -> + // Record the non-normalized entry if necessary + if filePath <> normalizedFilePath then + lock fileToIndexTable (fun () -> + fileToIndexTable.[filePath] <- idx) + + // Return the index + idx + + | _ -> lock fileToIndexTable (fun () -> - let n = indexToFileTable.Count in - indexToFileTable.Add(f) - fileToIndexTable.[f] <- n - n) + // Get the new index + let idx = indexToFileTable.Count + + // Record the normalized entry + indexToFileTable.Add normalizedFilePath + fileToIndexTable.[normalizedFilePath] <- idx + + // Record the non-normalized entry if necessary + if filePath <> normalizedFilePath then + fileToIndexTable.[filePath] <- idx + + // Return the index + idx) member t.IndexToFile n = - (if n < 0 then failwithf "fileOfFileIndex: negative argument: n = %d\n" n) - (if n >= indexToFileTable.Count then failwithf "fileOfFileIndex: invalid argument: n = %d\n" n) + if n < 0 then + failwithf "fileOfFileIndex: negative argument: n = %d\n" n + if n >= indexToFileTable.Count then + failwithf "fileOfFileIndex: invalid argument: n = %d\n" n indexToFileTable.[n] let maxFileIndex = pown32 fileIndexBitCount @@ -132,8 +192,11 @@ let maxFileIndex = pown32 fileIndexBitCount let fileIndexTable = new FileIndexTable() // If we exceed the maximum number of files we'll start to report incorrect file names -let fileIndexOfFile f = fileIndexTable.FileToIndex(f) % maxFileIndex -let fileOfFileIndex n = fileIndexTable.IndexToFile(n) +let fileIndexOfFileAux normalize f = fileIndexTable.FileToIndex normalize f % maxFileIndex + +let fileIndexOfFile filePath = fileIndexOfFileAux false filePath + +let fileOfFileIndex idx = fileIndexTable.IndexToFile idx let mkPos l c = pos (l, c) @@ -157,19 +220,31 @@ type range(code1:int64, code2: int64) = new (fidx, b:pos, e:pos) = range(fidx, b.Line, b.Column, e.Line, e.Column) member r.StartLine = int32((code2 &&& startLineMask) >>> startLineShift) + member r.StartColumn = int32((code1 &&& startColumnMask) >>> startColumnShift) + member r.EndLine = int32((code2 &&& heightMask) >>> heightShift) + r.StartLine + member r.EndColumn = int32((code1 &&& endColumnMask) >>> endColumnShift) + member r.IsSynthetic = int32((code2 &&& isSyntheticMask) >>> isSyntheticShift) <> 0 + member r.Start = pos (r.StartLine, r.StartColumn) + member r.End = pos (r.EndLine, r.EndColumn) + member r.FileIndex = int32(code1 &&& fileIndexMask) + member m.StartRange = range (m.FileIndex, m.Start, m.Start) + member m.EndRange = range (m.FileIndex, m.End, m.End) + member r.FileName = fileOfFileIndex r.FileIndex + member r.MakeSynthetic() = range(code1, code2 ||| isSyntheticMask) member r.Code1 = code1 + member r.Code2 = code2 #if DEBUG @@ -194,33 +269,31 @@ type range(code1:int64, code2: int64) = override r.ToString() = sprintf "%s (%d,%d--%d,%d) IsSynthetic=%b" r.FileName r.StartLine r.StartColumn r.EndLine r.EndColumn r.IsSynthetic -let mkRange f b e = - // remove relative parts from full path - let normalizedFilePath = if Path.IsPathRooted f then try Path.GetFullPath f with _ -> f else f - range (fileIndexOfFile normalizedFilePath, b, e) +let mkRange filePath startPos endPos = range (fileIndexOfFileAux true filePath, startPos, endPos) let equals (r1: range) (r2: range) = r1.Code1 = r2.Code1 && r1.Code2 = r2.Code2 -let mkFileIndexRange fi b e = range (fi, b, e) +let mkFileIndexRange fileIndex startPos endPos = range (fileIndex, startPos, endPos) -(* end representation, start derived ops *) - let posOrder = Order.orderOn (fun (p:pos) -> p.Line, p.Column) (Pair.order (Int32.order, Int32.order)) -(* rangeOrder: not a total order, but enough to sort on ranges *) + +/// rangeOrder: not a total order, but enough to sort on ranges let rangeOrder = Order.orderOn (fun (r:range) -> r.FileName, r.Start) (Pair.order (String.order, posOrder)) let outputPos (os:TextWriter) (m:pos) = fprintf os "(%d,%d)" m.Line m.Column + let outputRange (os:TextWriter) (m:range) = fprintf os "%s%a-%a" m.FileName outputPos m.Start outputPos m.End -let boutputPos os (m:pos) = bprintf os "(%d,%d)" m.Line m.Column -let boutputRange os (m:range) = bprintf os "%s%a-%a" m.FileName boutputPos m.Start boutputPos m.End let posGt (p1:pos) (p2:pos) = (p1.Line > p2.Line || (p1.Line = p2.Line && p1.Column > p2.Column)) + let posEq (p1:pos) (p2:pos) = (p1.Line = p2.Line && p1.Column = p2.Column) + let posGeq p1 p2 = posEq p1 p2 || posGt p1 p2 + let posLt p1 p2 = posGt p2 p1 -// This is deliberately written in an allocation-free way, i.e. m1.Start, m1.End etc. are not called +/// This is deliberately written in an allocation-free way, i.e. m1.Start, m1.End etc. are not called let unionRanges (m1:range) (m2:range) = if m1.FileIndex <> m2.FileIndex then m2 else let b = @@ -244,9 +317,13 @@ let rangeBeforePos (m1:range) p = posGeq p m1.End let rangeN filename line = mkRange filename (mkPos line 0) (mkPos line 0) + let pos0 = mkPos 1 0 + let range0 = rangeN "unknown" 1 + let rangeStartup = rangeN "startup" 1 + let rangeCmdArgs = rangeN "commandLineArgs" 0 let trimRangeToLine (r:range) = @@ -260,6 +337,7 @@ let trimRangeToLine (r:range) = (* For Diagnostics *) let stringOfPos (pos:pos) = sprintf "(%d,%d)" pos.Line pos.Column + let stringOfRange (r:range) = sprintf "%s%s-%s" r.FileName (stringOfPos r.Start) (stringOfPos r.End) #if CHECK_LINE0_TYPES // turn on to check that we correctly transform zero-based line counts to one-based line counts @@ -274,17 +352,22 @@ type Pos01 = Line0 * int type Range01 = Pos01 * Pos01 module Line = + // Visual Studio uses line counts starting at 0, F# uses them starting at 1 let fromZ (line:Line0) = int line+1 + let toZ (line:int) : Line0 = LanguagePrimitives.Int32WithMeasure(line - 1) module Pos = + let fromZ (line:Line0) idx = mkPos (Line.fromZ line) idx - let toZ (p:pos) = (Line.toZ p.Line, p.Column) + let toZ (p:pos) = (Line.toZ p.Line, p.Column) module Range = + let toZ (m:range) = Pos.toZ m.Start, Pos.toZ m.End + let toFileZ (m:range) = m.FileName, toZ m diff --git a/src/fsharp/range.fsi b/src/fsharp/range.fsi index 53deaca0e27..6549b008dcf 100755 --- a/src/fsharp/range.fsi +++ b/src/fsharp/range.fsi @@ -10,44 +10,86 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler -(* we keep a global tables of filenames that we can reference by integers *) +/// An index into a global tables of filenames type FileIndex = int32 -val fileIndexOfFile : string -> FileIndex + +/// Convert a file path to an index +val fileIndexOfFile : filePath: string -> FileIndex + +/// Convert an index into a file path val fileOfFileIndex : FileIndex -> string +/// Represents a position in a file [] type pos = + + /// The line number for the position member Line : int + + /// The column number for the position member Column : int + /// The encoding of the position as a 64-bit integer member Encoding : int64 + + /// Decode a position fro a 64-bit integer static member Decode : int64 -> pos + /// The maximum number of bits needed to store an encoded position static member EncodingSize : int /// Create a position for the given line and column val mkPos : line:int -> column:int -> pos +/// Ordering on positions val posOrder : IComparer +/// Represents a range within a known file [] type range = + + /// The start line of the range member StartLine : int + + /// The start column of the range member StartColumn : int + + /// The line number for the end position of the range member EndLine : int + + /// The column number for the end position of the range member EndColumn : int + + /// The start position of the range member Start : pos + + /// The end position of the range member End : pos + + /// The empty range that is located at the start position of the range member StartRange: range + + /// The empty range that is located at the end position of the range member EndRange: range + + /// The file index for the range member FileIndex : int + + /// The file name for the file of the range member FileName : string + /// Synthetic marks ranges which are produced by intermediate compilation phases. This /// bit signifies that the range covers something that should not be visible to language /// service operations like dot-completion. member IsSynthetic : bool + + /// Convert a range to be synthetic member MakeSynthetic : unit -> range + + /// Convert a range to string member ToShortString : unit -> string + + /// The range where all values are zero static member Zero : range /// This view of range marks uses file indexes explicitly @@ -58,34 +100,61 @@ val mkRange : string -> pos -> pos -> range val equals : range -> range -> bool +/// Reduce a range so it only covers a line val trimRangeToLine : range -> range /// not a total order, but enough to sort on ranges val rangeOrder : IComparer +/// Output a position val outputPos : System.IO.TextWriter -> pos -> unit + +/// Output a range val outputRange : System.IO.TextWriter -> range -> unit -val boutputPos : StringBuilder -> pos -> unit -val boutputRange : StringBuilder -> range -> unit +/// Compare positions for less-than val posLt : pos -> pos -> bool + +/// Compare positions for greater-than val posGt : pos -> pos -> bool + +/// Compare positions for equality val posEq : pos -> pos -> bool + +/// Compare positions for greater-than-or-equal-to val posGeq : pos -> pos -> bool +/// Union two ranges, taking their first occurring start position and last occurring end position val unionRanges : range -> range -> range + +/// Test to see if one range contains another range val rangeContainsRange : range -> range -> bool + +/// Test to see if a range contains a position val rangeContainsPos : range -> pos -> bool + +/// Test to see if a range occurs fully before a position val rangeBeforePos : range -> pos -> bool +/// Make a dummy range for a file val rangeN : string -> int -> range + +/// The zero position val pos0 : pos + +/// The zero range val range0 : range + +/// A range associated with a dummy file called "startup" val rangeStartup : range + +/// A range associated with a dummy file for the command line arguments val rangeCmdArgs : range -(* For diagnostics *) +/// Convert a position to a string val stringOfPos : pos -> string + +/// Convert a range to a string val stringOfRange : range -> string /// Represents a line number when using zero-based line counting (used by Visual Studio) @@ -100,22 +169,30 @@ type Line0 = int /// Represents a position using zero-based line counting (used by Visual Studio) type Pos01 = Line0 * int + /// Represents a range using zero-based line counting (used by Visual Studio) type Range01 = Pos01 * Pos01 module Line = + /// Convert a line number from zero-based line counting (used by Visual Studio) to one-based line counting (used internally in the F# compiler and in F# error messages) val fromZ : Line0 -> int + /// Convert a line number from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toZ : int -> Line0 module Pos = + /// Convert a position from zero-based line counting (used by Visual Studio) to one-based line counting (used internally in the F# compiler and in F# error messages) val fromZ : line:Line0 -> column:int -> pos + /// Convert a position from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toZ : pos -> Pos01 module Range = + /// Convert a range from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toZ : range -> Range01 + + /// Convert a range from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toFileZ : range -> string * Range01 diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index 37c4b16bf21..f5d0141b32e 100755 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -55,15 +55,16 @@ module internal IncrementalBuild = /// Get the Id for the given ScalarBuildRule. member x.Id = match x with - | ScalarInput(id, _) ->id - | ScalarDemultiplex(id, _, _, _) ->id - | ScalarMap(id, _, _, _) ->id + | ScalarInput(id, _) -> id + | ScalarDemultiplex(id, _, _, _) -> id + | ScalarMap(id, _, _, _) -> id + /// Get the Name for the givenScalarExpr. member x.Name = match x with - | ScalarInput(_, n) ->n - | ScalarDemultiplex(_, n, _, _) ->n - | ScalarMap(_, n, _, _) ->n + | ScalarInput(_, n) -> n + | ScalarDemultiplex(_, n, _, _) -> n + | ScalarMap(_, n, _, _) -> n /// A build rule with a vector of outputs and VectorBuildRule = @@ -1034,6 +1035,7 @@ type TypeCheckAccumulator = /// Accumulated 'open' declarations, last file first tcOpenDeclarationsRev: OpenDeclaration[] list + topAttribs:TopAttribs option /// Result of checking most recent file, if any @@ -1043,6 +1045,9 @@ type TypeCheckAccumulator = tcDependencyFiles: string list + /// Disambiguation table for module names + tcModuleNamesDict: ModuleNamesDict + /// Accumulated errors, last file first tcErrorsRev:(PhasedDiagnostic * FSharpErrorSeverity)[] list } @@ -1125,10 +1130,17 @@ type PartialCheckResults = /// Kept in a stack so that each incremental update shares storage with previous files TcOpenDeclarationsRev: OpenDeclaration[] list + /// Disambiguation table for module names + ModuleNamesDict: ModuleNamesDict + TcDependencyFiles: string list + TopAttribs: TopAttribs option + TimeStamp: DateTime + LatestImplementationFile: TypedImplFile option + LastestCcuSigForFile: ModuleOrNamespaceType option } member x.TcErrors = Array.concat (List.rev x.TcErrorsRev) @@ -1146,6 +1158,7 @@ type PartialCheckResults = TcOpenDeclarationsRev = tcAcc.tcOpenDeclarationsRev TcDependencyFiles = tcAcc.tcDependencyFiles TopAttribs = tcAcc.topAttribs + ModuleNamesDict = tcAcc.tcModuleNamesDict TimeStamp = timestamp LatestImplementationFile = tcAcc.latestImplFile LastestCcuSigForFile = tcAcc.latestCcuSigForFile } @@ -1175,7 +1188,9 @@ type RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState: yield (ccuName, (fun () -> r.GetBytes())) ] let autoOpenAttrs = topAttrs.assemblyAttrs |> List.choose (List.singleton >> TryFindFSharpStringAttribute tcGlobals tcGlobals.attrib_AutoOpenAttribute) + let ivtAttrs = topAttrs.assemblyAttrs |> List.choose (List.singleton >> TryFindFSharpStringAttribute tcGlobals tcGlobals.attrib_InternalsVisibleToAttribute) + interface IRawFSharpAssemblyData with member __.GetAutoOpenAttributes(_ilg) = autoOpenAttrs member __.GetInternalsVisibleToAttributes(_ilg) = ivtAttrs @@ -1246,6 +1261,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput let assertNotDisposed() = if disposed then System.Diagnostics.Debug.Assert(false, "IncrementalBuild object has already been disposed!") + let mutable referenceCount = 0 //---------------------------------------------------- @@ -1258,14 +1274,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput assertNotDisposed() cache.GetFileTimeStamp filename - // Deduplicate module names - let moduleNamesDict = ConcurrentDictionary>() - /// This is a build task function that gets placed into the build rules as the computation for a VectorMap /// - /// Parse the given files and return the given inputs. This function is expected to be - /// able to be called with a subset of sourceFiles and return the corresponding subset of - /// parsed inputs. + /// Parse the given file and return the given input. let ParseTask ctok (sourceRange:range, filename:string, isLastCompiland) = assertNotDisposed() DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent ctok @@ -1278,9 +1289,8 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput IncrementalBuilderEventTesting.MRU.Add(IncrementalBuilderEventTesting.IBEParsed filename) let input = ParseOneInputFile(tcConfig, lexResourceManager, [], filename , isLastCompiland, errorLogger, (*retryLocked*)true) fileParsed.Trigger (filename) - let result = Option.map (DeduplicateParsedInputModuleName moduleNamesDict) input - result, sourceRange, filename, errorLogger.GetErrors () + input, sourceRange, filename, errorLogger.GetErrors () with exn -> let msg = sprintf "unexpected failure in IncrementalFSharpBuild.Parse\nerror = %s" (exn.ToString()) System.Diagnostics.Debug.Assert(false, msg) @@ -1357,7 +1367,8 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput latestImplFile=None latestCcuSigForFile=None tcDependencyFiles=basicDependencies - tcErrorsRev = [ initialErrors ] } + tcErrorsRev = [ initialErrors ] + tcModuleNamesDict = Map.empty } return tcAcc } /// This is a build task function that gets placed into the build rules as the computation for a Vector.ScanLeft @@ -1378,6 +1389,8 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput let sink = TcResultsSinkImpl(tcAcc.tcGlobals) let hadParseErrors = not (Array.isEmpty parseErrors) + let input, moduleNamesDict = DeduplicateParsedInputModuleName tcAcc.tcModuleNamesDict input + let! (tcEnvAtEndOfFile, topAttribs, implFile, ccuSigForFile), tcState = TypeCheckOneInputEventually ((fun () -> hadParseErrors || errorLogger.ErrorCount > 0), @@ -1406,6 +1419,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput tcSymbolUsesRev=tcSymbolUses :: tcAcc.tcSymbolUsesRev tcOpenDeclarationsRev = sink.GetOpenDeclarations() :: tcAcc.tcOpenDeclarationsRev tcErrorsRev = newErrors :: tcAcc.tcErrorsRev + tcModuleNamesDict = moduleNamesDict tcDependencyFiles = filename :: tcAcc.tcDependencyFiles } } @@ -1448,55 +1462,55 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput TypeCheckMultipleInputsFinish (results, finalAcc.tcState) let ilAssemRef, tcAssemblyDataOpt, tcAssemblyExprOpt = - try - // TypeCheckClosedInputSetFinish fills in tcState.Ccu but in incremental scenarios we don't want this, - // so we make this temporary here - let oldContents = tcState.Ccu.Deref.Contents - try - let tcState, tcAssemblyExpr = TypeCheckClosedInputSetFinish (mimpls, tcState) - - // Compute the identity of the generated assembly based on attributes, options etc. - // Some of this is duplicated from fsc.fs - let ilAssemRef = - let publicKey = - try - let signingInfo = Driver.ValidateKeySigningAttributes (tcConfig, tcGlobals, topAttrs) - match Driver.GetStrongNameSigner signingInfo with - | None -> None - | Some s -> Some (PublicKey.KeyAsToken(s.PublicKey)) - with e -> - errorRecoveryNoRange e - None - let locale = TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyCultureAttribute") topAttrs.assemblyAttrs - let assemVerFromAttrib = - TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyVersionAttribute") topAttrs.assemblyAttrs - |> Option.bind (fun v -> try Some (parseILVersion v) with _ -> None) - let ver = - match assemVerFromAttrib with - | None -> tcConfig.version.GetVersionInfo(tcConfig.implicitIncludeDir) - | Some v -> v - ILAssemblyRef.Create(assemblyName, None, publicKey, false, Some ver, locale) - - let tcAssemblyDataOpt = + try + // TypeCheckClosedInputSetFinish fills in tcState.Ccu but in incremental scenarios we don't want this, + // so we make this temporary here + let oldContents = tcState.Ccu.Deref.Contents try - // Assemblies containing type provider components can not successfully be used via cross-assembly references. - // We return 'None' for the assembly portion of the cross-assembly reference - let hasTypeProviderAssemblyAttrib = - topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> tcref.CompiledRepresentationForNamedType.BasicQualifiedName = typeof.FullName) - if tcState.CreatesGeneratedProvidedTypes || hasTypeProviderAssemblyAttrib then - None - else - Some (RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState, outfile, topAttrs, assemblyName, ilAssemRef) :> IRawFSharpAssemblyData) - - with e -> - errorRecoveryNoRange e - None - ilAssemRef, tcAssemblyDataOpt, Some tcAssemblyExpr - finally - tcState.Ccu.Deref.Contents <- oldContents - with e -> - errorRecoveryNoRange e - mkSimpleAssemblyRef assemblyName, None, None + let tcState, tcAssemblyExpr = TypeCheckClosedInputSetFinish (mimpls, tcState) + + // Compute the identity of the generated assembly based on attributes, options etc. + // Some of this is duplicated from fsc.fs + let ilAssemRef = + let publicKey = + try + let signingInfo = Driver.ValidateKeySigningAttributes (tcConfig, tcGlobals, topAttrs) + match Driver.GetStrongNameSigner signingInfo with + | None -> None + | Some s -> Some (PublicKey.KeyAsToken(s.PublicKey)) + with e -> + errorRecoveryNoRange e + None + let locale = TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyCultureAttribute") topAttrs.assemblyAttrs + let assemVerFromAttrib = + TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyVersionAttribute") topAttrs.assemblyAttrs + |> Option.bind (fun v -> try Some (parseILVersion v) with _ -> None) + let ver = + match assemVerFromAttrib with + | None -> tcConfig.version.GetVersionInfo(tcConfig.implicitIncludeDir) + | Some v -> v + ILAssemblyRef.Create(assemblyName, None, publicKey, false, Some ver, locale) + + let tcAssemblyDataOpt = + try + // Assemblies containing type provider components can not successfully be used via cross-assembly references. + // We return 'None' for the assembly portion of the cross-assembly reference + let hasTypeProviderAssemblyAttrib = + topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> tcref.CompiledRepresentationForNamedType.BasicQualifiedName = typeof.FullName) + if tcState.CreatesGeneratedProvidedTypes || hasTypeProviderAssemblyAttrib then + None + else + Some (RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState, outfile, topAttrs, assemblyName, ilAssemRef) :> IRawFSharpAssemblyData) + + with e -> + errorRecoveryNoRange e + None + ilAssemRef, tcAssemblyDataOpt, Some tcAssemblyExpr + finally + tcState.Ccu.Deref.Contents <- oldContents + with e -> + errorRecoveryNoRange e + mkSimpleAssemblyRef assemblyName, None, None let finalAccWithErrors = { finalAcc with @@ -1561,9 +1575,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput member this.IncrementUsageCount() = assertNotDisposed() System.Threading.Interlocked.Increment(&referenceCount) |> ignore - { new System.IDisposable with member x.Dispose() = this.DecrementUsageCount() } + { new System.IDisposable with member __.Dispose() = this.DecrementUsageCount() } - member this.DecrementUsageCount() = + member __.DecrementUsageCount() = assertNotDisposed() let currentValue = System.Threading.Interlocked.Decrement(&referenceCount) if currentValue = 0 then @@ -1573,11 +1587,17 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput member __.IsAlive = referenceCount > 0 member __.TcConfig = tcConfig + member __.FileParsed = fileParsed.Publish + member __.BeforeFileChecked = beforeFileChecked.Publish + member __.FileChecked = fileChecked.Publish + member __.ProjectChecked = projectChecked.Publish + member __.ImportedCcusInvalidated = importsInvalidated.Publish + member __.AllDependenciesDeprecated = allDependencies #if !NO_EXTENSIONTYPING @@ -1622,7 +1642,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput | (*first file*) 0 -> IncrementalBuild.IsReady cache (Target(initialTcAccNode, None)) partialBuild | _ -> IncrementalBuild.IsReady cache (Target(tcStatesNode, Some (slotOfFile-1))) partialBuild - member builder.GetCheckResultsBeforeSlotInProject (ctok: CompilationThreadToken, slotOfFile) = + member __.GetCheckResultsBeforeSlotInProject (ctok: CompilationThreadToken, slotOfFile) = cancellable { let cache = TimeStampCache(defaultTimeStamp) let! result = @@ -1652,9 +1672,6 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput member builder.GetCheckResultsAfterLastFileInProject (ctok: CompilationThreadToken) = builder.GetCheckResultsBeforeSlotInProject(ctok, builder.GetSlotsCount()) - member builder.DeduplicateParsedInputModuleNameInProject (input) = - DeduplicateParsedInputModuleName moduleNamesDict input - member __.GetCheckResultsAndImplementationsForProject(ctok: CompilationThreadToken) = cancellable { let cache = TimeStampCache(defaultTimeStamp) @@ -1861,10 +1878,11 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput return builderOpt, diagnostics } + static member KeepBuilderAlive (builderOpt: IncrementalBuilder option) = match builderOpt with | Some builder -> builder.IncrementUsageCount() | None -> { new System.IDisposable with member __.Dispose() = () } - member builder.IsBeingKeptAliveApartFromCacheEntry = (referenceCount >= 2) + member __.IsBeingKeptAliveApartFromCacheEntry = (referenceCount >= 2) diff --git a/src/fsharp/service/IncrementalBuild.fsi b/src/fsharp/service/IncrementalBuild.fsi index b6b64a7ffd0..29c7a03a454 100755 --- a/src/fsharp/service/IncrementalBuild.fsi +++ b/src/fsharp/service/IncrementalBuild.fsi @@ -55,6 +55,9 @@ type internal PartialCheckResults = /// Represents open declarations TcOpenDeclarationsRev: OpenDeclaration[] list + /// Disambiguation table for module names + ModuleNamesDict: ModuleNamesDict + TcDependencyFiles: string list /// Represents the collected attributes to apply to the module of assuembly generates @@ -151,8 +154,6 @@ type internal IncrementalBuilder = // TODO: make this an Eventually (which can be scheduled) or an Async (which can be cancelled) member GetCheckResultsAndImplementationsForProject : CompilationThreadToken -> Cancellable - member DeduplicateParsedInputModuleNameInProject: Ast.ParsedInput -> Ast.ParsedInput - /// Get the logical time stamp that is associated with the output of the project if it were gully built immediately member GetLogicalTimeStampForProject: TimeStampCache * CompilationThreadToken -> DateTime diff --git a/src/fsharp/service/ServiceAssemblyContent.fs b/src/fsharp/service/ServiceAssemblyContent.fs index b85396c26e7..663ed82a941 100644 --- a/src/fsharp/service/ServiceAssemblyContent.fs +++ b/src/fsharp/service/ServiceAssemblyContent.fs @@ -914,8 +914,9 @@ module ParsedInput = let rec walkImplFileInput (ParsedImplFileInput(modules = moduleOrNamespaceList)) = List.iter (walkSynModuleOrNamespace []) moduleOrNamespaceList - and walkSynModuleOrNamespace (parent: LongIdent) (SynModuleOrNamespace(ident, _, isModule, decls, _, _, _, range)) = + and walkSynModuleOrNamespace (parent: LongIdent) (SynModuleOrNamespace(ident, _, kind, decls, _, _, _, range)) = if range.EndLine >= currentLine then + let isModule = kind.IsModule match isModule, parent, ident with | false, _, _ -> ns := Some (longIdentToIdents ident) // top level module with "inlined" namespace like Ns1.Ns2.TopModule diff --git a/src/fsharp/service/ServiceNavigation.fs b/src/fsharp/service/ServiceNavigation.fs index cd7f43e2036..fd0453f88d9 100755 --- a/src/fsharp/service/ServiceNavigation.fs +++ b/src/fsharp/service/ServiceNavigation.fs @@ -273,7 +273,7 @@ module NavigationImpl = let items = // Show base name for this module only if it's not the root one let singleTopLevel = (modules.Length = 1) - modules |> List.collect (fun (SynModuleOrNamespace(id, _isRec, isModule, decls, _, _, access, m)) -> + modules |> List.collect (fun (SynModuleOrNamespace(id, _isRec, kind, decls, _, _, access, m)) -> let baseName = if (not singleTopLevel) then textOfLid id else "" // Find let bindings (for the right dropdown) let nested = processNestedDeclarations(decls) @@ -286,7 +286,7 @@ module NavigationImpl = | _ -> let decl = FSharpNavigationDeclarationItem.Create - (textOfLid id, (if isModule then ModuleFileDecl else NamespaceDecl), + (textOfLid id, (if kind.IsModule then ModuleFileDecl else NamespaceDecl), FSharpGlyph.Module, m, unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other), singleTopLevel, FSharpEnclosingEntityKind.Module, false, access), (addItemName(textOfLid id)), nested @@ -413,7 +413,7 @@ module NavigationImpl = let items = // Show base name for this module only if it's not the root one let singleTopLevel = (modules.Length = 1) - modules |> List.collect (fun (SynModuleOrNamespaceSig(id, _isRec, isModule, decls, _, _, access, m)) -> + modules |> List.collect (fun (SynModuleOrNamespaceSig(id, _isRec, kind, decls, _, _, access, m)) -> let baseName = if (not singleTopLevel) then textOfLid id else "" // Find let bindings (for the right dropdown) let nested = processNestedSigDeclarations(decls) @@ -423,7 +423,7 @@ module NavigationImpl = // Create explicitly - it can be 'single top level' thing that is hidden let decl = FSharpNavigationDeclarationItem.Create - (textOfLid id, (if isModule then ModuleFileDecl else NamespaceDecl), + (textOfLid id, (if kind.IsModule then ModuleFileDecl else NamespaceDecl), FSharpGlyph.Module, m, unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other), singleTopLevel, FSharpEnclosingEntityKind.Module, false, access), (addItemName(textOfLid id)), nested @@ -577,7 +577,8 @@ module NavigateTo = for item in moduleOrNamespaceList do walkSynModuleOrNamespaceSig item { Type = ContainerType.File; Name = fileName } - and walkSynModuleOrNamespaceSig (SynModuleOrNamespaceSig(lid, _, isModule, decls, _, _, _, _)) container = + and walkSynModuleOrNamespaceSig (SynModuleOrNamespaceSig(lid, _, kind, decls, _, _, _, _)) container = + let isModule = kind.IsModule if isModule then addModule lid true container let container = @@ -634,7 +635,8 @@ module NavigateTo = for item in moduleOrNamespaceList do walkSynModuleOrNamespace item container - and walkSynModuleOrNamespace(SynModuleOrNamespace(lid, _, isModule, decls, _, _, _, _)) container = + and walkSynModuleOrNamespace(SynModuleOrNamespace(lid, _, kind, decls, _, _, _, _)) container = + let isModule = kind.IsModule if isModule then addModule lid false container let container = diff --git a/src/fsharp/service/ServiceParseTreeWalk.fs b/src/fsharp/service/ServiceParseTreeWalk.fs index f84f84bb993..da673eb4083 100755 --- a/src/fsharp/service/ServiceParseTreeWalk.fs +++ b/src/fsharp/service/ServiceParseTreeWalk.fs @@ -458,9 +458,12 @@ module public AstTraversal = dive synExpr2 synExpr2.Range traverseSynExpr dive synExpr3 synExpr3.Range traverseSynExpr] |> pick expr - | SynExpr.TypeTest(synExpr, _synType, _range) -> traverseSynExpr synExpr - | SynExpr.Upcast(synExpr, _synType, _range) -> traverseSynExpr synExpr - | SynExpr.Downcast(synExpr, _synType, _range) -> traverseSynExpr synExpr + | SynExpr.TypeTest(synExpr, synType, _range) + | SynExpr.Upcast(synExpr, synType, _range) + | SynExpr.Downcast(synExpr, synType, _range) -> + [dive synExpr synExpr.Range traverseSynExpr + dive synType synType.Range traverseSynType] + |> pick expr | SynExpr.InferredUpcast(synExpr, _range) -> traverseSynExpr synExpr | SynExpr.InferredDowncast(synExpr, _range) -> traverseSynExpr synExpr | SynExpr.Null(_range) -> None diff --git a/src/fsharp/service/ServiceStructure.fs b/src/fsharp/service/ServiceStructure.fs index f225c87b6d0..a89afd44c54 100644 --- a/src/fsharp/service/ServiceStructure.fs +++ b/src/fsharp/service/ServiceStructure.fs @@ -610,14 +610,14 @@ module Structure = parseAttributes attrs | _ -> () - let parseModuleOrNamespace isScript (SynModuleOrNamespace (longId,_,isModule,decls,_,attribs,_,r)) = + let parseModuleOrNamespace (SynModuleOrNamespace (longId,_,kind,decls,_,attribs,_,r)) = parseAttributes attribs let idRange = longIdentRange longId let fullrange = Range.startToEnd idRange r let collapse = Range.endToEnd idRange r // do not return range for top level implicit module in scripts - if isModule && not isScript then + if kind = NamedModule then rcheck Scope.Module Collapse.Below fullrange collapse collectHashDirectives decls @@ -833,14 +833,14 @@ module Structure = List.iter parseModuleSigDeclaration decls | _ -> () - let parseModuleOrNamespaceSigs (SynModuleOrNamespaceSig(longId,_,isModule,decls,_,attribs,_,r)) = + let parseModuleOrNamespaceSigs (SynModuleOrNamespaceSig(longId,_,kind,decls,_,attribs,_,r)) = parseAttributes attribs let rangeEnd = lastModuleSigDeclRangeElse r decls let idrange = longIdentRange longId let fullrange = Range.startToEnd idrange rangeEnd let collapse = Range.endToEnd idrange rangeEnd - if isModule then + if kind.IsModule then rcheck Scope.Module Collapse.Below fullrange collapse collectSigHashDirectives decls @@ -848,8 +848,8 @@ module Structure = List.iter parseModuleSigDeclaration decls match parsedInput with - | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules; isScript = isScript)) -> - modules |> List.iter (parseModuleOrNamespace isScript) + | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules)) -> + modules |> List.iter parseModuleOrNamespace getCommentRanges sourceLines | ParsedInput.SigFile (ParsedSigFileInput (modules = moduleSigs)) -> List.iter parseModuleOrNamespaceSigs moduleSigs diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 3545293e44e..bc176102748 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1614,6 +1614,7 @@ module internal Parser = tcGlobals: TcGlobals, tcImports: TcImports, tcState: TcState, + moduleNamesDict: ModuleNamesDict, loadClosure: LoadClosure option, // These are the errors and warnings seen by the background compiler for the entire antecedent backgroundDiagnostics: (PhasedDiagnostic * FSharpErrorSeverity)[], @@ -1718,6 +1719,9 @@ module internal Parser = async { try let checkForErrors() = (parseResults.ParseHadErrors || errHandler.ErrorCount > 0) + + let parsedMainInput, _moduleNamesDict = DeduplicateParsedInputModuleName moduleNamesDict parsedMainInput + // Typecheck is potentially a long running operation. We chop it up here with an Eventually continuation and, at each slice, give a chance // for the client to claim the result as obsolete and have the typecheck abort. @@ -1904,7 +1908,8 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem let cenv = SymbolEnv(tcGlobals, thisCcu, Some ccuSig, tcImports) [| for r in tcSymbolUses do - for symbolUse in r.AllUsesOfSymbols do + for symbolUseChunk in r.AllUsesOfSymbols do + for symbolUse in symbolUseChunk do if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then let symbol = FSharpSymbol.Create(cenv, symbolUse.Item) yield FSharpSymbolUse(tcGlobals, symbolUse.DisplayEnv, symbol, symbolUse.ItemOccurence, symbolUse.Range) |] @@ -2098,7 +2103,8 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp (fun () -> [| |]) (fun scope -> let cenv = scope.SymbolEnv - [| for symbolUse in scope.ScopeSymbolUses.AllUsesOfSymbols do + [| for symbolUseChunk in scope.ScopeSymbolUses.AllUsesOfSymbols do + for symbolUse in symbolUseChunk do if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then let symbol = FSharpSymbol.Create(cenv, symbolUse.Item) yield FSharpSymbolUse(scope.TcGlobals, symbolUse.DisplayEnv, symbol, symbolUse.ItemOccurence, symbolUse.Range) |]) @@ -2596,7 +2602,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC let loadClosure = scriptClosureCacheLock.AcquireLock (fun ltok -> scriptClosureCache.TryGet (ltok, options)) let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, sourceText, fileName, options.ProjectFileName, tcPrior.TcConfig, tcPrior.TcGlobals, tcPrior.TcImports, - tcPrior.TcState, loadClosure, tcPrior.TcErrors, reactorOps, (fun () -> builder.IsAlive), textSnapshotInfo, userOpName) + tcPrior.TcState, tcPrior.ModuleNamesDict, loadClosure, tcPrior.TcErrors, reactorOps, (fun () -> builder.IsAlive), textSnapshotInfo, userOpName) let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules) let checkAnswer = MakeCheckFileAnswer(fileName, tcFileResult, options, builder, Array.ofList tcPrior.TcDependencyFiles, creationErrors, parseResults.Errors, tcErrors) bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, sourceText.GetHashCode()) @@ -2677,9 +2683,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC | _ -> Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "CheckFileInProject.CacheMiss", filename) let! tcPrior = execWithReactorAsync <| fun ctok -> builder.GetCheckResultsBeforeFileInProject (ctok, filename) - let parseTreeOpt = parseResults.ParseTree |> Option.map builder.DeduplicateParsedInputModuleNameInProject - let parseResultsAterDeDuplication = FSharpParseFileResults(parseResults.Errors, parseTreeOpt, parseResults.ParseHadErrors, parseResults.DependencyFiles) - let! checkAnswer = bc.CheckOneFileImpl(parseResultsAterDeDuplication, sourceText, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) + let! checkAnswer = bc.CheckOneFileImpl(parseResults, sourceText, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) return checkAnswer finally bc.ImplicitlyStartCheckProjectInBackground(options, userOpName) @@ -2722,7 +2726,6 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC // Do the parsing. let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles), options.UseScriptResolutionRules) let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile (sourceText, filename, parsingOptions, userOpName) - let parseTreeOpt = parseTreeOpt |> Option.map builder.DeduplicateParsedInputModuleNameInProject let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated) let! checkResults = bc.CheckOneFileImpl(parseResults, sourceText, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) @@ -3322,7 +3325,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio CompileOptions.ParseCompilerOptions (ignore, fsiCompilerOptions, [ ]) let loadClosure = LoadClosure.ComputeClosureOfScriptText(ctok, legacyReferenceResolver, defaultFSharpBinariesDir, filename, sourceText, CodeContext.Editing, tcConfig.useSimpleResolution, tcConfig.useFsiAuxLib, new Lexhelp.LexResourceManager(), applyCompilerOptions, assumeDotNetFramework, tryGetMetadataSnapshot=(fun _ -> None), reduceMemoryUsage=reduceMemoryUsage) - let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, sourceText, filename, "project", tcConfig, tcGlobals, tcImports, tcState, Some loadClosure, backgroundDiagnostics, reactorOps, (fun () -> true), None, userOpName) + let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, sourceText, filename, "project", tcConfig, tcGlobals, tcImports, tcState, Map.empty, Some loadClosure, backgroundDiagnostics, reactorOps, (fun () -> true), None, userOpName) return match tcFileResult with diff --git a/src/utils/EditDistance.fs b/src/utils/EditDistance.fs index 6beac0c408f..503662400ff 100644 --- a/src/utils/EditDistance.fs +++ b/src/utils/EditDistance.fs @@ -23,33 +23,45 @@ let jaro (s1: string) (s2: string) = let matchRadius = let minLen = Math.Min(s1.Length, s2.Length) minLen / 2 + minLen % 2 - - // An inner function which recursively finds the number - // of matched characters within the radius. - let commonChars (chars1: string) (chars2: string) = - let result = ResizeArray(chars1.Length) - for i = 0 to chars1.Length - 1 do - let c = chars1.[i] - if existsInWin c chars2 i matchRadius then - result.Add c - result - - // The sets of common characters and their lengths as floats - let c1 = commonChars s1 s2 - let c2 = commonChars s2 s1 - let c1length = float c1.Count - let c2length = float c2.Count - + + let rec nextChar (s1:string) (s2:string) i c = + if i < s1.Length then + let c = s1.[i] + if not (existsInWin c s2 i matchRadius) then + nextChar s1 s2 (i + 1) c + else + struct (i, c) + else + struct (i, c) + + // The sets of common characters and their lengths as floats // The number of transpositions within the sets of common characters. - let transpositions = - let mutable mismatches = 0.0 - for i = 0 to (Math.Min(c1.Count, c2.Count)) - 1 do - if c1.[i] <> c2.[i] then - mismatches <- mismatches + 1.0 - - // If one common string is longer than the other - // each additional char counts as half a transposition - (mismatches + abs (c1length - c2length)) / 2.0 + let struct (transpositions, c1length, c2length) = + let rec loop i j mismatches c1length c2length = + if i < s1.Length && j < s2.Length then + let struct (ti, ci) = nextChar s1 s2 i ' ' + let struct (tj, cj) = nextChar s2 s1 j ' ' + if ci <> cj then + loop (ti + 1) (tj + 1) (mismatches + 1) (c1length + 1) (c2length + 1) + else + loop (ti + 1) (tj + 1) mismatches (c1length + 1) (c2length + 1) + else struct (i, j, mismatches, c1length, c2length) + + let struct (i, j, mismatches, c1length, c2length) = loop 0 0 0 0 0 + + let rec loop (s1:string) (s2:string) i length = + if i < s1.Length - 1 then + let c = s1.[i] + if existsInWin c s2 i matchRadius then + loop s1 s2 (i + 1) (length + 1) + else + loop s1 s2 (i + 1) length + else + length + let c1length = loop s1 s2 i c1length |> float + let c2length = loop s2 s1 j c2length |> float + + struct ((float mismatches + abs (c1length - c2length)) / 2.0, c1length, c2length) let tLength = Math.Max(c1length, c2length) diff --git a/tests/.gitignore b/tests/.gitignore index 2de72583ada..bf970a32fde 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,6 +1,5 @@ FSharp_* net40-fsharpqa-suite-* CoreUnit_* -TestResults *.il dont.run.peverify \ No newline at end of file diff --git a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd index 7d8475c39c3..56af32e144b 100644 --- a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd +++ b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd @@ -16,17 +16,18 @@ rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\BasicProvider /s /q +taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure rem @@ -35,16 +36,16 @@ rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\BasicProvider /s /q -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure :success diff --git a/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd b/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd index ccd8c4d2e3b..74035032e29 100644 --- a/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd +++ b/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd @@ -15,17 +15,18 @@ rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\ComboProvider /s /q +taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: ComboProviderProvider failed && goto :failure rem @@ -34,16 +35,16 @@ rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\ComboProvider /s /q -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: ComboProviderProvider failed && goto :failure -@echo%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure :success diff --git a/tests/FSharp.Directory.Build.props b/tests/FSharp.Directory.Build.props index 19257808542..bb8eac309b1 100644 --- a/tests/FSharp.Directory.Build.props +++ b/tests/FSharp.Directory.Build.props @@ -1,9 +1,3 @@ - - - - - - diff --git a/tests/fsharp/SDKTests/AllSdkTargetsTests.proj b/tests/fsharp/SDKTests/AllSdkTargetsTests.proj index 857e3efd636..9da3a21fea1 100644 --- a/tests/fsharp/SDKTests/AllSdkTargetsTests.proj +++ b/tests/fsharp/SDKTests/AllSdkTargetsTests.proj @@ -1,7 +1,7 @@ - release + Release diff --git a/tests/fsharp/SDKTests/tests/Test.props b/tests/fsharp/SDKTests/tests/Test.props index fdfc314758e..8d29b210bfb 100644 --- a/tests/fsharp/SDKTests/tests/Test.props +++ b/tests/fsharp/SDKTests/tests/Test.props @@ -2,18 +2,18 @@ - net46 - <_TargetFrameworkVersionWithoutV Condition="'$(_TargetFrameworkVersionWithoutV)' == ''">4.6 + net472 + <_TargetFrameworkVersionWithoutV Condition="'$(_TargetFrameworkVersionWithoutV)' == ''">4.7.2 .NETFramework - release - $(MSBuildThisFileDirectory)..\..\..\..\$(Configuration)\net40\bin + Release + $(MSBuildThisFileDirectory)..\..\..\..\artifacts\bin\FSharp.Build\$(Configuration)\net472 AnyCPU $(MSBuildThisFileDirectory) - + diff --git a/tests/fsharp/SDKTests/tests/Test.targets b/tests/fsharp/SDKTests/tests/Test.targets index 5526c118403..6f1638051d8 100644 --- a/tests/fsharp/SDKTests/tests/Test.targets +++ b/tests/fsharp/SDKTests/tests/Test.targets @@ -1,6 +1,6 @@ - + diff --git a/tests/fsharp/Test.Directory.Build.props b/tests/fsharp/Test.Directory.Build.props deleted file mode 100644 index 6603d10e659..00000000000 --- a/tests/fsharp/Test.Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - $(CompilerTestPath)\Microsoft.FSharp.Targets - $(CompilerTestPath)\Microsoft.FSharp.NetSdk.props - $(CompilerTestPath)\Microsoft.FSharp.NetSdk.targets - $(CompilerTestPath)\Microsoft.FSharp.Overrides.NetSdk.targets - - diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 537fa6aa499..54915dc1ec1 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -62,10 +62,10 @@ type ProjectConfiguration = { let replaceTokens tag (replacement:string) (template:string) = template.Replace(tag, replacement) -let generateProps testCompilerVersion= +let generateProps testCompilerVersion = let template = @" - release + Release $(TESTCOMPILERVERSION) @@ -96,13 +96,13 @@ let generateProjectArtifacts (pc:ProjectConfiguration) targetFramework = let condition = if addCondition then " Condition=\"Exists('" + fileName + "')\"" else "" match compileItem with | CompileItem.Compile -> - "\n " + "\n " | CompileItem.Reference -> - "\n " + "\n " | CompileItem.UseSource -> - "\n " + "\n " | CompileItem.LoadSource -> - "\n " + "\n " sources |> List.map(fun src -> computeInclude src) @@ -221,7 +221,7 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNet20Exe (sprintf "run -f %s" targetFramework) + exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) testOkFile.CheckExists() executeFsc compilerType targetFramework else @@ -231,7 +231,7 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNet20Exe "build /t:RunFSharpScript" + exec { cfg with Directory = directory } cfg.DotNetExe "build /t:RunFSharpScript" testOkFile.CheckExists() executeFsi compilerType targetFramework result <- true diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index df2570d4d8b..bb4b134f8d0 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -122,19 +122,19 @@ type TestConfig = BUILD_CONFIG : string FSC : string fsc_flags : string - BinPath : string FSCOREDLLPATH : string FSI : string #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS FSIANYCPU : string #endif FSI_FOR_SCRIPTS : string + FSharpBuild : string + FSharpCompilerInteractiveSettings : string fsi_flags : string ILDASM : string PEVERIFY : string Directory: string DotNetExe: string - DotNet20Exe: string DefaultPlatform: string} @@ -157,11 +157,21 @@ let config configurationName envVars = let SCRIPT_ROOT = __SOURCE_DIRECTORY__ let packagesDir = Environment.GetEnvironmentVariable("USERPROFILE") ++ ".nuget" ++ "packages" #if NET472 - let architecture = "net40" + let fscArchitecture = "net472" + let fsiArchitecture = "net472" + let fsharpCoreArchitecture = "net45" + let fsharpBuildArchitecture = "net472" + let fsharpCompilerInteractiveSettingsArchitecture = "net472" #else - let architecture = "coreclr" + let fscArchitecture = "netcoreapp2.1" + let fsiArchitecture = "netcoreapp2.1" + let fsharpCoreArchitecture = "netstandard1.6" + let fsharpBuildArchitecture = "netstandard2.0" + let fsharpCompilerInteractiveSettingsArchitecture = "netstandard1.6" #endif - let BINPATH = SCRIPT_ROOT ++ ".." ++ ".." ++ configurationName ++ architecture ++ "bin" + let repoRoot = SCRIPT_ROOT ++ ".." ++ ".." + let artifactsPath = repoRoot ++ "artifacts" + let artifactsBinPath = artifactsPath ++ "bin" let csc_flags = "/nologo" let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED" let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror" @@ -170,20 +180,20 @@ let config configurationName envVars = let CSC = requireFile (packagesDir ++ "Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe") let ILDASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ "2.0.3" ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ildasm.exe") let coreclrdll = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ "2.0.3" ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "coreclr.dll") - let PEVERIFY = requireFile (SCRIPT_ROOT ++ ".." ++ "fsharpqa" ++ "testenv" ++ "src" ++ "PEVerify" ++ "bin" ++ configurationName ++ "net472" ++ "PEVerify.exe") - let FSI_FOR_SCRIPTS = BINPATH ++ "fsi.exe" - let toolsDir = SCRIPT_ROOT ++ ".." ++ ".." ++ "Tools" - let dotNetExe = toolsDir ++ "dotnetcli" ++ "dotnet.exe" - let dotNet20Exe = toolsDir ++ "dotnet20" ++ "dotnet.exe" + let PEVERIFY = requireFile (artifactsBinPath ++ "PEVerify" ++ configurationName ++ "net472" ++ "PEVerify.exe") + let FSI_FOR_SCRIPTS = artifactsBinPath ++ "fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.exe" + let FSharpBuild = requireFile (artifactsBinPath ++ "FSharp.Build" ++ configurationName ++ fsharpBuildArchitecture ++ "FSharp.Build.dll") + let FSharpCompilerInteractiveSettings = requireFile (artifactsBinPath ++ "FSharp.Compiler.Interactive.Settings" ++ configurationName ++ fsharpCompilerInteractiveSettingsArchitecture ++ "FSharp.Compiler.Interactive.Settings.dll") + let dotNetExe = artifactsPath ++ "toolset" ++ "dotnet" ++ "dotnet.exe" // ildasm requires coreclr.dll to run which has already been restored to the packages directory File.Copy(coreclrdll, Path.GetDirectoryName(ILDASM) ++ "coreclr.dll", overwrite=true) - let FSI = requireFile (BINPATH ++ "fsi.exe") + let FSI = requireFile (FSI_FOR_SCRIPTS) #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS - let FSIANYCPU = requireFile (BINPATH ++ "fsiAnyCpu.exe") + let FSIANYCPU = requireFile (artifactsBinPath ++ "fsiAnyCpu" ++ configurationName ++ "net472" ++ "fsiAnyCpu.exe") #endif - let FSC = requireFile (BINPATH ++ "fsc.exe") - let FSCOREDLLPATH = requireFile (BINPATH ++ "FSharp.Core.dll") + let FSC = requireFile (artifactsBinPath ++ "fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe") + let FSCOREDLLPATH = requireFile (artifactsBinPath ++ "FSharp.Core" ++ configurationName ++ fsharpCoreArchitecture ++ "FSharp.Core.dll") let defaultPlatform = match Is64BitOperatingSystem with @@ -193,7 +203,6 @@ let config configurationName envVars = | false -> "win7-x86" { EnvironmentVariables = envVars - BinPath = BINPATH |> Commands.pathAddBackslash FSCOREDLLPATH = FSCOREDLLPATH ILDASM = ILDASM PEVERIFY = PEVERIFY @@ -205,12 +214,13 @@ let config configurationName envVars = FSIANYCPU = FSIANYCPU #endif FSI_FOR_SCRIPTS = FSI_FOR_SCRIPTS + FSharpBuild = FSharpBuild + FSharpCompilerInteractiveSettings = FSharpCompilerInteractiveSettings csc_flags = csc_flags fsc_flags = fsc_flags fsi_flags = fsi_flags Directory="" DotNetExe = dotNetExe - DotNet20Exe = dotNet20Exe DefaultPlatform = defaultPlatform } let logConfig (cfg: TestConfig) = @@ -222,7 +232,6 @@ let logConfig (cfg: TestConfig) = log "csc_flags =%s" cfg.csc_flags log "FSC =%s" cfg.FSC log "fsc_flags =%s" cfg.fsc_flags - log "BINPATH =%s" cfg.BinPath log "FSCOREDLLPATH =%s" cfg.FSCOREDLLPATH log "FSI =%s" cfg.FSI #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS @@ -452,6 +461,7 @@ let rm cfg x = Commands.rm cfg.Directory x let rmdir cfg x = Commands.rmdir cfg.Directory x let mkdir cfg = Commands.mkdir_p cfg.Directory let copy_y cfg f = Commands.copy_y cfg.Directory f >> checkResult +let copySystemValueTuple cfg = copy_y cfg (getDirectoryName(cfg.FSC) ++ "System.ValueTuple.dll") ("." ++ "System.ValueTuple.dll") let diff normalize path1 path2 = let result = System.Text.StringBuilder() diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index c9b3bb2695e..ca19aa3a7fa 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1068,7 +1068,7 @@ module CoreTests = echo "Test 6=================================================" - fscAppend cfg stdoutPath stderrPath "--nologo -r FSharp.Compiler.Interactive.Settings" ["usesfsi.fsx"] + fscAppend cfg stdoutPath stderrPath "--nologo -r \"%s\"" cfg.FSharpCompilerInteractiveSettings ["usesfsi.fsx"] echo "Test 7=================================================" @@ -1628,13 +1628,13 @@ module CoreTests = let verify () = let cfg = testConfig "core/verify" - peverifyWithArgs cfg "/nologo" (cfg.BinPath ++ "FSharp.Build.dll") + peverifyWithArgs cfg "/nologo" (cfg.FSharpBuild) - // peverifyWithArgs cfg "/nologo /MD" (cfg.BinPath ++ "FSharp.Compiler.dll") + // peverifyWithArgs cfg "/nologo /MD" (getDirectoryName(cfg.FSC) ++ "FSharp.Compiler.dll") - peverifyWithArgs cfg "/nologo" (cfg.BinPath ++ "fsi.exe") + peverifyWithArgs cfg "/nologo" (cfg.FSI) - peverifyWithArgs cfg "/nologo" (cfg.BinPath ++ "FSharp.Compiler.Interactive.Settings.dll") + peverifyWithArgs cfg "/nologo" (cfg.FSharpCompilerInteractiveSettings) fsc cfg "%s -o:xmlverify.exe -g" cfg.fsc_flags ["xmlverify.fs"] diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd index da8260013c7..1786d4bc552 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd @@ -3,7 +3,7 @@ REM == %1 --> assembly ildasm /TEXT /LINENUM /NOBAR "%~nx1" >"%~n1.il" IF NOT ERRORLEVEL 0 exit 1 -echo ..\..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" -..\..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" +echo %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" + %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" exit /b %ERRORLEVEL% diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx deleted file mode 100644 index 1ed9611bb9d..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx +++ /dev/null @@ -1,4 +0,0 @@ -// #Regression #NoMT #CompilerOptions -#load "FunctionalLibrary01.fs";; -#q;; -//Unexpected character '\?' in type name$ \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst index cba9684e8d0..b80eac641bd 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst @@ -29,8 +29,6 @@ SOURCE=E_RequiresParameter01.fs TAILFLAGS="--codepage" # E_RequiresParameter01.fs SOURCE=E_RequiresParameter01.fs TAILFLAGS="--codepage" FSIMODE=EXEC # E_RequiresParameter01.fs-fsi -# Disabled due to build machine change that causes `FunctionalLibrary01.fs` to be checked out incorrectly -# SOURCE=E_DefaultCodePage01.fsx COMPILE_ONLY=1 FSIMODE=EXEC # E_DefaultCodePage01.fsx SOURCE=E_DefaultCodePage02.fsx COMPILE_ONLY=1 # E_DefaultCodePage02.fsx SOURCE=MatchingCodePage01.fsx COMPILE_ONLY=1 SCFLAGS="--codepage:1250" FSIMODE=EXEC # MatchingCodePage01.fsx diff --git a/tests/fsharpqa/Source/run.pl b/tests/fsharpqa/Source/run.pl index 6555341a967..bc3bd3f2fc7 100644 --- a/tests/fsharpqa/Source/run.pl +++ b/tests/fsharpqa/Source/run.pl @@ -265,12 +265,12 @@ my $PEVERIFY = $ENV{PEVERIFY}; unless(defined($PEVERIFY)) { my $scriptPath = dirname(__FILE__); - $PEVERIFY = "$scriptPath\\..\\testenv\\src\\PEVerify\\bin\\Release\\net472\\PEVerify.exe"; + $PEVERIFY = "$scriptPath\\..\\..\\..\\artifacts\\bin\\PEVerify\\Release\\net472\\PEVerify.exe"; if (-e $PEVERIFY) { $ENV{PEVERIFY} = $PEVERIFY; } else { - $ENV{PEVERIFY} = "$scriptPath\\..\\testenv\\src\\PEVerify\\bin\\Debug\\net472\\PEVerify.exe"; + $ENV{PEVERIFY} = "$scriptPath\\..\\..\\..\\artifacts\\bin\\PEVerify\\Debug\\net472\\PEVerify.exe"; } } diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 2cfaf0c6119..7693993113e 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -198,7 +198,6 @@ let parseAndCheckScript (file, input) = let parseSourceCode (name: string, code: string) = let location = Path.Combine(Path.GetTempPath(),"test"+string(hash (name, code))) try Directory.CreateDirectory(location) |> ignore with _ -> () - let projPath = Path.Combine(location, name + ".fsproj") let filePath = Path.Combine(location, name + ".fs") let dllPath = Path.Combine(location, name + ".dll") diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index 5fb5249e83a..4ce255440f9 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -63,6 +63,12 @@ let ``Intro test`` () = let identToken = FSharpTokenTag.IDENT // let projectOptions = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously + // So we check that the messages are the same + for msg in typeCheckResults.Errors do + printfn "Got an error, hopefully with the right text: %A" msg + + printfn "typeCheckResults.Errors.Length = %d" typeCheckResults.Errors.Length + // We only expect one reported error. However, // on Unix, using filenames like /home/user/Test.fsx gives a second copy of all parse errors due to the // way the load closure for scripts is generated. So this returns two identical errors diff --git a/tests/service/FscTests.fs b/tests/service/FscTests.fs index 57cc47083e7..f8ecbfaf4cb 100644 --- a/tests/service/FscTests.fs +++ b/tests/service/FscTests.fs @@ -48,7 +48,7 @@ type PEVerifier () = Some ("pedump", "--verify all") else let peverifyPath configuration = - Path.Combine(__SOURCE_DIRECTORY__, "..", "fsharpqa", "testenv", "src", "PEVerify", "bin", configuration, "net472", "PEVerify.exe") + Path.Combine(__SOURCE_DIRECTORY__, "..", "..", "artifacts", "bin", "PEVerify", configuration, "net472", "PEVerify.exe") let peverify = if File.Exists(peverifyPath "Debug") then peverifyPath "Debug" else peverifyPath "Release" diff --git a/tests/service/StructureTests.fs b/tests/service/StructureTests.fs index 9229ab6ccb5..38bb62d2d82 100644 --- a/tests/service/StructureTests.fs +++ b/tests/service/StructureTests.fs @@ -41,7 +41,6 @@ let (=>) (source: string) (expectedRanges: (Range * Range) list) = let getRange (r: range) = (r.StartLine, r.StartColumn, r.EndLine, r.EndColumn) let ast = parseSourceCode(fileName, source) - try match ast with | Some tree -> @@ -60,7 +59,7 @@ let (=>) (source: string) (expectedRanges: (Range * Range) list) = reraise() [] -let ``empty file``() = "" => [ ] +let ``empty file``() = "" => [] [] let ``nested module``() = @@ -68,8 +67,7 @@ let ``nested module``() = module MyModule = () """ - => [ (1, 0, 4, 0), (1, 0, 4, 0) - (2, 0, 3, 6), (2, 15, 3, 6) ] + => [ (2, 0, 3, 6), (2, 15, 3, 6) ] [] let ``module with multiline function``() = @@ -78,8 +76,7 @@ module MyModule = let foo() = foo() """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 13), (2, 15, 4, 13) + => [ (2, 0, 4, 13), (2, 15, 4, 13) (3, 4, 4, 13), (3, 13, 4, 13) (3, 8, 4, 13), (3, 13, 4, 13) ] @@ -91,8 +88,7 @@ type Color = | Green | Blue """ - => [ (1, 0, 6, 0), (1, 0, 6, 0) - (2, 5, 5, 10), (2, 11, 5, 10) + => [ (2, 5, 5, 10), (2, 11, 5, 10) (3, 4, 5, 10), (3, 4, 5, 10) ] [] @@ -107,8 +103,7 @@ type Color = member __.Dispose() = (docEventListener :> IDisposable).Dispose() """ - => [ (1, 0, 10, 0), (1, 0, 10, 0) - (2, 5, 9, 55), (2, 11, 9, 55) + => [ (2, 5, 9, 55), (2, 11, 9, 55) (3, 4, 5, 10), (3, 4, 5, 10) (7, 4, 9, 55), (7, 25, 9, 55) (8, 15, 9, 55), (8, 27, 9, 55) @@ -128,8 +123,7 @@ type Color = (docEventListener :> IDisposable).Dispose() """ => - [ (1, 0, 11, 0), (1, 0, 11, 0) - (2, 5, 10, 55), (2, 11, 10, 55) + [ (2, 5, 10, 55), (2, 11, 10, 55) (3, 4, 4, 14), (3, 4, 4, 14) (3, 6, 4, 13), (3, 6, 4, 13) (8, 4, 10, 55), (8, 25, 10, 55) @@ -147,8 +141,7 @@ type Color() = // 2 foo() () // 8 """ - => [ (1, 0, 9, 0), (1, 0, 9, 0) - (2, 5, 8, 10), (2, 11, 8, 10) + => [ (2, 5, 8, 10), (2, 11, 8, 10) (3, 8, 4, 10), (3, 13, 4, 10) (6, 4, 8, 10), (6, 6, 8, 10) ] @@ -182,8 +175,7 @@ module MyModule = // 2 member __.Dispose() = (docEventListener :> IDisposable).Dispose() """ - => [ (1, 0, 28, 0), (1, 0, 28, 0) - (2, 0, 27, 63), (2, 15, 27, 63) + => [ (2, 0, 27, 63), (2, 15, 27, 63) (4, 4, 5, 10), (4, 13, 5, 10) (4, 8, 5, 10), (4, 13, 5, 10) (7, 9, 15, 59), (7, 15, 15, 59) @@ -228,8 +220,7 @@ open H open G open H """ - => [ (1, 0, 26, 6), (1, 0, 26, 6) - (2, 5, 3, 6), (2, 5, 3, 6) + => [ (2, 5, 3, 6), (2, 5, 3, 6) (5, 0, 19, 17), (5, 8, 19, 17) (8, 9, 9, 10), (8, 9, 9, 10) (11, 4, 14, 17), (11, 12, 14, 17) @@ -263,8 +254,7 @@ let x = 1 "c" #r "d" """ - => [ (1, 0, 23, 6), (1, 0, 23, 6) - (2, 3, 8, 6), (2, 3, 8, 6) + => [ (2, 3, 8, 6), (2, 3, 8, 6) (11, 3, 23, 6), (11, 3, 23, 6) ] [] @@ -277,8 +267,7 @@ let f x = // 2 () // 6 x // 7 """ - => [ (1, 0, 8, 0), (1, 0, 8, 0) - (2, 0, 7, 5), (2, 7, 7, 5) + => [ (2, 0, 7, 5), (2, 7, 7, 5) (2, 4, 7, 5), (2, 7, 7, 5) (3, 8, 6, 10), (3, 11, 6, 10) (4, 12, 5, 14), (4, 13, 5, 14) ] @@ -296,8 +285,7 @@ match None with // 2 let x = () // 9 () // 10 """ - => [ (1, 0, 11, 0), (1, 0, 11, 0) - (2, 0, 10, 10), (2, 15, 10, 10) + => [ (2, 0, 10, 10), (2, 15, 10, 10) (6, 4, 10, 10), (5, 6, 10, 10) (6, 4, 10, 10), (6, 19, 10, 10) (9, 8, 10, 10), (8, 10, 10, 10) ] @@ -317,8 +305,7 @@ async { // 2 () // 11 } // 12 """ - => [ (1, 0, 12, 1), (1, 0, 12, 1) - (2, 0, 12, 1), (2, 7, 12, 0) + => [ (2, 0, 12, 1), (2, 7, 12, 0) (3, 4, 11, 14), (3, 37, 11, 14) (7, 8, 11, 14), (6, 10, 11, 14) (7, 8, 11, 14), (7, 23, 11, 14) @@ -335,8 +322,7 @@ seq { // 2 yield () } // 7 } // 8 """ - => [ (1, 0, 8, 1), (1, 0, 8, 1) - (2, 0, 8, 1), (2, 5, 8, 0) + => [ (2, 0, 8, 1), (2, 5, 8, 0) (4, 8, 5, 10), (4, 11, 5, 10) (6, 4, 7, 18), (6, 4, 7, 18) (6, 11, 7, 18), (6, 16, 7, 17) ] @@ -348,8 +334,7 @@ let _ = [ 1; 2 3 ] """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 9), (2, 5, 4, 9) + => [ (2, 0, 4, 9), (2, 5, 4, 9) (2, 4, 4, 9), (2, 5, 4, 9) (3, 4, 4, 9), (3, 5, 4, 8) ] @@ -360,8 +345,7 @@ let _ = { new System.IDisposable with member __.Dispose() = () } """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 34), (2, 5, 4, 34) + => [ (2, 0, 4, 34), (2, 5, 4, 34) (2, 4, 4, 34), (2, 5, 4, 34) (3, 4, 4, 34), (3, 28, 4, 34) ] @@ -376,8 +360,7 @@ with _ -> // 5 () // 7 () // 8 """ - => [ (1, 0, 9, 0), (1, 0, 9, 0) - (2, 0, 5, 0), (2, 3, 5, 0) + => [ (2, 0, 5, 0), (2, 3, 5, 0) (2, 0, 8, 6), (2, 3, 8, 6) (3, 8, 4, 10), (3, 11, 4, 10) (5, 0, 8, 6), (5, 4, 8, 6) @@ -395,8 +378,7 @@ finally // 5 () // 7 () // 8 """ - => [ (1, 0, 9, 0), (1, 0, 9, 0) - (2, 0, 8, 6), (2, 3, 8, 6) + => [ (2, 0, 8, 6), (2, 3, 8, 6) (3, 8, 4, 10), (3, 11, 4, 10) (5, 0, 8, 6), (5, 7, 8, 6) (6, 8, 7, 10), (6, 11, 7, 10) ] @@ -413,8 +395,7 @@ else () () """ - => [ (1, 0, 10, 0), (1, 0, 10, 0) - (2, 0, 9, 6), (2, 7, 9, 6) + => [ (2, 0, 9, 6), (2, 7, 9, 6) (2, 8, 5, 6), (2, 12, 5, 6) (3, 8, 4, 10), (3, 11, 4, 10) (7, 8, 8, 10), (7, 11, 8, 10) ] @@ -426,8 +407,7 @@ let ``code quotation``() = "code" @> """ - => [ (1, 0, 4, 10), (1, 0, 4, 10) - (2, 0, 4, 10), (2, 2, 4, 8) ] + => [ (2, 0, 4, 10), (2, 2, 4, 8) ] [] let ``raw code quotation``() = @@ -436,8 +416,7 @@ let ``raw code quotation``() = "code" @@> """ - => [ (1, 0, 4, 11), (1, 0, 4, 11) - (2, 0, 4, 11), (2, 3, 4, 8) ] + => [ (2, 0, 4, 11), (2, 3, 4, 8) ] [] let ``match lambda aka function``() = @@ -446,8 +425,7 @@ function | 0 -> () () """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 10), (2, 8, 4, 10) + => [ (2, 0, 4, 10), (2, 8, 4, 10) (3, 8, 4, 10), (3, 3, 4, 10) ] [] @@ -458,8 +436,7 @@ let matchwith num = | 0 -> () () """ - => [ (1, 0, 6, 0), (1, 0, 6, 0) - (2, 0, 5, 13), (2, 17, 5, 13) + => [ (2, 0, 5, 13), (2, 17, 5, 13) (2, 4, 5, 13), (2, 17, 5, 13) (3, 4, 5, 13), (3, 18, 5, 13) (4, 11, 5, 13), (4, 7, 5, 13) ] @@ -471,8 +448,7 @@ for x = 100 downto 10 do () () """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 6), (2, 0, 4, 6) ] + => [ (2, 0, 4, 6), (2, 0, 4, 6) ] [] let ``for each``() = @@ -481,8 +457,7 @@ for x in 0 .. 100 -> () () """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 14), (2, 0, 4, 14) + => [ (2, 0, 4, 14), (2, 0, 4, 14) (2, 18, 4, 14), (2, 18, 4, 14) ] [] @@ -492,8 +467,7 @@ let ``tuple``() = , 322 , 123123 ) """ - => [ (1, 0, 4, 10), (1, 0, 4, 10) - (2, 2, 4, 8), (2, 2, 4, 8) ] + => [ (2, 2, 4, 8), (2, 2, 4, 8) ] [] let ``do!``() = @@ -502,8 +476,7 @@ do! printfn "allo" printfn "allo" """ - => [(1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 18), (2, 3, 4, 18)] + => [ (2, 0, 4, 18), (2, 3, 4, 18) ] [] let ``cexpr yield yield!``() = @@ -517,11 +490,10 @@ cexpr{ } } """ - => [(1, 0, 9, 5), (1, 0, 9, 5) - (2, 0, 9, 5), (2, 6, 9, 4) - (3, 4, 8, 17), (3, 4, 8, 17) - (4, 8, 8, 17), (4, 14, 8, 16) - (5, 20, 7, 26), (5, 20, 7, 26)] + => [ (2, 0, 9, 5), (2, 6, 9, 4) + (3, 4, 8, 17), (3, 4, 8, 17) + (4, 8, 8, 17), (4, 14, 8, 16) + (5, 20, 7, 26), (5, 20, 7, 26) ] [] let ``XML doc comments``() = @@ -539,8 +511,7 @@ module M = /// Single line comment let f x = x """ - => [ (1, 0, 14, 0), (1, 0, 14, 0) - (2, 0, 3, 10), (2, 0, 3, 10) + => [ (2, 0, 3, 10), (2, 0, 3, 10) (4, 0, 13, 15), (4, 8, 13, 15) (5, 4, 6, 14), (5, 4, 6, 14) (7, 9, 11, 19), (7, 11, 11, 19) @@ -562,8 +533,7 @@ module M = // Single line comment let f x = x """ - => [ (1, 0, 14, 0), (1, 0, 14, 0) - (2, 0, 3, 9), (2, 0, 3, 9) + => [ (2, 0, 3, 9), (2, 0, 3, 9) (4, 0, 13, 15), (4, 8, 13, 15) (5, 4, 6, 13), (5, 4, 6, 13) (7, 9, 11, 19), (7, 11, 11, 19) @@ -582,8 +552,7 @@ let ``XML doc and regular comments in one block``() = /// Line 8 /// Line 9 """ - => [ (1, 0, 11, 0), (1, 0, 11, 0) - (2, 0, 3, 9), (2, 0, 3, 9) + => [ (2, 0, 3, 9), (2, 0, 3, 9) (4, 0, 5, 10), (4, 0, 5, 10) (7, 0, 10, 10), (7, 0, 10, 10) ] @@ -596,9 +565,45 @@ module M = 'c', 1) """ - => [ (1, 0, 7, 0), (1, 0, 7, 0) - (2, 0, 6, 14), (2, 8, 6, 14) + => [ (2, 0, 6, 14), (2, 8, 6, 14) (3, 4, 6, 14), (3, 9, 6, 14) (3, 8, 6, 14), (3, 9, 6, 14) (4, 8, 6, 14), (4, 25, 6, 14) (5, 12, 6, 13), (5, 12, 6, 13) ] + +[] +let ``Top level module`` () = + """ +module TopLevelModule + +module Nested = + let x = 123 +""" + => [ (2, 7, 5, 15), (2, 21, 5, 15) + (4, 0, 5, 15), (4, 13, 5, 15) ] + +[] +let ``Top level namespace`` () = + """ +namespace TopLevelNamespace.Another + +module Nested = + let x = 123 +""" + => [ (4, 0, 5, 15), (4, 13, 5, 15) ] + +[] +let ``Multiple namespaces`` () = + """ +namespace TopLevelNamespace.Another + +module Nested = + let x = 123 + +namespace AnotherTopLevel.Nested + +module NestedModule = + let x = 123 +""" + => [ (4, 0, 5, 15), (4, 13, 5, 15) + (9, 0, 10, 15), (9, 19, 10, 15) ] diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 8b5749f0546..da2a7795577 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -100,4 +100,27 @@ module Mod2 = mod1val1.XmlDocSig |> shouldEqual "P:Mod1.val1" mod2func2.XmlDocSig |> shouldEqual "M:Mod1.Mod2.func2" - \ No newline at end of file + +module Attributes = + [] + let ``Emit conditional attributes`` () = + let source = """ +open System +open System.Diagnostics + +[] +type FooAttribute() = + inherit Attribute() + +[] +let x = 123 +""" + let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] + let _, checkResults = parseAndCheckFile fileName source options + + checkResults.GetAllUsesOfAllSymbolsInFile() + |> Async.RunSynchronously + |> Array.tryFind (fun su -> su.Symbol.DisplayName = "x") + |> Option.orElseWith (fun _ -> failwith "Could not get symbol") + |> Option.map (fun su -> su.Symbol :?> FSharpMemberOrFunctionOrValue) + |> Option.iter (fun symbol -> symbol.Attributes.Count |> shouldEqual 1) diff --git a/tests/service/TreeVisitorTests.fs b/tests/service/TreeVisitorTests.fs new file mode 100644 index 00000000000..aee58607ba0 --- /dev/null +++ b/tests/service/TreeVisitorTests.fs @@ -0,0 +1,25 @@ +module Tests.Service.TreeVisitorTests + +open FSharp.Compiler.Service.Tests.Common +open Microsoft.FSharp.Compiler.Range +open Microsoft.FSharp.Compiler.SourceCodeServices.AstTraversal +open NUnit.Framework + +[] +let ``Visit type test`` () = + let visitor = + { new AstVisitorBase<_>() with + member x.VisitExpr(_, _, defaultTraverse, expr) = defaultTraverse expr + member x.VisitType(_, _) = Some () } + + let source = "123 :? int" + let parseTree = + match parseSourceCode("C:\\test.fs", source) with + | None -> failwith "No parse tree" + | Some parseTree -> parseTree + + Traverse(mkPos 1 11, parseTree, visitor) + |> Option.defaultWith (fun _ -> failwith "Did not visit type") + + Traverse(mkPos 1 3, parseTree, visitor) + |> Option.iter (fun _ -> failwith "Should not visit type") diff --git a/verify-translations.cmd b/verify-translations.cmd index 6717de0f778..2580890c6fb 100644 --- a/verify-translations.cmd +++ b/verify-translations.cmd @@ -1,3 +1,3 @@ @echo off -%~dp0release\net40\bin\fsi.exe %~dp0src\scripts\VerifyAllTranslations.fsx -- %~dp0 +%~dp0artifacts\bin\fsi\Release\net46\fsi.exe %~dp0src\scripts\VerifyAllTranslations.fsx -- %~dp0 diff --git a/vsintegration/ItemTemplates/.gitignore b/vsintegration/ItemTemplates/.gitignore new file mode 100644 index 00000000000..cd42ee34e87 --- /dev/null +++ b/vsintegration/ItemTemplates/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/vsintegration/ProjectTemplates/.gitignore b/vsintegration/ProjectTemplates/.gitignore new file mode 100644 index 00000000000..cd42ee34e87 --- /dev/null +++ b/vsintegration/ProjectTemplates/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/vsintegration/Templates.Directory.Build.props b/vsintegration/Templates.Directory.Build.props index c9d39a043eb..088d6a4867d 100644 --- a/vsintegration/Templates.Directory.Build.props +++ b/vsintegration/Templates.Directory.Build.props @@ -2,6 +2,12 @@ + + + + + + net472 v4.7.2 diff --git a/vsintegration/Templates.Directory.Build.targets b/vsintegration/Templates.Directory.Build.targets index 84513c489fc..4d8df139274 100644 --- a/vsintegration/Templates.Directory.Build.targets +++ b/vsintegration/Templates.Directory.Build.targets @@ -11,4 +11,21 @@ + + + + + $(OutputPath)$(TemplateCategory)\FSharp + $(MSBuildProjectDirectory)\$(TemplatesRootPath) + + + + + + + + + + diff --git a/vsintegration/Vsix/Directory.Build.targets b/vsintegration/Vsix/Directory.Build.targets index fa37bc2cd13..677cf0afc9d 100644 --- a/vsintegration/Vsix/Directory.Build.targets +++ b/vsintegration/Vsix/Directory.Build.targets @@ -2,6 +2,11 @@ + + $(ArtifactsDir)\VSSetup\$(Configuration) + $(ArtifactsDir)\VSSetup.obj\$(Configuration)\Microsoft.FSharp\ + + False diff --git a/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj b/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj index aed53275a11..e3c60441449 100644 --- a/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj +++ b/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj @@ -85,7 +85,7 @@ True TargetFramework=net45 - + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B} FsiAnyCPU BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b @@ -97,7 +97,7 @@ True TargetFramework=net472 - + {D0E98C0D-490B-4C61-9329-0862F6E87645} Fsi BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b @@ -109,7 +109,7 @@ True TargetFramework=net472 - + {C94C257C-3C0A-4858-B5D8-D746498D1F08} fsc BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b diff --git a/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj b/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj index 0267329af35..110fc964e1c 100644 --- a/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj +++ b/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj @@ -6,7 +6,6 @@ VisualFSharpTemplate Library Microsoft\FSharpTemplates - true diff --git a/vsintegration/src/Directory.Build.props b/vsintegration/src/Directory.Build.props new file mode 100644 index 00000000000..1ad6fb80ecd --- /dev/null +++ b/vsintegration/src/Directory.Build.props @@ -0,0 +1,9 @@ + + + + + + false + + + diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj index 262612d8f81..a1bdf05aba8 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj @@ -4,8 +4,7 @@ Debug - net40 - $(FSharpSourcesRoot)\..\$(Configuration)\$(TargetDotnetProfile)\bin + $(ArtifactsBinDir)\$(MSBuildProjectName)\$(Configuration)\$(TargetFramework) AnyCPU 9.0.21022 2.0 @@ -25,6 +24,9 @@ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 40026;42105;42107;42353 v4.7.2 + win + + true false false diff --git a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj index fcab1fdf8bc..b057f0f8204 100644 --- a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj +++ b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj @@ -29,7 +29,6 @@ CompilerLocationUtils.fs - diff --git a/vsintegration/src/FSharp.VS.FSI/quickparse.fs b/vsintegration/src/FSharp.VS.FSI/quickparse.fs deleted file mode 100644 index 9099134a660..00000000000 --- a/vsintegration/src/FSharp.VS.FSI/quickparse.fs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.FSharp.Interactive -open System.Globalization - -// Duplication note: -// Inlined from Language Service. -// If/when there is a common DLL this code can be shared. - -/// Methods for cheaply and innacurately parsing F# -module internal QuickParse = - /// The characters that are allowed to be in an identifier. - let private IsIdentifierPartCharacter c = - let cat = System.Char.GetUnicodeCategory(c) - ( - // Letters - cat = UnicodeCategory.UppercaseLetter - || cat = UnicodeCategory.LowercaseLetter - || cat = UnicodeCategory.TitlecaseLetter - || cat = UnicodeCategory.ModifierLetter - || cat = UnicodeCategory.OtherLetter - || cat = UnicodeCategory.LetterNumber - // Numbers - || cat = UnicodeCategory.DecimalDigitNumber - // Connectors - || cat = UnicodeCategory.ConnectorPunctuation - // Combiners - || cat = UnicodeCategory.NonSpacingMark - || cat = UnicodeCategory.SpacingCombiningMark - ) - /// Is this character a part of a long identifier - let private IsLongIdentifierPartCharacter c = - (IsIdentifierPartCharacter c) || (c='.') - /// Given a line of text and an index into the line return the - /// "island" of text that could be an identifier around index. - let GetIdentifierIsland(line:string,index)= - if index=0 && IsLongIdentifierPartCharacter line.[left] do left<-left-1 - while rightfalse true true + true true @@ -20,6 +21,7 @@ + diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index 062e24ab198..f266f6f1d01 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -43,13 +43,13 @@ module internal Salsa = { new System.IDisposable with member this.Dispose() = actuallyBuild <- true } member th.Results = capturedFlags, capturedSources - member th.Compile(compile:System.Func, flags:string[], sources:string[]) = + member th.Compile(compile:System.Func, flags:string[], sources:string[]) = capturedFlags <- flags capturedSources <- sources if actuallyBuild then compile.Invoke() else - 0 + 0 interface ITaskHost type BuildResult = { diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index bcb512a94eb..058fe998a13 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -435,19 +435,15 @@ type UsingMSBuild() = | [] -> System.String.Format((*Mark*) | x :: xs -> f xs""" // Note, 3 of these 8 are only available on .NET 4.6.1. On .NET 4.5 only 5 overloads are returned. - let expected45 = [["format"; "arg0"]; //Net4.5 - ["format"; "args"]; //Net4.5 - ["provider"; "format"; "args"]; //Net4.5 - ["format"; "arg0"; "arg1"]; //Net4.5 - ["format"; "arg0"; "arg1"; "arg2"]] //Net4.5 - let expected461 = [["provider"; "format"; "arg0"]; //Net4.6.1 - ["provider"; "format"; "arg0"; "arg1"]; //Net4.6.1 - ["provider"; "format"; "arg0"; "arg1"; "arg2"]] //Net4.6.1 - - let expected = - if Environment.Version.CompareTo(v461) >= 0 then - List.concat [expected45;expected461] - else expected45 + let expected = [["format"; "arg0"]; //Net4.5 + ["format"; "args"]; //Net4.5 + ["provider"; "format"; "args"]; //Net4.5 + ["format"; "arg0"; "arg1"]; //Net4.5 + ["format"; "arg0"; "arg1"; "arg2"]; //Net4.5 + ["provider"; "format"; "arg0"]; //Net4.6.1 + ["provider"; "format"; "arg0"; "arg1"]; //Net4.6.1 + ["provider"; "format"; "arg0"; "arg1"; "arg2"]] //Net4.6.1 + this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)", expected) (* --- Parameter Info Systematic Tests ------------------------------------------------- *) diff --git a/vsintegration/tests/UnitTests/Tests.Build.fs b/vsintegration/tests/UnitTests/Tests.Build.fs index 2263fc57674..b71a43661d0 100644 --- a/vsintegration/tests/UnitTests/Tests.Build.fs +++ b/vsintegration/tests/UnitTests/Tests.Build.fs @@ -40,8 +40,8 @@ type MyLogger(f : string -> unit) = type FauxHostObject() = let mutable myFlags : string[] = null let mutable mySources : string[] = null - member x.Compile(compile:System.Func, flags:string[], sources:string[]) = - myFlags <- flags + member x.Compile(compile:System.Func, flags:string[], sources:string[]) = + myFlags <- flags mySources <- sources 0 member x.Flags = myFlags @@ -301,7 +301,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -485,7 +485,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -501,7 +501,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -517,7 +517,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -532,7 +532,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -547,7 +547,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -562,7 +562,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -576,7 +576,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva+" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -591,7 +591,7 @@ type Build() = "--flaterrors" + Environment.NewLine + "--subsystemversion:6.02" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + - "--nocopyfsharpcore" + Environment.NewLine ) + "--nocopyfsharpcore" + Environment.NewLine) cmd [] diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 1d4564108d2..072876386dc 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -12,6 +12,7 @@ true true false + true true @@ -107,6 +108,9 @@ CompilerService\UnusedOpensTests.fs + + CompilerService\TreeVisitorTests.fs + Roslyn\SyntacticColorizationServiceTests.fs @@ -156,11 +160,11 @@ Roslyn\DocumentHighlightsServiceTests.fs - + @@ -173,6 +177,23 @@ + + + + + + + + + + + + + + + + + @@ -190,35 +211,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -