diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 95fa8fcd020..791850399b3 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -18,6 +18,8 @@ + $(MSBuildThisFileDirectory)icon.png + $(RestoreAdditionalProjectSources);$(ArtifactsPackagesDir) $(ArtifactsPackagesDir) diff --git a/TESTGUIDE.md b/TESTGUIDE.md index ef34e6f51bb..f658b443c1d 100644 --- a/TESTGUIDE.md +++ b/TESTGUIDE.md @@ -46,7 +46,7 @@ There are also negative tests checking code expected to fail compilation. See no ### FSharpQA Suite -The FSharpQA suite relies on [Perl](http://www.perl.org/get.html), StrawberryPerl64 package from nuget is used automatically by the test suite. +The FSharpQA suite relies on [Perl](http://www.perl.org/get.html), StrawberryPerl package from nuget is used automatically by the test suite. These tests use the `RunAll.pl` framework to execute, however the easiest way to run them is via the `build.cmd` script, see [usage examples](https://github.com/Microsoft/visualfsharp/blob/master/build.cmd#L31). diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7895b291d1a..cd106ffbc2f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -298,30 +298,30 @@ stages: continueOnError: true condition: always() - #- job: Linux_FCS - # pool: - # vmImage: ubuntu-16.04 - # variables: - # - name: _SignType - # value: Test - # steps: - # - checkout: self - # clean: true - # - script: ./fcs/build.sh Build - # displayName: Build - - - job: MacOS_FCS + - job: Linux_FCS pool: - vmImage: macOS-10.13 + vmImage: ubuntu-16.04 variables: - name: _SignType value: Test steps: - checkout: self clean: true - - script: ./fcs/build.sh Build + - script: ./fcs/build.sh displayName: Build + # - job: MacOS_FCS + # pool: + # vmImage: macOS-10.13 + # variables: + # - name: _SignType + # value: Test + # steps: + # - checkout: self + # clean: true + # - script: ./fcs/build.sh + # displayName: Build + #---------------------------------------------------------------------------------------------------------------------# # Post Build # #---------------------------------------------------------------------------------------------------------------------# diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 4d503dbedaa..f9d7e1b5ac7 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -359,7 +359,8 @@ try { $resultsLog = "test-net40-fsharpqa-results.log" $errorLog = "test-net40-fsharpqa-errors.log" $failLog = "test-net40-fsharpqa-errors" - $perlExe = "$env:USERPROFILE\.nuget\packages\StrawberryPerl64\5.22.2.1\Tools\perl\bin\perl.exe" + $perlPackageRoot = "$env:USERPROFILE\.nuget\packages\StrawberryPerl\5.28.0.1"; + $perlExe = "$perlPackageRoot\bin\perl.exe" Create-Directory $resultsRoot UpdatePath $env:HOSTED_COMPILER = 1 @@ -367,6 +368,7 @@ try { $env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\net472\FSharp.Core.dll" $env:LINK_EXE = "$RepoRoot\tests\fsharpqa\testenv\bin\link\link.exe" $env:OSARCH = $env:PROCESSOR_ARCHITECTURE + $env:PERL5LIB = "$perlPackageRoot\vendor\lib" Exec-Console $perlExe """$RepoRoot\tests\fsharpqa\testenv\bin\runall.pl"" -resultsroot ""$resultsRoot"" -results $resultsLog -log $errorLog -fail $failLog -cleanup:no -procs:$env:NUMBER_OF_PROCESSORS" Pop-Location } diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f10ba74c201..0288911f9e9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - da75c6547c64a91eb8a9cecf8c503331c2cc394a + 9d34fd008e754e1ada35c8b6bc3694e7a90b4ed7 diff --git a/eng/Versions.props b/eng/Versions.props index 8efcedaa538..caa59fe65ea 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -182,7 +182,7 @@ 3.11.0 2.1.36 1.0.0-beta2-dev3 - 5.22.2.1 + 5.28.0.1 2.0.187 diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 772de110ca2..000319af33b 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -237,14 +237,14 @@ function Make-BootstrapBuild() { Create-Directory $dir # prepare FsLex and Fsyacc and AssemblyCheck - Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish" -logFileName "BuildTools" -configuration $bootstrapConfiguration + Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish /p:PublishWindowsPdb=false" -logFileName "BuildTools" -configuration $bootstrapConfiguration Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fslex" -Force -Recurse Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fsyacc" -Force -Recurse Copy-Item "$ArtifactsDir\bin\AssemblyCheck\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\AssemblyCheck" -Force -Recurse # prepare compiler $projectPath = "$RepoRoot\proto.proj" - Run-MSBuild $projectPath "/restore /t:Publish /p:TargetFramework=$bootstrapTfm;ProtoTargetFramework=$bootstrapTfm" -logFileName "Bootstrap" -configuration $bootstrapConfiguration + Run-MSBuild $projectPath "/restore /t:Publish /p:TargetFramework=$bootstrapTfm;ProtoTargetFramework=$bootstrapTfm /p:PublishWindowsPdb=false" -logFileName "Bootstrap" -configuration $bootstrapConfiguration Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsc" -Force -Recurse Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsi" -Force -Recurse diff --git a/eng/common/CheckSymbols.ps1 b/eng/common/CheckSymbols.ps1 index b8d84607b89..5442eff3861 100644 --- a/eng/common/CheckSymbols.ps1 +++ b/eng/common/CheckSymbols.ps1 @@ -5,11 +5,12 @@ param( ) Add-Type -AssemblyName System.IO.Compression.FileSystem +. $PSScriptRoot\pipeline-logging-functions.ps1 function FirstMatchingSymbolDescriptionOrDefault { param( [string] $FullPath, # Full path to the module that has to be checked - [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $TargetServerParameter, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols [string] $SymbolsPath ) @@ -21,36 +22,36 @@ function FirstMatchingSymbolDescriptionOrDefault { # checking and which type of file was uploaded. # The file itself is returned - $SymbolPath = $SymbolsPath + "\" + $FileName + $SymbolPath = $SymbolsPath + '\' + $FileName # PDB file for the module - $PdbPath = $SymbolPath.Replace($Extension, ".pdb") + $PdbPath = $SymbolPath.Replace($Extension, '.pdb') # PDB file for R2R module (created by crossgen) - $NGenPdb = $SymbolPath.Replace($Extension, ".ni.pdb") + $NGenPdb = $SymbolPath.Replace($Extension, '.ni.pdb') # DBG file for a .so library - $SODbg = $SymbolPath.Replace($Extension, ".so.dbg") + $SODbg = $SymbolPath.Replace($Extension, '.so.dbg') # DWARF file for a .dylib - $DylibDwarf = $SymbolPath.Replace($Extension, ".dylib.dwarf") + $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') - .\dotnet-symbol.exe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null + .\dotnet-symbol.exe --symbols --modules --windows-pdbs $TargetServerParameter $FullPath -o $SymbolsPath | Out-Null if (Test-Path $PdbPath) { - return "PDB" + return 'PDB' } elseif (Test-Path $NGenPdb) { - return "NGen PDB" + return 'NGen PDB' } elseif (Test-Path $SODbg) { - return "DBG for SO" + return 'DBG for SO' } elseif (Test-Path $DylibDwarf) { - return "Dwarf for Dylib" + return 'Dwarf for Dylib' } elseif (Test-Path $SymbolPath) { - return "Module" + return 'Module' } else { return $null @@ -68,7 +69,7 @@ function CountMissingSymbols { } # Extensions for which we'll look for symbols - $RelevantExtensions = @(".dll", ".exe", ".so", ".dylib") + $RelevantExtensions = @('.dll', '.exe', '.so', '.dylib') # How many files are missing symbol information $MissingSymbols = 0 @@ -76,7 +77,7 @@ function CountMissingSymbols { $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) $PackageGuid = New-Guid $ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid - $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath "Symbols" + $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath 'Symbols' [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) @@ -86,31 +87,31 @@ function CountMissingSymbols { Get-ChildItem -Recurse $ExtractPath | Where-Object {$RelevantExtensions -contains $_.Extension} | ForEach-Object { - if ($_.FullName -Match "\\ref\\") { + if ($_.FullName -Match '\\ref\\') { Write-Host "`t Ignoring reference assembly file" $_.FullName return } - $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--microsoft-symbol-server" $SymbolsPath - $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--internal-server" $SymbolsPath + $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault -FullPath $_.FullName -TargetServerParameter '--microsoft-symbol-server' -SymbolsPath $SymbolsPath + $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault -FullPath $_.FullName -TargetServerParameter '--internal-server' -SymbolsPath $SymbolsPath Write-Host -NoNewLine "`t Checking file" $_.FullName "... " if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { - Write-Host "Symbols found on MSDL (" $SymbolsOnMSDL ") and SymWeb (" $SymbolsOnSymWeb ")" + Write-Host "Symbols found on MSDL (${$SymbolsOnMSDL}) and SymWeb (${$SymbolsOnSymWeb})" } else { $MissingSymbols++ if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { - Write-Host "No symbols found on MSDL or SymWeb!" + Write-Host 'No symbols found on MSDL or SymWeb!' } else { if ($SymbolsOnMSDL -eq $null) { - Write-Host "No symbols found on MSDL!" + Write-Host 'No symbols found on MSDL!' } else { - Write-Host "No symbols found on SymWeb!" + Write-Host 'No symbols found on SymWeb!' } } } @@ -129,26 +130,26 @@ function CheckSymbolsAvailable { Get-ChildItem "$InputPath\*.nupkg" | ForEach-Object { $FileName = $_.Name - + # These packages from Arcade-Services include some native libraries that # our current symbol uploader can't handle. Below is a workaround until # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. - if ($FileName -Match "Microsoft\.DotNet\.Darc\.") { + if ($FileName -Match 'Microsoft\.DotNet\.Darc\.') { Write-Host "Ignoring Arcade-services file: $FileName" Write-Host return } - elseif ($FileName -Match "Microsoft\.DotNet\.Maestro\.Tasks\.") { + elseif ($FileName -Match 'Microsoft\.DotNet\.Maestro\.Tasks\.') { Write-Host "Ignoring Arcade-services file: $FileName" Write-Host return } - + Write-Host "Validating $FileName " $Status = CountMissingSymbols "$InputPath\$FileName" if ($Status -ne 0) { - Write-Error "Missing symbols for $Status modules in the package $FileName" + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $Status modules in the package $FileName" } Write-Host diff --git a/eng/common/PublishToSymbolServers.proj b/eng/common/PublishToSymbolServers.proj index 5d55e312b01..311e2bbe0f6 100644 --- a/eng/common/PublishToSymbolServers.proj +++ b/eng/common/PublishToSymbolServers.proj @@ -37,6 +37,8 @@ 3650 true + true + true false @@ -56,7 +58,7 @@ DryRun="false" ConvertPortablePdbsToWindowsPdbs="false" PdbConversionTreatAsWarning="" - Condition="$(PublishToSymbolServer)"/> + Condition="$(PublishToSymbolServer) and $(PublishToMSDL)"/> git commit --> git push -Write-Host "git add ." -git add . -if ($LASTEXITCODE -ne 0) { - Write-Error "Git add failed with exit code $LASTEXITCODE." -} -Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" -git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" -if ($LASTEXITCODE -ne 0) { - Write-Error "Git commit failed with exit code $LASTEXITCODE." -} -Write-Host "git push" -git push -if ($LASTEXITCODE -ne 0) { - Write-Error "Git push failed with exit code $LASTEXITCODE." -} + # We create the temp directory where we'll store the sdl-config repository + $sdlDir = Join-Path $env:TEMP 'sdl' + if (Test-Path $sdlDir) { + Remove-Item -Force -Recurse $sdlDir + } -# Return to the original directory -Pop-Location \ No newline at end of file + Write-Host "git clone https://dnceng:`$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" + git clone https://dnceng:$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git clone failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + # We copy the .gdn folder from our local run into the git repository so it can be committed + $sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) '.gdn' + if (Get-Command Robocopy) { + Robocopy /S $GdnFolder $sdlRepositoryFolder + } else { + rsync -r $GdnFolder $sdlRepositoryFolder + } + # cd to the sdl-config directory so we can run git there + Push-Location $sdlDir + # git add . --> git commit --> git push + Write-Host 'git add .' + git add . + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git add failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" + git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git commit failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + Write-Host 'git push' + git push + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git push failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + + # Return to the original directory + Pop-Location +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 index 9bc25314ae2..40a084f7969 100644 --- a/eng/common/sdl/run-sdl.ps1 +++ b/eng/common/sdl/run-sdl.ps1 @@ -5,55 +5,65 @@ Param( [string] $GdnFolder, [string[]] $ToolsList, [string] $UpdateBaseline, - [string] $GuardianLoggerLevel="Standard", + [string] $GuardianLoggerLevel='Standard', [string[]] $CrScanAdditionalRunConfigParams, [string[]] $PoliCheckAdditionalRunConfigParams ) -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true $LASTEXITCODE = 0 -# We store config files in the r directory of .gdn -Write-Host $ToolsList -$gdnConfigPath = Join-Path $GdnFolder "r" -$ValidPath = Test-Path $GuardianCliLocation +try { + . $PSScriptRoot\..\tools.ps1 -if ($ValidPath -eq $False) -{ - Write-Host "Invalid Guardian CLI Location." - exit 1 -} + # We store config files in the r directory of .gdn + Write-Host $ToolsList + $gdnConfigPath = Join-Path $GdnFolder 'r' + $ValidPath = Test-Path $GuardianCliLocation -$configParam = @("--config") - -foreach ($tool in $ToolsList) { - $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" - Write-Host $tool - # We have to manually configure tools that run on source to look at the source directory only - if ($tool -eq "credscan") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory < $TargetDirectory `" `" OutputType < pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory < $TargetDirectory " "OutputType < pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." + ExitWithExitCode 1 } - if ($tool -eq "policheck") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target < $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target < $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE + + $configParam = @('--config') + + foreach ($tool in $ToolsList) { + $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" + Write-Host $tool + # We have to manually configure tools that run on source to look at the source directory only + if ($tool -eq 'credscan') { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory < $TargetDirectory `" `" OutputType < pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory < $TargetDirectory " "OutputType < pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian configure for $tool failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + } + if ($tool -eq 'policheck') { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target < $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target < $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian configure for $tool failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } } - } - $configParam+=$gdnConfigFile -} + $configParam+=$gdnConfigFile + } -Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam" -& $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam -if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE + Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam" + & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } } +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 9a00430d652..2973bcaf3a4 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -6,6 +6,11 @@ parameters: # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter sdlContinueOnError: false # optional: determines whether to continue the build if the step errors; dependsOn: '' # Optional: dependencies of the job + artifactNames: '' # Optional: patterns supplied to DownloadBuildArtifacts + # Usage: + # artifactNames: + # - 'BlobArtifacts' + # - 'Artifacts_Windows_NT_Release' jobs: - job: Run_SDL @@ -18,13 +23,22 @@ jobs: steps: - checkout: self clean: true - - task: DownloadBuildArtifacts@0 - displayName: Download Build Artifacts - inputs: - buildType: current - downloadType: specific files - matchingPattern: "**" - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts + - ${{ if ne(parameters.artifactNames, '') }}: + - ${{ each artifactName in parameters.artifactNames }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Build Artifacts + inputs: + buildType: current + artifactName: ${{ artifactName }} + downloadPath: $(Build.ArtifactStagingDirectory)\artifacts + - ${{ if eq(parameters.artifactNames, '') }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Build Artifacts + inputs: + buildType: current + downloadType: specific files + itemPattern: "**" + downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - powershell: eng/common/sdl/extract-artifact-packages.ps1 -InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 13dd40e26cf..ecebd0f03eb 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -17,7 +17,7 @@ parameters: workspace: '' # Job base template specific parameters - # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md artifacts: '' enableMicrobuild: false enablePublishBuildArtifacts: false diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml similarity index 82% rename from eng/common/templates/post-build/channels/netcore-internal-30.yml rename to eng/common/templates/post-build/channels/generic-internal-channel.yml index 201ed570ae8..3a8755fbbb7 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml @@ -2,21 +2,28 @@ parameters: artifactsPublishingAdditionalParameters: '' dependsOn: - Validate + publishInstallersAndChecksums: false symbolPublishingAdditionalParameters: '' + stageName: '' + channelName: '' + channelId: '' + transportFeed: '' + shippingFeed: '' + symbolsFeed: '' stages: -- stage: NetCore_30_Internal_Servicing_Publishing +- stage: ${{ parameters.stageName }} dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml - displayName: .NET Core 3.0 Internal Servicing Publishing + displayName: ${{ parameters.channelName }} Publishing jobs: - template: ../setup-maestro-vars.yml - - job: + - job: publish_symbols displayName: Symbol Publishing dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.InternalServicing_30_Channel_Id)) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )) variables: - group: DotNet-Symbol-Server-Pats pool: @@ -57,19 +64,23 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' /p:Configuration=Release + /p:PublishToMSDL=false ${{ parameters.symbolPublishingAdditionalParameters }} + - template: ../../steps/publish-logs.yml + parameters: + StageLabel: '${{ parameters.stageName }}' + JobLabel: 'SymbolPublishing' + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - name: IsStableBuild value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.InternalServicing_30_Channel_Id)) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }})) pool: vmImage: 'windows-2019' steps: @@ -78,13 +89,14 @@ stages: inputs: buildType: current artifactName: PackageArtifacts + continueOnError: true - task: DownloadBuildArtifacts@0 displayName: Download Blob Artifacts inputs: buildType: current artifactName: BlobArtifacts - + continueOnError: true - task: DownloadBuildArtifacts@0 displayName: Download Asset Manifests inputs: @@ -128,15 +140,20 @@ stages: /p:ChecksumsAzureAccountKey=$(InternalChecksumsBlobFeedKey) /p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(InternalInstallersBlobFeedKey) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}' /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:PublishToMSDL=false ${{ parameters.artifactsPublishingAdditionalParameters }} + - template: ../../steps/publish-logs.yml + parameters: + StageLabel: '${{ parameters.stageName }}' + JobLabel: 'AssetsPublishing' + - template: ../../steps/promote-build.yml parameters: - ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} + ChannelId: ${{ parameters.channelId }} diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml similarity index 75% rename from eng/common/templates/post-build/channels/netcore-release-31.yml rename to eng/common/templates/post-build/channels/generic-public-channel.yml index 6270c828359..3f572f8b12f 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/generic-public-channel.yml @@ -4,20 +4,26 @@ parameters: - Validate publishInstallersAndChecksums: false symbolPublishingAdditionalParameters: '' + stageName: '' + channelName: '' + channelId: '' + transportFeed: '' + shippingFeed: '' + symbolsFeed: '' stages: -- stage: NetCore_Release31_Publish +- stage: ${{ parameters.stageName }} dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml - displayName: .NET Core 3.1 Release Publishing + displayName: ${{ parameters.channelName }} Publishing jobs: - template: ../setup-maestro-vars.yml - - job: + - job: publish_symbols displayName: Symbol Publishing dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )) variables: - group: DotNet-Symbol-Server-Pats pool: @@ -35,6 +41,18 @@ stages: artifactName: 'PDBArtifacts' continueOnError: true + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish inputs: @@ -48,17 +66,20 @@ stages: /p:Configuration=Release ${{ parameters.symbolPublishingAdditionalParameters }} + - template: ../../steps/publish-logs.yml + parameters: + StageLabel: '${{ parameters.stageName }}' + JobLabel: 'SymbolPublishing' + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - name: IsStableBuild value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }})) pool: vmImage: 'windows-2019' steps: @@ -67,12 +88,14 @@ stages: inputs: buildType: current artifactName: PackageArtifacts + continueOnError: true - task: DownloadBuildArtifacts@0 displayName: Download Blob Artifacts inputs: buildType: current artifactName: BlobArtifacts + continueOnError: true - task: DownloadBuildArtifacts@0 displayName: Download Asset Manifests @@ -118,15 +141,19 @@ stages: /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}' /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} + - template: ../../steps/publish-logs.yml + parameters: + StageLabel: '${{ parameters.stageName }}' + JobLabel: 'AssetsPublishing' + - template: ../../steps/promote-build.yml parameters: - ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} + ChannelId: ${{ parameters.channelId }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml deleted file mode 100644 index af64724f797..00000000000 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ /dev/null @@ -1,132 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - symbolPublishingAdditionalParameters: '' - -stages: -- stage: NetCore_Dev31_Publish - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: .NET Core 3.1 Dev Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id)) - variables: - - group: DotNet-Symbol-Server-Pats - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts - inputs: - artifactName: 'PDBArtifacts' - continueOnError: true - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - ${{ parameters.symbolPublishingAdditionalParameters }} - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(_DotNetArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/promote-build.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml deleted file mode 100644 index 6c8dff54245..00000000000 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ /dev/null @@ -1,132 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - symbolPublishingAdditionalParameters: '' - -stages: -- stage: NetCore_Dev5_Publish - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: .NET Core 5 Dev Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_5_Dev_Channel_Id)) - variables: - - group: DotNet-Symbol-Server-Pats - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts - inputs: - artifactName: 'PDBArtifacts' - continueOnError: true - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - ${{ parameters.symbolPublishingAdditionalParameters }} - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_5_Dev_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(_DotNetArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/promote-build.yml - parameters: - ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml deleted file mode 100644 index 206dd43e3a8..00000000000 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ /dev/null @@ -1,132 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - symbolPublishingAdditionalParameters: '' - -stages: -- stage: NetCore_Release30_Publish - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: .NET Core 3.0 Release Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id)) - variables: - - group: DotNet-Symbol-Server-Pats - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts - inputs: - artifactName: 'PDBArtifacts' - continueOnError: true - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - ${{ parameters.symbolPublishingAdditionalParameters }} - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(_DotNetArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3/nuget/v3/index.json' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-symbols/nuget/v3/index.json' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/promote-build.yml - parameters: - ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml deleted file mode 100644 index 9bf9626ca34..00000000000 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ /dev/null @@ -1,132 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - symbolPublishingAdditionalParameters: '' - -stages: -- stage: NetCore_Tools_Latest_Publish - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: .NET Tools - Latest Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_Tools_Latest_Channel_Id)) - variables: - - group: DotNet-Symbol-Server-Pats - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts - inputs: - artifactName: 'PDBArtifacts' - continueOnError: true - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - ${{ parameters.symbolPublishingAdditionalParameters }} - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_Tools_Latest_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(_DotNetArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/promote-build.yml - parameters: - ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml deleted file mode 100644 index 5c8e91cce13..00000000000 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ /dev/null @@ -1,97 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - -stages: -- stage: PVR_Publish - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: .NET Tools - Validation Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicValidationRelease_30_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/promote-build.yml - parameters: - ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 9ccc08b2c88..9505cf170f0 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -1,8 +1,10 @@ variables: - - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - group: DotNet-Blob-Feed - group: DotNet-DotNetCli-Storage - group: DotNet-MSRC-Storage - + - group: Publish-Build-Assets + # .NET Core 3.1 Dev - name: PublicDevRelease_31_Channel_Id value: 128 @@ -11,14 +13,22 @@ variables: - name: NetCore_5_Dev_Channel_Id value: 131 - # .NET Tools - Validation - - name: PublicValidationRelease_30_Channel_Id + # .NET Eng - Validation + - name: Net_Eng_Validation_Channel_Id value: 9 - # .NET Tools - Latest - - name: NetCore_Tools_Latest_Channel_Id + # .NET Eng - Latest + - name: Net_Eng_Latest_Channel_Id value: 2 + # .NET 3 Eng - Validation + - name: NET_3_Eng_Validation_Channel_Id + value: 390 + + # .NET 3 Eng + - name: NetCore_3_Tools_Channel_Id + value: 344 + # .NET Core 3.0 Internal Servicing - name: InternalServicing_30_Channel_Id value: 184 @@ -31,6 +41,18 @@ variables: - name: PublicRelease_31_Channel_Id value: 129 + # General Testing + - name: GeneralTesting_Channel_Id + value: 529 + + # .NET Core 3.1 Blazor Features + - name: NetCore_31_Blazor_Features_Channel_Id + value: 531 + + # .NET Core Experimental + - name: NetCore_Experimental_Channel_Id + value: 562 + # Whether the build is internal or not - name: IsInternalBuild value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 3f06b5d1467..8a8d84f2026 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -8,6 +8,7 @@ parameters: enable: false continueOnError: false params: '' + artifactNames: '' # These parameters let the user customize the call to sdk-task.ps1 for publishing # symbols & general artifacts as well as for signing validation @@ -50,7 +51,6 @@ stages: displayName: Signing Validation variables: - template: common-variables.yml - - group: AzureDevOps-Artifact-Feeds-Pats pool: vmImage: 'windows-2019' steps: @@ -64,7 +64,6 @@ stages: # Since sdk-task.ps1 tries to restore packages we need to do this authentication here # otherwise it'll complain about accessing a private feed. - task: NuGetAuthenticate@0 - condition: eq(variables['IsInternalBuild'], 'true') displayName: 'Authenticate to AzDO Feeds' - task: PowerShell@2 @@ -80,9 +79,13 @@ stages: arguments: -task SigningValidation -restore -msbuildEngine dotnet /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - /p:Configuration=Release ${{ parameters.signingValidationAdditionalParameters }} + - template: ../steps/publish-logs.yml + parameters: + StageLabel: 'Validation' + JobLabel: 'Signing' + - ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}: - job: displayName: SourceLink Validation @@ -113,50 +116,108 @@ stages: parameters: additionalParameters: ${{ parameters.SDLValidationParameters.params }} continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} + artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} -- template: \eng\common\templates\post-build\channels\netcore-dev-5.yml +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - -- template: \eng\common\templates\post-build\channels\netcore-dev-31.yml + stageName: 'NetCore_Dev5_Publish' + channelName: '.NET Core 5 Dev' + channelId: 131 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - -- template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml + stageName: 'Net_Eng_Latest_Publish' + channelName: '.NET Eng - Latest' + channelId: 2 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - -- template: \eng\common\templates\post-build\channels\public-validation-release.yml + stageName: 'Net_Eng_Validation_Publish' + channelName: '.NET Eng - Validation' + channelId: 9 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - -- template: \eng\common\templates\post-build\channels\netcore-release-30.yml + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'General_Testing_Publish' + channelName: 'General Testing' + channelId: 529 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - -- template: \eng\common\templates\post-build\channels\netcore-release-31.yml + stageName: 'NETCore_Tooling_Dev_Publishing' + channelName: '.NET Core Tooling Dev' + channelId: 548 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - -- template: \eng\common\templates\post-build\channels\netcore-internal-30.yml + stageName: 'NETCore_Tooling_Release_Publishing' + channelName: '.NET Core Tooling Release' + channelId: 549 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NET_Internal_Tooling_Publishing' + channelName: '.NET Internal Tooling' + channelId: 551 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_Experimental_Publishing' + channelName: '.NET Core Experimental' + channelId: 562 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json' diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 56242b068e1..716b53f7405 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -4,6 +4,8 @@ jobs: pool: vmImage: 'windows-2019' steps: + - checkout: none + - task: DownloadBuildArtifacts@0 displayName: Download Release Configs inputs: @@ -14,5 +16,25 @@ jobs: name: setReleaseVars displayName: Set Release Configs Vars inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/setup-maestro-vars.ps1 - arguments: -ReleaseConfigsPath '$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt' + targetType: inline + script: | + try { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + + $BarId = $Content | Select -Index 0 + + $Channels = "" + $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } + + $IsStableBuild = $Content | Select -Index 2 + + Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId" + Write-Host "##vso[task.setvariable variable=InitialChannels;isOutput=true]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } diff --git a/eng/common/templates/steps/publish-logs.yml b/eng/common/templates/steps/publish-logs.yml new file mode 100644 index 00000000000..8903ba57c00 --- /dev/null +++ b/eng/common/templates/steps/publish-logs.yml @@ -0,0 +1,23 @@ +parameters: + StageLabel: '' + JobLabel: '' + +steps: +- task: Powershell@2 + displayName: Prepare Binlogs to Upload + inputs: + targetType: inline + script: | + New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + continueOnError: true + condition: always() + +- task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' + PublishLocation: Container + ArtifactName: PostBuilLogs + continueOnError: true + condition: always() diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 05df886f55f..30becf01ea5 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -23,6 +23,7 @@ parameters: EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting int) Creator: '' # optional -- if the build is external, use this to specify who is sending the job DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() @@ -55,6 +56,7 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} Creator: ${{ parameters.Creator }} SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) @@ -85,6 +87,7 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} Creator: ${{ parameters.Creator }} SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 5c94bd78d69..d762c9f044a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -5,7 +5,7 @@ [bool]$ci = if (Test-Path variable:ci) { $ci } else { $false } # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. -[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } +[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. # Binary log must be enabled on CI. @@ -24,7 +24,7 @@ [bool]$restore = if (Test-Path variable:restore) { $restore } else { $true } # Adjusts msbuild verbosity level. -[string]$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } +[string]$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { 'minimal' } # Set to true to reuse msbuild nodes. Recommended to not reuse on CI. [bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } @@ -41,21 +41,23 @@ # Enable repos to use a particular version of the on-line dotnet-install scripts. # default URL: https://dot.net/v1/dotnet-install.ps1 -[string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { "v1" } +[string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } # True to use global NuGet cache instead of restoring packages to repository-local directory. [bool]$useGlobalNuGetCache = if (Test-Path variable:useGlobalNuGetCache) { $useGlobalNuGetCache } else { !$ci } # An array of names of processes to stop on script exit if prepareMachine is true. -$processesToStopOnExit = if (Test-Path variable:processesToStopOnExit) { $processesToStopOnExit } else { @("msbuild", "dotnet", "vbcscompiler") } +$processesToStopOnExit = if (Test-Path variable:processesToStopOnExit) { $processesToStopOnExit } else { @('msbuild', 'dotnet', 'vbcscompiler') } + +$disableConfigureToolsetImport = if (Test-Path variable:disableConfigureToolsetImport) { $disableConfigureToolsetImport } else { $null } set-strictmode -version 2.0 -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 function Create-Directory([string[]] $path) { if (!(Test-Path $path)) { - New-Item -path $path -force -itemType "Directory" | Out-Null + New-Item -path $path -force -itemType 'Directory' | Out-Null } } @@ -119,7 +121,7 @@ function InitializeDotNetCli([bool]$install) { # Find the first path on %PATH% that contains the dotnet.exe if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) { - $dotnetCmd = Get-Command "dotnet.exe" -ErrorAction SilentlyContinue + $dotnetCmd = Get-Command 'dotnet.exe' -ErrorAction SilentlyContinue if ($dotnetCmd -ne $null) { $env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent } @@ -132,13 +134,13 @@ function InitializeDotNetCli([bool]$install) { if ((-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { - $dotnetRoot = Join-Path $RepoRoot ".dotnet" + $dotnetRoot = Join-Path $RepoRoot '.dotnet' if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { if ($install) { InstallDotNetSdk $dotnetRoot $dotnetSdkVersion } else { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" ExitWithExitCode 1 } } @@ -161,7 +163,7 @@ function InitializeDotNetCli([bool]$install) { } function GetDotNetInstallScript([string] $dotnetRoot) { - $installScript = Join-Path $dotnetRoot "dotnet-install.ps1" + $installScript = Join-Path $dotnetRoot 'dotnet-install.ps1' if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit @@ -171,11 +173,18 @@ function GetDotNetInstallScript([string] $dotnetRoot) { return $installScript } -function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = "") { +function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = '') { InstallDotNet $dotnetRoot $version $architecture } -function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { +function InstallDotNet([string] $dotnetRoot, + [string] $version, + [string] $architecture = '', + [string] $runtime = '', + [bool] $skipNonVersionedFiles = $false, + [string] $runtimeSourceFeed = '', + [string] $runtimeSourceFeedKey = '') { + $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ Version = $version @@ -186,10 +195,29 @@ function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $archit if ($runtime) { $installParameters.Runtime = $runtime } if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } - & $installScript @installParameters - if ($lastExitCode -ne 0) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet cli (exit code '$lastExitCode')." - ExitWithExitCode $lastExitCode + try { + & $installScript @installParameters + } + catch { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from public location." + + # Only the runtime can be installed from a custom [private] location. + if ($runtime -and ($runtimeSourceFeed -or $runtimeSourceFeedKey)) { + if ($runtimeSourceFeed) { $installParameters.AzureFeed = $runtimeSourceFeed } + + if ($runtimeSourceFeedKey) { + $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) + $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) + $installParameters.FeedCredential = $decodedString + } + + try { + & $installScript @installParameters + } + catch { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." + } + } } } @@ -210,16 +238,16 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } + $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { '15.9' } $vsMinVersion = [Version]::new($vsMinVersionStr) # Try msbuild command available in the environment. if ($env:VSINSTALLDIR -ne $null) { - $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue + $msbuildCmd = Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue if ($msbuildCmd -ne $null) { # Workaround for https://github.com/dotnet/roslyn/issues/35793 # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ - $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0]) + $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0]) if ($msbuildVersion -ge $vsMinVersion) { return $global:_MSBuildExe = $msbuildCmd.Path @@ -239,7 +267,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion } else { - if (Get-Member -InputObject $GlobalJson.tools -Name "xcopy-msbuild") { + if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] } else { @@ -249,7 +277,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install if ($vsInstallDir -eq $null) { - throw "Unable to find Visual Studio that has required version and components installed" + throw 'Unable to find Visual Studio that has required version and components installed' } } @@ -273,7 +301,7 @@ function InstallXCopyMSBuild([string]$packageVersion) { } function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { - $packageName = "RoslynTools.MSBuild" + $packageName = 'RoslynTools.MSBuild' $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" @@ -289,7 +317,7 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { Unzip $packagePath $packageDir } - return Join-Path $packageDir "tools" + return Join-Path $packageDir 'tools' } # @@ -306,32 +334,32 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { # or $null if no instance meeting the requirements is found on the machine. # function LocateVisualStudio([object]$vsRequirements = $null){ - if (Get-Member -InputObject $GlobalJson.tools -Name "vswhere") { + if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') { $vswhereVersion = $GlobalJson.tools.vswhere } else { - $vswhereVersion = "2.5.2" + $vswhereVersion = '2.5.2' } $vsWhereDir = Join-Path $ToolsDir "vswhere\$vswhereVersion" - $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" + $vsWhereExe = Join-Path $vsWhereDir 'vswhere.exe' if (!(Test-Path $vsWhereExe)) { Create-Directory $vsWhereDir - Write-Host "Downloading vswhere" + Write-Host 'Downloading vswhere' Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild", "-products", "*") + $args = @('-latest', '-prerelease', '-format', 'json', '-requires', 'Microsoft.Component.MSBuild', '-products', '*') - if (Get-Member -InputObject $vsRequirements -Name "version") { - $args += "-version" + if (Get-Member -InputObject $vsRequirements -Name 'version') { + $args += '-version' $args += $vsRequirements.version } - if (Get-Member -InputObject $vsRequirements -Name "components") { + if (Get-Member -InputObject $vsRequirements -Name 'components') { foreach ($component in $vsRequirements.components) { - $args += "-requires" + $args += '-requires' $args += $component } } @@ -357,27 +385,27 @@ function InitializeBuildTool() { # Initialize dotnet cli if listed in 'tools' $dotnetRoot = $null - if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { + if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { $dotnetRoot = InitializeDotNetCli -install:$restore } - if ($msbuildEngine -eq "dotnet") { + if ($msbuildEngine -eq 'dotnet') { if (!$dotnetRoot) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "/global.json must specify 'tools.dotnet'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." ExitWithExitCode 1 } - $buildTool = @{ Path = Join-Path $dotnetRoot "dotnet.exe"; Command = "msbuild"; Tool = "dotnet"; Framework = "netcoreapp2.1" } + $buildTool = @{ Path = Join-Path $dotnetRoot 'dotnet.exe'; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp2.1' } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore } catch { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message $_ + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ ExitWithExitCode 1 } $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472" } } else { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." ExitWithExitCode 1 } @@ -386,15 +414,15 @@ function InitializeBuildTool() { function GetDefaultMSBuildEngine() { # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. - if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { - return "vs" + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { + return 'vs' } - if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { - return "dotnet" + if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + return 'dotnet' } - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." ExitWithExitCode 1 } @@ -403,9 +431,9 @@ function GetNuGetPackageCachePath() { # Use local cache on CI to ensure deterministic build, # use global cache in dev builds to avoid cost of downloading packages. if ($useGlobalNuGetCache) { - $env:NUGET_PACKAGES = Join-Path $env:UserProfile ".nuget\packages" + $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages' } else { - $env:NUGET_PACKAGES = Join-Path $RepoRoot ".packages" + $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages' } } @@ -418,7 +446,7 @@ function GetSdkTaskProject([string]$taskName) { } function InitializeNativeTools() { - if (Get-Member -InputObject $GlobalJson -Name "native-tools") { + if (-Not (Test-Path variable:DisableNativeToolsetInstalls) -And (Get-Member -InputObject $GlobalJson -Name "native-tools")) { $nativeArgs= @{} if ($ci) { $nativeArgs = @{ @@ -447,14 +475,14 @@ function InitializeToolset() { } if (-not $restore) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Toolset version $toolsetVersion has not been restored." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Toolset version $toolsetVersion has not been restored." ExitWithExitCode 1 } $buildTool = InitializeBuildTool - $proj = Join-Path $ToolsetDir "restore.proj" - $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "ToolsetRestore.binlog") } else { "" } + $proj = Join-Path $ToolsetDir 'restore.proj' + $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ToolsetRestore.binlog') } else { '' } '' | Set-Content $proj @@ -476,7 +504,7 @@ function ExitWithExitCode([int] $exitCode) { } function Stop-Processes() { - Write-Host "Killing running build processes..." + Write-Host 'Killing running build processes...' foreach ($processName in $processesToStopOnExit) { Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process } @@ -493,7 +521,7 @@ function MSBuild() { # Work around issues with Azure Artifacts credential provider # https://github.com/dotnet/arcade/issues/3932 - if ($ci -and $buildTool.Tool -eq "dotnet") { + if ($ci -and $buildTool.Tool -eq 'dotnet') { dotnet nuget locals http-cache -c $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 @@ -504,7 +532,7 @@ function MSBuild() { $toolsetBuildProject = InitializeToolset $path = Split-Path -parent $toolsetBuildProject - $path = Join-Path $path (Join-Path $buildTool.Framework "Microsoft.DotNet.Arcade.Sdk.dll") + $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll') $args += "/logger:$path" } @@ -519,12 +547,12 @@ function MSBuild() { function MSBuild-Core() { if ($ci) { if (!$binaryLog) { - Write-PipelineTaskError -Message "Binary log must be enabled in CI build." + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build.' ExitWithExitCode 1 } if ($nodeReuse) { - Write-PipelineTaskError -Message "Node reuse must be disabled in CI build." + Write-PipelineTelemetryError -Category 'Build' -Message 'Node reuse must be disabled in CI build.' ExitWithExitCode 1 } } @@ -534,10 +562,10 @@ function MSBuild-Core() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" if ($warnAsError) { - $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + $cmdArgs += ' /warnaserror /p:TreatWarningsAsErrors=true' } else { - $cmdArgs += " /p:TreatWarningsAsErrors=false" + $cmdArgs += ' /p:TreatWarningsAsErrors=false' } foreach ($arg in $args) { @@ -549,7 +577,7 @@ function MSBuild-Core() { $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { - Write-PipelineTaskError -Message "Build failed." + Write-PipelineTelemetryError Category 'Build' -Message 'Build failed.' $buildLog = GetMSBuildBinaryLogCommandLineArgument $args if ($buildLog -ne $null) { @@ -564,12 +592,12 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { foreach ($argument in $arguments) { if ($argument -ne $null) { $arg = $argument.Trim() - if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { - return $arg.Substring("/bl:".Length) + if ($arg.StartsWith('/bl:', "OrdinalIgnoreCase")) { + return $arg.Substring('/bl:'.Length) } - if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { - return $arg.Substring("/binaryLogger:".Length) + if ($arg.StartsWith('/binaryLogger:', 'OrdinalIgnoreCase')) { + return $arg.Substring('/binaryLogger:'.Length) } } } @@ -579,14 +607,14 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { . $PSScriptRoot\pipeline-logging-functions.ps1 -$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") -$EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") -$ArtifactsDir = Join-Path $RepoRoot "artifacts" -$ToolsetDir = Join-Path $ArtifactsDir "toolset" -$ToolsDir = Join-Path $RepoRoot ".tools" -$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration -$TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration -$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json +$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..') +$EngRoot = Resolve-Path (Join-Path $PSScriptRoot '..') +$ArtifactsDir = Join-Path $RepoRoot 'artifacts' +$ToolsetDir = Join-Path $ArtifactsDir 'toolset' +$ToolsDir = Join-Path $RepoRoot '.tools' +$LogDir = Join-Path (Join-Path $ArtifactsDir 'log') $configuration +$TempDir = Join-Path (Join-Path $ArtifactsDir 'tmp') $configuration +$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json # true if global.json contains a "runtimes" section $globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false } @@ -599,3 +627,18 @@ Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir Write-PipelineSetVariable -Name 'TEMP' -Value $TempDir Write-PipelineSetVariable -Name 'TMP' -Value $TempDir + +# Import custom tools configuration, if present in the repo. +# Note: Import in global scope so that the script set top-level variables without qualification. +if (!$disableConfigureToolsetImport) { + $configureToolsetScript = Join-Path $EngRoot 'configure-toolset.ps1' + if (Test-Path $configureToolsetScript) { + . $configureToolsetScript + if ((Test-Path variable:failOnConfigureToolsetError) -And $failOnConfigureToolsetError) { + if ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { + Write-PipelineTelemetryError -Category 'Build' -Message 'configure-toolset.ps1 returned a non-zero exit code' + ExitWithExitCode $LastExitCode + } + } + } +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 895ad2442b8..f58db5e25d1 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -81,7 +81,7 @@ function ReadGlobalVersion { local pattern="\"$key\" *: *\"(.*)\"" if [[ ! $line =~ $pattern ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Error: Cannot find \"$key\" in $global_json_file" + Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file" ExitWithExitCode 1 fi @@ -191,8 +191,28 @@ function InstallDotNet { fi bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK (exit code '$exit_code')." - ExitWithExitCode $exit_code + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from public location (exit code '$exit_code')." + + if [[ -n "$runtimeArg" ]]; then + local runtimeSourceFeed='' + if [[ -n "${6:-}" ]]; then + runtimeSourceFeed="--azure-feed $6" + fi + + local runtimeSourceFeedKey='' + if [[ -n "${7:-}" ]]; then + decodedFeedKey=`echo $7 | base64 --decode` + runtimeSourceFeedKey="--feed-credential $decodedFeedKey" + fi + + if [[ -n "$runtimeSourceFeed" || -n "$runtimeSourceFeedKey" ]]; then + bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg $runtimeSourceFeed $runtimeSourceFeedKey || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." + ExitWithExitCode $exit_code + } + fi + fi } } @@ -252,6 +272,9 @@ function GetNuGetPackageCachePath { } function InitializeNativeTools() { + if [[ -n "${DisableNativeToolsetInstalls:-}" ]]; then + return + fi if grep -Fq "native-tools" $global_json_file then local nativeArgs="" @@ -301,7 +324,7 @@ function InitializeToolset { local toolset_build_proj=`cat "$toolset_location_file"` if [[ ! -a "$toolset_build_proj" ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Invalid toolset path: $toolset_build_proj" + Write-PipelineTelemetryError -category 'Build' "Invalid toolset path: $toolset_build_proj" ExitWithExitCode 3 fi @@ -351,12 +374,12 @@ function MSBuild { function MSBuild-Core { if [[ "$ci" == true ]]; then if [[ "$binary_log" != true ]]; then - Write-PipelineTaskError "Binary log must be enabled in CI build." + Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build." ExitWithExitCode 1 fi if [[ "$node_reuse" == true ]]; then - Write-PipelineTaskError "Node reuse must be disabled in CI build." + Write-PipelineTelemetryError -category 'Build' "Node reuse must be disabled in CI build." ExitWithExitCode 1 fi fi @@ -370,7 +393,7 @@ function MSBuild-Core { "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || { local exit_code=$? - Write-PipelineTaskError "Build failed (exit code '$exit_code')." + Write-PipelineTelemetryError -category 'Build' "Build failed (exit code '$exit_code')." ExitWithExitCode $exit_code } } @@ -411,3 +434,18 @@ Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir" Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir" Write-PipelineSetVariable -name "Temp" -value "$temp_dir" Write-PipelineSetVariable -name "TMP" -value "$temp_dir" + +# Import custom tools configuration, if present in the repo. +if [ -z "${disable_configure_toolset_import:-}" ]; then + configure_toolset_script="$eng_root/configure-toolset.sh" + if [[ -a "$configure_toolset_script" ]]; then + . "$configure_toolset_script" + fi +fi + +# TODO: https://github.com/dotnet/arcade/issues/1468 +# Temporary workaround to avoid breaking change. +# Remove once repos are updated. +if [[ -n "${useInstalledDotNetCli:-}" ]]; then + use_installed_dotnet_cli="$useInstalledDotNetCli" +fi diff --git a/eng/release/insert-into-vs.yml b/eng/release/insert-into-vs.yml index 89650f190db..98c3ee790de 100644 --- a/eng/release/insert-into-vs.yml +++ b/eng/release/insert-into-vs.yml @@ -26,6 +26,8 @@ stages: value: ${{ parameters.insertTeamEmail }} - name: InsertTeamName value: ${{ parameters.insertTeamName }} + - name: InsertPayloadName + value: 'F# $(Build.SourceBranchName) $(Build.BuildNumber)' steps: - task: DownloadBuildArtifacts@0 displayName: Download Insertion Artifacts diff --git a/eng/targets/Settings.props b/eng/targets/Settings.props index 32902881820..474e5d22a86 100644 --- a/eng/targets/Settings.props +++ b/eng/targets/Settings.props @@ -6,6 +6,11 @@ $(ArtifactsBinDir) + + + false + + false diff --git a/fcs/.config/dotnet-tools.json b/fcs/.config/dotnet-tools.json new file mode 100644 index 00000000000..c3e6f5e472f --- /dev/null +++ b/fcs/.config/dotnet-tools.json @@ -0,0 +1,18 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "fake-cli": { + "version": "5.18.3", + "commands": [ + "fake" + ] + }, + "paket": { + "version": "5.236.0", + "commands": [ + "paket" + ] + } + } +} \ No newline at end of file diff --git a/fcs/.gitignore b/fcs/.gitignore index a21a02ee547..ba316d8d5ae 100644 --- a/fcs/.gitignore +++ b/fcs/.gitignore @@ -1,4 +1,5 @@ .paket/ +build.fsx.lock FSharp.Compiler.Service.Tests/TestResults/* FSharp.Compiler.Service.netstandard/illex.fs FSharp.Compiler.Service.netstandard/ilpars.fs diff --git a/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs b/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs index d5be2c7565f..3a096cb5660 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs +++ b/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs @@ -2,13 +2,10 @@ #if !NETSTANDARD open System.Runtime.Serialization.Json -open System.Runtime -open System.Diagnostics #endif open System.Text open System.IO open System -open System.Xml module Utils = diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs index 7cf970f7a7f..93a74cbb0e8 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs +++ b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs @@ -8,7 +8,6 @@ open Microsoft.Build.Utilities module internal ProjectCrackerTool = open System.Collections.Generic - open Microsoft.Build.Evaluation let runningOnMono = #if NETCOREAPP2_0 diff --git a/fcs/FSharp.Compiler.Service.sln.DotSettings b/fcs/FSharp.Compiler.Service.sln.DotSettings new file mode 100644 index 00000000000..59e0b85499d --- /dev/null +++ b/fcs/FSharp.Compiler.Service.sln.DotSettings @@ -0,0 +1,780 @@ + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True~ \ No newline at end of file diff --git a/fcs/build.cmd b/fcs/build.cmd index e556a4bd7db..dc47a88f8cf 100644 --- a/fcs/build.cmd +++ b/fcs/build.cmd @@ -3,13 +3,14 @@ setlocal pushd %~dp0% +dotnet tool restore + if errorlevel 1 ( endlocal exit /b %errorlevel% ) -powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\download-paket.ps1" -.paket\paket.exe restore +dotnet paket restore if errorlevel 1 ( endlocal exit /b %errorlevel% @@ -18,7 +19,8 @@ if errorlevel 1 ( :: don't care if this fails dotnet build-server shutdown >NUL 2>&1 -packages\FAKE\tools\FAKE.exe build.fsx %* +dotnet fake build -t %* + if errorlevel 1 ( endlocal exit /b %errorlevel% diff --git a/fcs/build.fsx b/fcs/build.fsx index cf0e0d8deda..1c2528dd2e0 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -1,61 +1,34 @@ // -------------------------------------------------------------------------------------- // FAKE build script // -------------------------------------------------------------------------------------- +#r "paket: groupref Main //" +#load "./.fake/build.fsx/intellisense.fsx" -#I "packages/FAKE/tools" -#r "packages/FAKE/tools/FakeLib.dll" open System open System.IO -open Fake -open Fake.AppVeyor -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__ + "/../artifacts/TestResults") -File.WriteAllText(__SOURCE_DIRECTORY__ + "/../artifacts/TestResults/notestsyet.txt","No tests yet") -let isMono = true -#else -let isMono = false -#endif +open Fake.BuildServer +open Fake.Core +open Fake.DotNet +open Fake.IO +BuildServer.install [ AppVeyor.Installer ] // -------------------------------------------------------------------------------------- // Utilities // -------------------------------------------------------------------------------------- -let dotnetExePath = +let withDotnetExe = // Build.cmd normally downloads a dotnet cli to: \artifacts\toolset\dotnet // check if there is one there to avoid downloading an additional one here let pathToCli = Path.Combine(__SOURCE_DIRECTORY__, @"..\artifacts\toolset\dotnet\dotnet.exe") if File.Exists(pathToCli) then - pathToCli + (fun opts -> { opts with DotNet.Options.DotNetCliPath = pathToCli }) else - DotNetCli.InstallDotNetSDK "2.2.105" - -let runDotnet workingDir args = - let result = - ExecProcess (fun info -> - info.FileName <- dotnetExePath - info.WorkingDirectory <- workingDir - info.Arguments <- args) TimeSpan.MaxValue - - if result <> 0 then failwithf "dotnet %s failed" args - -let assertExitCodeZero x = if x = 0 then () else failwithf "Command failed with exit code %i" x - -let runCmdIn workDir (exe:string) = Printf.ksprintf (fun (args:string) -> -#if MONO - let exe = exe.Replace("\\","/") - let args = args.Replace("\\","/") - printfn "[%s] mono %s %s" workDir exe args - Shell.Exec("mono", sprintf "%s %s" exe args, workDir) -#else - printfn "[%s] %s %s" workDir exe args - Shell.Exec(exe, args, workDir) -#endif - |> assertExitCodeZero -) + DotNet.install (fun cliOpts -> { cliOpts with Version = DotNet.CliVersion.GlobalJson }) + +let runDotnet workingDir command args = + let result = DotNet.exec (DotNet.Options.withWorkingDirectory workingDir >> withDotnetExe) command args + + if result.ExitCode <> 0 then failwithf "dotnet %s failed with errors: %s" args (result.Errors |> String.concat "\n") // -------------------------------------------------------------------------------------- // The rest of the code is standard F# build script @@ -64,66 +37,68 @@ let runCmdIn workDir (exe:string) = Printf.ksprintf (fun (args:string) -> let releaseDir = Path.Combine(__SOURCE_DIRECTORY__, "../artifacts/bin/fcs/Release") // Read release notes & version info from RELEASE_NOTES.md -let release = LoadReleaseNotes (__SOURCE_DIRECTORY__ + "/RELEASE_NOTES.md") -let isAppVeyorBuild = buildServer = BuildServer.AppVeyor -let isJenkinsBuild = buildServer = BuildServer.Jenkins +let release = ReleaseNotes.load (__SOURCE_DIRECTORY__ + "/RELEASE_NOTES.md") +let isAppVeyorBuild = AppVeyor.detect() let isVersionTag (tag: string) = Version.TryParse tag |> fst -let hasRepoVersionTag = isAppVeyorBuild && AppVeyorEnvironment.RepoTag && isVersionTag AppVeyorEnvironment.RepoTagName -let assemblyVersion = if hasRepoVersionTag then AppVeyorEnvironment.RepoTagName else release.NugetVersion +let hasRepoVersionTag = isAppVeyorBuild && AppVeyor.Environment.RepoTag && isVersionTag AppVeyor.Environment.RepoTagName +let assemblyVersion = if hasRepoVersionTag then AppVeyor.Environment.RepoTagName else release.NugetVersion let buildVersion = if hasRepoVersionTag then assemblyVersion - else if isAppVeyorBuild then sprintf "%s-b%s" assemblyVersion AppVeyorEnvironment.BuildNumber + else if isAppVeyorBuild then sprintf "%s-b%s" assemblyVersion AppVeyor.Environment.BuildNumber else assemblyVersion -Target "Clean" (fun _ -> - CleanDir releaseDir +Target.create "Clean" (fun _ -> + Shell.cleanDir releaseDir ) -Target "Restore" (fun _ -> +Target.create "Restore" (fun _ -> // We assume a paket restore has already been run - runDotnet __SOURCE_DIRECTORY__ "restore ../src/buildtools/buildtools.proj -v n" - runDotnet __SOURCE_DIRECTORY__ "restore FSharp.Compiler.Service.sln -v n" + runDotnet __SOURCE_DIRECTORY__ "restore" "../src/buildtools/buildtools.proj -v n" + runDotnet __SOURCE_DIRECTORY__ "restore" "FSharp.Compiler.Service.sln -v n" ) -Target "BuildVersion" (fun _ -> +Target.create "BuildVersion" (fun _ -> Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore ) -Target "Build" (fun _ -> - runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto" +Target.create "Build" (fun _ -> + runDotnet __SOURCE_DIRECTORY__ "build" "../src/buildtools/buildtools.proj -v n -c Proto" let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.1/fslex.dll" let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/netcoreapp2.1/fsyacc.dll" - runDotnet __SOURCE_DIRECTORY__ (sprintf "build FSharp.Compiler.Service.sln -v n -c Release /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath) + runDotnet __SOURCE_DIRECTORY__ "build" (sprintf "FSharp.Compiler.Service.sln -v n -c Release /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath) ) -Target "Test" (fun _ -> +Target.create "Test" (fun _ -> // This project file is used for the netcoreapp2.0 tests to work out reference sets - runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableCompilerRedirection=true" + runDotnet __SOURCE_DIRECTORY__ "build" "../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableCompilerRedirection=true" // Now run the tests let logFilePath = Path.Combine(__SOURCE_DIRECTORY__, "..", "artifacts", "TestResults", "Release", "FSharp.Compiler.Service.Test.xml") - runDotnet __SOURCE_DIRECTORY__ (sprintf "test FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --no-restore --no-build -v n -c Release --test-adapter-path . --logger \"nunit;LogFilePath=%s\"" logFilePath) + runDotnet __SOURCE_DIRECTORY__ "test" (sprintf "FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --no-restore --no-build -v n -c Release --test-adapter-path . --logger \"nunit;LogFilePath=%s\"" logFilePath) ) -Target "NuGet" (fun _ -> - runDotnet __SOURCE_DIRECTORY__ "pack FSharp.Compiler.Service.sln -v n -c Release" +Target.create "NuGet" (fun _ -> + DotNet.pack (fun packOpts -> + { packOpts with + Configuration = DotNet.BuildConfiguration.Release + Common = packOpts.Common |> withDotnetExe |> DotNet.Options.withVerbosity (Some DotNet.Verbosity.Normal) + MSBuildParams = { packOpts.MSBuildParams with + Properties = packOpts.MSBuildParams.Properties @ [ "Version", assemblyVersion ] } + }) "FSharp.Compiler.Service.sln" ) -Target "GenerateDocsEn" (fun _ -> - executeFSIWithArgs "docsrc/tools" "generate.fsx" [] [] |> ignore +Target.create "GenerateDocsEn" (fun _ -> + runDotnet "docsrc/tools" "fake" "run generate.fsx" ) -Target "GenerateDocsJa" (fun _ -> - executeFSIWithArgs "docsrc/tools" "generate.ja.fsx" [] [] |> ignore +Target.create "GenerateDocsJa" (fun _ -> + runDotnet "docsrc/tools" "fake" "run generate.ja.fsx" ) -Target "PublishNuGet" (fun _ -> - Paket.Push (fun p -> - let apikey = - match getBuildParam "nuget-apikey" with - | s when not (String.IsNullOrWhiteSpace s) -> s - | _ -> getUserInput "Nuget API Key: " +Target.create "PublishNuGet" (fun _ -> + let apikey = Environment.environVarOrDefault "nuget-apikey" (UserInput.getUserPassword "Nuget API Key: ") + Paket.push (fun p -> { p with ApiKey = apikey WorkingDir = releaseDir }) @@ -132,10 +107,12 @@ Target "PublishNuGet" (fun _ -> // -------------------------------------------------------------------------------------- // Run all targets by default. Invoke 'build ' to override -Target "Start" DoNothing -Target "Release" DoNothing -Target "GenerateDocs" DoNothing -Target "TestAndNuGet" DoNothing +Target.create "Start" ignore +Target.create "Release" ignore +Target.create "GenerateDocs" ignore +Target.create "TestAndNuGet" ignore + +open Fake.Core.TargetOperators "Start" =?> ("BuildVersion", isAppVeyorBuild) @@ -153,21 +130,21 @@ Target "TestAndNuGet" DoNothing "NuGet" ==> "TestAndNuGet" - + "Build" ==> "NuGet" ==> "PublishNuGet" ==> "Release" "Build" - ==> "GenerateDocsEn" + // ==> "GenerateDocsEn" ==> "GenerateDocs" "Build" - ==> "GenerateDocsJa" + // ==> "GenerateDocsJa" ==> "GenerateDocs" "GenerateDocs" ==> "Release" -RunTargetOrDefault "Build" +Target.runOrDefaultWithArguments "Build" diff --git a/fcs/build.sh b/fcs/build.sh index 0b71dd409d2..4c4819aca7c 100755 --- a/fcs/build.sh +++ b/fcs/build.sh @@ -1,22 +1,17 @@ #!/bin/bash -if test "$OS" = "Windows_NT" -then - # use .Net - cmd fcs/build.cmd $@ -else - cd fcs - # use mono - if [[ ! -e ~/.config/.mono/certs ]]; then - mozroots --import --sync --quiet - fi +# bail out as soon as any single command errors +set -e - ./download-paket.sh - mono .paket/paket.exe restore - exit_code=$? - if [ $exit_code -ne 0 ]; then - exit $exit_code - fi - - mono packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx -fi +start_pwd=$PWD + +# dotnet tools look in certain paths by default that Just Work when we're in the fcs dir, +# so let's force that here: +cd $(dirname ${BASH_SOURCE[0]}) + +dotnet tool restore +dotnet paket restore +dotnet fake build -t $@ + +# but we'll be nice and go back to the start dir at the end +cd $start_pwd \ No newline at end of file diff --git a/fcs/cibuild.sh b/fcs/cibuild.sh deleted file mode 100755 index ddc49d8ff34..00000000000 --- a/fcs/cibuild.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# note: expects to run from top directory -./mono/latest-mono-stable.sh -./fcs/build.sh NuGet diff --git a/fcs/docsrc/tools/generate.fsx b/fcs/docsrc/tools/generate.fsx index 617a154efb3..09fa803a2f5 100644 --- a/fcs/docsrc/tools/generate.fsx +++ b/fcs/docsrc/tools/generate.fsx @@ -3,6 +3,9 @@ // (the generated documentation is stored in the 'docs' directory) // -------------------------------------------------------------------------------------- +#r "paket: groupref generate //" +#load "./.fake/generate.fsx/intellisense.fsx" + // Binaries that have XML documentation (in a corresponding generated XML file) let referenceBinaries = [ "FSharp.Compiler.Service.dll" ] // Web site location for the generated documentation @@ -20,14 +23,12 @@ let info = // For typical project, no changes are needed below // -------------------------------------------------------------------------------------- -#load "../../packages/FSharp.Formatting/FSharp.Formatting.fsx" -#I "../../packages/FAKE/tools" -#r "../../packages/FAKE/tools/FakeLib.dll" open Fake open System.IO -open Fake.FileHelper +open Fake.IO.FileSystemOperators +open Fake.IO +open Fake.Core open FSharp.Literate -open FSharp.MetadataFormat let root = "." @@ -48,19 +49,20 @@ let layoutRoots = // Copy static files and CSS + JS from F# Formatting let copyFiles () = - CopyRecursive files output true |> Log "Copying file: " - ensureDirectory (output @@ "content") - CopyRecursive (formatting @@ "styles") (output @@ "content") true - |> Log "Copying styles and scripts: " + Shell.copyRecursive files output true + |> Trace.tracefn "Copying file: %A" + Directory.ensure (output @@ "content") + Shell.copyRecursive (formatting @@ "styles") (output @@ "content") true + |> Trace.tracefn "Copying styles and scripts: %A" let clr = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() let fsfmt = __SOURCE_DIRECTORY__ @@ ".." @@ ".." @@ @"packages" @@ "FSharp.Formatting" @@ "lib" @@ "net40" // Build API reference from XML comments let buildReference () = - CleanDir (output @@ "reference") + Shell.cleanDir (output @@ "reference") for lib in referenceBinaries do - MetadataFormat.Generate + RazorMetadataFormat.Generate ( bin @@ lib, output @@ "reference", layoutRoots, parameters = ("root", root)::info, sourceRepo = "https://github.com/fsharp/FSharp.Compiler.Service/tree/master/src", @@ -87,7 +89,7 @@ let buildReference () = let buildDocumentation () = for dir in [content] do let sub = if dir.Length > content.Length then dir.Substring(content.Length + 1) else "." - Literate.ProcessDirectory + RazorLiterate.ProcessDirectory ( dir, docTemplate, output @@ sub, replacements = ("root", root)::info, layoutRoots = layoutRoots, generateAnchors = true, processRecursive=false ) diff --git a/fcs/download-paket.ps1 b/fcs/download-paket.ps1 deleted file mode 100644 index 4541168012b..00000000000 --- a/fcs/download-paket.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -$paketurl="https://github.com/fsprojects/Paket/releases/download/5.215.0/paket.exe" -$paketdir = Join-Path $PSScriptRoot ".paket" -$paketpath = Join-Path $paketdir "paket.exe" - -# Enable TLS 1.2 and TLS 1.1 as Security Protocols -[Net.ServicePointManager]::SecurityProtocol = ` - [Net.SecurityProtocolType]::Tls12, - [Net.SecurityProtocolType]::Tls11; - -if (-not (Test-Path "$paketpath")) { - if (-not (Test-Path "$paketdir")) { - mkdir "$paketdir" - } - Invoke-WebRequest -Uri $paketurl -OutFile "$paketpath" -} diff --git a/fcs/download-paket.sh b/fcs/download-paket.sh deleted file mode 100755 index 2825ac4d5ae..00000000000 --- a/fcs/download-paket.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" - -# resolve $source until the file is no longer a symlink -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -paketurl=https://github.com/fsprojects/Paket/releases/download/5.215.0/paket.exe -paketdir=$scriptroot/.paket -paketpath=$paketdir/paket.exe -if [ ! -e "$paketpath" ]; then - if [ ! -e "$paketdir" ]; then - mkdir "$paketdir" - fi - curl -o "$paketpath" -L $paketurl -fi diff --git a/fcs/global.json b/fcs/global.json new file mode 100644 index 00000000000..2223a05e312 --- /dev/null +++ b/fcs/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "3.0.100" + } +} \ No newline at end of file diff --git a/fcs/paket.dependencies b/fcs/paket.dependencies index d23e0010e76..c3d2f47304e 100644 --- a/fcs/paket.dependencies +++ b/fcs/paket.dependencies @@ -1,6 +1,29 @@ -framework: net461 +source https://api.nuget.org/v3/index.json -source https://www.nuget.org/api/v2/ +storage: none +framework: netstandard2.0 -nuget FAKE 5.8.4 -nuget FSharp.Formatting +nuget FSharp.Core ~> 4.7 +nuget Fake.BuildServer.AppVeyor +nuget Fake.Core +nuget Fake.Core.Environment +nuget Fake.Core.Process +nuget Fake.Core.ReleaseNotes +nuget Fake.Core.Target +nuget Fake.Core.UserInput +nuget Fake.DotNet.Cli +nuget Fake.DotNet.Fsi +nuget Fake.DotNet.Paket + +group generate + +source https://api.nuget.org/v3/index.json + +storage: none +framework: netstandard2.0 + +nuget FSharp.Core +nuget Fake.Core +nuget Fake.IO.FileSystem +nuget Fake.Core.Trace +nuget FSharp.Literate diff --git a/fcs/paket.lock b/fcs/paket.lock index 85f5ff5efec..13fe5c84cc2 100644 --- a/fcs/paket.lock +++ b/fcs/paket.lock @@ -1,19 +1,1089 @@ -RESTRICTION: == net461 +STORAGE: NONE +RESTRICTION: == netstandard2.0 NUGET - remote: https://www.nuget.org/api/v2 - FAKE (5.8.4) + remote: https://api.nuget.org/v3/index.json + BlackFox.VsWhere (1.0) + FSharp.Core (>= 4.2.3) + Fake.BuildServer.AppVeyor (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + Fake.Net.Http (>= 5.18.3) + FSharp.Core (>= 4.7) + System.Diagnostics.FileVersionInfo (>= 4.3) + System.Diagnostics.Process (>= 4.3) + System.IO.FileSystem.Watcher (>= 4.3) + System.Net.Http (>= 4.3.4) + System.Xml.ReaderWriter (>= 4.3.1) + System.Xml.XDocument (>= 4.3) + System.Xml.XmlDocument (>= 4.3) + System.Xml.XPath (>= 4.3) + System.Xml.XPath.XDocument (>= 4.3) + System.Xml.XPath.XmlDocument (>= 4.3) + Fake.Core (5.16) + Fake.Core.CommandLineParsing (5.18.3) + FParsec (>= 1.0.3) + FSharp.Core (>= 4.7) + Fake.Core.Context (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Environment (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.FakeVar (5.18.3) + Fake.Core.Context (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Process (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.FakeVar (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + FSharp.Core (>= 4.7) + System.Diagnostics.Process (>= 4.3) + Fake.Core.ReleaseNotes (5.18.3) + Fake.Core.SemVer (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.SemVer (5.18.3) + FSharp.Core (>= 4.7) + System.Runtime.Numerics (>= 4.3) + Fake.Core.String (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Target (5.18.3) + Fake.Core.CommandLineParsing (>= 5.18.3) + Fake.Core.Context (>= 5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.FakeVar (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + FSharp.Control.Reactive (>= 4.2) + FSharp.Core (>= 4.7) + System.Reactive.Compatibility (>= 4.2) + Fake.Core.Tasks (5.18.3) + Fake.Core.Trace (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Trace (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.FakeVar (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.UserInput (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Xml (5.18.3) + Fake.Core.String (>= 5.18.3) + FSharp.Core (>= 4.7) + System.Xml.ReaderWriter (>= 4.3.1) + System.Xml.XDocument (>= 4.3) + System.Xml.XPath (>= 4.3) + System.Xml.XPath.XDocument (>= 4.3) + System.Xml.XPath.XmlDocument (>= 4.3) + Fake.DotNet.Cli (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.DotNet.MSBuild (>= 5.18.3) + Fake.DotNet.NuGet (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + FSharp.Core (>= 4.7) + Mono.Posix.NETStandard (>= 1.0) + Newtonsoft.Json (>= 12.0.2) + Fake.DotNet.Fsi (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.DotNet.MSBuild (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + Fake.Tools.Git (>= 5.18.3) + FSharp.Compiler.Service (>= 32.0) + FSharp.Core (>= 4.7) + Fake.DotNet.MSBuild (5.18.3) + BlackFox.VsWhere (>= 1.0) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + FSharp.Core (>= 4.7) + MSBuild.StructuredLogger (>= 2.0.110) + Fake.DotNet.NuGet (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.SemVer (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Tasks (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.Core.Xml (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + Fake.Net.Http (>= 5.18.3) + FSharp.Core (>= 4.7) + Newtonsoft.Json (>= 12.0.2) + NuGet.Protocol (>= 4.9.4) + System.Net.Http (>= 4.3.4) + Fake.DotNet.Paket (5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.DotNet.Cli (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.IO.FileSystem (5.18.3) + Fake.Core.String (>= 5.18.3) + FSharp.Core (>= 4.7) + System.Diagnostics.FileVersionInfo (>= 4.3) + System.IO.FileSystem.Watcher (>= 4.3) + Fake.Net.Http (5.18.3) + Fake.Core.Trace (>= 5.18.3) + FSharp.Core (>= 4.7) + System.Net.Http (>= 4.3.4) + Fake.Tools.Git (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.Process (>= 5.18.3) + Fake.Core.SemVer (>= 5.18.3) + Fake.Core.String (>= 5.18.3) + Fake.Core.Trace (>= 5.18.3) + Fake.IO.FileSystem (>= 5.18.3) + FSharp.Core (>= 4.7) + FParsec (1.0.3) + FSharp.Core (>= 4.2.3) + NETStandard.Library (>= 1.6.1) + FSharp.Compiler.Service (33.0) + FSharp.Core (>= 4.6.2) + System.Collections.Immutable (>= 1.5) + System.Diagnostics.Process (>= 4.1) + System.Diagnostics.TraceSource (>= 4.0) + System.Reflection.Emit (>= 4.3) + System.Reflection.Metadata (>= 1.6) + System.Reflection.TypeExtensions (>= 4.3) + System.Runtime.Loader (>= 4.0) + System.Security.Cryptography.Algorithms (>= 4.3) + FSharp.Control.Reactive (4.2) + FSharp.Core (>= 4.2.3) + System.Reactive (>= 4.0) + FSharp.Core (4.7) + Microsoft.Build (16.3) + Microsoft.Build.Framework (16.3) + System.Runtime.Serialization.Primitives (>= 4.1.1) + System.Threading.Thread (>= 4.0) + Microsoft.Build.Tasks.Core (16.3) + Microsoft.Build.Framework (>= 16.3) + Microsoft.Build.Utilities.Core (>= 16.3) + Microsoft.Win32.Registry (>= 4.3) + System.CodeDom (>= 4.4) + System.Collections.Immutable (>= 1.5) + System.Linq.Parallel (>= 4.0.1) + System.Net.Http (>= 4.3.4) + System.Reflection.Metadata (>= 1.6) + System.Reflection.TypeExtensions (>= 4.1) + System.Resources.Extensions (>= 4.6) + System.Resources.Writer (>= 4.0) + System.Threading.Tasks.Dataflow (>= 4.9) + Microsoft.Build.Utilities.Core (16.3) + Microsoft.Build.Framework (>= 16.3) + Microsoft.Win32.Registry (>= 4.3) + System.Collections.Immutable (>= 1.5) + System.Text.Encoding.CodePages (>= 4.0.1) + Microsoft.NETCore.Platforms (3.0) + Microsoft.NETCore.Targets (3.0) + Microsoft.Win32.Primitives (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + Microsoft.Win32.Registry (4.6) + System.Buffers (>= 4.5) + System.Memory (>= 4.5.3) + System.Security.AccessControl (>= 4.6) + System.Security.Principal.Windows (>= 4.6) + Mono.Posix.NETStandard (1.0) + MSBuild.StructuredLogger (2.0.152) + Microsoft.Build (>= 15.8.166) + Microsoft.Build.Framework (>= 15.8.166) + Microsoft.Build.Tasks.Core (>= 15.8.166) + Microsoft.Build.Utilities.Core (>= 15.8.166) + NETStandard.Library (2.0.3) + Microsoft.NETCore.Platforms (>= 1.1) + Newtonsoft.Json (12.0.3) + NuGet.Common (5.3.1) + NuGet.Frameworks (>= 5.3.1) + System.Diagnostics.Process (>= 4.3) + System.Threading.Thread (>= 4.3) + NuGet.Configuration (5.3.1) + NuGet.Common (>= 5.3.1) + System.Security.Cryptography.ProtectedData (>= 4.3) + NuGet.Frameworks (5.3.1) + NuGet.Packaging (5.3.1) + Newtonsoft.Json (>= 9.0.1) + NuGet.Configuration (>= 5.3.1) + NuGet.Versioning (>= 5.3.1) + System.Dynamic.Runtime (>= 4.3) + NuGet.Protocol (5.3.1) + NuGet.Packaging (>= 5.3.1) + System.Dynamic.Runtime (>= 4.3) + NuGet.Versioning (5.3.1) + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.native.System (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + runtime.native.System.Net.Http (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + runtime.native.System.Security.Cryptography.Apple (4.3.1) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) + runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + System.Buffers (4.5) + System.CodeDom (4.6) + System.Collections (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Collections.Concurrent (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.Reflection (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Collections.Immutable (1.6) + System.Memory (>= 4.5.3) + System.Diagnostics.Debug (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Diagnostics.DiagnosticSource (4.6) + System.Memory (>= 4.5.3) + System.Diagnostics.FileVersionInfo (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Reflection.Metadata (>= 1.4.1) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Diagnostics.Process (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.Win32.Primitives (>= 4.3) + Microsoft.Win32.Registry (>= 4.3) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Text.Encoding.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Thread (>= 4.3) + System.Threading.ThreadPool (>= 4.3) + System.Diagnostics.Tools (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Diagnostics.TraceSource (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Diagnostics.Tracing (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Dynamic.Runtime (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Linq (>= 4.3) + System.Linq.Expressions (>= 4.3) + System.ObjectModel (>= 4.3) + System.Reflection (>= 4.3) + System.Reflection.Emit (>= 4.3) + System.Reflection.Emit.ILGeneration (>= 4.3) + System.Reflection.Primitives (>= 4.3) + System.Reflection.TypeExtensions (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Globalization (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Globalization.Calendars (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Globalization (>= 4.3) + System.Runtime (>= 4.3) + System.Globalization.Extensions (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.IO (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.IO.FileSystem (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.IO (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.IO.FileSystem.Primitives (4.3) + System.Runtime (>= 4.3) + System.IO.FileSystem.Watcher (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.Win32.Primitives (>= 4.3) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Overlapped (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Thread (>= 4.3) + System.Linq (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Linq.Expressions (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Linq (>= 4.3) + System.ObjectModel (>= 4.3) + System.Reflection (>= 4.3) + System.Reflection.Emit (>= 4.3) + System.Reflection.Emit.ILGeneration (>= 4.3) + System.Reflection.Emit.Lightweight (>= 4.3) + System.Reflection.Extensions (>= 4.3) + System.Reflection.Primitives (>= 4.3) + System.Reflection.TypeExtensions (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Linq.Parallel (4.3) + System.Collections (>= 4.3) + System.Collections.Concurrent (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Linq (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Memory (4.5.3) + System.Buffers (>= 4.4) + System.Numerics.Vectors (>= 4.4) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) + System.Net.Http (4.3.4) + Microsoft.NETCore.Platforms (>= 1.1.1) + runtime.native.System (>= 4.3) + runtime.native.System.Net.Http (>= 4.3) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Diagnostics.DiagnosticSource (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.Globalization.Extensions (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.Net.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Cryptography.Algorithms (>= 4.3) + System.Security.Cryptography.Encoding (>= 4.3) + System.Security.Cryptography.OpenSsl (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Security.Cryptography.X509Certificates (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Net.Primitives (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + System.Runtime (>= 4.3.1) + System.Runtime.Handles (>= 4.3) + System.Numerics.Vectors (4.5) + System.ObjectModel (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Threading (>= 4.3) + System.Reactive (4.2) + System.Runtime.InteropServices.WindowsRuntime (>= 4.3) + System.Threading.Tasks.Extensions (>= 4.5.3) + System.Reactive.Compatibility (4.2) + System.Reactive.Core (>= 4.2) + System.Reactive.Interfaces (>= 4.2) + System.Reactive.Linq (>= 4.2) + System.Reactive.PlatformServices (>= 4.2) + System.Reactive.Providers (>= 4.2) + System.Reactive.Core (4.2) + System.Reactive (>= 4.2) + System.Threading.Tasks.Extensions (>= 4.5.3) + System.Reactive.Interfaces (4.2) + System.Reactive (>= 4.2) + System.Threading.Tasks.Extensions (>= 4.5.3) + System.Reactive.Linq (4.2) + System.Reactive (>= 4.2) + System.Threading.Tasks.Extensions (>= 4.5.3) + System.Reactive.PlatformServices (4.2) + System.Reactive (>= 4.2) + System.Threading.Tasks.Extensions (>= 4.5.3) + System.Reactive.Providers (4.2) + System.Reactive (>= 4.2) + System.Threading.Tasks.Extensions (>= 4.5.3) + System.Reflection (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.IO (>= 4.3) + System.Reflection.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Reflection.Emit (4.6) + System.Reflection.Emit.ILGeneration (>= 4.6) + System.Reflection.Emit.ILGeneration (4.6) + System.Reflection.Emit.Lightweight (4.6) + System.Reflection.Emit.ILGeneration (>= 4.6) + System.Reflection.Extensions (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Reflection (>= 4.3) + System.Runtime (>= 4.3) + System.Reflection.Metadata (1.7) + System.Collections.Immutable (>= 1.6) + System.Reflection.Primitives (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Reflection.TypeExtensions (4.6) + System.Resources.Extensions (4.6) + System.Memory (>= 4.5.3) + System.Resources.ResourceManager (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Globalization (>= 4.3) + System.Reflection (>= 4.3) + System.Runtime (>= 4.3) + System.Resources.Writer (4.3) + System.Collections (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Runtime (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + System.Runtime.CompilerServices.Unsafe (4.6) + System.Runtime.Extensions (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + System.Runtime (>= 4.3.1) + System.Runtime.Handles (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Runtime.InteropServices (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Reflection (>= 4.3) + System.Reflection.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices.WindowsRuntime (4.3) + System.Runtime (>= 4.3) + System.Runtime.Loader (4.3) + System.IO (>= 4.3) + System.Reflection (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Numerics (4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Serialization.Primitives (4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Security.AccessControl (4.6) + System.Security.Principal.Windows (>= 4.6) + System.Security.Cryptography.Algorithms (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) + System.Collections (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Runtime.Numerics (>= 4.3) + System.Security.Cryptography.Encoding (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Security.Cryptography.Cng (4.6) + System.Security.Cryptography.Csp (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.IO (>= 4.3) + System.Reflection (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Cryptography.Algorithms (>= 4.3) + System.Security.Cryptography.Encoding (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Security.Cryptography.Encoding (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) + System.Collections (>= 4.3) + System.Collections.Concurrent (>= 4.3) + System.Linq (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Security.Cryptography.OpenSsl (4.6) + System.Security.Cryptography.Primitives (4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Security.Cryptography.ProtectedData (4.6) + System.Memory (>= 4.5.3) + System.Security.Cryptography.X509Certificates (4.3.2) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System (>= 4.3) + runtime.native.System.Net.Http (>= 4.3) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.Globalization.Calendars (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Runtime.Numerics (>= 4.3) + System.Security.Cryptography.Algorithms (>= 4.3) + System.Security.Cryptography.Cng (>= 4.3) + System.Security.Cryptography.Csp (>= 4.3) + System.Security.Cryptography.Encoding (>= 4.3) + System.Security.Cryptography.OpenSsl (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Security.Principal.Windows (4.6) + System.Text.Encoding (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Text.Encoding.CodePages (4.6) + System.Runtime.CompilerServices.Unsafe (>= 4.6) + System.Text.Encoding.Extensions (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Text.RegularExpressions (4.3.1) + System.Collections (>= 4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3.1) + System.Runtime.Extensions (>= 4.3.1) + System.Threading (>= 4.3) + System.Threading (4.3) + System.Runtime (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Overlapped (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Threading.Tasks (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Threading.Tasks.Dataflow (4.10) + System.Threading.Tasks.Extensions (4.5.3) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) + System.Threading.Thread (4.3) + System.Runtime (>= 4.3) + System.Threading.ThreadPool (4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Xml.ReaderWriter (4.3.1) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Text.Encoding.Extensions (>= 4.3) + System.Text.RegularExpressions (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Tasks.Extensions (>= 4.3) + System.Xml.XDocument (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Diagnostics.Tools (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Reflection (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Xml.ReaderWriter (>= 4.3) + System.Xml.XmlDocument (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Xml.ReaderWriter (>= 4.3) + System.Xml.XPath (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Xml.ReaderWriter (>= 4.3) + System.Xml.XPath.XDocument (4.3) + System.Diagnostics.Debug (>= 4.3) + System.Linq (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Xml.ReaderWriter (>= 4.3) + System.Xml.XDocument (>= 4.3) + System.Xml.XPath (>= 4.3) + System.Xml.XPath.XmlDocument (4.3) + System.Collections (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Xml.ReaderWriter (>= 4.3) + System.Xml.XmlDocument (>= 4.3) + System.Xml.XPath (>= 4.3) + +GROUP generate +STORAGE: NONE +RESTRICTION: == netstandard2.0 +NUGET + remote: https://api.nuget.org/v3/index.json + Fake.Core (5.16) + Fake.Core.Context (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Environment (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.FakeVar (5.18.3) + Fake.Core.Context (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.String (5.18.3) + FSharp.Core (>= 4.7) + Fake.Core.Trace (5.18.3) + Fake.Core.Environment (>= 5.18.3) + Fake.Core.FakeVar (>= 5.18.3) + FSharp.Core (>= 4.7) + Fake.IO.FileSystem (5.18.3) + Fake.Core.String (>= 5.18.3) + FSharp.Core (>= 4.7) + System.Diagnostics.FileVersionInfo (>= 4.3) + System.IO.FileSystem.Watcher (>= 4.3) FSharp.Compiler.Service (27.0.1) FSharp.Core (>= 4.5.2) System.Collections.Immutable (>= 1.5) + System.Diagnostics.Process (>= 4.1) + System.Diagnostics.TraceSource (>= 4.0) + System.Reflection.Emit (>= 4.3) System.Reflection.Metadata (>= 1.6) - System.ValueTuple (>= 4.4) - FSharp.Core (4.6.2) - FSharp.Formatting (3.1) + System.Reflection.TypeExtensions (>= 4.3) + System.Runtime.Loader (>= 4.0) + System.Security.Cryptography.Algorithms (>= 4.3) + FSharp.Core (4.7) + FSharp.Literate (3.1) FSharp.Compiler.Service (>= 27.0.1 < 28.0) - Microsoft.AspNet.Razor (>= 3.2.7 < 4.0) System.ValueTuple (>= 4.5 < 5.0) - Microsoft.AspNet.Razor (3.2.7) - System.Collections.Immutable (1.5) - System.Reflection.Metadata (1.6) - System.Collections.Immutable (>= 1.5) + Microsoft.NETCore.Platforms (3.0) + Microsoft.NETCore.Targets (3.0) + Microsoft.Win32.Primitives (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + Microsoft.Win32.Registry (4.6) + System.Buffers (>= 4.5) + System.Memory (>= 4.5.3) + System.Security.AccessControl (>= 4.6) + System.Security.Principal.Windows (>= 4.6) + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.native.System (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + runtime.native.System.Security.Cryptography.Apple (4.3.1) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) + runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1) + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) + System.Buffers (4.5) + System.Collections (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Collections.Concurrent (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.Reflection (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Collections.Immutable (1.6) + System.Memory (>= 4.5.3) + System.Diagnostics.Debug (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Diagnostics.FileVersionInfo (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Reflection.Metadata (>= 1.4.1) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Diagnostics.Process (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.Win32.Primitives (>= 4.3) + Microsoft.Win32.Registry (>= 4.3) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Text.Encoding.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Thread (>= 4.3) + System.Threading.ThreadPool (>= 4.3) + System.Diagnostics.TraceSource (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Diagnostics.Tracing (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Globalization (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.IO (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.IO.FileSystem (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.IO (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.IO.FileSystem.Primitives (4.3) + System.Runtime (>= 4.3) + System.IO.FileSystem.Watcher (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.Win32.Primitives (>= 4.3) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Overlapped (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Thread (>= 4.3) + System.Linq (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Memory (4.5.3) + System.Buffers (>= 4.4) + System.Numerics.Vectors (>= 4.4) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) + System.Numerics.Vectors (4.5) + System.Reflection (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.IO (>= 4.3) + System.Reflection.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Reflection.Emit (4.6) + System.Reflection.Emit.ILGeneration (>= 4.6) + System.Reflection.Emit.ILGeneration (4.6) + System.Reflection.Metadata (1.7) + System.Collections.Immutable (>= 1.6) + System.Reflection.Primitives (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Reflection.TypeExtensions (4.6) + System.Resources.ResourceManager (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Globalization (>= 4.3) + System.Reflection (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + System.Runtime.CompilerServices.Unsafe (4.6) + System.Runtime.Extensions (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + System.Runtime (>= 4.3.1) + System.Runtime.Handles (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Runtime.InteropServices (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Reflection (>= 4.3) + System.Reflection.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.Loader (4.3) + System.IO (>= 4.3) + System.Reflection (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Numerics (4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Security.AccessControl (4.6) + System.Security.Principal.Windows (>= 4.6) + System.Security.Cryptography.Algorithms (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) + System.Collections (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Runtime.Numerics (>= 4.3) + System.Security.Cryptography.Encoding (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Security.Cryptography.Encoding (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) + System.Collections (>= 4.3) + System.Collections.Concurrent (>= 4.3) + System.Linq (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Security.Cryptography.Primitives (4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Security.Principal.Windows (4.6) + System.Text.Encoding (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Text.Encoding.Extensions (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (4.3) + System.Runtime (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Overlapped (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Threading.Tasks (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.Runtime (>= 4.3) + System.Threading.Thread (4.3) + System.Runtime (>= 4.3) + System.Threading.ThreadPool (4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) System.ValueTuple (4.5) diff --git a/fcs/samples/EditorService/Program.fs b/fcs/samples/EditorService/Program.fs index e3ab70185c3..d457bf17c91 100644 --- a/fcs/samples/EditorService/Program.fs +++ b/fcs/samples/EditorService/Program.fs @@ -1,6 +1,4 @@ // Open the namespace with InteractiveChecker type -open System -open FSharp.Compiler open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.QuickParse diff --git a/fcs/samples/FscExe/FscMain.fs b/fcs/samples/FscExe/FscMain.fs index 26f26be63d1..da272800d65 100644 --- a/fcs/samples/FscExe/FscMain.fs +++ b/fcs/samples/FscExe/FscMain.fs @@ -7,12 +7,10 @@ open System.Diagnostics open System.IO open System.Reflection open System.Runtime.CompilerServices -open FSharp.Compiler open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.AbstractIL.IL // runningOnMono open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.Range #if RESIDENT_COMPILER type TypeInThisAssembly() = member x.Dummy = 1 diff --git a/fcs/samples/FsiExe/fsimain.fs b/fcs/samples/FsiExe/fsimain.fs index c59ef2fe50f..5fb34c3af17 100644 --- a/fcs/samples/FsiExe/fsimain.fs +++ b/fcs/samples/FsiExe/fsimain.fs @@ -17,13 +17,11 @@ module internal Sample.FSharp.Compiler.Interactive.Main open System open System.Globalization -open System.IO open System.Reflection open System.Threading open System.Windows.Forms open FSharp.Compiler.Interactive.Shell -open FSharp.Compiler.Interactive open FSharp.Compiler #nowarn "55" diff --git a/fcs/samples/UntypedTree/Program.fs b/fcs/samples/UntypedTree/Program.fs index ba6afb2dd2b..9d99b8199f8 100644 --- a/fcs/samples/UntypedTree/Program.fs +++ b/fcs/samples/UntypedTree/Program.fs @@ -1,5 +1,4 @@ // Open the namespace with InteractiveChecker type -open System open FSharp.Compiler.SourceCodeServices diff --git a/global.json b/global.json index d506e565469..707f7b7357e 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19502.11", + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19602.4", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } diff --git a/src/fsharp/FSharp.Core.nuget/icon.png b/icon.png similarity index 100% rename from src/fsharp/FSharp.Core.nuget/icon.png rename to icon.png diff --git a/src/absil/bytes.fs b/src/absil/bytes.fs index a272b99a454..fd5f14247cf 100644 --- a/src/absil/bytes.fs +++ b/src/absil/bytes.fs @@ -3,11 +3,7 @@ /// Byte arrays namespace FSharp.Compiler.AbstractIL.Internal -open System.IO -open Internal.Utilities -open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.Internal module internal Bytes = let b0 n = (n &&& 0xFF) @@ -87,10 +83,10 @@ type internal ByteBuffer = let n = arr.Length let newSize = buf.bbCurrent + n buf.Ensure newSize - let bbarr = buf.bbArray - let bbbase = buf.bbCurrent + let bbArr = buf.bbArray + let bbBase = buf.bbCurrent for i = 0 to n - 1 do - bbarr.[bbbase + i] <- byte arr.[i] + bbArr.[bbBase + i] <- byte arr.[i] buf.bbCurrent <- newSize member bb.FixupInt32 pos n = diff --git a/src/absil/il.fs b/src/absil/il.fs index 51b75e55fbb..fb6e5bc320a 100644 --- a/src/absil/il.fs +++ b/src/absil/il.fs @@ -12,7 +12,6 @@ open System.IO open System.Collections open System.Collections.Generic open System.Collections.Concurrent -open System.Runtime.CompilerServices open System.Reflection open System.Text open System.Threading @@ -2962,7 +2961,7 @@ let mkILNonGenericEmptyCtor tag superTy = mkILCtor (ILMemberAccess.Public, [], mkMethodBody (false, [], 8, nonBranchingInstrsToCode ctor, tag)) // -------------------------------------------------------------------- -// Make a static, top level monomophic method - very useful for +// Make a static, top level monomorphic method - very useful for // creating helper ILMethodDefs for internal use. // -------------------------------------------------------------------- @@ -3324,7 +3323,7 @@ let mkILSimpleModule assemblyName modname dll subsystemVersion useHighEntropyVA // [instructions_to_code] makes the basic block structure of code from // a primitive array of instructions. We // do this be iterating over the instructions, pushing new basic blocks -// everytime we encounter an address that has been recorded +// every time we encounter an address that has been recorded // [bbstartToCodeLabelMap]. //----------------------------------------------------------------------- diff --git a/src/absil/ilascii.fs b/src/absil/ilascii.fs index cf8cef0a631..6c89ca69b59 100644 --- a/src/absil/ilascii.fs +++ b/src/absil/ilascii.fs @@ -8,7 +8,7 @@ open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.IL // set to the proper value at CompileOps.fs (BuildFrameworkTcImports) -// Only reelvant when compiling FSharp.Core.dll +// Only relevant when compiling FSharp.Core.dll let parseILGlobals = ref EcmaMscorlibILGlobals /// Table of parsing and pretty printing data for instructions. diff --git a/src/absil/ilbinary.fs b/src/absil/ilbinary.fs index 2b22b4cbabb..eea2f06bfda 100644 --- a/src/absil/ilbinary.fs +++ b/src/absil/ilbinary.fs @@ -2,10 +2,7 @@ module internal FSharp.Compiler.AbstractIL.Internal.BinaryConstants -open Internal.Utilities -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library [] diff --git a/src/absil/ildiag.fs b/src/absil/ildiag.fs index de7411fbf9b..1cd20ad8750 100644 --- a/src/absil/ildiag.fs +++ b/src/absil/ildiag.fs @@ -4,7 +4,6 @@ module internal FSharp.Compiler.AbstractIL.Diagnostics -open Internal.Utilities let diagnosticsLog = ref (Some stdout) diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 68b7c8d40a8..70e67a0815d 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -164,12 +164,12 @@ module Array = /// pass an array byref to reverse it in place let revInPlace (array: 'T []) = if Array.isEmpty array then () else - let arrlen, revlen = array.Length-1, array.Length/2 - 1 - for idx in 0 .. revlen do + let arrLen, revLen = array.Length-1, array.Length/2 - 1 + for idx in 0 .. revLen do let t1 = array.[idx] - let t2 = array.[arrlen-idx] + let t2 = array.[arrLen-idx] array.[idx] <- t2 - array.[arrlen-idx] <- t1 + array.[arrLen-idx] <- t1 /// Async implementation of Array.map. let mapAsync (mapping : 'T -> Async<'U>) (array : 'T[]) : Async<'U[]> = @@ -624,7 +624,7 @@ type CompilationThreadToken() = interface ExecutionToken let RequireCompilationThread (_ctok: CompilationThreadToken) = () /// Represents a place in the compiler codebase where we are passed a CompilationThreadToken unnecessarily. -/// This reprents code that may potentially not need to be executed on the compilation thread. +/// This represents code that may potentially not need to be executed on the compilation thread. let DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent (_ctok: CompilationThreadToken) = () /// Represents a place in the compiler codebase where we assume we are executing on a compilation thread diff --git a/src/absil/ilmorph.fs b/src/absil/ilmorph.fs index ffd86aa504b..b6fb7ce69b6 100644 --- a/src/absil/ilmorph.fs +++ b/src/absil/ilmorph.fs @@ -3,11 +3,8 @@ module internal FSharp.Compiler.AbstractIL.Morphs open System.Collections.Generic -open Internal.Utilities open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library -open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.IL let mutable morphCustomAttributeData = false @@ -50,7 +47,7 @@ let code_instr2instr_ty2ty (finstr,fty) (c:ILCode) = Exceptions = c.Exceptions |> List.map (fun e -> { e with Clause = e.Clause |> (function ILExceptionClause.TypeCatch (ilty, b) -> ILExceptionClause.TypeCatch (fty ilty, b) | cl -> cl) }) } // -------------------------------------------------------------------- -// Standard morphisms - mapping tyes etc. +// Standard morphisms - mapping types etc. // -------------------------------------------------------------------- let rec ty_tref2tref f x = diff --git a/src/absil/ilprint.fs b/src/absil/ilprint.fs index e2ed4e9302e..7f408d48cbc 100644 --- a/src/absil/ilprint.fs +++ b/src/absil/ilprint.fs @@ -2,16 +2,12 @@ module internal FSharp.Compiler.AbstractIL.ILAsciiWriter -open Internal.Utilities -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library -open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.Extensions.ILX.Types open FSharp.Compiler.AbstractIL.Internal.AsciiConstants open FSharp.Compiler.AbstractIL.IL -open System.Text open System.IO open System.Reflection diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index 38c1c5ff817..cc5c865515a 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -18,7 +18,6 @@ open System.Runtime.InteropServices open System.Text open Internal.Utilities open Internal.Utilities.Collections -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Support open FSharp.Compiler.AbstractIL.Diagnostics @@ -27,7 +26,6 @@ open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range -open Microsoft.FSharp.NativeInterop open System.Reflection let checking = false @@ -4128,7 +4126,6 @@ let OpenILModuleReader fileName opts = [] module Shim = - open FSharp.Compiler.Lib type IAssemblyReader = abstract GetILModuleReader: filename: string * readerOptions: ILReaderOptions -> ILModuleReader diff --git a/src/absil/ilreflect.fs b/src/absil/ilreflect.fs index cf43af269e6..69209100b98 100644 --- a/src/absil/ilreflect.fs +++ b/src/absil/ilreflect.fs @@ -19,7 +19,6 @@ open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.IL -open FSharp.Compiler.AbstractIL.ILAsciiWriter open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range open FSharp.Core.Printf @@ -1724,7 +1723,7 @@ let buildMethodImplsPass3 cenv _tref (typB: TypeBuilder) emEnv (mimpl: IL.ILMeth // typeAttributesOf* //---------------------------------------------------------------------------- -let typeAttrbutesOfTypeDefKind x = +let typeAttributesOfTypeDefKind x = match x with // required for a TypeBuilder | ILTypeDefKind.Class -> TypeAttributes.Class @@ -1733,14 +1732,14 @@ let typeAttrbutesOfTypeDefKind x = | ILTypeDefKind.Enum -> TypeAttributes.Class | ILTypeDefKind.Delegate -> TypeAttributes.Class -let typeAttrbutesOfTypeAccess x = +let typeAttributesOfTypeAccess x = match x with | ILTypeDefAccess.Public -> TypeAttributes.Public | ILTypeDefAccess.Private -> TypeAttributes.NotPublic | ILTypeDefAccess.Nested macc -> match macc with | ILMemberAccess.Assembly -> TypeAttributes.NestedAssembly - | ILMemberAccess.CompilerControlled -> failwith "Nested compiler controled." + | ILMemberAccess.CompilerControlled -> failwith "Nested compiler controlled." | ILMemberAccess.FamilyAndAssembly -> TypeAttributes.NestedFamANDAssem | ILMemberAccess.FamilyOrAssembly -> TypeAttributes.NestedFamORAssem | ILMemberAccess.Family -> TypeAttributes.NestedFamily @@ -1929,7 +1928,7 @@ let rec getTypeRefsInType (allTypes: CollectTypes) ty acc = | CollectTypes.ValueTypesOnly -> acc | CollectTypes.All -> getTypeRefsInType allTypes eltType acc | ILType.Value tspec -> - // We usee CollectTypes.All because the .NET type loader appears to always eagerly require all types + // We use CollectTypes.All because the .NET type loader appears to always eagerly require all types // referred to in an instantiation of a generic value type tspec.TypeRef :: List.foldBack (getTypeRefsInType CollectTypes.All) tspec.GenericArgs acc | ILType.Boxed tspec -> diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index fb8a98b3494..a5dbe768b88 100644 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -2,11 +2,8 @@ module internal FSharp.Compiler.AbstractIL.Internal.Support -open Internal.Utilities open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal -open FSharp.Compiler.AbstractIL.Internal.Bytes -open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Internal.NativeRes #if FX_NO_CORHOST_SIGNER @@ -15,7 +12,6 @@ open FSharp.Compiler.AbstractIL.Internal.StrongNameSign open System open System.IO -open System.Text open System.Reflection #if !FX_NO_SYMBOLSTORE @@ -757,7 +753,7 @@ type ISymUnmanagedWriter2 = abstract OpenScope: startOffset: int * pRetVal: int byref -> unit abstract CloseScope: endOffset: int -> unit abstract SetScopeRange: scopeID: int * startOffset: int * endOffset: int -> unit - abstract DefineLocalVariable: [] varname: string * + abstract DefineLocalVariable: [] varName: string * attributes: int * cSig: int * []signature: byte[] * @@ -767,7 +763,7 @@ type ISymUnmanagedWriter2 = addr3: int * startOffset: int * endOffset: int -> unit - abstract DefineParameter: [] paramname: string * + abstract DefineParameter: [] paramName: string * attributes: int * sequence: int * addressKind: int * @@ -775,7 +771,7 @@ type ISymUnmanagedWriter2 = addr2: int * addr3: int -> unit abstract DefineField: parent: int * - [] fieldname: string * + [] fieldName: string * attributes: int * cSig: int * []signature: byte[] * @@ -783,7 +779,7 @@ type ISymUnmanagedWriter2 = addr1: int * addr2: int * addr3: int -> unit - abstract DefineGlobalVariable: [] globalvarname: string * + abstract DefineGlobalVariable: [] globalVarName: string * attributes: int * cSig: int * []signature: byte[] * @@ -793,7 +789,7 @@ type ISymUnmanagedWriter2 = addr3: int -> unit abstract Close: unit -> unit abstract SetSymAttribute: parent: int * - [] attname: string * + [] attName: string * cData: int * []data: byte[] -> unit abstract OpenNamespace: [] nsname: string -> unit @@ -822,16 +818,16 @@ type ISymUnmanagedWriter2 = []endColumns: int [] -> unit abstract RemapToken: oldToken: int * newToken: int -> unit abstract Initialize2: emitter: nativeint * - [] tempfilename: string * + [] tempFileName: string * stream: IStream * fullBuild: bool * - [] finalfilename: string -> unit - abstract DefineConstant: [] constname: string * + [] finalFileName: string -> unit + abstract DefineConstant: [] constName: string * value: Object * cSig: int * []signature: byte[] -> unit abstract Abort: unit -> unit - abstract DefineLocalVariable2: [] localvarname2: string * + abstract DefineLocalVariable2: [] localVarName2: string * attributes: int * sigToken: int * addressKind: int * @@ -840,14 +836,14 @@ type ISymUnmanagedWriter2 = addr3: int * startOffset: int * endOffset: int -> unit - abstract DefineGlobalVariable2: [] globalvarname2: string * + abstract DefineGlobalVariable2: [] globalVarName2: string * attributes: int * sigToken: int * addressKind: int * addr1: int * addr2: int * addr3: int -> unit - abstract DefineConstant2: [] constantname2: string * + abstract DefineConstant2: [] constantName2: string * value: Object * sigToken: int -> unit abstract OpenMethod2: method2: int * diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index dbd8a288755..409c91d590b 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -6,17 +6,13 @@ open System.Collections.Generic open System.IO open Internal.Utilities -open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.ILAsciiWriter open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Diagnostics -open FSharp.Compiler.AbstractIL.Extensions.ILX.Types open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.BinaryConstants open FSharp.Compiler.AbstractIL.Internal.Support open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.ILPdbWriter -open FSharp.Compiler.DiagnosticMessage open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range #if FX_NO_CORHOST_SIGNER @@ -476,8 +472,8 @@ type MetadataTable<'T> = h.Clear() t |> Array.iteri (fun i x -> h.[x] <- (i+1)) - member tbl.AddUniqueEntry nm geterr x = - if tbl.dict.ContainsKey x then failwith ("duplicate entry '"+geterr x+"' in "+nm+" table") + member tbl.AddUniqueEntry nm getter x = + if tbl.dict.ContainsKey x then failwith ("duplicate entry '"+getter x+"' in "+nm+" table") else tbl.AddSharedEntry x member tbl.GetTableEntry x = tbl.dict.[x] @@ -806,7 +802,7 @@ let getTypeDefOrRefAsUncodedToken (tag, idx) = else failwith "getTypeDefOrRefAsUncodedToken" getUncodedToken tab idx -// REVIEW: write into an accumuating buffer +// REVIEW: write into an accumulating buffer let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = let sized = List.filter (function (_, Some _) -> true | _ -> false) shape let lobounded = List.filter (function (Some _, _) -> true | _ -> false) shape @@ -834,7 +830,7 @@ let callconvToByte ntypars (Callconv (hasthis, bcc)) = | ILArgConvention.VarArg -> e_IMAGE_CEE_CS_CALLCONV_VARARG) -// REVIEW: write into an accumuating buffer +// REVIEW: write into an accumulating buffer let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec: ILTypeSpec) = if isNil tspec.GenericArgs then bb.EmitByte et @@ -944,7 +940,7 @@ and EmitCallsig cenv env bb (callconv, args: ILTypes, ret, varargs: ILVarArgs, g and GetCallsigAsBytes cenv env x = emitBytesViaBuffer (fun bb -> EmitCallsig cenv env bb x) -// REVIEW: write into an accumuating buffer +// REVIEW: write into an accumulating buffer and EmitTypes cenv env bb (inst: ILTypes) = inst |> List.iter (EmitType cenv env bb) @@ -976,7 +972,7 @@ let rec GetNativeTypeAsBlobIdx cenv (ty: ILNativeType) = and GetNativeTypeAsBytes ty = emitBytesViaBuffer (fun bb -> EmitNativeType bb ty) -// REVIEW: write into an accumuating buffer +// REVIEW: write into an accumulating buffer and EmitNativeType bb ty = if List.memAssoc ty (Lazy.force ILNativeTypeRevMap) then bb.EmitByte (List.assoc ty (Lazy.force ILNativeTypeRevMap)) @@ -1035,7 +1031,7 @@ and EmitNativeType bb ty = let rec GetFieldInitAsBlobIdx cenv (x: ILFieldInit) = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> GetFieldInit bb x)) -// REVIEW: write into an accumuating buffer +// REVIEW: write into an accumulating buffer and GetFieldInit (bb: ByteBuffer) x = match x with | ILFieldInit.String b -> bb.EmitBytes (System.Text.Encoding.Unicode.GetBytes b) @@ -1093,7 +1089,7 @@ let GetTypeAccessFlags access = | ILTypeDefAccess.Nested ILMemberAccess.Public -> 0x00000002 | ILTypeDefAccess.Nested ILMemberAccess.Private -> 0x00000003 | ILTypeDefAccess.Nested ILMemberAccess.Family -> 0x00000004 - | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type acccess" + | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type access" | ILTypeDefAccess.Nested ILMemberAccess.FamilyAndAssembly -> 0x00000006 | ILTypeDefAccess.Nested ILMemberAccess.FamilyOrAssembly -> 0x00000007 | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> 0x00000005 @@ -1258,7 +1254,7 @@ and GetFieldDefAsFieldDefIdx cenv tidx fd = // -------------------------------------------------------------------- // ILMethodRef --> ILMethodDef. // -// Only successfuly converts ILMethodRef's referring to +// Only successfully converts ILMethodRef's referring to // methods in the module being emitted. // -------------------------------------------------------------------- @@ -1439,7 +1435,7 @@ and GetFieldSpecAsMemberRefIdx cenv env fspec = let fenv = envForFieldSpec fspec FindOrAddSharedRow cenv TableNames.MemberRef (GetFieldSpecAsMemberRefRow cenv env fenv fspec) -// REVIEW: write into an accumuating buffer +// REVIEW: write into an accumulating buffer and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec: ILFieldSpec) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb fspec.FormalType @@ -1555,8 +1551,8 @@ type CodeBuffer = member codebuf.EmitUncodedToken u = codebuf.EmitInt32 u - member codebuf.RecordReqdStringFixup stringidx = - codebuf.reqdStringFixupsInMethod <- (codebuf.code.Position, stringidx) :: codebuf.reqdStringFixupsInMethod + member codebuf.RecordReqdStringFixup stringIdx = + codebuf.reqdStringFixupsInMethod <- (codebuf.code.Position, stringIdx) :: codebuf.reqdStringFixupsInMethod // Write a special value in that we check later when applying the fixup codebuf.EmitInt32 0xdeadbeef @@ -1592,7 +1588,7 @@ module Codebuf = go 0 (Array.length arr) let applyBrFixups (origCode : byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups origSeqPoints origScopes = - let orderedOrigReqdBrFixups = origReqdBrFixups |> List.sortBy (fun (_, fixuploc, _) -> fixuploc) + let orderedOrigReqdBrFixups = origReqdBrFixups |> List.sortBy (fun (_, fixupLoc, _) -> fixupLoc) let newCode = ByteBuffer.Create origCode.Length @@ -1732,7 +1728,7 @@ module Codebuf = | true, n -> let relOffset = n - endOfInstr if small then - if Bytes.get newCode newFixupLoc <> 0x98 then failwith "br fixupsanity check failed" + if Bytes.get newCode newFixupLoc <> 0x98 then failwith "br fixup sanity check failed" newCode.[newFixupLoc] <- b0 relOffset else checkFixup32 newCode newFixupLoc 0xf00dd00fl @@ -2820,7 +2816,7 @@ and GenExportedTypesPass3 cenv (ce: ILExportedTypesAndForwarders) = // manifest --> generate Assembly row // -------------------------------------------------------------------- -and GetManifsetAsAssemblyRow cenv m = +and GetManifestAsAssemblyRow cenv m = UnsharedRow [|ULong m.AuxModuleHashAlgorithm UShort (match m.Version with None -> 0us | Some version -> version.Major) @@ -2836,7 +2832,7 @@ and GetManifsetAsAssemblyRow cenv m = | ILAssemblyLongevity.PlatformSystem -> 0x0008) ||| (if m.Retargetable then 0x100 else 0x0) ||| // Setting these causes peverify errors. Hence both ilread and ilwrite ignore them and refuse to set them. - // Any debugging customattributes will automatically propagate + // Any debugging customAttributes will automatically propagate // REVIEW: No longer appears to be the case (if m.JitTracking then 0x8000 else 0x0) ||| (match m.PublicKey with None -> 0x0000 | Some _ -> 0x0001) ||| 0x0000) @@ -2845,7 +2841,7 @@ and GetManifsetAsAssemblyRow cenv m = (match m.Locale with None -> StringE 0 | Some x -> StringE (GetStringHeapIdx cenv x)) |] and GenManifestPass3 cenv m = - let aidx = AddUnsharedRow cenv TableNames.Assembly (GetManifsetAsAssemblyRow cenv m) + let aidx = AddUnsharedRow cenv TableNames.Assembly (GetManifestAsAssemblyRow cenv m) GenSecurityDeclsPass3 cenv (hds_Assembly, aidx) m.SecurityDecls.AsList GenCustomAttrsPass3Or4 cenv (hca_Assembly, aidx) m.CustomAttrs GenExportedTypesPass3 cenv m.ExportedTypes @@ -3033,7 +3029,7 @@ let nochunk next = ({addr= 0x0;size= 0x0; }, next) let count f arr = Array.fold (fun x y -> x + f y) 0x0 arr -module FileSystemUtilites = +module FileSystemUtilities = open System open System.Reflection open System.Globalization @@ -3630,7 +3626,7 @@ let writeBinaryAndReportMappings (outfile, match aref.Version with | Some version when version.Major = 2us -> parseILVersion "2.0.50727.0" | Some v -> v - | None -> failwith "Expected msorlib to have a version number" + | None -> failwith "Expected mscorlib to have a version number" let entryPointToken, code, codePadding, metadata, data, resources, requiredDataFixups, pdbData, mappings, guidStart = writeILMetadataAndCode ((pdbfile <> None), desiredMetadataVersion, ilg, emitTailcalls, deterministic, showTimes) modul next normalizeAssemblyRefs @@ -3859,7 +3855,7 @@ let writeBinaryAndReportMappings (outfile, writeInt32 os timestamp // Update pdbData with new guid and timestamp. Portable and embedded PDBs don't need the ModuleID - // Full and PdbOnly aren't supported under deterministic builds currently, they rely on non-determinsitic Windows native code + // Full and PdbOnly aren't supported under deterministic builds currently, they rely on non-deterministic Windows native code { pdbData with ModuleID = final.[0..15] ; Timestamp = timestamp } else writeInt32 os timestamp // date since 1970 @@ -4191,7 +4187,7 @@ let writeBinaryAndReportMappings (outfile, os.Dispose() try - FileSystemUtilites.setExecutablePermission outfile + FileSystemUtilities.setExecutablePermission outfile with _ -> () pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 90d53444e78..682b20a6888 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -10,11 +10,9 @@ open System.IO.Compression open System.Reflection open System.Reflection.Metadata open System.Reflection.Metadata.Ecma335 -open System.Reflection.PortableExecutable open System.Text open Internal.Utilities open FSharp.Compiler.AbstractIL.IL -open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.Internal.Support open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.ErrorLogger diff --git a/src/absil/ilx.fs b/src/absil/ilx.fs index 56d264a6dcd..2b364186c98 100644 --- a/src/absil/ilx.fs +++ b/src/absil/ilx.fs @@ -3,9 +3,6 @@ /// Defines an extension of the IL algebra module internal FSharp.Compiler.AbstractIL.Extensions.ILX.Types -open Internal.Utilities -open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal.Library diff --git a/src/absil/zset.fs b/src/absil/zset.fs index 5d6588a5986..aee52eb68e3 100644 --- a/src/absil/zset.fs +++ b/src/absil/zset.fs @@ -3,9 +3,7 @@ namespace FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library -open Internal.Utilities open Internal.Utilities.Collections.Tagged open System.Collections.Generic diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 5979861c1fd..ab20bfcf139 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -435,7 +435,7 @@ let SplitRelatedDiagnostics(err: PhasedDiagnostic) = SplitRelatedException err.Exception -let DeclareMesssage = FSharp.Compiler.DiagnosticMessage.DeclareResourceString +let DeclareMessage = FSharp.Compiler.DiagnosticMessage.DeclareResourceString do FSComp.SR.RunStartupValidation() let SeeAlsoE() = DeclareResourceString("SeeAlso", "%s") @@ -1493,15 +1493,15 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa | IntfImplInExtrinsicAugmentation(_) -> os.Append(IntfImplInExtrinsicAugmentationE().Format) |> ignore - | UnresolvedReferenceError(assemblyname, _) + | UnresolvedReferenceError(assemblyName, _) - | UnresolvedReferenceNoRange assemblyname -> - os.Append(UnresolvedReferenceNoRangeE().Format assemblyname) |> ignore + | UnresolvedReferenceNoRange assemblyName -> + os.Append(UnresolvedReferenceNoRangeE().Format assemblyName) |> ignore - | UnresolvedPathReference(assemblyname, pathname, _) + | UnresolvedPathReference(assemblyName, pathname, _) - | UnresolvedPathReferenceNoRange(assemblyname, pathname) -> - os.Append(UnresolvedPathReferenceNoRangeE().Format pathname assemblyname) |> ignore + | UnresolvedPathReferenceNoRange(assemblyName, pathname) -> + os.Append(UnresolvedPathReferenceNoRangeE().Format pathname assemblyName) |> ignore | DeprecatedCommandLineOptionFull(fullText, _) -> os.Append fullText |> ignore @@ -2169,7 +2169,7 @@ type TcConfigBuilder = static member Initial = { - primaryAssembly = PrimaryAssembly.Mscorlib // defaut value, can be overridden using the command line switch + primaryAssembly = PrimaryAssembly.Mscorlib // default value, can be overridden using the command line switch light = None noFeedback = false stackReserveSize = None @@ -2581,7 +2581,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = // Look for an explicit reference to mscorlib/netstandard.dll or System.Runtime.dll and use that to compute clrRoot and targetFrameworkVersion let primaryAssemblyReference, primaryAssemblyExplicitFilenameOpt = computeKnownDllReference(data.primaryAssembly.Name) let fslibReference = - // Look for explict FSharp.Core reference otherwise use version that was referenced by compiler + // Look for explicit FSharp.Core reference otherwise use version that was referenced by compiler let dllReference, fileNameOpt = computeKnownDllReference getFSharpCoreLibraryName match fileNameOpt with | Some _ -> dllReference @@ -2816,7 +2816,11 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = let facades = Path.Combine(frameworkRootVersion, "Facades") if Directory.Exists facades then yield facades - ] + match frameworkRefsPackDirectory with + | Some path when Directory.Exists(path) -> + yield path + | _ -> () + ] with e -> errorRecovery e range0; [] @@ -2926,7 +2930,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = | None -> None else None - member tcConfig.ResolveLibWithDirectories (ccuLoadFaulureAction, r: AssemblyReference) = + member tcConfig.ResolveLibWithDirectories (ccuLoadFailureAction, r: AssemblyReference) = let m, nm = r.Range, r.Text use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter // test for both libraries and executables @@ -2944,7 +2948,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = match rs |> List.tryPick (fun r -> tcConfig.TryResolveLibWithDirectories r) with | Some res -> Some res | None -> - match ccuLoadFaulureAction with + match ccuLoadFailureAction with | CcuLoadFailureAction.RaiseError -> let searchMessage = String.concat "\n " (tcConfig.GetSearchPathsForLibraryFiles()) raise (FileNameNotResolved(nm, searchMessage, m)) @@ -3189,14 +3193,14 @@ let QualFileNameOfImpls filename specs = | [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]) -let PrepandPathToImpl x (SynModuleOrNamespace(p, b, c, d, e, f, g, h)) = SynModuleOrNamespace(x@p, b, c, d, e, f, g, h) -let PrepandPathToSpec x (SynModuleOrNamespaceSig(p, b, c, d, e, f, g, h)) = SynModuleOrNamespaceSig(x@p, b, c, d, e, f, g, h) +let PrependPathToQualFileName x (QualifiedNameOfFile q) = ComputeQualifiedNameOfFileFromUniquePath (q.idRange, pathOfLid x@[q.idText]) +let PrependPathToImpl x (SynModuleOrNamespace(p, b, c, d, e, f, g, h)) = SynModuleOrNamespace(x@p, b, c, d, e, f, g, h) +let PrependPathToSpec x (SynModuleOrNamespaceSig(p, b, c, d, e, f, g, h)) = SynModuleOrNamespaceSig(x@p, b, c, d, e, f, g, h) let PrependPathToInput x inp = match inp with - | ParsedInput.ImplFile (ParsedImplFileInput (b, c, q, d, hd, impls, e)) -> ParsedInput.ImplFile (ParsedImplFileInput (b, c, PrepandPathToQualFileName x q, d, hd, List.map (PrepandPathToImpl x) impls, e)) - | ParsedInput.SigFile (ParsedSigFileInput (b, q, d, hd, specs)) -> ParsedInput.SigFile (ParsedSigFileInput (b, PrepandPathToQualFileName x q, d, hd, List.map (PrepandPathToSpec x) specs)) + | ParsedInput.ImplFile (ParsedImplFileInput (b, c, q, d, hd, impls, e)) -> ParsedInput.ImplFile (ParsedImplFileInput (b, c, PrependPathToQualFileName x q, d, hd, List.map (PrependPathToImpl x) impls, e)) + | ParsedInput.SigFile (ParsedSigFileInput (b, q, d, hd, specs)) -> ParsedInput.SigFile (ParsedSigFileInput (b, PrependPathToQualFileName x q, d, hd, List.map (PrependPathToSpec x) specs)) let ComputeAnonModuleName check defaultNamespace filename (m: range) = let modname = CanonicalizeFilename filename @@ -3583,17 +3587,17 @@ let GetOptimizationDataResourceName (r: ILResource) = let IsReflectedDefinitionsResource (r: ILResource) = r.Name.StartsWithOrdinal(QuotationPickler.SerializedReflectedDefinitionsResourceNameBase) -let MakeILResource rname bytes = - { Name = rname +let MakeILResource rName bytes = + { Name = rName Location = ILResourceLocation.LocalOut bytes Access = ILResourceAccess.Public CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs MetadataIndex = NoMetadataIdx } -let PickleToResource inMem file (g: TcGlobals) scope rname p x = +let PickleToResource inMem file (g: TcGlobals) scope rName p x = let file = PathMap.apply g.pathMap file - { Name = rname + { Name = rName Location = (let bytes = pickleObjWithDanglingCcus inMem file g scope p x in ILResourceLocation.LocalOut bytes) Access = ILResourceAccess.Public CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs @@ -3607,7 +3611,7 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu let mspec = ApplyExportRemappingToEntity tcGlobals exportRemapping mspec // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. - let rname = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpSignatureDataResourceName2 else FSharpSignatureDataResourceName + let rName = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpSignatureDataResourceName2 else FSharpSignatureDataResourceName let includeDir = if String.IsNullOrEmpty tcConfig.implicitIncludeDir then "" @@ -3616,7 +3620,7 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu |> System.IO.Path.GetFullPath |> PathMap.applyDir tcGlobals.pathMap - PickleToResource inMem file tcGlobals ccu (rname+ccu.AssemblyName) pickleCcuInfo + PickleToResource inMem file tcGlobals ccu (rName+ccu.AssemblyName) pickleCcuInfo { mspec=mspec compileTimeWorkingDir=includeDir usesQuotations = ccu.UsesFSharp20PlusQuotations } @@ -3627,8 +3631,8 @@ let GetOptimizationData (file, ilScopeRef, ilModule, byteReader) = let WriteOptimizationData (tcGlobals, file, inMem, ccu: CcuThunk, modulInfo) = // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. - let rname = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpOptimizationDataResourceName2 else FSharpOptimizationDataResourceName - PickleToResource inMem file tcGlobals ccu (rname+ccu.AssemblyName) Optimizer.p_CcuOptimizationInfo modulInfo + let rName = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpOptimizationDataResourceName2 else FSharpOptimizationDataResourceName + PickleToResource inMem file tcGlobals ccu (rName+ccu.AssemblyName) Optimizer.p_CcuOptimizationInfo modulInfo //---------------------------------------------------------------------------- // Abstraction for project reference @@ -4118,7 +4122,7 @@ and [] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse (typeProviderEnvironment, tcConfig: TcConfig, m, entity: Entity, - injectedNamspace, remainingNamespace, + injectedNamespace, remainingNamespace, provider, st: Tainted option) = match remainingNamespace with @@ -4126,13 +4130,13 @@ and [] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse // Inject the namespace entity match entity.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName.TryFind next with | Some childEntity -> - tcImports.InjectProvidedNamespaceOrTypeIntoEntity (typeProviderEnvironment, tcConfig, m, childEntity, next :: injectedNamspace, rest, provider, st) + tcImports.InjectProvidedNamespaceOrTypeIntoEntity (typeProviderEnvironment, tcConfig, m, childEntity, next :: injectedNamespace, rest, provider, st) | None -> // Build up the artificial namespace if there is not a real one. - let cpath = CompPath(ILScopeRef.Local, injectedNamspace |> List.rev |> List.map (fun n -> (n, ModuleOrNamespaceKind.Namespace)) ) + let cpath = CompPath(ILScopeRef.Local, injectedNamespace |> List.rev |> List.map (fun n -> (n, ModuleOrNamespaceKind.Namespace)) ) let newNamespace = NewModuleOrNamespace (Some cpath) taccessPublic (ident(next, rangeStartup)) XmlDoc.Empty [] (MaybeLazy.Strict (NewEmptyModuleOrNamespaceType Namespace)) entity.ModuleOrNamespaceType.AddModuleOrNamespaceByMutation newNamespace - tcImports.InjectProvidedNamespaceOrTypeIntoEntity (typeProviderEnvironment, tcConfig, m, newNamespace, next :: injectedNamspace, rest, provider, st) + tcImports.InjectProvidedNamespaceOrTypeIntoEntity (typeProviderEnvironment, tcConfig, m, newNamespace, next :: injectedNamespace, rest, provider, st) | [] -> match st with | Some st -> @@ -4584,7 +4588,7 @@ and [] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse | None -> ErrorD(AssemblyNotResolved(assemblyReference.Text, assemblyReference.Range)) else - // This is a previously unencounterd assembly. Resolve it and add it to the list. + // This is a previously unencountered assembly. Resolve it and add it to the list. // But don't cache resolution failures because the assembly may appear on the disk later. let resolved, unresolved = TcConfig.TryResolveLibsUsingMSBuildRules(tcConfig, [ assemblyReference ], assemblyReference.Range, mode) match resolved, unresolved with @@ -4938,7 +4942,6 @@ type CodeContext = module private ScriptPreprocessClosure = - open Internal.Utilities.Text.Lexing /// Represents an input to the closure finding process type ClosureSource = ClosureSource of filename: string * referenceRange: range * sourceText: ISourceText * parseRequired: bool @@ -5187,7 +5190,7 @@ module private ScriptPreprocessClosure = filename, sourceText, codeContext, useSimpleResolution, useFsiAuxLib, useSdkRefs, lexResourceManager: Lexhelp.LexResourceManager, - applyCommmandLineArgs, assumeDotNetFramework, + applyCommandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage) = // Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script @@ -5198,7 +5201,7 @@ module private ScriptPreprocessClosure = let tcConfig = CreateScriptTextTcConfig(legacyReferenceResolver, defaultFSharpBinariesDir, filename, codeContext, useSimpleResolution, - useFsiAuxLib, None, applyCommmandLineArgs, assumeDotNetFramework, + useFsiAuxLib, None, applyCommandLineArgs, assumeDotNetFramework, useSdkRefs, tryGetMetadataSnapshot, reduceMemoryUsage) let resolutions0, _unresolvedReferences = GetAssemblyResolutionInformation(ctok, tcConfig) @@ -5208,7 +5211,7 @@ module private ScriptPreprocessClosure = let tcConfig = CreateScriptTextTcConfig(legacyReferenceResolver, defaultFSharpBinariesDir, filename, codeContext, useSimpleResolution, useFsiAuxLib, Some references0, - applyCommmandLineArgs, assumeDotNetFramework, useSdkRefs, + applyCommandLineArgs, assumeDotNetFramework, useSdkRefs, tryGetMetadataSnapshot, reduceMemoryUsage) let closureSources = [ClosureSource(filename, range0, sourceText, true)] @@ -5238,13 +5241,13 @@ type LoadClosure with (ctok, legacyReferenceResolver, defaultFSharpBinariesDir, filename: string, sourceText: ISourceText, codeContext, useSimpleResolution: bool, useFsiAuxLib, useSdkRefs, lexResourceManager: Lexhelp.LexResourceManager, - applyCommmandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage) = + applyCommandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage) = use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse ScriptPreprocessClosure.GetFullClosureOfScriptText (ctok, legacyReferenceResolver, defaultFSharpBinariesDir, filename, sourceText, codeContext, useSimpleResolution, useFsiAuxLib, useSdkRefs, lexResourceManager, - applyCommmandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage) + applyCommandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage) /// Analyze a set of script files and find the closure of their references. static member ComputeClosureOfScriptFiles diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 364336f32d6..51b10bc0287 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -63,7 +63,7 @@ val ComputeQualifiedNameOfFileFromUniquePath: range * string list -> Ast.Qualifi val PrependPathToInput: Ast.Ident list -> Ast.ParsedInput -> Ast.ParsedInput -/// State used to de-deuplicate module names along a list of file names +/// State used to de-deduplicate 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. diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index c4595d2dc24..29e854a83f1 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -1670,7 +1670,7 @@ let ReportTime (tcConfig:TcConfig) descr = // OPTIMIZATION - support - addDllToOptEnv //---------------------------------------------------------------------------- -let AddExternalCcuToOpimizationEnv tcGlobals optEnv (ccuinfo: ImportedAssembly) = +let AddExternalCcuToOptimizationEnv tcGlobals optEnv (ccuinfo: ImportedAssembly) = match ccuinfo.FSharpOptimizationData.Force() with | None -> optEnv | Some data -> Optimizer.BindCcu ccuinfo.FSharpViewOfMetadata data optEnv tcGlobals @@ -1682,7 +1682,7 @@ let AddExternalCcuToOpimizationEnv tcGlobals optEnv (ccuinfo: ImportedAssembly) let GetInitialOptimizationEnv (tcImports:TcImports, tcGlobals:TcGlobals) = let ccuinfos = tcImports.GetImportedAssemblies() let optEnv = Optimizer.IncrementalOptimizationEnv.Empty - let optEnv = List.fold (AddExternalCcuToOpimizationEnv tcGlobals) optEnv ccuinfos + let optEnv = List.fold (AddExternalCcuToOptimizationEnv tcGlobals) optEnv ccuinfos optEnv let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importMap, isIncrementalFragment, optEnv, ccu:CcuThunk, implFiles) = diff --git a/src/fsharp/CompileOptions.fsi b/src/fsharp/CompileOptions.fsi index e6e010bff2c..f1ea7d44cdc 100644 --- a/src/fsharp/CompileOptions.fsi +++ b/src/fsharp/CompileOptions.fsi @@ -76,7 +76,7 @@ val SetTargetProfile : TcConfigBuilder -> string -> unit val GetGeneratedILModuleName : CompilerTarget -> string -> string val GetInitialOptimizationEnv : TcImports * TcGlobals -> IncrementalOptimizationEnv -val AddExternalCcuToOpimizationEnv : TcGlobals -> IncrementalOptimizationEnv -> ImportedAssembly -> IncrementalOptimizationEnv +val AddExternalCcuToOptimizationEnv : TcGlobals -> IncrementalOptimizationEnv -> ImportedAssembly -> IncrementalOptimizationEnv val ApplyAllOptimizations : TcConfig * TcGlobals * ConstraintSolver.TcValF * string * ImportMap * bool * IncrementalOptimizationEnv * CcuThunk * TypedImplFile list -> TypedAssemblyAfterOptimization * Optimizer.LazyModuleInfo * IncrementalOptimizationEnv val CreateIlxAssemblyGenerator : TcConfig * TcImports * TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxGen.IlxAssemblyGenerator diff --git a/src/fsharp/CompilerGlobalState.fs b/src/fsharp/CompilerGlobalState.fs index 1e857e7cade..a54fc0426ae 100644 --- a/src/fsharp/CompilerGlobalState.fs +++ b/src/fsharp/CompilerGlobalState.fs @@ -5,7 +5,6 @@ namespace FSharp.Compiler open System.Collections.Generic -open FSharp.Compiler.AbstractIL open FSharp.Compiler.Range open FSharp.Compiler.PrettyNaming diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 1e59e05b526..f5aade84008 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -14,7 +14,7 @@ // The constraints are immediately processed into a normal form, in particular // - type equations on inference parameters: 'tp = ty // - type inequations on inference parameters: 'tp :> ty -// - other constraints on inference paramaters +// - other constraints on inference parameters // // The state of the inference engine is kept in imperative mutations to inference // type variables. @@ -257,7 +257,7 @@ let MakeConstraintSolverEnv contextInfo css m denv = { SolverState = css m = m eContextInfo = contextInfo - // Indicates that when unifiying ty1 = ty2, only type variables in ty1 may be solved + // Indicates that when unifying ty1 = ty2, only type variables in ty1 may be solved MatchingOnly = false EquivEnv = TypeEquivEnv.Empty DisplayEnv = denv } @@ -2110,7 +2110,7 @@ and CanMemberSigsMatchUpToCheck | Some calledArg -> if isArray1DTy g calledArg.CalledArgumentType then let paramArrayElemTy = destArrayTy g calledArg.CalledArgumentType - let reflArgInfo = calledArg.ReflArgInfo // propgate the reflected-arg info to each param array argument + let reflArgInfo = calledArg.ReflArgInfo // propagate the reflected-arg info to each param array argument match calledMeth.ParamArrayCallerArgs with | Some args -> for callerArg in args do @@ -2493,9 +2493,9 @@ and ResolveOverloading if c <> 0 then c else 0 - let better (candidate: CalledMeth<_>, candidateWarnings, _) (other: CalledMeth<_>, otherwarnings, _) = + let better (candidate: CalledMeth<_>, candidateWarnings, _) (other: CalledMeth<_>, otherWarnings, _) = let candidateWarnCount = List.length candidateWarnings - let otherWarnCount = List.length otherwarnings + let otherWarnCount = List.length otherWarnings // Prefer methods that don't give "this code is less generic" warnings // Note: Relies on 'compare' respecting true > false let c = compare (candidateWarnCount = 0) (otherWarnCount = 0) @@ -2862,10 +2862,10 @@ let CodegenWitnessThatTypeSupportsTraitConstraint tcVal g amap m (traitInfo: Tra | Choice1Of5(minfo, methArgTys) -> let argExprs = // FIX for #421894 - typechecker assumes that coercion can be applied for the trait calls arguments but codegen doesn't emit coercion operations - // result - generation of non-verifyable code + // result - generation of non-verifiable code // fix - apply coercion for the arguments (excluding 'receiver' argument in instance calls) - // flatten list of argument types (looks like trait calls with curried arguments are not supported so we can just convert argument list in straighforward way) + // flatten list of argument types (looks like trait calls with curried arguments are not supported so we can just convert argument list in straightforward way) let argTypes = minfo.GetParamTypes(amap, m, methArgTys) |> List.concat diff --git a/src/fsharp/DetupleArgs.fs b/src/fsharp/DetupleArgs.fs index af198b9850a..0bed5b7c521 100644 --- a/src/fsharp/DetupleArgs.fs +++ b/src/fsharp/DetupleArgs.fs @@ -199,7 +199,7 @@ module GlobalUsageAnalysis = TopLevelBindings = Zset.empty valOrder IterationIsAtTopLevel = true } - /// Log the use of a value with a particular tuple chape at a callsite + /// Log the use of a value with a particular tuple shape at a callsite /// Note: this routine is called very frequently let logUse (f: Val) tup z = {z with Uses = diff --git a/src/fsharp/DotNetFrameworkDependencies.fs b/src/fsharp/DotNetFrameworkDependencies.fs index faae31ba35b..8c9c98c16d3 100644 --- a/src/fsharp/DotNetFrameworkDependencies.fs +++ b/src/fsharp/DotNetFrameworkDependencies.fs @@ -6,7 +6,6 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies open System open System.Collections.Generic - open System.Diagnostics open System.Globalization open System.IO open System.Reflection @@ -166,7 +165,7 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies | Some v -> yield v // These are the Portable-profile and .NET Standard 1.6 dependencies of FSharp.Core.dll. These are needed - // when an F# sript references an F# profile 7, 78, 259 or .NET Standard 1.6 component which in turn refers + // when an F# script references an F# profile 7, 78, 259 or .NET Standard 1.6 component which in turn refers // to FSharp.Core for profile 7, 78, 259 or .NET Standard. yield "netstandard" yield "System.Runtime" // lots of types diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index 5760aef8a2a..c37a3395121 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -88,10 +88,10 @@ exception Deprecated of string * range exception Experimental of string * range exception PossibleUnverifiableCode of range -exception UnresolvedReferenceNoRange of (*assemblyname*) string -exception UnresolvedReferenceError of (*assemblyname*) string * range -exception UnresolvedPathReferenceNoRange of (*assemblyname*) string * (*path*) string -exception UnresolvedPathReference of (*assemblyname*) string * (*path*) string * range +exception UnresolvedReferenceNoRange of (*assemblyName*) string +exception UnresolvedReferenceError of (*assemblyName*) string * range +exception UnresolvedPathReferenceNoRange of (*assemblyName*) string * (*path*) string +exception UnresolvedPathReference of (*assemblyName*) string * (*path*) string * range @@ -197,7 +197,7 @@ type PhasedDiagnostic = /// Construct a phased error static member Create(exn:exn, phase:BuildPhase) : PhasedDiagnostic = - // FUTURE: renable this assert, which has historically triggered in some compiler service scenarios + // FUTURE: reenable this assert, which has historically triggered in some compiler service scenarios // System.Diagnostics.Debug.Assert(phase<>BuildPhase.DefaultPhase, sprintf "Compile error seen with no phase to attribute it to.%A %s %s" phase exn.Message exn.StackTrace ) {Exception = exn; Phase=phase} @@ -281,7 +281,7 @@ let DiscardErrorsLogger = let AssertFalseErrorLogger = { new ErrorLogger("AssertFalseErrorLogger") with - // TODO: renable these asserts in the compiler service + // TODO: reenable these asserts in the compiler service member x.DiagnosticSink(phasedError, isError) = (* assert false; *) () member x.ErrorCount = (* assert false; *) 0 } @@ -313,7 +313,7 @@ type internal CompileThreadStatic = static member BuildPhase with get() = match box CompileThreadStatic.buildPhase with - // FUTURE: renable these asserts, which have historically fired in some compiler service scernaios + // FUTURE: reenable these asserts, which have historically fired in some compiler service scenarios | null -> (* assert false; *) BuildPhase.DefaultPhase | _ -> CompileThreadStatic.buildPhase and set v = CompileThreadStatic.buildPhase <- v @@ -606,7 +606,7 @@ let TryD f g = } | res -> res -let rec RepeatWhileD ndeep body = body ndeep ++ (fun x -> if x then RepeatWhileD (ndeep+1) body else CompleteD) +let rec RepeatWhileD nDeep body = body nDeep ++ (fun x -> if x then RepeatWhileD (nDeep+1) body else CompleteD) let AtLeastOneD f l = MapD f l ++ (fun res -> ResultD (List.exists id res)) diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index c075e0dbe96..24dc9883957 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -15,7 +15,6 @@ module internal ExtensionTyping = open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range open FSharp.Compiler.AbstractIL.IL - open FSharp.Compiler.AbstractIL.Diagnostics // dprintfn open FSharp.Compiler.AbstractIL.Internal.Library // frontAndBack type TypeProviderDesignation = TypeProviderDesignation of string @@ -904,7 +903,7 @@ module internal ExtensionTyping = let namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal let fullName = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal ValidateExpectedName m expectedPath expectedName st - // Must be able to call (GetMethods|GetEvents|GetPropeties|GetNestedTypes|GetConstructors)(bindingFlags). + // Must be able to call (GetMethods|GetEvents|GetProperties|GetNestedTypes|GetConstructors)(bindingFlags). let usedMembers : Tainted[] = // These are the members the compiler will actually use [| for x in TryTypeMemberArray(st, fullName, "GetMethods", m, fun st -> st.GetMethods()) -> x.Coerce m diff --git a/src/fsharp/FSharp.Compiler.Private.Scripting/FSharp.Compiler.Private.Scripting.nuspec b/src/fsharp/FSharp.Compiler.Private.Scripting/FSharp.Compiler.Private.Scripting.nuspec index dac8f0c240e..fb54c7f3938 100644 --- a/src/fsharp/FSharp.Compiler.Private.Scripting/FSharp.Compiler.Private.Scripting.nuspec +++ b/src/fsharp/FSharp.Compiler.Private.Scripting/FSharp.Compiler.Private.Scripting.nuspec @@ -10,6 +10,7 @@ + $CommonFileElements$ diff --git a/src/fsharp/FSharp.Compiler.Private.Scripting/FSharpScript.fs b/src/fsharp/FSharp.Compiler.Private.Scripting/FSharpScript.fs index c0ce545e074..3d9e113bcc5 100644 --- a/src/fsharp/FSharp.Compiler.Private.Scripting/FSharpScript.fs +++ b/src/fsharp/FSharp.Compiler.Private.Scripting/FSharpScript.fs @@ -4,6 +4,7 @@ namespace FSharp.Compiler.Scripting open System open System.Threading +open FSharp.Compiler open FSharp.Compiler.Interactive.Shell type FSharpScript(?captureInput: bool, ?captureOutput: bool, ?additionalArgs: string[]) as this = @@ -37,12 +38,16 @@ type FSharpScript(?captureInput: bool, ?captureOutput: bool, ?additionalArgs: st member __.AssemblyReferenceAdded = fsi.AssemblyReferenceAdded + member __.ValueBound = fsi.ValueBound + member __.ProvideInput = stdin.ProvideInput member __.OutputProduced = outputProduced.Publish member __.ErrorProduced = errorProduced.Publish + member __.Fsi = fsi + member __.Eval(code: string, ?cancellationToken: CancellationToken) = let cancellationToken = defaultArg cancellationToken CancellationToken.None let ch, errors = fsi.EvalInteractionNonThrowing(code, cancellationToken) @@ -50,6 +55,20 @@ type FSharpScript(?captureInput: bool, ?captureOutput: bool, ?additionalArgs: st | Choice1Of2 v -> Ok(v), errors | Choice2Of2 ex -> Error(ex), errors + /// Get the available completion items from the code at the specified location. + /// + /// The input text on which completions will be calculated + /// The 1-based line index + /// The 0-based column index + member __.GetCompletionItems(text: string, line: int, column: int) = + async { + let! parseResults, checkResults, _projectResults = fsi.ParseAndCheckInteraction(text) + let lineText = text.Split('\n').[line - 1] + let partialName = QuickParse.GetPartialLongNameEx(lineText, column - 1) + let! declarationListInfos = checkResults.GetDeclarationListInfo(Some parseResults, line, lineText, partialName) + return declarationListInfos.Items + } + interface IDisposable with member __.Dispose() = if captureInput then diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index dd9293cd88c..9505cf61e55 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -34,6 +34,7 @@ + $CommonFileElements$ IQueryable if qexprInner is IQueryable, otherwise seq { qexprInner' } // | query.Yield --> not IQueryable, seq { } // | query.YieldFrom --> not IQueryable, seq { yield! } -// | query.Op(, ) --> IQueryable if qexprOuter is IQueryable, otherwise query.Op(qexpOuter', ) +// | query.Op(, ) --> IQueryable if qexprOuter is IQueryable, otherwise query.Op(qexprOuter', ) let rec tryRewriteToSeqCombinators g (e: Expr) = let m = e.Range match e with @@ -2113,7 +2113,7 @@ and OptimizeExprOpReductionsAfter cenv env (op, tyargs, argsR, arginfos, m) = | None -> OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos UnknownValue and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu = - // The generic case - we may collect information, but the construction/projection doesnRt disappear + // The generic case - we may collect information, but the construction/projection doesn't disappear let argsTSize = AddTotalSizes arginfos let argsFSize = AddFunctionSizes arginfos let argEffects = OrEffects arginfos @@ -2231,7 +2231,7 @@ and TryOptimizeTupleFieldGet cenv _env (_tupInfo, e1info, tys, n, m) = and TryOptimizeUnionCaseGet cenv _env (e1info, cspec, _tys, n, m) = match e1info.Info with - | StripUnionCaseValue(cspec2, args) when cenv.settings.EliminatUnionCaseFieldGet() && not e1info.HasEffect && cenv.g.unionCaseRefEq cspec cspec2 -> + | StripUnionCaseValue(cspec2, args) when cenv.settings.EliminateUnionCaseFieldGet() && not e1info.HasEffect && cenv.g.unionCaseRefEq cspec cspec2 -> if n >= args.Length then errorR(InternalError( "TryOptimizeUnionCaseGet: term argument out of range", m)) Some args.[n] | _ -> None @@ -2299,7 +2299,7 @@ and OptimizeLinearExpr cenv env expr contf = // Eliminate subsumption coercions for functions. This must be done post-typechecking because we need // complete inference types. let expr = DetectAndOptimizeForExpression cenv.g OptimizeAllForExpressions expr - let expr = if cenv.settings.ExpandStructrualValues() then ExpandStructuralBinding cenv expr else expr + let expr = if cenv.settings.ExpandStructuralValues() then ExpandStructuralBinding cenv expr else expr let expr = stripExpr expr match expr with @@ -2327,7 +2327,7 @@ and OptimizeLinearExpr cenv env expr contf = let (bindR, bindingInfo), env = OptimizeBinding cenv false env bind OptimizeLinearExpr cenv env body (contf << (fun (bodyR, bodyInfo) -> // PERF: This call to ValueIsUsedOrHasEffect/freeInExpr amounts to 9% of all optimization time. - // Is it quadratic or quasi-quadtratic? + // Is it quadratic or quasi-quadratic? if ValueIsUsedOrHasEffect cenv (fun () -> (freeInExpr CollectLocals bodyR).FreeLocals) (bindR, bindingInfo) then // Eliminate let bindings on the way back up let exprR, adjust = TryEliminateLet cenv env bindR bodyR m @@ -3028,7 +3028,7 @@ and ComputeSplitToMethodCondition flag threshold cenv env (e: Expr, einfo) = // None of them should be byrefs not (isByrefLikeTy cenv.g m v.Type) && // None of them should be local polymorphic constrained values - not (IsGenericValWithGenericContraints cenv.g v) && + not (IsGenericValWithGenericConstraints cenv.g v) && // None of them should be mutable not v.IsMutable)))) && not (isByrefLikeTy cenv.g m (tyOfExpr cenv.g e)) diff --git a/src/fsharp/Optimizer.fsi b/src/fsharp/Optimizer.fsi index e156a26d3ea..bd656614bf4 100644 --- a/src/fsharp/Optimizer.fsi +++ b/src/fsharp/Optimizer.fsi @@ -61,4 +61,4 @@ val UnionOptimizationInfos: seq -> CcuOptimizationInfo /// Check if an expression has an effect val ExprHasEffect: TcGlobals -> Expr -> bool -val internal u_CcuOptimizationInfo : TastPickle.ReaderState -> CcuOptimizationInfo +val internal u_CcuOptimizationInfo : TastPickle.ReaderState -> CcuOptimizationInfo \ No newline at end of file diff --git a/src/fsharp/PatternMatchCompilation.fs b/src/fsharp/PatternMatchCompilation.fs index c52f300d375..5676c008e6e 100644 --- a/src/fsharp/PatternMatchCompilation.fs +++ b/src/fsharp/PatternMatchCompilation.fs @@ -596,7 +596,7 @@ let rec BuildSwitch inpExprOpt g expr edges dflt m = let testexpr = match discrim with | DecisionTreeTest.ArrayLength(n, _) -> - let _v, vExpr, bind = mkCompGenLocalAndInvisbleBind g "testExpr" m testexpr + let _v, vExpr, bind = mkCompGenLocalAndInvisibleBind g "testExpr" m testexpr mkLetBind m bind (mkLazyAnd g m (mkNonNullTest g m vExpr) (mkILAsmCeq g m (mkLdlen g m vExpr) (mkInt g m n))) | DecisionTreeTest.Const (Const.String _ as c) -> mkCallEqualsOperator g m g.string_ty testexpr (Expr.Const (c, m, g.string_ty)) @@ -954,7 +954,7 @@ let CompilePatternBasic Some vExpr, Some(mkInvisibleBind v appExpr) // Any match on a struct union must take the address of its input. - // We can shortcut the addrof when the original input is a deref of a byref value. + // We can shortcut the addrOf when the original input is a deref of a byref value. | EdgeDiscrim(_i', (DecisionTreeTest.UnionCase (ucref, _)), _) :: _rest when isNil origInputValTypars && ucref.Tycon.IsStructRecordOrUnionTycon -> @@ -1033,7 +1033,7 @@ let CompilePatternBasic (isNil origInputValTypars && not origInputVal.IsMemberOrModuleBinding && not ucref.Tycon.IsStructRecordOrUnionTycon && - ucref.UnionCase.RecdFields.Length >= 1 && + ucref.UnionCase.RecdFieldsArray.Length >= 1 && ucref.Tycon.UnionCasesArray.Length > 1) -> let v, vExpr = mkCompGenLocal m "unionCase" (mkProvenUnionCaseTy ucref tinst) diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index 7b79e4ccba4..f67f2ed7cb2 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -561,7 +561,7 @@ let mkArgsForAppliedVal isBaseCall (vref: ValRef) argsl = | Some topValInfo -> let argArities = topValInfo.AritiesOfArgs let argArities = if isBaseCall && argArities.Length >= 1 then List.tail argArities else argArities - // Check for partial applications: arguments to partial applciations don't get to use byrefs + // Check for partial applications: arguments to partial applications don't get to use byrefs if List.length argsl >= argArities.Length then List.map mkArgsPermit argArities else @@ -640,7 +640,7 @@ let CheckTypePermitSpanLike (cenv: cenv) env m ty = CheckType PermitByRefType.Sp /// Check types occurring in TAST but allow all byrefs. Only used on internally-generated types let CheckTypePermitAllByrefs (cenv: cenv) env m ty = CheckType PermitByRefType.All cenv env m ty -/// Check types ocurring in TAST but disallow inner types to be byref or byref-like types. +/// Check types occurring in TAST but disallow inner types to be byref or byref-like types. let CheckTypeNoInnerByrefs cenv env m ty = CheckType PermitByRefType.NoInnerByRefLike cenv env m ty let CheckTypeInstNoByrefs cenv env m tyargs = @@ -824,7 +824,7 @@ and CheckCallLimitArgs cenv env m returnTy limitArgs (context: PermitByRefExpr) errorR(Error(FSComp.SR.chkNoByrefAddressOfValueFromExpression(), m)) // You cannot call a function that takes a byref of a span-like (not stack referring) and - // either a stack referring spanlike or a local-byref of a stack referring span-like. + // either a stack referring span-like or a local-byref of a stack referring span-like. let isCallLimited = HasLimitFlag LimitFlags.ByRefOfSpanLike limitArgs && (HasLimitFlag LimitFlags.StackReferringSpanLike limitArgs || @@ -1139,7 +1139,7 @@ and CheckExprOp cenv env (op, tyargs, args, m) context expr = let ctorLimitedZoneCheck() = if env.ctorLimitedZone then errorR(Error(FSComp.SR.chkObjCtorsCantUseExceptionHandling(), m)) - // Ensure anonynous record type requirements are recorded + // Ensure anonymous record type requirements are recorded match op with | TOp.AnonRecdGet (anonInfo, _) | TOp.AnonRecd anonInfo -> @@ -1318,7 +1318,7 @@ and CheckExprOp cenv env (op, tyargs, args, m) context expr = // C# applies a rule where the APIs to struct types can't return the addresses of fields in that struct. // There seems no particular reason for this given that other protections in the language, though allowing - // it would mean "readonly" on a struct doesn't imply immutabality-of-contents - it only implies + // it would mean "readonly" on a struct doesn't imply immutability-of-contents - it only implies if context.PermitOnlyReturnable && (match obj with Expr.Val (vref, _, _) -> vref.BaseOrThisInfo = MemberThisVal | _ -> false) && isByrefTy g (tyOfExpr g obj) then errorR(Error(FSComp.SR.chkStructsMayNotReturnAddressesOfContents(), m)) diff --git a/src/fsharp/PrettyNaming.fs b/src/fsharp/PrettyNaming.fs index 4c11b9054d3..13ca5e4fc76 100755 --- a/src/fsharp/PrettyNaming.fs +++ b/src/fsharp/PrettyNaming.fs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. //---------------------------------------------------------------------------- -// Some general F# utilities for mangling / unmangling / manipulating names. +// Some general F# utilities for mangling / demangling / manipulating names. //-------------------------------------------------------------------------- /// Anything to do with special names of identifiers and other lexical rules diff --git a/src/fsharp/QuotationPickler.fs b/src/fsharp/QuotationPickler.fs index 90a9e299947..82273b01ab7 100644 --- a/src/fsharp/QuotationPickler.fs +++ b/src/fsharp/QuotationPickler.fs @@ -5,7 +5,6 @@ module internal FSharp.Compiler.QuotationPickler open System.Text open Internal.Utilities.Collections open FSharp.Compiler.AbstractIL.Internal -open FSharp.Compiler open FSharp.Compiler.Lib let mkRLinear mk (vs, body) = List.foldBack (fun v acc -> mk (v, acc)) vs body diff --git a/src/fsharp/SignatureConformance.fs b/src/fsharp/SignatureConformance.fs index 2a057269d4f..4cd2ecca996 100644 --- a/src/fsharp/SignatureConformance.fs +++ b/src/fsharp/SignatureConformance.fs @@ -345,8 +345,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = sigUnionCase.OtherRangeOpt <- Some (implUnionCase.Range, true) implUnionCase.OtherRangeOpt <- Some (sigUnionCase.Range, false) if implUnionCase.Id.idText <> sigUnionCase.Id.idText then err FSComp.SR.ModuleContainsConstructorButNamesDiffer - elif implUnionCase.RecdFields.Length <> sigUnionCase.RecdFields.Length then err FSComp.SR.ModuleContainsConstructorButDataFieldsDiffer - elif not (List.forall2 (checkField aenv) implUnionCase.RecdFields sigUnionCase.RecdFields) then err FSComp.SR.ModuleContainsConstructorButTypesOfFieldsDiffer + elif implUnionCase.RecdFieldsArray.Length <> sigUnionCase.RecdFieldsArray.Length then err FSComp.SR.ModuleContainsConstructorButDataFieldsDiffer + elif not (Array.forall2 (checkField aenv) implUnionCase.RecdFieldsArray sigUnionCase.RecdFieldsArray) then err FSComp.SR.ModuleContainsConstructorButTypesOfFieldsDiffer elif isLessAccessible implUnionCase.Accessibility sigUnionCase.Accessibility then err FSComp.SR.ModuleContainsConstructorButAccessibilityDiffers else checkAttribs aenv implUnionCase.Attribs sigUnionCase.Attribs (fun attribs -> implUnionCase.Attribs <- attribs) diff --git a/src/fsharp/SimulatedMSBuildReferenceResolver.fs b/src/fsharp/SimulatedMSBuildReferenceResolver.fs index 8b47ad9bff7..bf5ffc092f0 100644 --- a/src/fsharp/SimulatedMSBuildReferenceResolver.fs +++ b/src/fsharp/SimulatedMSBuildReferenceResolver.fs @@ -138,17 +138,17 @@ let private SimulatedMSBuildResolver = #if !FX_RESHAPED_MSBUILD try - // Seach the GAC on Windows + // Search the GAC on Windows if not found && not isFileName && Environment.OSVersion.Platform = PlatformID.Win32NT then let n = AssemblyName r - let netfx = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() - let gac = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(netfx.TrimEnd('\\'))), "assembly") + let netFx = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + let gac = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") match n.Version, n.GetPublicKeyToken() with | null, _ | _, null -> let options = [ if Directory.Exists gac then - for gacdir in Directory.EnumerateDirectories gac do - let assemblyDir = Path.Combine(gacdir, n.Name) + for gacDir in Directory.EnumerateDirectories gac do + let assemblyDir = Path.Combine(gacDir, n.Name) if Directory.Exists assemblyDir then for tdir in Directory.EnumerateDirectories assemblyDir do let trialPath = Path.Combine(tdir, qual) @@ -162,18 +162,18 @@ let private SimulatedMSBuildResolver = | v, tok -> if Directory.Exists gac then - for gacdir in Directory.EnumerateDirectories gac do - //printfn "searching GAC directory: %s" gacdir - let assemblyDir = Path.Combine(gacdir, n.Name) + for gacDir in Directory.EnumerateDirectories gac do + //printfn "searching GAC directory: %s" gacDir + let assemblyDir = Path.Combine(gacDir, n.Name) if Directory.Exists assemblyDir then //printfn "searching GAC directory: %s" assemblyDir let tokText = String.concat "" [| for b in tok -> sprintf "%02x" b |] - let verdir = Path.Combine(assemblyDir, "v4.0_"+v.ToString()+"__"+tokText) - //printfn "searching GAC directory: %s" verdir + let verDir = Path.Combine(assemblyDir, "v4.0_"+v.ToString()+"__"+tokText) + //printfn "searching GAC directory: %s" verDir - if Directory.Exists verdir then - let trialPath = Path.Combine(verdir, qual) + if Directory.Exists verDir then + let trialPath = Path.Combine(verDir, qual) //printfn "searching GAC: %s" trialPath if FileSystem.SafeExists trialPath then success trialPath diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index f2377a4c9e9..bff6cc06b27 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -397,7 +397,7 @@ let mkTyconInst (tycon: Tycon) tinst = mkTyparInst tycon.TyparsNoRange tinst let mkTyconRefInst (tcref: TyconRef) tinst = mkTyconInst tcref.Deref tinst //--------------------------------------------------------------------------- -// Basic equalites +// Basic equalities //--------------------------------------------------------------------------- let tyconRefEq (g: TcGlobals) tcref1 tcref2 = primEntityRefEq g.compilingFslib g.fslibCcu tcref1 tcref2 @@ -721,7 +721,7 @@ let rec stripTyEqnsA g canShortcut ty = | Some abbrevTy -> stripTyEqnsA g canShortcut (applyTyconAbbrev abbrevTy tycon tinst) | None -> - // This is the point where we get to add additional coditional normalizing equations + // This is the point where we get to add additional conditional normalizing equations // into the type system. Such power! // // Add the equation byref<'T> = byref<'T, ByRefKinds.InOut> for when using sufficient FSharp.Core @@ -4275,14 +4275,14 @@ let isPublicTycon (tcref: Tycon) = (tcref.Accessibility = taccessPublic) let freeVarsAllPublic fvs = // Are any non-public items used in the expr (which corresponded to the fvs)? // Recall, taccess occurs in: - // EntityData has ReprAccessibility and Accessiblity + // EntityData has ReprAccessibility and Accessibility // UnionCase has Accessibility // RecdField has Accessibility // ValData has Accessibility // The freevars and FreeTyvars collect local constructs. // Here, we test that all those constructs are public. // - // CODEREVIEW: + // CODE REVIEW: // What about non-local vals. This fix assumes non-local vals must be public. OK? Zset.forall isPublicVal fvs.FreeLocals && Zset.forall isPublicUnionCase fvs.FreeUnionCases && @@ -4381,6 +4381,10 @@ let bindLhs opts (bind: Binding) fvs = boundLocalVal opts bind.Var fvs let freeVarsCacheCompute opts cache f = if opts.canCache then cached cache f else f() +let tryGetFreeVarsCacheValue opts cache = + if opts.canCache then tryGetCacheValue cache + else ValueNone + let rec accBindRhs opts (TBind(_, repr, _)) acc = accFreeInExpr opts repr acc and accFreeInSwitchCases opts csl dflt (acc: FreeVars) = @@ -4478,13 +4482,16 @@ and accFreeInExpr (opts: FreeVarOptions) x acc = and accFreeInExprLinear (opts: FreeVarOptions) x acc contf = // for nested let-bindings, we need to continue after the whole let-binding is processed match x with - | Expr.Let (bind, e, _, cache) -> - let contf = contf << (fun free -> - unionFreeVars (freeVarsCacheCompute opts cache (fun () -> bindLhs opts bind (accBindRhs opts bind free))) acc ) - accFreeInExprLinear opts e emptyFreeVars contf + | Expr.Let (bind, e, _, cache) -> + match tryGetFreeVarsCacheValue opts cache with + | ValueSome free -> contf (unionFreeVars free acc) + | _ -> + accFreeInExprLinear opts e emptyFreeVars (contf << (fun free -> + unionFreeVars (freeVarsCacheCompute opts cache (fun () -> bindLhs opts bind (accBindRhs opts bind free))) acc + )) | _ -> - // No longer linear expr - accFreeInExpr opts x acc |> contf + // No longer linear expr + contf (accFreeInExpr opts x acc) and accFreeInExprNonLinear opts x acc = match x with @@ -5743,7 +5750,7 @@ let isExpansiveUnderInstantiation g fty0 tyargs pargs argsl = | _ :: t -> not (isFunTy g fty) || loop (rangeOfFunTy g fty) t loop fty1 argsl) -let rec mkExprApplAux g f fty argsl m = +let rec mkExprAppAux g f fty argsl m = match argsl with | [] -> f | _ -> @@ -5778,7 +5785,7 @@ let rec mkAppsAux g f fty tyargsl argsl m = let arfty = applyForallTy g fty tyargs mkAppsAux g (primMkApp (f, fty) tyargs [] m) arfty rest argsl m | [] -> - mkExprApplAux g f fty argsl m + mkExprAppAux g f fty argsl m let mkApps g ((f, fty), tyargsl, argl, m) = mkAppsAux g f fty tyargsl argl m @@ -6672,7 +6679,7 @@ let mkNil (g: TcGlobals) m ty = mkUnionCaseExpr (g.nil_ucref, [ty], [], m) let mkCons (g: TcGlobals) ty h t = mkUnionCaseExpr (g.cons_ucref, [ty], [h;t], unionRanges h.Range t.Range) -let mkCompGenLocalAndInvisbleBind g nm m e = +let mkCompGenLocalAndInvisibleBind g nm m e = let locv, loce = mkCompGenLocal m nm (tyOfExpr g e) locv, loce, mkInvisibleBind locv e @@ -7227,7 +7234,7 @@ let AdjustArityOfLambdaBody g arity (vs: Val list) body = let MultiLambdaToTupledLambda g vs body = match vs with - | [] -> failwith "MultiLambdaToTupledLambda: expected some argments" + | [] -> failwith "MultiLambdaToTupledLambda: expected some arguments" | [v] -> v, body | vs -> let tupledv, untupler = untupledToRefTupled g vs @@ -7240,7 +7247,7 @@ let (|RefTuple|_|) expr = let MultiLambdaToTupledLambdaIfNeeded g (vs, arg) body = match vs, arg with - | [], _ -> failwith "MultiLambdaToTupledLambda: expected some argments" + | [], _ -> failwith "MultiLambdaToTupledLambda: expected some arguments" | [v], _ -> [(v, arg)], body | vs, RefTuple args when args.Length = vs.Length -> List.zip vs args, body | vs, _ -> @@ -7301,7 +7308,7 @@ let rec MakeApplicationAndBetaReduceAux g (f, fty, tyargsl: TType list list, arg let argvs2, args2 = List.unzip (List.concat pairs) mkLetsBind m (mkCompGenBinds argvs2 args2) body | _ -> - mkExprApplAux g f fty argsl m + mkExprAppAux g f fty argsl m | [] -> f @@ -8524,7 +8531,7 @@ let isCompiledConstraint cx = // Is a value a first-class polymorphic value with .NET constraints? // Used to turn off TLR and method splitting -let IsGenericValWithGenericContraints g (v: Val) = +let IsGenericValWithGenericConstraints g (v: Val) = isForallTy g v.Type && v.Type |> destForallTy g |> fst |> List.exists (fun tp -> List.exists isCompiledConstraint tp.Constraints) diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 225279024c0..76124d9c214 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -31,7 +31,7 @@ val typeEquiv : TcGlobals -> TType -> TType - /// Check the equivalence of two units-of-measure val measureEquiv : TcGlobals -> Measure -> Measure -> bool -/// Reduce a type to its more anonical form subject to an erasure flag, inference equations and abbreviations +/// Reduce a type to its more canonical form subject to an erasure flag, inference equations and abbreviations val stripTyEqnsWrtErasure: Erasure -> TcGlobals -> TType -> TType /// Build a function type @@ -120,7 +120,7 @@ val mkMutableCompGenLocal : range -> string -> TType -> Val * Expr /// 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 +val mkCompGenLocalAndInvisibleBind : TcGlobals -> string -> range -> Expr -> Val * Expr * Binding /// Build a lambda expression taking multiple values val mkMultiLambda : range -> Val list -> Expr * TType -> Expr @@ -1150,7 +1150,7 @@ type SignatureRepackageInfo = { /// The list of corresponding values RepackagedVals: (ValRef * ValRef) list - /// The list of corresponding modules, namespacea and type definitions + /// The list of corresponding modules, namespaces and type definitions RepackagedEntities: (TyconRef * TyconRef) list } /// The empty table @@ -1219,7 +1219,7 @@ val IsHiddenVal : (Remap * SignatureHidingInfo) list -> Val -> bool /// 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. +/// Adjust marks in expressions, replacing all marks by the given mark. /// Used when inlining. val remarkExpr : range -> Expr -> Expr @@ -1250,7 +1250,7 @@ val mkAddrGet : range -> ValRef -> Expr /// &localv val mkValAddr : range -> readonly: bool -> ValRef -> Expr -/// Build an exression representing the read of an instance class or record field. +/// Build an expression 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 @@ -1280,7 +1280,7 @@ val AdjustArityOfLambdaBody : TcGlobals -> int -> Val list -> Expr -> Val list * /// 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 +/// Combine two static-resolution requirements on a type parameter val JoinTyparStaticReq : TyparStaticReq -> TyparStaticReq -> TyparStaticReq /// Layout for internal compiler debugging purposes @@ -1481,10 +1481,10 @@ val destListTy : TcGlobals -> TType -> TType /// 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 +/// Check if a type definition is one of the artificial 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 +/// Determine the rank of one of the artificial type definitions used for array types val rankOfArrayTyconRef : TcGlobals -> TyconRef -> int /// Determine if a type is the F# unit type @@ -2220,7 +2220,7 @@ val RewriteExpr : ExprRewritingEnv -> Expr -> Expr val RewriteImplFile : ExprRewritingEnv -> TypedImplFile -> TypedImplFile -val IsGenericValWithGenericContraints: TcGlobals -> Val -> bool +val IsGenericValWithGenericConstraints: TcGlobals -> Val -> bool type Entity with diff --git a/src/fsharp/TastPickle.fs b/src/fsharp/TastPickle.fs index b403b7060c2..99f9aecb909 100644 --- a/src/fsharp/TastPickle.fs +++ b/src/fsharp/TastPickle.fs @@ -6,7 +6,6 @@ open System.Collections.Generic open System.Text open Internal.Utilities open FSharp.Compiler -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library @@ -582,8 +581,7 @@ let u_array_ext extraf f st = extraItem, arr let u_list_core f n st = - [ for _ in 1..n do - yield f st ] + List.init n (fun _ -> f st) let u_list f st = let n = u_int st @@ -1306,11 +1304,23 @@ let u_ILInstr st = // Pickle/unpickle for F# types and module signatures //--------------------------------------------------------------------------- -let p_Map pk pv = p_wrap Map.toList (p_list (p_tup2 pk pv)) +let p_Map_core pk pv xs st = + xs |> Map.iter (fun k v -> pk k st; pv v st) + +let p_Map pk pv x st = + p_int (Map.count x) st + p_Map_core pk pv x st + let p_qlist pv = p_wrap QueueList.toList (p_list pv) let p_namemap p = p_Map p_string p -let u_Map uk uv = u_wrap Map.ofList (u_list (u_tup2 uk uv)) +let u_Map_core uk uv n st = + Map.ofSeq (seq { for _ in 1..n -> (uk st, uv st) }) + +let u_Map uk uv st = + let n = u_int st + u_Map_core uk uv n st + let u_qlist uv = u_wrap QueueList.ofList (u_list uv) let u_namemap u = u_Map u_string u @@ -1368,7 +1378,7 @@ let p_tys = (p_list p_ty) let fill_p_attribs, p_attribs = p_hole() // In F# 4.5, the type of the "this" pointer for structs is considered to be inref for the purposes of checking the implementation -// of the struct. However for backwards compat reaons we can't serialize this as the type. +// of the struct. However for backwards compat reasons we can't serialize this as the type. let checkForInRefStructThisArg st ty = let g = st.oglobals let _, tauTy = tryDestForallTy g ty @@ -2163,7 +2173,7 @@ and u_entity_spec_data st : Entity = entity_xmldoc= defaultArg x15 XmlDoc.Empty entity_xmldocsig = System.String.Empty entity_tycon_abbrev = x8 - entity_accessiblity = x4a + entity_accessibility = x4a entity_tycon_repr_accessibility = x4b entity_exn_info = x14 } } diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 9d6720c53e0..f50e049f48f 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -26,7 +26,7 @@ open FSharp.Compiler.Features open Internal.Utilities -let internal DummyFileNameForRangesWithoutASpecificLocation = "startup" +let internal DummyFileNameForRangesWithoutASpecificLocation = startupFileName let private envRange = rangeN DummyFileNameForRangesWithoutASpecificLocation 0 /// Represents an intrinsic value from FSharp.Core known to the compiler diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 0d2808ea2d0..c4a3554ce3c 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -286,7 +286,7 @@ let addFreeItemOfTy ty eUngeneralizableItems = if isEmptyFreeTyvars fvs then eUngeneralizableItems else UngeneralizableItem(fun () -> freeInType CollectAllNoCaching ty) :: eUngeneralizableItems -/// Add the contents of a module type to the TcEnv, i.e. register the contants as ungeneralizable. +/// Add the contents of a module type to the TcEnv, i.e. register the contents as ungeneralizable. /// Add a module type to the TcEnv, i.e. register it as ungeneralizable. let addFreeItemOfModuleTy mtyp eUngeneralizableItems = let fvs = freeInModuleTy mtyp @@ -410,7 +410,7 @@ let AddNonLocalCcu g amap scopem env assemblyName (ccu: CcuThunk, internalsVisib { env with eNameResEnv = AddTyconRefsToNameEnv BulkAdd.Yes false g amap env.eAccessRights scopem true env.eNameResEnv tcrefs } env -/// Adjust the TcEnv to account for a fully processed "namespace" declaration in thie file +/// Adjust the TcEnv to account for a fully processed "namespace" declaration in this file let AddLocalRootModuleOrNamespace tcSink g amap scopem env (mtyp: ModuleOrNamespaceType) = // Compute the top-rooted module or namespace references let modrefs = mtyp.ModuleAndNamespaceDefinitions |> List.map mkLocalModRef @@ -1278,7 +1278,7 @@ let GeneralizedTypeForTypeScheme typeScheme = let (TypeScheme(generalizedTypars, tau)) = typeScheme mkForallTyIfNeeded generalizedTypars tau -/// Create a type scheme for somthing that is not generic +/// Create a type scheme for something that is not generic let NonGenericTypeScheme ty = TypeScheme([], ty) //------------------------------------------------------------------------- @@ -2456,7 +2456,7 @@ type NormalizedBinding = | NormalizedBinding of SynAccess option * SynBindingKind * - bool * (* pesudo/mustinline value? *) + bool * (* pseudo/mustinline value? *) bool * (* mutable *) SynAttribute list * XmlDoc * @@ -3969,10 +3969,10 @@ let EliminateInitializationGraphs // Check the shape of an object constructor and rewrite calls //------------------------------------------------------------------------- -let CheckAndRewriteObjectCtor g env (ctorLambaExpr: Expr) = +let CheckAndRewriteObjectCtor g env (ctorLambdaExpr: Expr) = - let m = ctorLambaExpr.Range - let tps, vsl, body, returnTy = stripTopLambda (ctorLambaExpr, tyOfExpr g ctorLambaExpr) + let m = ctorLambdaExpr.Range + let tps, vsl, body, returnTy = stripTopLambda (ctorLambdaExpr, tyOfExpr g ctorLambdaExpr) // Rewrite legitimate self-construction calls to CtorValUsedAsSelfInit let error (expr: Expr) = @@ -4185,7 +4185,7 @@ type NewSlotsOK = | NoNewSlots -type ImplictlyBoundTyparsAllowed = +type ImplicitlyBoundTyparsAllowed = | NewTyparsOKButWarnIfNotRigid | NewTyparsOK | NoNewTypars @@ -5811,7 +5811,7 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = // LanguageFeatures.ImplicitYield do not require this validation let implicitYieldEnabled = cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield let validateObjectSequenceOrRecordExpression = not implicitYieldEnabled - let validateExpressionWithIfRequiresParenethesis = not implicitYieldEnabled + let validateExpressionWithIfRequiresParenthesis = not implicitYieldEnabled let acceptDeprecatedIfThenExpression = not implicitYieldEnabled match synExpr with @@ -6027,7 +6027,7 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = | SynExpr.CompExpr (_, _, (SimpleSemicolonSequence cenv acceptDeprecatedIfThenExpression elems as body), _) -> match body with | SimpleSemicolonSequence cenv false _ -> () - | _ when validateExpressionWithIfRequiresParenethesis -> errorR(Deprecated(FSComp.SR.tcExpressionWithIfRequiresParenthesis(), m)) + | _ when validateExpressionWithIfRequiresParenthesis -> errorR(Deprecated(FSComp.SR.tcExpressionWithIfRequiresParenthesis(), m)) | _ -> () let replacementExpr = @@ -9322,7 +9322,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del -> false - // Propagte the known application structure into function types + // Propagate the known application structure into function types Propagate cenv overallTy env tpenv (MakeApplicableExprNoFlex cenv expr) (tyOfExpr g expr) delayed // Take all simple arguments and process them before applying the constraint. @@ -9370,7 +9370,8 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del if isByrefTy g vty then destByrefTy g vty else - if not vref.IsMutable then error (ValNotMutable(env.DisplayEnv, vref, mStmt)) + if not vref.IsMutable then + errorR (ValNotMutable (env.DisplayEnv, vref, mStmt)) vty // Always allow subsumption on assignment to fields let e2', tpenv = TcExprFlex cenv true false vty2 env tpenv e2 @@ -9423,15 +9424,15 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del if meths.IsEmpty then let meths = pinfos |> GettersOfPropInfos let isByrefMethReturnSetter = meths |> List.exists (function (_,Some pinfo) -> isByrefTy g (pinfo.GetPropertyType(cenv.amap,mItem)) | _ -> false) - if isByrefMethReturnSetter then - // x.P <- ... byref setter - if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt [] mItem mItem nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic delayed - else - error (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + if not isByrefMethReturnSetter then + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + // x.P <- ... byref setter + if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) + TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt [] mItem mItem nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic delayed else let args = if pinfo.IsIndexer then args else [] - if isNil meths then error (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + if isNil meths then + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) // Note: static calls never mutate a struct object argument TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt [] mStmt mItem nm ad NeverMutates true meths afterResolution NormalValUse (args@[e2]) ExprAtomicFlag.NonAtomic otherDelayed | _ -> @@ -9608,12 +9609,11 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela if meths.IsEmpty then let meths = pinfos |> GettersOfPropInfos let isByrefMethReturnSetter = meths |> List.exists (function (_,Some pinfo) -> isByrefTy cenv.g (pinfo.GetPropertyType(cenv.amap,mItem)) | _ -> false) - if isByrefMethReturnSetter then - // x.P <- ... byref setter - if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag delayed - else - error (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + if not isByrefMethReturnSetter then + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + // x.P <- ... byref setter + if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) + TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag delayed else let args = if pinfo.IsIndexer then args else [] let mut = (if isStructTy cenv.g (tyOfExpr cenv.g objExpr) then DefinitelyMutates else PossiblyMutates) @@ -9708,7 +9708,7 @@ and TcEventValueThen cenv overallTy env tpenv mItem mExprAndItem objDetails (ein | None -> f [] | Some (objExpr, objExprTy) -> mkCompGenLetIn mItem "eventTarget" objExprTy objExpr (fun (_, ve) -> f [ve]) - // Bind the object target expression to make sure we only run its sdie effects once, and to make + // Bind the object target expression to make sure we only run its side effects once, and to make // sure if it's a mutable reference then we dereference it - see FSharp 1.0 bug 942 let expr = bindObjArgs (fun objVars -> @@ -9857,7 +9857,7 @@ and TcMethodApplication // The arguments are passed as if they are curried with arity [numberOfIndexParameters;1], however in the TAST, indexed property setters // are uncurried and have arity [numberOfIndexParameters+1]. // - // Here we work around this mismatch by crunching all property argument lists to uncirred form. + // Here we work around this mismatch by crunching all property argument lists to uncurried form. // Ideally the problem needs to be solved at its root cause at the callsites to this function let unnamedCurriedCallerArgs, namedCurriedCallerArgs = if isProp then @@ -11192,7 +11192,7 @@ and TcLetBinding cenv isUse env containerInfo declKind tpenv (synBinds, synBinds /// RECAP: /// The LHS of let-bindings are patterns. /// These patterns could fail, e.g. "let Some x = ...". -/// So letbindings could contain a fork at a match construct, with one branch being the match failure. +/// So let bindings could contain a fork at a match construct, with one branch being the match failure. /// If bindings are linearised, then this fork is pushed to the RHS. /// In this case, the let bindings type check to a sequence of bindings. and TcLetBindings cenv env containerInfo declKind tpenv (binds, bindsm, scopem) = @@ -11435,7 +11435,7 @@ and AnalyzeRecursiveStaticMemberOrValDecl let vis = CombineVisibilityAttribs vis1 vis2 mBinding // Check if we're defining a member, in which case generate the internal unique - // name for the member and the information about which type it is agumenting + // name for the member and the information about which type it is augmenting match tcrefContainerInfo, memberFlagsOpt with | (Some(MemberOrValContainerInfo(tcref, optIntfSlotTy, baseValOpt, _safeInitInfo, declaredTyconTypars)), Some memberFlags) -> @@ -11655,7 +11655,7 @@ and AnalyzeAndMakeAndPublishRecursiveValue overridesOK isGeneratedEventVal cenv let isComplete = ComputeIsComplete enclosingDeclaredTypars declaredTypars ty // NOTE: The type scheme here is normally not 'complete'!!!! The type is more or less just a type variable at this point. - // NOTE: toparity, type and typars get fixed-up after inference + // NOTE: top arity, type and typars get fixed-up after inference let prelimTyscheme = TypeScheme(enclosingDeclaredTypars@declaredTypars, ty) let partialValReprInfo = TranslateTopValSynInfo mBinding (TcAttributes cenv envinner) valSynInfo let topValInfo = UseSyntacticArity declKind prelimTyscheme partialValReprInfo @@ -11832,7 +11832,7 @@ and TcIncrementalLetRecGeneralization cenv scopem // - This table is usually much smaller than the number of remaining forward declarations ? e.g. in the pathological case you mentioned below this table is size 1. // - If a forward declaration does not have an entry in this table then its type can't involve any inference variables from the declarations we have already checked. // - So by scanning the domain of this table we can reduce the complexity down to something like O(n * average-number-of-forward-calls). - // - For a fully connected programs or programs where every forward declaration is subject to a forward call, this would be quadratic. However we do not expect callgraphs to be like this in practice + // - For a fully connected programs or programs where every forward declaration is subject to a forward call, this would be quadratic. However we do not expect call graphs to be like this in practice // // Hence we use the recursive-uses table to guide the process of scraping forward references for frozen types // If the is no entry in the recursive use table then a forward binding has never been used and @@ -12199,8 +12199,8 @@ and TcLetrec overridesOK cenv env tpenv (binds, bindsm, scopem) = let results = EliminateInitializationGraphs - (fun _ -> failwith "unreachable 2 - no type definitions in recursivve group") - (fun _ _ -> failwith "unreachable 3 - no type definitions in recursivve group") + (fun _ -> failwith "unreachable 2 - no type definitions in recursive group") + (fun _ _ -> failwith "unreachable 3 - no type definitions in recursive group") id (fun morpher oldBinds -> morpher oldBinds) cenv.g mustHaveArity env.DisplayEnv [MutRecShape.Lets bindsWithoutLaziness] bindsm @@ -12559,7 +12559,7 @@ module IncrClassChecking = TyconRef: TyconRef /// The type parameters allocated for the implicit instance constructor. - /// These may be equated with other (WillBeRigid) type parameters through equirecursive inference, and so + /// These may be equated with other (WillBeRigid) type parameters through equi-recursive inference, and so /// should always be renormalized/canonicalized when used. InstanceCtorDeclaredTypars: Typars @@ -12601,7 +12601,7 @@ module IncrClassChecking = /// Check and elaborate the "left hand side" of the implicit class construction /// syntax. - let TcImplictCtorLhs_Phase2A(cenv, env, tpenv, tcref: TyconRef, vis, attrs, spats, thisIdOpt, baseValOpt: Val option, safeInitInfo, m, copyOfTyconTypars, objTy, thisTy) = + let TcImplicitCtorLhs_Phase2A(cenv, env, tpenv, tcref: TyconRef, vis, attrs, spats, thisIdOpt, baseValOpt: Val option, safeInitInfo, m, copyOfTyconTypars, objTy, thisTy) = let baseValOpt = match GetSuperTypeOfType cenv.g cenv.amap m objTy with @@ -13183,12 +13183,12 @@ module IncrClassChecking = // Note: the recursive calls are made via members on the object // or via access to fields. This means the recursive loop is "broken", // and we can collapse to sequential bindings - let reps = (reps, binds) ||> List.fold (fun rep bind -> rep.ValNowWithRepresentation bind.Var) // inscope before + let reps = (reps, binds) ||> List.fold (fun rep bind -> rep.ValNowWithRepresentation bind.Var) // in scope before let actions, methodBinds = binds |> List.map (TransBind reps) |> List.unzip // since can occur in RHS of own defns actions, reps, methodBinds else let actions, methodBinds = binds |> List.map (TransBind reps) |> List.unzip - let reps = (reps, binds) ||> List.fold (fun rep bind -> rep.ValNowWithRepresentation bind.Var) // inscope after + let reps = (reps, binds) ||> List.fold (fun rep bind -> rep.ValNowWithRepresentation bind.Var) // in scope after actions, reps, methodBinds let methodBinds = List.concat methodBinds if isStatic then @@ -13458,16 +13458,16 @@ module MutRecBindingChecking = // Class members can access protected members of the implemented type // Class members can access private members in the ty let isExtrinsic = (declKind = ExtrinsicExtensionBinding) - let initalEnvForTycon = MakeInnerEnvForTyconRef envForDecls tcref isExtrinsic + let initialEnvForTycon = MakeInnerEnvForTyconRef envForDecls tcref isExtrinsic // Re-add the type constructor to make it take precedence for record label field resolutions // This does not apply to extension members: in those cases the relationship between the record labels // and the type is too extruded let envForTycon = if isExtrinsic then - initalEnvForTycon + initialEnvForTycon else - AddLocalTyconRefs true g cenv.amap tcref.Range [tcref] initalEnvForTycon + AddLocalTyconRefs true g cenv.amap tcref.Range [tcref] initialEnvForTycon // Make fresh version of the class type for type checking the members and lets * let _, copyOfTyconTypars, _, objTy, thisTy = FreshenObjectArgType cenv tcref.Range TyparRigidity.WillBeRigid tcref isExtrinsic declaredTyconTypars @@ -13496,7 +13496,7 @@ module MutRecBindingChecking = error(Error(FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m)) // Phase2A: make incrClassCtorLhs - ctorv, thisVal etc, type depends on argty(s) - let incrClassCtorLhs = TcImplictCtorLhs_Phase2A(cenv, envForTycon, tpenv, tcref, vis, attrs, spats, thisIdOpt, baseValOpt, safeInitInfo, m, copyOfTyconTypars, objTy, thisTy) + let incrClassCtorLhs = TcImplicitCtorLhs_Phase2A(cenv, envForTycon, tpenv, tcref, vis, attrs, spats, thisIdOpt, baseValOpt, safeInitInfo, m, copyOfTyconTypars, objTy, thisTy) // Phase2A: Add copyOfTyconTypars from incrClassCtorLhs - or from tcref let envForTycon = AddDeclaredTypars CheckForDuplicateTypars incrClassCtorLhs.InstanceCtorDeclaredTypars envForTycon let innerState = (Some incrClassCtorLhs, envForTycon, tpenv, recBindIdx, uncheckedBindsRev) @@ -14470,7 +14470,7 @@ module TyconConstraintInference = yield tycon.Stamp ] // Initially, don't assume that the equality relation is dependent on any type variables - let initialAsssumedTypars = Set.empty + let initialAssumedTypars = Set.empty // Repeatedly eliminate structural type definitions whose structural component types no longer support // comparison. On the way record type variables which are support the comparison relation. @@ -14576,7 +14576,7 @@ module TyconConstraintInference = else loop newSet !assumedTyparsAcc - let uneliminatedTycons, assumedTyparsActual = loop initialAssumedTycons initialAsssumedTypars + let uneliminatedTycons, assumedTyparsActual = loop initialAssumedTycons initialAssumedTypars // OK, we're done, Record the results for the type variable which provide the support for tyconStamp in uneliminatedTycons do @@ -14617,7 +14617,7 @@ module TyconConstraintInference = if tp.Constraints |> List.exists (function TyparConstraint.SupportsEquality _ -> true | _ -> false) then true - // Within structural types, type parameters can be optimistically assumed to have ewquality + // Within structural types, type parameters can be optimistically assumed to have equality // We record the ones for which we have made this assumption. elif tycon.Typars(tycon.Range) |> List.exists (fun tp2 -> typarRefEq tp tp2) then assumedTyparsAcc := (!assumedTyparsAcc).Add(tp.Stamp) @@ -15434,7 +15434,7 @@ module EstablishTypeDefinitionCores = with e -> errorRecovery e m - // Third phase: check and publish the supr types. Run twice, once before constraints are established + // Third phase: check and publish the super types. Run twice, once before constraints are established // and once after let private TcTyconDefnCore_Phase1D_Phase1F_EstablishSuperTypesAndInterfaceTypes cenv tpenv inSig pass (envMutRec, mutRecDefns: MutRecShape<(_ * (Tycon * (Attribs * _)) option), _, _, _, _> list) = let checkCxs = if (pass = SecondPass) then CheckCxs else NoCheckCxs @@ -15564,7 +15564,7 @@ module EstablishTypeDefinitionCores = let hasMeasureAttr = HasFSharpAttribute g g.attrib_MeasureAttribute attrs // REVIEW: for hasMeasureableAttr we need to be stricter about checking these - // are only used on exactly the right kinds of type definitions and not inconjunction with other attributes. + // are only used on exactly the right kinds of type definitions and not in conjunction with other attributes. let hasMeasureableAttr = HasFSharpAttribute g g.attrib_MeasureableAttribute attrs let hasCLIMutable = HasFSharpAttribute g g.attrib_CLIMutableAttribute attrs @@ -16452,7 +16452,7 @@ module TcDeclarations = | SynMemberDefn.Inherit _ | SynMemberDefn.AbstractSlot _ -> false) - // Convert autoproperties to let bindings in the pre-list + // Convert auto properties to let bindings in the pre-list let rec preAutoProps memb = match memb with | SynMemberDefn.AutoProperty(Attributes attribs, isStatic, id, tyOpt, propKind, _, xmlDoc, _access, synExpr, _mGetSet, mWholeAutoProp) -> @@ -16479,7 +16479,7 @@ module TcDeclarations = | SynMemberDefn.ImplicitInherit _ -> [memb] | _ -> [] - // Convert autoproperties to member bindings in the post-list + // Convert auto properties to member bindings in the post-list let rec postAutoProps memb = match memb with | SynMemberDefn.AutoProperty(Attributes attribs, isStatic, id, tyOpt, propKind, memberFlags, xmlDoc, access, _synExpr, mGetSetOpt, _mWholeAutoProp) -> diff --git a/src/fsharp/TypeRelations.fs b/src/fsharp/TypeRelations.fs index 29c95cc55a9..dd32a6ee001 100755 --- a/src/fsharp/TypeRelations.fs +++ b/src/fsharp/TypeRelations.fs @@ -11,7 +11,6 @@ open FSharp.Compiler.Tast open FSharp.Compiler.Tastops open FSharp.Compiler.TcGlobals open FSharp.Compiler.Infos -open FSharp.Compiler.PrettyNaming /// Implements a :> b without coercion based on finalized (no type variable) types // Note: This relation is approximate and not part of the language specification. diff --git a/src/fsharp/UnicodeLexing.fs b/src/fsharp/UnicodeLexing.fs index d34092940e2..c776a1f1f76 100644 --- a/src/fsharp/UnicodeLexing.fs +++ b/src/fsharp/UnicodeLexing.fs @@ -7,8 +7,6 @@ module internal FSharp.Compiler.UnicodeLexing // open FSharp.Compiler.AbstractIL.Internal.Library -open FSharp.Compiler.Features -open Internal.Utilities open System.IO open Internal.Utilities.Text.Lexing diff --git a/src/fsharp/XmlAdapters.fs b/src/fsharp/XmlAdapters.fs index 4f48955945a..2e04733fc18 100644 --- a/src/fsharp/XmlAdapters.fs +++ b/src/fsharp/XmlAdapters.fs @@ -1,13 +1,9 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.FSharp.Core -open System.Reflection //Replacement for: System.Security.SecurityElement.Escape(line) All platforms module internal XmlAdapters = - open System.Text - open Microsoft.FSharp.Collections - let s_escapeChars = [| '<'; '>'; '\"'; '\''; '&' |] let getEscapeSequence c = diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 59e93205ce1..f5a8382505a 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -2,12 +2,10 @@ module public FSharp.Compiler.Ast -open System.Collections.Generic open Internal.Utilities.Text.Lexing open Internal.Utilities.Text.Parsing open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler open FSharp.Compiler.UnicodeLexing @@ -750,7 +748,7 @@ and /// Computation expressions only, based on JOIN_IN token from lex filter | JoinIn of SynExpr * range * SynExpr * range: range - /// Used internally during type checking for translating computation expressions. + /// Used in parser error recovery and internally during type checking for translating computation expressions. | ImplicitZero of range: range /// Used internally during type checking for translating computation expressions. @@ -1368,7 +1366,7 @@ and and [] SynExceptionDefnRepr = - | SynExceptionDefnRepr of SynAttributes * SynUnionCase * longId: LongIdent option * xmlDoc: PreXmlDoc * accessiblity: SynAccess option * range: range + | SynExceptionDefnRepr of SynAttributes * SynUnionCase * longId: LongIdent option * xmlDoc: PreXmlDoc * accessibility: SynAccess option * range: range member this.Range = match this with SynExceptionDefnRepr (range=m) -> m @@ -1416,7 +1414,7 @@ and | Member of memberDefn: SynBinding * range: range /// implicit ctor args as a defn line, 'as' specification - | ImplicitCtor of accessiblity: SynAccess option * attributes: SynAttributes * ctorArgs: SynSimplePats * selfIdentifier: Ident option * range: range + | ImplicitCtor of accessibility: SynAccess option * attributes: SynAttributes * ctorArgs: SynSimplePats * selfIdentifier: Ident option * range: range /// inherit (args...) as base | ImplicitInherit of inheritType: SynType * inheritArgs: SynExpr * inheritAlias: Ident option * range: range @@ -1448,7 +1446,7 @@ and propKind: MemberKind * memberFlags:(MemberKind -> MemberFlags) * xmlDoc: PreXmlDoc * - accessiblity: SynAccess option * + accessibility: SynAccess option * synExpr: SynExpr * getSetRange: range option * range: range @@ -1760,15 +1758,15 @@ let (|SynPatErrorSkip|) (p: SynPat) = let rec SimplePatOfPat (synArgNameGenerator: SynArgNameGenerator) p = match p with | SynPat.Typed(p', ty, m) -> - let p2, laterf = SimplePatOfPat synArgNameGenerator p' + let p2, laterF = SimplePatOfPat synArgNameGenerator p' SynSimplePat.Typed(p2, ty, m), - laterf + laterF | SynPat.Attrib(p', attribs, m) -> - let p2, laterf = SimplePatOfPat synArgNameGenerator p' + let p2, laterF = SimplePatOfPat synArgNameGenerator p' SynSimplePat.Attrib(p2, attribs, m), - laterf - | SynPat.Named (SynPat.Wild _, v, thisv, _, m) -> - SynSimplePat.Id (v, None, false, thisv, false, m), + laterF + | SynPat.Named (SynPat.Wild _, v, thisV, _, m) -> + SynSimplePat.Id (v, None, false, thisV, false, m), None | SynPat.OptionalVal (v, m) -> SynSimplePat.Id (v, None, false, false, true, m), @@ -1803,13 +1801,13 @@ let rec SimplePatsOfPat synArgNameGenerator p = match p with | SynPat.FromParseError (p, _) -> SimplePatsOfPat synArgNameGenerator p | SynPat.Typed(p', ty, m) -> - let p2, laterf = SimplePatsOfPat synArgNameGenerator p' + let p2, laterF = SimplePatsOfPat synArgNameGenerator p' SynSimplePats.Typed(p2, ty, m), - laterf + laterF // | SynPat.Paren (p, m) -> SimplePatsOfPat synArgNameGenerator p | SynPat.Tuple (false, ps, m) | SynPat.Paren(SynPat.Tuple (false, ps, m), _) -> - let ps2, laterf = + let ps2, laterF = List.foldBack (fun (p', rhsf) (ps', rhsf') -> p':: ps', @@ -1817,23 +1815,23 @@ let rec SimplePatsOfPat synArgNameGenerator p = (List.map (SimplePatOfPat synArgNameGenerator) ps) ([], None) SynSimplePats.SimplePats (ps2, m), - laterf + laterF | SynPat.Paren(SynPat.Const (SynConst.Unit, m), _) | SynPat.Const (SynConst.Unit, m) -> SynSimplePats.SimplePats ([], m), None | _ -> let m = p.Range - let sp, laterf = SimplePatOfPat synArgNameGenerator p - SynSimplePats.SimplePats ([sp], m), laterf + let sp, laterF = SimplePatOfPat synArgNameGenerator p + SynSimplePats.SimplePats ([sp], m), laterF let PushPatternToExpr synArgNameGenerator isMember pat (rhs: SynExpr) = - let nowpats, laterf = SimplePatsOfPat synArgNameGenerator pat - nowpats, SynExpr.Lambda (isMember, false, nowpats, appFunOpt laterf rhs, rhs.Range) + let nowPats, laterF = SimplePatsOfPat synArgNameGenerator pat + nowPats, SynExpr.Lambda (isMember, false, nowPats, appFunOpt laterF rhs, rhs.Range) let private isSimplePattern pat = - let _nowpats, laterf = SimplePatsOfPat (SynArgNameGenerator()) pat - Option.isNone laterf + let _nowPats, laterF = SimplePatsOfPat (SynArgNameGenerator()) pat + Option.isNone laterF /// "fun (UnionCase x) (UnionCase y) -> body" /// ==> @@ -1950,15 +1948,15 @@ let mkSynDotBrackGet m mDot a b = SynExpr.DotIndexedGet (a, [SynIndexerArg.On let mkSynQMarkSet m a b c = mkSynTrifix m qmarkSet a b c let mkSynDotBrackSliceGet m mDot arr sliceArg = SynExpr.DotIndexedGet (arr, [sliceArg], mDot, m) -let mkSynDotBrackSeqSliceGet m mDot arr (argslist: list) = - let notsliced=[ for arg in argslist do +let mkSynDotBrackSeqSliceGet m mDot arr (argsList: list) = + let notSliced=[ for arg in argsList do match arg with | SynIndexerArg.One x -> yield x | _ -> () ] - if notsliced.Length = argslist.Length then - SynExpr.DotIndexedGet (arr, [SynIndexerArg.One (SynExpr.Tuple (false, notsliced, [], unionRanges (List.head notsliced).Range (List.last notsliced).Range))], mDot, m) + if notSliced.Length = argsList.Length then + SynExpr.DotIndexedGet (arr, [SynIndexerArg.One (SynExpr.Tuple (false, notSliced, [], unionRanges (List.head notSliced).Range (List.last notSliced).Range))], mDot, m) else - SynExpr.DotIndexedGet (arr, argslist, mDot, m) + SynExpr.DotIndexedGet (arr, argsList, mDot, m) let mkSynDotParenGet lhsm dotm a b = match b with @@ -2206,7 +2204,7 @@ let mkSynBindingRhs staticOptimizations rhsExpr mRhs retInfo = let rhsExpr = List.foldBack (fun (c, e1) e2 -> SynExpr.LibraryOnlyStaticOptimization (c, e1, e2, mRhs)) staticOptimizations rhsExpr let rhsExpr, retTyOpt = match retInfo with - | Some (SynReturnInfo((ty, SynArgInfo(rattribs, _, _)), tym)) -> SynExpr.Typed (rhsExpr, ty, rhsExpr.Range), Some(SynBindingReturnInfo(ty, tym, rattribs) ) + | Some (SynReturnInfo((ty, SynArgInfo(rAttribs, _, _)), tym)) -> SynExpr.Typed (rhsExpr, ty, rhsExpr.Range), Some(SynBindingReturnInfo(ty, tym, rAttribs) ) | None -> rhsExpr, None rhsExpr, retTyOpt diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index dc5777cdc39..bb46f75e1db 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -13,13 +13,11 @@ module internal FSharp.Compiler.Driver open System -open System.Collections.Concurrent open System.Collections.Generic open System.Diagnostics open System.Globalization open System.IO open System.Reflection -open System.Runtime.CompilerServices open System.Text open System.Threading @@ -37,7 +35,6 @@ open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.IlxGen open FSharp.Compiler.AccessibilityLogic -open FSharp.Compiler.AttributeChecking open FSharp.Compiler.Ast open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions @@ -1105,7 +1102,6 @@ module MainModuleBuilder = /// Optional static linking of all DLLs that depend on the F# Library, plus other specified DLLs module StaticLinker = - open FSharp.Compiler.AbstractIL // Handles TypeForwarding for the generated IL model type TypeForwarding (tcImports: TcImports) = diff --git a/src/fsharp/fscmain.fs b/src/fsharp/fscmain.fs index 73e578f3deb..f4c6b87c283 100644 --- a/src/fsharp/fscmain.fs +++ b/src/fsharp/fscmain.fs @@ -77,7 +77,6 @@ let main(argv) = System.Runtime.GCSettings.LatencyMode <- System.Runtime.GCLatencyMode.Batch use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter - if not runningOnMono then Lib.UnmanagedProcessExecutionOptions.EnableHeapTerminationOnCorruption() (* SDL recommendation *) Lib.UnmanagedProcessExecutionOptions.EnableHeapTerminationOnCorruption() (* SDL recommendation *) try diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index bfecea2a169..c5e71384f1f 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -13,20 +13,16 @@ open System open System.Collections.Generic open System.Diagnostics open System.Globalization -open System.Runtime.InteropServices open System.IO open System.Text open System.Threading open System.Reflection -open System.Runtime.CompilerServices open FSharp.Compiler open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILBinaryReader -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library -open FSharp.Compiler.AbstractIL.Extensions.ILX open FSharp.Compiler.AbstractIL.ILRuntimeWriter open FSharp.Compiler.Lib open FSharp.Compiler.AccessibilityLogic @@ -34,16 +30,11 @@ open FSharp.Compiler.Ast open FSharp.Compiler.CompileOptions open FSharp.Compiler.CompileOps open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.Features -open FSharp.Compiler.Infos open FSharp.Compiler.InfoReader open FSharp.Compiler.NameResolution open FSharp.Compiler.IlxGen open FSharp.Compiler.Lexhelp open FSharp.Compiler.Layout -open FSharp.Compiler.Lib -open FSharp.Compiler.Optimizer -open FSharp.Compiler.PostTypeCheckSemanticChecks open FSharp.Compiler.Range open FSharp.Compiler.TypeChecker open FSharp.Compiler.Tast @@ -54,7 +45,6 @@ open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.ReferenceResolver open Internal.Utilities -open Internal.Utilities.Collections open Internal.Utilities.StructuredFormat //---------------------------------------------------------------------------- @@ -405,7 +395,7 @@ type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, g: TcGlobals, // Note: The value may be (null:Object). // Note: A System.Type allows the value printer guide printing of nulls, e.g. as None or []. //------- - // IlxGen knows what the v:Val was converted to w.r.t. AbsIL datastructures. + // IlxGen knows what the v:Val was converted to w.r.t. AbsIL data structures. // Ilreflect knows what the AbsIL was generated to. // Combining these allows for obtaining the (obj,objTy) by reflection where possible. // This assumes the v:Val was given appropriate storage, e.g. StaticField. @@ -960,6 +950,7 @@ type internal FsiDynamicCompiler let assemblyName = "FSI-ASSEMBLY" let assemblyReferenceAddedEvent = Control.Event() + let valueBoundEvent = Control.Event<_>() let mutable fragmentId = 0 let mutable prevIt : ValRef option = None @@ -1165,6 +1156,10 @@ type internal FsiDynamicCompiler if v.CompiledName = "it" then itValue <- fsiValueOpt + match fsiValueOpt with + | Some fsiValue -> valueBoundEvent.Trigger(fsiValue.ReflectionValue, fsiValue.ReflectionType, v.CompiledName) + | None -> () + let symbol = FSharpSymbol.Create(cenv, v.Item) let symbolUse = FSharpSymbolUse(tcGlobals, newState.tcState.TcEnvFromImpls.DisplayEnv, symbol, ItemOccurence.Binding, v.DeclarationLocation) fsi.TriggerEvaluation (fsiValueOpt, symbolUse, decl) @@ -1254,7 +1249,7 @@ type internal FsiDynamicCompiler with e -> tcConfigB.RemoveReferencedAssemblyByPath(m,path) reraise() - let optEnv = List.fold (AddExternalCcuToOpimizationEnv tcGlobals) istate.optEnv ccuinfos + let optEnv = List.fold (AddExternalCcuToOptimizationEnv tcGlobals) istate.optEnv ccuinfos istate.ilxGenerator.AddExternalCcus (ccuinfos |> List.map (fun ccuinfo -> ccuinfo.FSharpViewOfMetadata)) resolutions, { istate with tcState = tcState.NextStateAfterIncrementalFragment(tcEnv); optEnv = optEnv } @@ -1341,6 +1336,8 @@ type internal FsiDynamicCompiler member __.AssemblyReferenceAdded = assemblyReferenceAddedEvent.Publish + member __.ValueBound = valueBoundEvent.Publish + //---------------------------------------------------------------------------- // ctrl-c handling //---------------------------------------------------------------------------- @@ -1401,7 +1398,7 @@ type internal FsiInterruptController(fsiOptions: FsiCommandLineOptions, fsiConso member controller.InstallKillThread(threadToKill:Thread, pauseMilliseconds:int) = - // Fsi Interupt handler + // Fsi Interrupt handler let raiseCtrlC() = use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiInterrupt()) @@ -1623,11 +1620,11 @@ type internal FsiStdinLexerProvider let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId - let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) readf = + let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) readF = UnicodeLexing.FunctionAsLexbuf (isFeatureSupported, (fun (buf: char[], start, len) -> //fprintf fsiConsoleOutput.Out "Calling ReadLine\n" - let inputOption = try Some(readf()) with :? EndOfStreamException -> None + let inputOption = try Some(readF()) with :? EndOfStreamException -> None inputOption |> Option.iter (fun t -> fsiStdinSyphon.Add (t + "\n")) match inputOption with | Some(null) | None -> @@ -2232,7 +2229,6 @@ type internal FsiInteractionProcessor let fsiInteractiveChecker = FsiInteractiveChecker(legacyReferenceResolver, checker, tcConfig, istate.tcGlobals, istate.tcImports, istate.tcState) fsiInteractiveChecker.ParseAndCheckInteraction(ctok, SourceText.ofString text) - //---------------------------------------------------------------------------- // Server mode: //---------------------------------------------------------------------------- @@ -2640,6 +2636,9 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i /// Event fires every time an assembly reference is added to the execution environment, e.g., via `#r`. member __.AssemblyReferenceAdded = fsiDynamicCompiler.AssemblyReferenceAdded + + /// Event fires when a root-level value is bound to an identifier, e.g., via `let x = ...`. + member __.ValueBound = fsiDynamicCompiler.ValueBound /// Performs these steps: /// - Load the dummy interaction, if any @@ -2699,7 +2698,7 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i DriveFsiEventLoop (fsi, fsiConsoleOutput ) else // not interact - if !progress then fprintfn fsiConsoleOutput.Out "Run: not interact, loading intitial files..." + if !progress then fprintfn fsiConsoleOutput.Out "Run: not interact, loading initial files..." fsiInteractionProcessor.LoadInitialFiles(ctokRun, errorLogger) if !progress then fprintfn fsiConsoleOutput.Out "Run: done..." @@ -2749,7 +2748,7 @@ module Settings = abstract Invoke : (unit -> 'T) -> 'T abstract ScheduleRestart : unit -> unit - // fsi.fs in FSHarp.Compiler.Sevice.dll avoids a hard dependency on FSharp.Compiler.Interactive.Settings.dll + // fsi.fs in FSHarp.Compiler.Service.dll avoids a hard dependency on FSharp.Compiler.Interactive.Settings.dll // by providing an optional reimplementation of the functionality // An implementation of IEventLoop suitable for the command-line console diff --git a/src/fsharp/fsi/fsi.fsi b/src/fsharp/fsi/fsi.fsi index 8cc0b23fed0..c576a33fbdc 100644 --- a/src/fsharp/fsi/fsi.fsi +++ b/src/fsharp/fsi/fsi.fsi @@ -125,10 +125,10 @@ type FsiEvaluationSession = /// Create an FsiEvaluationSession, reading from the given text input, writing to the given text output and error writers /// /// The dynamic configuration of the evaluation session - /// The commmand line arguments for the evaluation session + /// The command line arguments for the evaluation session /// Read input from the given reader /// Write output to the given writer - /// Optionally make the dynamic assmbly for the session collectible + /// Optionally make the dynamic assembly for the session collectible static member Create : fsiConfig: FsiEvaluationSessionHostConfig * argv:string[] * inReader:TextReader * outWriter:TextWriter * errorWriter: TextWriter * ?collectible: bool * ?legacyReferenceResolver: ReferenceResolver.Resolver -> FsiEvaluationSession /// A host calls this to request an interrupt on the evaluation thread. @@ -177,7 +177,7 @@ type FsiEvaluationSession = /// Execute the code as if it had been entered as one or more interactions, with an /// implicit termination at the end of the input. Stop on first error, discarding the rest /// of the input. Errors are sent to the output writer. Parsing is performed on the current thread, and execution is performed - /// sycnhronously on the 'main' thread. + /// synchronously on the 'main' thread. /// /// Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered /// by input from 'stdin'. @@ -187,7 +187,7 @@ type FsiEvaluationSession = /// implicit termination at the end of the input. Stop on first error, discarding the rest /// of the input. Errors and warnings are collected apart from any exception arising from execution /// which is returned via a Choice. Parsing is performed on the current thread, and execution is performed - /// sycnhronously on the 'main' thread. + /// synchronously on the 'main' thread. /// /// Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered /// by input from 'stdin'. @@ -222,7 +222,7 @@ type FsiEvaluationSession = /// Get a handle to the resolved view of the current signature of the incrementally generated assembly. member CurrentPartialAssemblySignature : FSharpAssemblySignature - /// Get a handle to the dynamicly generated assembly + /// Get a handle to the dynamically generated assembly member DynamicAssembly : System.Reflection.Assembly /// A host calls this to determine if the --gui parameter is active @@ -237,6 +237,9 @@ type FsiEvaluationSession = /// Event fires every time an assembly reference is added to the execution environment, e.g., via `#r`. member AssemblyReferenceAdded : IEvent + /// Event fires when a root-level value is bound to an identifier, e.g., via `let x = ...`. + member ValueBound : IEvent + /// Load the dummy interaction, load the initial files, and, /// if interacting, start the background thread to read the standard input. /// @@ -320,7 +323,7 @@ module Settings = /// A default implementation of the 'fsi' object, used by GetDefaultConfiguration(). Note this /// is a different object to FSharp.Compiler.Interactive.Settings.fsi in FSharp.Compiler.Interactive.Settings.dll, - /// which can be used as an alternative implementation of the interactiev settings if passed as a parameter + /// which can be used as an alternative implementation of the interactive settings if passed as a parameter /// to GetDefaultConfiguration(fsiObj). val fsi : InteractiveSettings diff --git a/src/fsharp/import.fs b/src/fsharp/import.fs index 8fdd28f3b54..29943461bd3 100644 --- a/src/fsharp/import.fs +++ b/src/fsharp/import.fs @@ -3,7 +3,6 @@ /// Functions to import .NET binary metadata as TAST objects module internal FSharp.Compiler.Import -open System.Reflection open System.Collections.Concurrent open System.Collections.Generic diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index 4ca16f77cdd..0231d5f2ab0 100755 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -1077,7 +1077,7 @@ type MethInfo = /// For an extension method this includes all type parameters, even if it is extending a generic type. member x.GenericArity = x.FormalMethodTypars.Length - member x.IsProtectedAccessiblity = + member x.IsProtectedAccessibility = match x with | ILMeth(_, ilmeth, _) -> ilmeth.IsProtectedAccessibility | FSMeth _ -> false @@ -2476,7 +2476,7 @@ type EventInfo = /// Test whether two event infos have the same underlying definition. /// Must be compatible with ItemsAreEffectivelyEqual relation. - static member EventInfosUseIdenticalDefintions x1 x2 = + static member EventInfosUseIdenticalDefinitions x1 x2 = match x1, x2 with | FSEvent(g, pi1, vrefa1, vrefb1), FSEvent(_, pi2, vrefa2, vrefb2) -> PropInfo.PropInfosUseIdenticalDefinitions pi1 pi2 && valRefEq g vrefa1 vrefa2 && valRefEq g vrefb1 vrefb2 diff --git a/src/fsharp/layout.fs b/src/fsharp/layout.fs index d63a8f8f023..c54a545a2bb 100644 --- a/src/fsharp/layout.fs +++ b/src/fsharp/layout.fs @@ -3,7 +3,6 @@ module FSharp.Compiler.Layout open System -open System.Collections.Generic open System.IO open Internal.Utilities.StructuredFormat open Microsoft.FSharp.Core.Printf @@ -389,7 +388,7 @@ type LayoutRenderer<'a, 'b> = let renderL (rr: LayoutRenderer<_, _>) layout = let rec addL z pos i layout k = match layout with - | ObjLeaf _ -> failwith "ObjLeaf should never apper here" + | ObjLeaf _ -> failwith "ObjLeaf should never appear here" (* pos is tab level *) | Leaf (_, text, _) -> k(rr.AddText z text, i + text.Text.Length) diff --git a/src/fsharp/lexhelp.fs b/src/fsharp/lexhelp.fs index 6a9a6430cbd..b25627e9a45 100644 --- a/src/fsharp/lexhelp.fs +++ b/src/fsharp/lexhelp.fs @@ -6,19 +6,15 @@ open System open System.Text open Internal.Utilities -open Internal.Utilities.Collections -open Internal.Utilities.Text open Internal.Utilities.Text.Lexing open FSharp.Compiler -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.Lib open FSharp.Compiler.Ast open FSharp.Compiler.PrettyNaming open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.Range open FSharp.Compiler.Parser diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index 6c4599f8a1c..fba1c975e8d 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -4,8 +4,8 @@ module internal FSharp.Compiler.Lib open System.IO open System.Collections.Generic +open System.Runtime.InteropServices open Internal.Utilities -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library @@ -98,31 +98,31 @@ module Check = /// Throw System.InvalidOperationException() if argument is None. /// If there is a value (e.g. Some(value)) then value is returned. - let NotNone argname (arg:'T option) : 'T = + let NotNone argName (arg:'T option) : 'T = match arg with - | None -> raise (new System.InvalidOperationException(argname)) + | None -> raise (new System.InvalidOperationException(argName)) | Some x -> x /// Throw System.ArgumentNullException() if argument is null. - let ArgumentNotNull arg argname = + let ArgumentNotNull arg argName = match box(arg) with - | null -> raise (new System.ArgumentNullException(argname)) + | null -> raise (new System.ArgumentNullException(argName)) | _ -> () /// Throw System.ArgumentNullException() if array argument is null. /// Throw System.ArgumentOutOfRangeException() is array argument is empty. - let ArrayArgumentNotNullOrEmpty (arr:'T[]) argname = - ArgumentNotNull arr argname + let ArrayArgumentNotNullOrEmpty (arr:'T[]) argName = + ArgumentNotNull arr argName if (0 = arr.Length) then - raise (new System.ArgumentOutOfRangeException(argname)) + raise (new System.ArgumentOutOfRangeException(argName)) /// Throw System.ArgumentNullException() if string argument is null. /// Throw System.ArgumentOutOfRangeException() is string argument is empty. - let StringArgumentNotNullOrEmpty (s:string) argname = - ArgumentNotNull s argname + let StringArgumentNotNullOrEmpty (s:string) argName = + ArgumentNotNull s argName if s.Length = 0 then - raise (new System.ArgumentNullException(argname)) + raise (new System.ArgumentNullException(argName)) //------------------------------------------------------------------------- // Library @@ -378,10 +378,10 @@ let nullableSlotFull x = x type cache<'T> = { mutable cacheVal: 'T NonNullSlot } let newCache() = { cacheVal = nullableSlotEmpty() } -let inline cached cache resf = +let inline cached cache resF = match box cache.cacheVal with | null -> - let res = resf() + let res = resF() cache.cacheVal <- nullableSlotFull res res | _ -> @@ -395,6 +395,10 @@ let inline cacheOptRef cache f = cache := Some res res +let inline tryGetCacheValue cache = + match box cache.cacheVal with + | null -> ValueNone + | _ -> ValueSome cache.cacheVal #if DUMPER type Dumper(x:obj) = @@ -419,11 +423,11 @@ module internal AsyncUtil = | AsyncCanceled of OperationCanceledException static member Commit(res:AsyncResult<'T>) = - Async.FromContinuations (fun (cont, econt, ccont) -> + Async.FromContinuations (fun (cont, eCont, cCont) -> match res with | AsyncOk v -> cont v - | AsyncException exn -> econt exn - | AsyncCanceled exn -> ccont exn) + | AsyncException exn -> eCont exn + | AsyncCanceled exn -> cCont exn) /// When using .NET 4.0 you can replace this type by [] @@ -446,7 +450,7 @@ module internal AsyncUtil = else result <- Some res // Invoke continuations in FIFO order - // Continuations that Async.FromContinuations provide do QUWI/SynchContext.Post, + // Continuations that Async.FromContinuations provide do QUWI/SyncContext.Post, // so the order is not overly relevant but still. List.rev savedConts) let postOrQueue (sc:SynchronizationContext, cont) = @@ -515,7 +519,7 @@ module UnmanagedProcessExecutionOptions = // Translation of C# from http://swikb/v1/DisplayOnlineDoc.aspx?entryID=826 and copy in bug://5018 [] let EnableHeapTerminationOnCorruption() = - if (System.Environment.OSVersion.Version.Major >= 6 && // If OS is Vista or higher + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && System.Environment.OSVersion.Version.Major >= 6 && // If OS is Vista or higher System.Environment.Version.Major < 3) then // and CLR not 3.0 or higher // "The flag HeapSetInformation sets is available in Windows XP SP3 and later. // The data structure used for heap information is available on earlier versions of Windows. @@ -544,4 +548,4 @@ module StackGuard = let EnsureSufficientExecutionStack recursionDepth = if recursionDepth > MaxUncheckedRecursionDepth then - RuntimeHelpers.EnsureSufficientExecutionStack () \ No newline at end of file + RuntimeHelpers.EnsureSufficientExecutionStack () diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 64011e2c407..749c8dd5e38 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -788,7 +788,7 @@ optLiteralValueSpfn: | EQUALS declExpr { Some($2) } - | EQUALS OBLOCKBEGIN declExpr oblockend + | EQUALS OBLOCKBEGIN declExpr oblockend opt_ODECLEND { Some($3) } @@ -1623,21 +1623,23 @@ classDefnMemberGetSetElement: /* The core of a member definition */ memberCore: /* Methods and simple getter properties */ - | opt_inline bindingPattern opt_topReturnTypeWithTypeConstraints EQUALS typedSeqExprBlock - { let mRhs = $5.Range - let mWhole = unionRanges (rhs2 parseState 3 4) mRhs - let optReturnType = $3 - let bindingBuilder,mBindLhs = $2 - (fun vis memFlagsBuilder attrs -> - [ SynMemberDefn.Member (bindingBuilder (vis,$1,false,mBindLhs,NoSequencePointAtInvisibleBinding,optReturnType,$5,mRhs,[],attrs,Some(memFlagsBuilder MemberKind.Member)),unionRanges mWhole mBindLhs) ]) } + | opt_inline bindingPattern opt_topReturnTypeWithTypeConstraints EQUALS typedSeqExprBlock + { let mRhs = $5.Range + let optReturnType = $3 + let bindingBuilder, mBindLhs = $2 + (fun vis memFlagsBuilder attrs rangeStart -> + let memberFlags = Some (memFlagsBuilder MemberKind.Member) + let binding = bindingBuilder (vis, $1, false, mBindLhs, NoSequencePointAtInvisibleBinding, optReturnType, $5, mRhs, [], attrs, memberFlags) + let memberRange = unionRanges rangeStart mRhs + [ SynMemberDefn.Member (binding, memberRange) ]) } /* Properties with explicit get/set, also indexer properties */ - | opt_inline bindingPattern opt_topReturnTypeWithTypeConstraints classDefnMemberGetSet + | opt_inline bindingPattern opt_topReturnTypeWithTypeConstraints classDefnMemberGetSet { let mWhole = (rhs parseState 2, $4) ||> unionRangeWithListBy (fun (_,_,_,_,_,m2) -> m2) - let propertyNameBindingBuilder,_ = $2 + let propertyNameBindingBuilder, _ = $2 let optPropertyType = $3 let isMutable = false - (fun visNoLongerUsed memFlagsBuilder attrs -> + (fun visNoLongerUsed memFlagsBuilder attrs rangeStart -> let hasGet = ref false let hasSet = ref false @@ -1665,21 +1667,21 @@ memberCore: | SynPat.Attrib (p,_,_) -> go p | _ -> raiseParseErrorAt mBindLhs (FSComp.SR.parsInvalidDeclarationSyntax()) go pv - if getset = "get" then ( + if getset = "get" then if !hasGet then reportParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) None else hasGet := true Some MemberKind.PropertyGet - ) else if getset = "set" then ( + else if getset = "set" then if !hasSet then reportParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) None else hasSet := true Some MemberKind.PropertySet - ) else + else raiseParseErrorAt mBindLhs (FSComp.SR.parsGetAndOrSetRequired()) match memberKind with @@ -1697,7 +1699,7 @@ memberCore: let optReturnType = match (memberKind, optReturnType) with - | MemberKind.PropertySet,_ -> optReturnType + | MemberKind.PropertySet, _ -> optReturnType | _, None -> optPropertyType | _ -> optReturnType @@ -1719,35 +1721,39 @@ memberCore: | _ -> SynInfo.unnamedTopArg match memberKind, valSynInfo, memFlags.IsInstance with - | MemberKind.PropertyGet,SynValInfo ([],_ret), false - | MemberKind.PropertyGet,SynValInfo ([_],_ret), true -> + | MemberKind.PropertyGet, SynValInfo ([], _ret), false + | MemberKind.PropertyGet, SynValInfo ([_], _ret), true -> raiseParseErrorAt mBindLhs (FSComp.SR.parsGetterMustHaveAtLeastOneArgument()) - | MemberKind.PropertyGet,SynValInfo (thisArg :: indexOrUnitArgs :: rest,ret), true -> - if not rest.IsEmpty then reportParseErrorAt mBindLhs (FSComp.SR.parsGetterAtMostOneArgument()) - SynValInfo ([thisArg; indexOrUnitArgs],ret) + | MemberKind.PropertyGet, SynValInfo (thisArg :: indexOrUnitArgs :: rest, ret), true -> + if not rest.IsEmpty then + reportParseErrorAt mBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) + SynValInfo ([thisArg; indexOrUnitArgs], ret) - | MemberKind.PropertyGet,SynValInfo (indexOrUnitArgs :: rest,ret), false -> - if not rest.IsEmpty then reportParseErrorAt mBindLhs (FSComp.SR.parsGetterAtMostOneArgument()) - SynValInfo ([indexOrUnitArgs],ret) + | MemberKind.PropertyGet, SynValInfo (indexOrUnitArgs :: rest,ret), false -> + if not rest.IsEmpty then + reportParseErrorAt mBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) + SynValInfo ([indexOrUnitArgs], ret) - | MemberKind.PropertySet,SynValInfo ([thisArg;valueArg],ret), true -> - SynValInfo ([thisArg; adjustValueArg valueArg],ret) + | MemberKind.PropertySet, SynValInfo ([thisArg;valueArg], ret), true -> + SynValInfo ([thisArg; adjustValueArg valueArg], ret) - | MemberKind.PropertySet,SynValInfo (thisArg :: indexArgs :: valueArg :: rest,ret), true -> - if not rest.IsEmpty then reportParseErrorAt mBindLhs (FSComp.SR.parsSetterAtMostTwoArguments()) - SynValInfo ([thisArg; indexArgs @ adjustValueArg valueArg],ret) + | MemberKind.PropertySet, SynValInfo (thisArg :: indexArgs :: valueArg :: rest, ret), true -> + if not rest.IsEmpty then + reportParseErrorAt mBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) + SynValInfo ([thisArg; indexArgs @ adjustValueArg valueArg], ret) - | MemberKind.PropertySet,SynValInfo ([valueArg],ret), false -> - SynValInfo ([adjustValueArg valueArg],ret) + | MemberKind.PropertySet, SynValInfo ([valueArg], ret), false -> + SynValInfo ([adjustValueArg valueArg], ret) - | MemberKind.PropertySet,SynValInfo (indexArgs :: valueArg :: rest,ret), _ -> - if not rest.IsEmpty then reportParseErrorAt mBindLhs (FSComp.SR.parsSetterAtMostTwoArguments()) - SynValInfo ([indexArgs @ adjustValueArg valueArg],ret) + | MemberKind.PropertySet, SynValInfo (indexArgs :: valueArg :: rest,ret), _ -> + if not rest.IsEmpty then + reportParseErrorAt mBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) + SynValInfo ([indexArgs @ adjustValueArg valueArg], ret) | _ -> // should be unreachable, cover just in case - raiseParseErrorAt mBindLhs (FSComp.SR.parsInvalidProperty()) + raiseParseErrorAt mBindLhs (FSComp.SR.parsInvalidProperty ()) let valSynData = SynValData(Some(memFlags), valSynInfo,None) @@ -1808,7 +1814,9 @@ memberCore: go pv,PreXmlDoc.Merge doc2 doc - Some <| SynMemberDefn.Member (Binding (vis, NormalBinding, isInline, isMutable, attrs, xmlDocAdjusted, valSynData, bindingPatAdjusted, rhsRetInfo, rhsExpr, mBindLhs, spBind),mWhole))) + let binding = Binding (vis, NormalBinding, isInline, isMutable, attrs, xmlDocAdjusted, valSynData, bindingPatAdjusted, rhsRetInfo, rhsExpr, mBindLhs, spBind) + let memberRange = unionRanges rangeStart mWhole + Some (SynMemberDefn.Member (binding, memberRange)))) } @@ -1827,10 +1835,12 @@ classDefnMember: { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(),rhs parseState 2)) [mkClassMemberLocalBindings(true,Some (rhs parseState 3),$1,$2,$4)] } - | opt_attributes opt_declVisibility memberFlags memberCore opt_ODECLEND - { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(),rhs parseState 2)) - let _,flags = $3 - $4 $2 flags $1 } + | opt_attributes opt_declVisibility memberFlags memberCore opt_ODECLEND + { let rangeStart = rhs parseState 1 + if Option.isSome $2 then + errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) + let _, flags = $3 + $4 $2 flags $1 rangeStart } | opt_attributes opt_declVisibility interfaceMember appType opt_interfaceImplDefn { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesAreNotPermittedOnInterfaceImplementations(),rhs parseState 1)) @@ -1869,9 +1879,11 @@ classDefnMember: $4 (Some (rhs parseState 3)) $1 true } | opt_attributes opt_declVisibility memberFlags autoPropsDefnDecl opt_ODECLEND - { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(),rhs parseState 2)) - let isStatic, flags = $3 - $4 $1 isStatic flags } + { let rangeStart = rhs parseState 1 + if Option.isSome $2 then + errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(),rhs parseState 2)) + let isStatic, flags = $3 + $4 $1 isStatic flags rangeStart } | opt_attributes opt_declVisibility NEW atomicPattern optAsSpec EQUALS typedSeqExprBlock opt_ODECLEND { let m = unionRanges (rhs2 parseState 3 6) $7.Range @@ -1903,12 +1915,13 @@ valDefnDecl: /* An auto-property definition in an object type definition */ autoPropsDefnDecl: | VAL opt_mutable opt_access ident opt_typ EQUALS typedSeqExprBlock classMemberSpfnGetSet - { let doc = grabXmlDoc(parseState,5) - let mValDecl = unionRanges (rhs parseState 1) $7.Range - let mGetSetOpt, getSet = $8 - if $2 then errorR(Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet(),rhs parseState 3)) - (fun attribs isStatic flags -> - [ SynMemberDefn.AutoProperty(attribs, isStatic, $4, $5, getSet, flags, doc, $3, $7, mGetSetOpt, mValDecl) ]) } + { let doc = grabXmlDoc(parseState, 5) + let mGetSetOpt, getSet = $8 + if $2 then + errorR (Error (FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 3)) + (fun attribs isStatic flags rangeStart -> + let memberRange = unionRanges rangeStart $7.Range + [ SynMemberDefn.AutoProperty(attribs, isStatic, $4, $5, getSet, flags, doc, $3, $7, mGetSetOpt, memberRange) ]) } /* An optional type on an auto-property definition */ @@ -2022,10 +2035,12 @@ objectImplementationMembers: /* One member in an object expression or interface implementation */ objectImplementationMember: | opt_attributes memberOrOverride memberCore opt_ODECLEND - { $3 None OverrideMemberFlags $1 } + { let rangeStart = rhs parseState 1 + $3 None OverrideMemberFlags $1 rangeStart } | opt_attributes memberOrOverride autoPropsDefnDecl opt_ODECLEND - { $3 $1 false OverrideMemberFlags } + { let rangeStart = rhs parseState 1 + $3 $1 false OverrideMemberFlags rangeStart } | opt_attributes memberOrOverride error { [] } diff --git a/src/fsharp/range.fs b/src/fsharp/range.fs index 1462f11d4ea..4e3d8175a25 100755 --- a/src/fsharp/range.fs +++ b/src/fsharp/range.fs @@ -200,12 +200,16 @@ let fileOfFileIndex idx = fileIndexTable.IndexToFile idx let mkPos l c = pos (l, c) +let unknownFileName = "unknown" +let startupFileName = "startup" +let commandLineArgsFileName = "commandLineArgs" + [] [ {DebugCode}")>] type range(code1:int64, code2: int64) = static member Zero = range(0L, 0L) - new (fidx, bl, bc, el, ec) = - let code1 = ((int64 fidx) &&& fileIndexMask) + new (fIdx, bl, bc, el, ec) = + let code1 = ((int64 fIdx) &&& fileIndexMask) ||| ((int64 bc <<< startColumnShift) &&& startColumnMask) ||| ((int64 ec <<< endColumnShift) &&& endColumnMask) let code2 = @@ -213,7 +217,7 @@ type range(code1:int64, code2: int64) = ||| ((int64 (el-bl) <<< heightShift) &&& heightMask) range(code1, code2) - new (fidx, b:pos, e:pos) = range(fidx, b.Line, b.Column, e.Line, e.Column) + new (fIdx, b:pos, e:pos) = range(fIdx, b.Line, b.Column, e.Line, e.Column) member r.StartLine = int32((code2 &&& startLineMask) >>> startLineShift) @@ -246,6 +250,9 @@ type range(code1:int64, code2: int64) = member r.Code2 = code2 member r.DebugCode = + let name = r.FileName + if name = unknownFileName || name = startupFileName || name = commandLineArgsFileName then name else + try let endCol = r.EndColumn - 1 let startCol = r.StartColumn - 1 @@ -319,11 +326,11 @@ let rangeN filename line = mkRange filename (mkPos line 0) (mkPos line 0) let pos0 = mkPos 1 0 -let range0 = rangeN "unknown" 1 +let range0 = rangeN unknownFileName 1 -let rangeStartup = rangeN "startup" 1 +let rangeStartup = rangeN startupFileName 1 -let rangeCmdArgs = rangeN "commandLineArgs" 0 +let rangeCmdArgs = rangeN commandLineArgsFileName 0 let trimRangeToLine (r:range) = let startL, startC = r.StartLine, r.StartColumn diff --git a/src/fsharp/range.fsi b/src/fsharp/range.fsi index 6bc7ddf5b7d..fdb63ec2a29 100755 --- a/src/fsharp/range.fsi +++ b/src/fsharp/range.fsi @@ -44,6 +44,10 @@ val mkPos : line:int -> column:int -> pos /// Ordering on positions val posOrder : IComparer +val unknownFileName: string +val startupFileName: string +val commandLineArgsFileName: string + /// Represents a range within a known file [] type range = diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index d17b56c0854..ab8ee3d216f 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -1353,7 +1353,7 @@ type internal TypeCheckInfo | CNR(_, (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, _, _, _, m) -> Some (m, SemanticClassificationType.ComputationExpression) // types get colored as types when they occur in syntactic types or custom attributes - // typevariables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords + // type variables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords | CNR(_, Item.Types (_, [OptionalArgumentAttribute]), LegitTypeOccurence, _, _, _, _) -> None | CNR(_, Item.CtorGroup(_, [MethInfo.FSMeth(_, OptionalArgumentAttribute, _, _)]), LegitTypeOccurence, _, _, _, _) -> None | CNR(_, Item.Types(_, types), LegitTypeOccurence, _, _, _, m) when types |> List.exists (isInterfaceTy g) -> @@ -1446,7 +1446,7 @@ type FSharpParsingOptions = CompilingFsLib = tcConfig.compilingFslib IsExe = tcConfig.target.IsExe } - static member FromTcConfigBuidler(tcConfigB: TcConfigBuilder, sourceFiles, isInteractive: bool) = + static member FromTcConfigBuilder(tcConfigB: TcConfigBuilder, sourceFiles, isInteractive: bool) = { SourceFiles = sourceFiles ConditionalCompilationDefines = tcConfigB.conditionalCompilationDefines @@ -2104,7 +2104,7 @@ type FSharpCheckProjectResults let (tcGlobals, tcImports, thisCcu, ccuSig, _tcSymbolUses, topAttribs, _tcAssemblyData, _ilAssemRef, _ad, _tcAssemblyExpr, _dependencyFiles) = getDetails() FSharpAssemblySignature(tcGlobals, thisCcu, ccuSig, tcImports, topAttribs, ccuSig) - member __.TypedImplementionFiles = + member __.TypedImplementationFiles = if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() let mimpls = @@ -2209,7 +2209,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, let backgroundDiagnostics = [| |] let reduceMemoryUsage = ReduceMemoryFlag.Yes - let assumeDotNetFramework = true + let assumeDotNetFramework = tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib let applyCompilerOptions tcConfigB = let fsiCompilerOptions = CompileOptions.GetCoreFsiCompilerOptions tcConfigB diff --git a/src/fsharp/service/FSharpCheckerResults.fsi b/src/fsharp/service/FSharpCheckerResults.fsi index 4f7062d9ce2..13496225bfb 100644 --- a/src/fsharp/service/FSharpCheckerResults.fsi +++ b/src/fsharp/service/FSharpCheckerResults.fsi @@ -89,7 +89,7 @@ type public FSharpParsingOptions = static member internal FromTcConfig: tcConfig: TcConfig * sourceFiles: string[] * isInteractive: bool -> FSharpParsingOptions - static member internal FromTcConfigBuidler: tcConfigB: TcConfigBuilder * sourceFiles: string[] * isInteractive: bool -> FSharpParsingOptions + static member internal FromTcConfigBuilder: tcConfigB: TcConfigBuilder * sourceFiles: string[] * isInteractive: bool -> FSharpParsingOptions /// A handle to the results of CheckFileInProject. [] diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index 96e81e32147..774fd78e108 100755 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -4,7 +4,6 @@ namespace FSharp.Compiler open System -open System.Collections.Concurrent open System.Collections.Generic open System.IO open System.Threading @@ -18,7 +17,6 @@ open FSharp.Compiler.AbstractIL.ILBinaryReader open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions -open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger open FSharp.Compiler.TcGlobals open FSharp.Compiler.TypeChecker @@ -253,9 +251,9 @@ module internal IncrementalBuild = static member OfSize size = ResultVector(size, DateTime.MinValue, Map.empty) member rv.Size = size member rv.Get slot = get slot - member rv.Resize newsize = - if size<>newsize then - ResultVector(newsize, zeroElementTimestamp, map |> Map.filter(fun s _ -> s < newsize)) + member rv.Resize newSize = + if size<>newSize then + ResultVector(newSize, zeroElementTimestamp, map |> Map.filter(fun s _ -> s < newSize)) else rv member rv.Set(slot, value) = @@ -266,7 +264,7 @@ module internal IncrementalBuild = ResultVector(size, zeroElementTimestamp, Map.add slot value map) member rv.MaxTimestamp() = - let maximize (lasttimestamp: DateTime) (_, result: Result) = max lasttimestamp result.Timestamp + let maximize (lastTimestamp: DateTime) (_, result: Result) = max lastTimestamp result.Timestamp List.fold maximize zeroElementTimestamp (asList.Force()) member rv.Signature() = @@ -416,16 +414,16 @@ module internal IncrementalBuild = /// Get the maximum build stamp for an output. let MaxTimestamp(bt: PartialBuild, id) = match bt.Results.TryFind id with - | Some resultset -> - match resultset with + | Some resultSet -> + match resultSet with | ScalarResult rs -> rs.Timestamp | VectorResult rv -> rv.MaxTimestamp() | None -> DateTime.MaxValue let Signature(bt: PartialBuild, id) = match bt.Results.TryFind id with - | Some resultset -> - match resultset with + | Some resultSet -> + match resultSet with | ScalarResult rs -> rs.InputSignature | VectorResult rv -> rv.Signature() | None -> UnevaluatedInput @@ -515,9 +513,9 @@ module internal IncrementalBuild = seen.[id] <- true false - let shouldEvaluate(bt, currentsig: InputSignature, id) = - if currentsig.IsEvaluated then - currentsig <> Signature(bt, id) + let shouldEvaluate(bt, currentSig: InputSignature, id) = + if currentSig.IsEvaluated then + currentSig <> Signature(bt, id) else false /// Make sure the result vector saved matches the size of expr @@ -555,20 +553,20 @@ module internal IncrementalBuild = let inputResult = GetVectorExprResult (bt, inputExpr, slot) match accumulatorResult, inputResult with - | Available (accumulator, accumulatortimesamp, _accumulatorInputSig), Available (input, inputtimestamp, _inputSig) -> - let inputtimestamp = max inputtimestamp accumulatortimesamp - let prevoutput = GetVectorExprResult (bt, ve, slot) - let outputtimestamp = prevoutput.Timestamp + | Available (accumulator, accumulatorTimestamp, _accumulatorInputSig), Available (input, inputTimestamp, _inputSig) -> + let inputTimestamp = max inputTimestamp accumulatorTimestamp + let prevOutput = GetVectorExprResult (bt, ve, slot) + let outputTimestamp = prevOutput.Timestamp let scanOpOpt = - if inputtimestamp <> outputtimestamp then + if inputTimestamp <> outputTimestamp then Some (fun ctok -> func ctok accumulator input) - elif prevoutput.ResultIsInProgress then - Some prevoutput.GetInProgressContinuation + elif prevOutput.ResultIsInProgress then + Some prevOutput.GetInProgressContinuation else // up-to-date and complete, no work required None match scanOpOpt with - | Some scanOp -> Some (actionFunc (IndexedAction(id, taskname, slot, cardinality, inputtimestamp, scanOp)) acc) + | Some scanOp -> Some (actionFunc (IndexedAction(id, taskname, slot, cardinality, inputTimestamp, scanOp)) acc) | None -> None | _ -> None @@ -584,19 +582,19 @@ module internal IncrementalBuild = | Some cardinality -> if cardinality=0 then // For vector length zero, just propagate the prior timestamp. - let inputtimestamp = MaxTimestamp(bt, inputExpr.Id) - let outputtimestamp = MaxTimestamp(bt, id) - if inputtimestamp <> outputtimestamp then - actionFunc (VectorAction(id, taskname, inputtimestamp, EmptyTimeStampedInput inputtimestamp, fun _ -> cancellable.Return [||])) acc + let inputTimestamp = MaxTimestamp(bt, inputExpr.Id) + let outputTimestamp = MaxTimestamp(bt, id) + if inputTimestamp <> outputTimestamp then + actionFunc (VectorAction(id, taskname, inputTimestamp, EmptyTimeStampedInput inputTimestamp, fun _ -> cancellable.Return [||])) acc else acc else let MapResults acc slot = - let inputtimestamp = GetVectorExprResult(bt, inputExpr, slot).Timestamp - let outputtimestamp = GetVectorExprResult(bt, ve, slot).Timestamp - if inputtimestamp <> outputtimestamp then + let inputTimestamp = GetVectorExprResult(bt, inputExpr, slot).Timestamp + let outputTimestamp = GetVectorExprResult(bt, ve, slot).Timestamp + if inputTimestamp <> outputTimestamp then let OneToOneOp ctok = Eventually.Done (func ctok (GetVectorExprResult(bt, inputExpr, slot).GetAvailable())) - actionFunc (IndexedAction(id, taskname, slot, cardinality, inputtimestamp, OneToOneOp)) acc + actionFunc (IndexedAction(id, taskname, slot, cardinality, inputTimestamp, OneToOneOp)) acc else acc match optSlot with | None -> @@ -615,20 +613,20 @@ module internal IncrementalBuild = | Some cardinality -> if cardinality=0 then // For vector length zero, just propagate the prior timestamp. - let inputtimestamp = MaxTimestamp(bt, inputExpr.Id) - let outputtimestamp = MaxTimestamp(bt, id) - if inputtimestamp <> outputtimestamp then - actionFunc (VectorAction(id, taskname, inputtimestamp, EmptyTimeStampedInput inputtimestamp, fun _ -> cancellable.Return [||])) acc + let inputTimestamp = MaxTimestamp(bt, inputExpr.Id) + let outputTimestamp = MaxTimestamp(bt, id) + if inputTimestamp <> outputTimestamp then + actionFunc (VectorAction(id, taskname, inputTimestamp, EmptyTimeStampedInput inputTimestamp, fun _ -> cancellable.Return [||])) acc else acc else let checkStamp acc slot = - let inputresult = GetVectorExprResult (bt, inputExpr, slot) - match inputresult with + let inputResult = GetVectorExprResult (bt, inputExpr, slot) + match inputResult with | Available (ires, _, _) -> - let oldtimestamp = GetVectorExprResult(bt, ve, slot).Timestamp - let newtimestamp = func cache ctok ires - if newtimestamp <> oldtimestamp then - actionFunc (IndexedAction(id, taskname, slot, cardinality, newtimestamp, fun _ -> Eventually.Done ires)) acc + let oldTimestamp = GetVectorExprResult(bt, ve, slot).Timestamp + let newTimestamp = func cache ctok ires + if newTimestamp <> oldTimestamp then + actionFunc (IndexedAction(id, taskname, slot, cardinality, newTimestamp, fun _ -> Eventually.Done ires)) acc else acc | _ -> acc match optSlot with @@ -642,11 +640,11 @@ module internal IncrementalBuild = | VectorMultiplex(id, taskname, inputExpr, func) -> let acc = match GetScalarExprResult (bt, inputExpr) with - | Available (inp, inputtimestamp, inputsig) -> - let outputtimestamp = MaxTimestamp(bt, id) - if inputtimestamp <> outputtimestamp then + | Available (inp, inputTimestamp, inputsig) -> + let outputTimestamp = MaxTimestamp(bt, id) + if inputTimestamp <> outputTimestamp then let MultiplexOp ctok = func ctok inp |> cancellable.Return - actionFunc (VectorAction(id, taskname, inputtimestamp, inputsig, MultiplexOp)) acc + actionFunc (VectorAction(id, taskname, inputTimestamp, inputsig, MultiplexOp)) acc else acc | _ -> acc visitScalar inputExpr acc @@ -659,16 +657,16 @@ module internal IncrementalBuild = | ScalarDemultiplex (id, taskname, inputExpr, func) -> let acc = match GetVectorExprResultVector (bt, inputExpr) with - | Some inputresult -> - let currentsig = inputresult.Signature() - if shouldEvaluate(bt, currentsig, id) then - let inputtimestamp = MaxTimestamp(bt, inputExpr.Id) + | Some inputResult -> + let currentSig = inputResult.Signature() + if shouldEvaluate(bt, currentSig, id) then + let inputTimestamp = MaxTimestamp(bt, inputExpr.Id) let DemultiplexOp ctok = cancellable { let input = AvailableAllResultsOfExpr bt inputExpr |> List.toArray return! func ctok input } - actionFunc (ScalarAction(id, taskname, inputtimestamp, currentsig, DemultiplexOp)) acc + actionFunc (ScalarAction(id, taskname, inputTimestamp, currentSig, DemultiplexOp)) acc else acc | None -> acc @@ -677,11 +675,11 @@ module internal IncrementalBuild = | ScalarMap (id, taskname, inputExpr, func) -> let acc = match GetScalarExprResult (bt, inputExpr) with - | Available (inp, inputtimestamp, inputsig) -> - let outputtimestamp = MaxTimestamp(bt, id) - if inputtimestamp <> outputtimestamp then + | Available (inp, inputTimestamp, inputsig) -> + let outputTimestamp = MaxTimestamp(bt, id) + if inputTimestamp <> outputTimestamp then let MapOp ctok = func ctok inp |> cancellable.Return - actionFunc (ScalarAction(id, taskname, inputtimestamp, inputsig, MapOp)) acc + actionFunc (ScalarAction(id, taskname, inputTimestamp, inputsig, MapOp)) acc else acc | _ -> acc @@ -782,10 +780,10 @@ module internal IncrementalBuild = if gen>5000 then failwith "Infinite loop in incremental builder?" #endif - let worklist = CollectActions cache target bt + let workList = CollectActions cache target bt let! newBt = - (bt, worklist) ||> Cancellable.fold (fun bt action -> + (bt, workList) ||> Cancellable.fold (fun bt action -> if injectCancellationFault then Cancellable.canceled() else @@ -800,9 +798,9 @@ module internal IncrementalBuild = cancellable { // REVIEW: we're building up the whole list of actions on the fringe of the work tree, // executing one thing and then throwing the list away. What about saving the list inside the Build instance? - let worklist = CollectActions cache target bt + let workList = CollectActions cache target bt - match worklist with + match workList with | action :: _ -> let! res = ExecuteApply ctok save action bt return Some res @@ -822,8 +820,8 @@ module internal IncrementalBuild = /// Check if an output is up-to-date and ready let IsReady cache target bt = - let worklist = CollectActions cache target bt - worklist.IsEmpty + let workList = CollectActions cache target bt + workList.IsEmpty /// Check if an output is up-to-date and ready let MaxTimeStampInDependencies cache ctok target bt = @@ -972,7 +970,7 @@ module internal IncrementalBuild = -// Record the most recent IncrementalBuilder events, so we can more easily unittest/debug the +// Record the most recent IncrementalBuilder events, so we can more easily unit test/debug the // 'incremental' behavior of the product. module IncrementalBuilderEventTesting = @@ -1054,7 +1052,7 @@ type TypeCheckAccumulator = /// Global service state type FrameworkImportsCacheKey = (*resolvedpath*)string list * string * (*TargetFrameworkDirectories*)string list * (*fsharpBinaries*)string * (*langVersion*)decimal -/// Represents a cache of 'framework' references that can be shared betweeen multiple incremental builds +/// Represents a cache of 'framework' references that can be shared between multiple incremental builds type FrameworkImportsCache(keepStrongly) = // Mutable collection protected via CompilationThreadToken @@ -1087,7 +1085,7 @@ type FrameworkImportsCache(keepStrongly) = tcConfig.primaryAssembly.Name, tcConfig.GetTargetFrameworkDirectories(), tcConfig.fsharpBinariesDir, - tcConfig.langVersion.SpecifiedVerson) + tcConfig.langVersion.SpecifiedVersion) match frameworkTcImportsCache.TryGet (ctok, key) with | Some res -> return res @@ -1141,7 +1139,7 @@ type PartialCheckResults = LatestImplementationFile: TypedImplFile option - LastestCcuSigForFile: ModuleOrNamespaceType option } + LatestCcuSigForFile: ModuleOrNamespaceType option } member x.TcErrors = Array.concat (List.rev x.TcErrorsRev) member x.TcSymbolUses = List.rev x.TcSymbolUsesRev @@ -1161,7 +1159,7 @@ type PartialCheckResults = ModuleNamesDict = tcAcc.tcModuleNamesDict TimeStamp = timestamp LatestImplementationFile = tcAcc.latestImplFile - LastestCcuSigForFile = tcAcc.latestCcuSigForFile } + LatestCcuSigForFile = tcAcc.latestCcuSigForFile } [] @@ -1722,9 +1720,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput /// Create a type-check configuration let tcConfigB, sourceFilesNew = - let getSwitchValue switchstring = - match commandLineArgs |> Seq.tryFindIndex(fun s -> s.StartsWithOrdinal switchstring) with - | Some idx -> Some(commandLineArgs.[idx].Substring(switchstring.Length)) + let getSwitchValue switchString = + match commandLineArgs |> Seq.tryFindIndex(fun s -> s.StartsWithOrdinal switchString) with + | Some idx -> Some(commandLineArgs.[idx].Substring(switchString.Length)) | _ -> None // see also fsc.fs: runFromCommandLineToImportingAssemblies(), as there are many similarities to where the PS creates a tcConfigB @@ -1810,7 +1808,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput [ for r in nonFrameworkResolutions do let fileName = r.resolvedPath - yield (Choice1Of2 fileName, (fun (cache: TimeStampCache) _ctokk -> cache.GetFileTimeStamp fileName)) + yield (Choice1Of2 fileName, (fun (cache: TimeStampCache) _ctok -> cache.GetFileTimeStamp fileName)) for pr in projectReferences do yield Choice2Of2 pr, (fun (cache: TimeStampCache) ctok -> cache.GetProjectReferenceTimeStamp (pr, ctok)) ] diff --git a/src/fsharp/service/IncrementalBuild.fsi b/src/fsharp/service/IncrementalBuild.fsi index 96d00636887..fb60dbff690 100755 --- a/src/fsharp/service/IncrementalBuild.fsi +++ b/src/fsharp/service/IncrementalBuild.fsi @@ -60,7 +60,7 @@ type internal PartialCheckResults = TcDependencyFiles: string list - /// Represents the collected attributes to apply to the module of assuembly generates + /// Represents the collected attributes to apply to the module of assembly generates TopAttribs: TypeChecker.TopAttribs option TimeStamp: DateTime @@ -70,7 +70,7 @@ type internal PartialCheckResults = LatestImplementationFile: TypedImplFile option /// Represents latest inferred signature contents. - LastestCcuSigForFile: ModuleOrNamespaceType option} + LatestCcuSigForFile: ModuleOrNamespaceType option} member TcErrors: (PhasedDiagnostic * FSharpErrorSeverity)[] @@ -163,7 +163,7 @@ type internal IncrementalBuilder = static member TryCreateBackgroundBuilderForProjectOptions : CompilationThreadToken * ReferenceResolver.Resolver * defaultFSharpBinariesDir: string * FrameworkImportsCache * scriptClosureOptions:LoadClosure option * sourceFiles:string list * commandLineArgs:string list * projectReferences: IProjectReference list * projectDirectory:string * useScriptResolutionRules:bool * keepAssemblyContents: bool * keepAllBackgroundResolutions: bool * maxTimeShareMilliseconds: int64 * tryGetMetadataSnapshot: ILBinaryReader.ILReaderTryGetMetadataSnapshot * suggestNamesForErrors: bool -> Cancellable -/// Generalized Incremental Builder. This is exposed only for unittesting purposes. +/// Generalized Incremental Builder. This is exposed only for unit testing purposes. module internal IncrementalBuild = type INode = abstract Name: string diff --git a/src/fsharp/service/QuickParse.fs b/src/fsharp/service/QuickParse.fs index b431f2557b4..434a0312da1 100644 --- a/src/fsharp/service/QuickParse.fs +++ b/src/fsharp/service/QuickParse.fs @@ -20,10 +20,10 @@ type PartialLongName = /// Position of the last dot. LastDotPos: int option } - /// Empty patial long name. + /// Empty partial long name. static member Empty(endColumn: int) = { QualifyingIdents = []; PartialIdent = ""; EndColumn = endColumn; LastDotPos = None } -/// Methods for cheaply and innacurately parsing F#. +/// Methods for cheaply and inaccurately parsing F#. /// /// These methods are very old and are mostly to do with extracting "long identifier islands" /// A.B.C @@ -58,7 +58,7 @@ module QuickParse = // Utility function that recognizes whether a name is valid active pattern name // Extracts the 'core' part without surrounding bars and checks whether it contains some identifier - // (Note, this doesn't have to be precise, because this is checked by backround compiler, + // (Note, this doesn't have to be precise, because this is checked by background compiler, // but it has to be good enough to distinguish operators and active pattern names) let private isValidActivePatternName (name: string) = @@ -152,7 +152,7 @@ module QuickParse = /// In general, only identifiers composed from upper/lower letters and '.' are supported, but there /// are a couple of explicitly handled exceptions to allow some common scenarios: /// - When the name contains only letters and '|' symbol, it may be an active pattern, so we - /// treat it as a valid identifier - e.g. let ( |Identitiy| ) a = a + /// treat it as a valid identifier - e.g. let ( |Identity| ) a = a /// (but other identifiers that include '|' are not allowed - e.g. '||' operator) /// - It searches for double tick (``) to see if the identifier could be something like ``a b`` /// diff --git a/src/fsharp/service/QuickParse.fsi b/src/fsharp/service/QuickParse.fsi index 5f78dbefd2b..3c2adfd0df8 100644 --- a/src/fsharp/service/QuickParse.fsi +++ b/src/fsharp/service/QuickParse.fsi @@ -19,10 +19,10 @@ type public PartialLongName = /// Position of the last dot. LastDotPos: int option } - /// Empty patial long name. + /// Empty partial long name. static member Empty: endColumn: int -> PartialLongName -/// Methods for cheaply and innacurately parsing F#. +/// Methods for cheaply and inaccurately parsing F#. /// /// These methods are very old and are mostly to do with extracting "long identifier islands" /// A.B.C @@ -57,7 +57,7 @@ module public QuickParse = /// In general, only identifiers composed from upper/lower letters and '.' are supported, but there /// are a couple of explicitly handled exceptions to allow some common scenarios: /// - When the name contains only letters and '|' symbol, it may be an active pattern, so we - /// treat it as a valid identifier - e.g. let ( |Identitiy| ) a = a + /// treat it as a valid identifier - e.g. let ( |Identity| ) a = a /// (but other identifiers that include '|' are not allowed - e.g. '||' operator) /// - It searches for double tick (``) to see if the identifier could be something like ``a b`` /// diff --git a/src/fsharp/service/Reactor.fs b/src/fsharp/service/Reactor.fs index f879e5133f9..b4c487caebf 100755 --- a/src/fsharp/service/Reactor.fs +++ b/src/fsharp/service/Reactor.fs @@ -34,7 +34,7 @@ type Reactor() = let mutable pauseBeforeBackgroundWork = pauseBeforeBackgroundWorkDefault // We need to store the culture for the VS thread that is executing now, - // so that when the reactor picks up a thread from the threadpool we can set the culture + // so that when the reactor picks up a thread from the thread pool we can set the culture let mutable culture = CultureInfo(CultureInfo.CurrentUICulture.Name) let mutable bgOpCts = new CancellationTokenSource() diff --git a/src/fsharp/service/ServiceAnalysis.fs b/src/fsharp/service/ServiceAnalysis.fs index e4f942b657a..e568767a1e8 100644 --- a/src/fsharp/service/ServiceAnalysis.fs +++ b/src/fsharp/service/ServiceAnalysis.fs @@ -3,7 +3,6 @@ namespace FSharp.Compiler.SourceCodeServices open FSharp.Compiler -open FSharp.Compiler.Ast open FSharp.Compiler.Range open FSharp.Compiler.PrettyNaming open System.Collections.Generic @@ -203,7 +202,7 @@ module UnusedOpens = let filterOpenStatements (symbolUses1: FSharpSymbolUse[], symbolUses2: FSharpSymbolUse[]) openStatements = async { // the key is a namespace or module, the value is a list of FSharpSymbolUse range of symbols defined in the - // namespace or module. So, it's just symbol uses ranges groupped by namespace or module where they are _defined_. + // namespace or module. So, it's just symbol uses ranges grouped by namespace or module where they are _defined_. let symbolUsesRangesByDeclaringEntity = Dictionary(entityHash) for symbolUse in symbolUses1 do match symbolUse.Symbol with diff --git a/src/fsharp/service/ServiceAssemblyContent.fs b/src/fsharp/service/ServiceAssemblyContent.fs index 8ceb381225b..a86b26db8a5 100644 --- a/src/fsharp/service/ServiceAssemblyContent.fs +++ b/src/fsharp/service/ServiceAssemblyContent.fs @@ -238,16 +238,16 @@ module AssemblyContentProvider = |> Seq.filter (fun x -> not x.IsInstanceMember && not x.IsPropertyGetterMethod && not x.IsPropertySetterMethod) |> Seq.collect (fun func -> let processIdents fullName idents = - let cleanedIdentes = parent.FixParentModuleSuffix idents + let cleanedIdents = parent.FixParentModuleSuffix idents { FullName = fullName - CleanedIdents = cleanedIdentes + CleanedIdents = cleanedIdents Namespace = ns NearestRequireQualifiedAccessParent = parent.ThisRequiresQualifiedAccess true |> Option.map parent.FixParentModuleSuffix TopRequireQualifiedAccessParent = topRequireQualifiedAccessParent AutoOpenParent = autoOpenParent Symbol = func Kind = fun _ -> EntityKind.FunctionOrValue func.IsActivePattern - UnresolvedSymbol = unresolvedSymbol topRequireQualifiedAccessParent cleanedIdentes fullName } + UnresolvedSymbol = unresolvedSymbol topRequireQualifiedAccessParent cleanedIdents fullName } [ yield! func.TryGetFullDisplayName() |> Option.map (fun fullDisplayName -> processIdents func.FullName (fullDisplayName.Split '.')) @@ -491,8 +491,6 @@ type OpenStatementInsertionPoint = | Nearest module ParsedInput = - open FSharp.Compiler - open FSharp.Compiler.Ast /// An recursive pattern that collect all sequential expressions to avoid StackOverflowException let rec (|Sequentials|_|) = function @@ -948,8 +946,8 @@ module ParsedInput = let fullIdent = parent @ ident addModule (fullIdent, range) if range.EndLine >= currentLine then - let moduleBodyIdentation = getMinColumn decls |> Option.defaultValue (range.StartColumn + 4) - doRange NestedModule fullIdent range.StartLine moduleBodyIdentation + let moduleBodyIndentation = getMinColumn decls |> Option.defaultValue (range.StartColumn + 4) + doRange NestedModule fullIdent range.StartLine moduleBodyIndentation List.iter (walkSynModuleDecl fullIdent) decls | SynModuleDecl.Open (_, range) -> doRange OpenDeclaration [] range.EndLine (range.StartColumn - 5) | SynModuleDecl.HashDirective (_, range) -> doRange HashDirective [] range.EndLine range.StartColumn @@ -1008,9 +1006,9 @@ module ParsedInput = if ctx.Pos.Line > 1 then // it's an implicit module without any open declarations let line = getLineStr (ctx.Pos.Line - 2) - let isImpliciteTopLevelModule = + let isImplicitTopLevelModule = not (line.StartsWithOrdinal("module") && not (line.EndsWithOrdinal("="))) - if isImpliciteTopLevelModule then 1 else ctx.Pos.Line + if isImplicitTopLevelModule then 1 else ctx.Pos.Line else 1 | ScopeKind.Namespace -> // for namespaces the start line is start line of the first nested entity diff --git a/src/fsharp/service/ServiceAssemblyContent.fsi b/src/fsharp/service/ServiceAssemblyContent.fsi index 0fe14c11444..f9e9699cb7d 100644 --- a/src/fsharp/service/ServiceAssemblyContent.fsi +++ b/src/fsharp/service/ServiceAssemblyContent.fsi @@ -44,7 +44,7 @@ type public AssemblySymbol = { /// Full entity name as it's seen in compiled code (raw FSharpEntity.FullName, FSharpValueOrFunction.FullName). FullName: string /// Entity name parts with removed module suffixes (Ns.M1Module.M2Module.M3.entity -> Ns.M1.M2.M3.entity) - /// and replaced compiled names with display names (FSharpEntity.DisplayName, FSharpValueOrFucntion.DisplayName). + /// and replaced compiled names with display names (FSharpEntity.DisplayName, FSharpValueOrFunction.DisplayName). /// Note: *all* parts are cleaned, not the last one. CleanedIdents: Idents /// `FSharpEntity.Namespace`. @@ -87,10 +87,10 @@ type public EntityCache = /// Performs an operation on the cache in thread safe manner. member Locking : (IAssemblyContentCache -> 'T) -> 'T -/// Lond identifier (i.e. it may contain dots). +/// Long identifier (i.e. it may contain dots). type public StringLongIdent = string -/// Helper data structure representing a symbol, sutable for implementing unresolved identifiers resolution code fixes. +/// Helper data structure representing a symbol, suitable for implementing unresolved identifiers resolution code fixes. type public Entity = { /// Full name, relative to the current scope. FullRelativeName: StringLongIdent @@ -149,7 +149,7 @@ module public ParsedInput = /// Returns `InsertContext` based on current position and symbol idents. val findNearestPointToInsertOpenDeclaration : currentLine: int -> ast: Ast.ParsedInput -> entity: Idents -> insertionPoint: OpenStatementInsertionPoint -> InsertContext - /// Returns lond identifier at position. + /// Returns long identifier at position. val getLongIdentAt : ast: Ast.ParsedInput -> pos: Range.pos -> Ast.LongIdent option /// Corrects insertion line number based on kind of scope and text surrounding the insertion point. diff --git a/src/fsharp/service/ServiceDeclarationLists.fs b/src/fsharp/service/ServiceDeclarationLists.fs index c4bf83bf087..ef9c0b40987 100644 --- a/src/fsharp/service/ServiceDeclarationLists.fs +++ b/src/fsharp/service/ServiceDeclarationLists.fs @@ -8,7 +8,6 @@ namespace FSharp.Compiler.SourceCodeServices open FSharp.Compiler -open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AccessibilityLogic diff --git a/src/fsharp/service/ServiceLexing.fs b/src/fsharp/service/ServiceLexing.fs index 2deb0073598..c37ea56d903 100644 --- a/src/fsharp/service/ServiceLexing.fs +++ b/src/fsharp/service/ServiceLexing.fs @@ -454,7 +454,7 @@ module internal LexerStateEncoding = let decodeLexInt (state: FSharpTokenizerLexState) = - let tag, n1, p1, ifd, lightSyntaxStatusInital = decodeLexCont state + let tag, n1, p1, ifd, lightSyntaxStatusInitial = decodeLexCont state let lexcont = match tag with | FSharpTokenizerColorState.Token -> LexCont.Token ifd @@ -471,7 +471,7 @@ module internal LexerStateEncoding = | FSharpTokenizerColorState.EndLineThenSkip -> LexCont.EndLine(LexerEndlineContinuation.Skip(ifd, n1, mkRange "file" p1 p1)) | FSharpTokenizerColorState.EndLineThenToken -> LexCont.EndLine(LexerEndlineContinuation.Token ifd) | _ -> LexCont.Token [] - lightSyntaxStatusInital, lexcont + lightSyntaxStatusInitial, lexcont let callLexCont lexcont args skip lexbuf = let argsWithIfDefs ifd = @@ -500,7 +500,7 @@ module internal LexerStateEncoding = //---------------------------------------------------------------------------- // Information beyond just tokens that can be derived by looking at just a single line. -// For example metacommands like #load. +// For example meta commands like #load. type SingleLineTokenState = | BeforeHash = 0 | NoFurtherMatchPossible = 1 @@ -595,11 +595,11 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, use unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse use unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> DiscardErrorsLogger) - let lightSyntaxStatusInital, lexcontInitial = LexerStateEncoding.decodeLexInt lexintInitial - let lightSyntaxStatus = LightSyntaxStatus(lightSyntaxStatusInital, false) + let lightSyntaxStatusInitial, lexcontInitial = LexerStateEncoding.decodeLexInt lexintInitial + let lightSyntaxStatus = LightSyntaxStatus(lightSyntaxStatusInitial, false) // Build the arguments to the lexer function - let lexargs = if lightSyntaxStatusInital then lexArgsLightOn else lexArgsLightOff + let lexargs = if lightSyntaxStatusInitial then lexArgsLightOn else lexArgsLightOff let GetTokenWithPosition lexcontInitial = // Column of token @@ -618,7 +618,7 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, try if (tokenStack.Count > 0) then true, tokenStack.Pop() else - // Choose which lexer entrypoint to call and call it + // Choose which lexer entry point to call and call it let token = LexerStateEncoding.callLexCont lexcontInitial lexargs skip lexbuf let leftc, rightc = ColumnsOfCurrentToken() @@ -722,8 +722,8 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, // Peek at the next token let isCached, (nextToken, _, rightc) = GetTokenWithPosition lexcontInitial match nextToken with - | IDENT possibleMetacommand -> - match fsx, possibleMetacommand with + | IDENT possibleMetaCommand -> + match fsx, possibleMetaCommand with // These are for script (.fsx and .fsscript) files. | true, "r" | true, "reference" diff --git a/src/fsharp/service/ServiceLexing.fsi b/src/fsharp/service/ServiceLexing.fsi index 85e18f171c4..2ee5dfacaa2 100755 --- a/src/fsharp/service/ServiceLexing.fsi +++ b/src/fsharp/service/ServiceLexing.fsi @@ -15,7 +15,7 @@ type FSharpTokenizerLexState = static member Initial : FSharpTokenizerLexState member Equals : FSharpTokenizerLexState -> bool -/// Represents stable information for the state of the laxing engine at the end of a line +/// Represents stable information for the state of the lexing engine at the end of a line type FSharpTokenizerColorState = | Token = 1 | IfDefSkip = 3 @@ -32,7 +32,7 @@ type FSharpTokenizerColorState = | TripleQuoteStringInComment = 14 | InitialState = 0 -/// Gives an indicattion of the color class to assign to the token an IDE +/// Gives an indication of the color class to assign to the token an IDE type FSharpTokenColorKind = | Default = 0 | Text = 0 diff --git a/src/fsharp/service/ServiceNavigation.fs b/src/fsharp/service/ServiceNavigation.fs index 0640e9ef06b..3578543b65b 100755 --- a/src/fsharp/service/ServiceNavigation.fs +++ b/src/fsharp/service/ServiceNavigation.fs @@ -127,13 +127,13 @@ module NavigationImpl = FSharpNavigationDeclarationItem.Create(id.idText, kind, baseGlyph, m, m, false, enclosingEntityKind, isAbstract, access), (addItemName(id.idText)) // Process let-binding - let processBinding isMember enclosingEntityKind isAbstract (Binding(_, _, _, _, _, _, SynValData(memebrOpt, _, _), synPat, _, synExpr, _, _)) = + let processBinding isMember enclosingEntityKind isAbstract (Binding(_, _, _, _, _, _, SynValData(memberOpt, _, _), synPat, _, synExpr, _, _)) = let m = match synExpr with | SynExpr.Typed (e, _, _) -> e.Range // fix range for properties with type annotations | _ -> synExpr.Range - match synPat, memebrOpt with + match synPat, memberOpt with | SynPat.LongIdent(longDotId=LongIdentWithDots(lid,_); accessibility=access), Some(flags) when isMember -> let icon, kind = match flags.MemberKind with @@ -632,7 +632,7 @@ module NavigateTo = | SynMemberSig.Inherit _ | SynMemberSig.Interface _ -> () - and walkImplFileInpit (ParsedImplFileInput (fileName = fileName; modules = moduleOrNamespaceList)) = + and walkImplFileInput (ParsedImplFileInput (fileName = fileName; modules = moduleOrNamespaceList)) = let container = { Type = ContainerType.File; Name = fileName } for item in moduleOrNamespaceList do walkSynModuleOrNamespace item container @@ -732,7 +732,7 @@ module NavigateTo = match parsedInput with | ParsedInput.SigFile input -> walkSigFileInput input - | ParsedInput.ImplFile input -> walkImplFileInpit input + | ParsedInput.ImplFile input -> walkImplFileInput input result.ToArray() diff --git a/src/fsharp/service/ServiceStructure.fs b/src/fsharp/service/ServiceStructure.fs index 1bf31e27cf6..56f2312da46 100644 --- a/src/fsharp/service/ServiceStructure.fs +++ b/src/fsharp/service/ServiceStructure.fs @@ -47,7 +47,7 @@ module Structure = | [] -> range0 | head :: _ -> Range.startToEnd head.idRange (List.last longId).idRange - /// Caclulate the range of the provided type arguments (<'a, ..., 'z>) + /// Calculate the range of the provided type arguments (<'a, ..., 'z>) /// or return the range `other` when `typeArgs` = [] let rangeOfTypeArgsElse other (typeArgs:SynTyparDecl list) = match typeArgs with @@ -77,7 +77,7 @@ module Structure = | Below | Same - /// Tag to identify the constuct that can be stored alongside its associated ranges + /// Tag to identify the construct that can be stored alongside its associated ranges [] type Scope = | Open @@ -177,7 +177,7 @@ module Structure = | Comment -> "Comment" | XmlDocComment -> "XmlDocComment" - /// Stores the range for a construct, the sub-range that should be collapsed for outlinging, + /// Stores the range for a construct, the sub-range that should be collapsed for outlining, /// a tag for the construct type, and a tag for the collapse style [] type ScopeRange = @@ -204,7 +204,7 @@ module Structure = let getOutliningRanges (sourceLines: string[]) (parsedInput: ParsedInput) = let acc = ResizeArray() - /// Validation function to ensure that ranges yielded for outlinging span 2 or more lines + /// Validation function to ensure that ranges yielded for outlining span 2 or more lines let inline rcheck scope collapse (fullRange: range) (collapseRange: range) = if fullRange.StartLine <> fullRange.EndLine then acc.Add { Scope = scope @@ -281,7 +281,7 @@ module Structure = if ExprAtomicFlag.NonAtomic=atomicFlag && (not isInfix) && (function SynExpr.Ident _ -> true | _ -> false) funcExpr && (function SynExpr.CompExpr _ -> false | _ -> true ) argExpr then - // if the argExrp is a computation expression another match will handle the outlining + // if the argExpr is a computation expression another match will handle the outlining // these cases must be removed to prevent creating unnecessary tags for the same scope let collapse = Range.endToEnd funcExpr.Range r rcheck Scope.SpecialFunc Collapse.Below r collapse @@ -624,7 +624,7 @@ module Structure = collectOpens decls List.iter parseDeclaration decls - /// Determine if a line is a single line or xml docummentation comment + /// Determine if a line is a single line or xml documentation comment let (|Comment|_|) (line: string) = if line.StartsWithOrdinal("///") then Some XmlDoc elif line.StartsWithOrdinal("//") then Some SingleLine diff --git a/src/fsharp/service/ServiceStructure.fsi b/src/fsharp/service/ServiceStructure.fsi index ef90f4627ea..4eeefe529fd 100644 --- a/src/fsharp/service/ServiceStructure.fsi +++ b/src/fsharp/service/ServiceStructure.fsi @@ -15,7 +15,7 @@ module public Structure = | Below | Same - /// Tag to identify the constuct that can be stored alongside its associated ranges + /// Tag to identify the construct that can be stored alongside its associated ranges [] type Scope = | Open diff --git a/src/fsharp/service/ServiceUntypedParse.fs b/src/fsharp/service/ServiceUntypedParse.fs index 84c8947d13d..24bb1c0d1f4 100755 --- a/src/fsharp/service/ServiceUntypedParse.fs +++ b/src/fsharp/service/ServiceUntypedParse.fs @@ -17,8 +17,6 @@ open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler open FSharp.Compiler.Range open FSharp.Compiler.Ast -open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.CompileOps open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming @@ -596,10 +594,10 @@ module UntypedParseImpl = AstTraversal.Traverse(pos, parseTree, walker) // Given a cursor position here: - // f(x) . iden + // f(x) . ident // ^ // walk the AST to find the position here: - // f(x) . iden + // f(x) . ident // ^ // On success, return Some (thatPos, boolTrueIfCursorIsAfterTheDotButBeforeTheIdentifier) // If there's no dot, return None, so for example diff --git a/src/fsharp/service/ServiceXmlDocParser.fs b/src/fsharp/service/ServiceXmlDocParser.fs index cac3a2743dd..5b71775adce 100644 --- a/src/fsharp/service/ServiceXmlDocParser.fs +++ b/src/fsharp/service/ServiceXmlDocParser.fs @@ -2,7 +2,6 @@ namespace FSharp.Compiler.SourceCodeServices -open FSharp.Compiler open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.Text diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 7eac7390c29..254491005a5 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -19,7 +19,6 @@ open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions open FSharp.Compiler.Driver open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.Range open FSharp.Compiler.TcGlobals @@ -131,7 +130,7 @@ module Helpers = && FSharpProjectOptions.UseSameProject(o1,o2) module CompileHelpers = - let mkCompilationErorHandlers() = + let mkCompilationErrorHandlers() = let errors = ResizeArray<_>() let errorSink isError exn = @@ -164,7 +163,7 @@ module CompileHelpers = /// Compile using the given flags. Source files names are resolved via the FileSystem API. The output file must be given by a -o flag. let compileFromArgs (ctok, argv: string[], legacyReferenceResolver, tcImportsCapture, dynamicAssemblyCreator) = - let errors, errorLogger, loggerProvider = mkCompilationErorHandlers() + let errors, errorLogger, loggerProvider = mkCompilationErrorHandlers() let result = tryCompile errorLogger (fun exiter -> mainCompile (ctok, argv, legacyReferenceResolver, (*bannerAlreadyPrinted*)true, ReduceMemoryFlag.Yes, CopyFSharpCoreFlag.No, exiter, loggerProvider, tcImportsCapture, dynamicAssemblyCreator) ) @@ -173,7 +172,7 @@ module CompileHelpers = let compileFromAsts (ctok, legacyReferenceResolver, asts, assemblyName, outFile, dependencies, noframework, pdbFile, executable, tcImportsCapture, dynamicAssemblyCreator) = - let errors, errorLogger, loggerProvider = mkCompilationErorHandlers() + let errors, errorLogger, loggerProvider = mkCompilationErrorHandlers() let executable = defaultArg executable true let target = if executable then CompilerTarget.ConsoleExe else CompilerTarget.Dll @@ -205,7 +204,7 @@ module CompileHelpers = TypeDefs = ilxMainModule.TypeDefs.AsList |> List.filter (fun td -> not (isTypeNameForGlobalFunctions td.Name)) |> mkILTypeDefs Resources=mkILResources [] } - // The function used to resolve typees while emitting the code + // The function used to resolve types while emitting the code let assemblyResolver s = match tcImportsRef.Value.Value.TryFindExistingFullyQualifiedPathByExactAssemblyRef (ctok, s) with | Some res -> Some (Choice1Of2 res) @@ -385,7 +384,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC areSame=AreSameForChecking3, areSimilar=AreSubsumable3) - /// Holds keys for files being currently checked. It's used to prevent checking same file in parallel (interleaving chunck queued to Reactor). + /// Holds keys for files being currently checked. It's used to prevent checking same file in parallel (interleaving chunk queued to Reactor). let beingCheckedFileTable = ConcurrentDictionary (HashIdentity.FromFunctions @@ -687,7 +686,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC tcErrors, reactorOps, keepAssemblyContents, - Option.get tcProj.LastestCcuSigForFile, + Option.get tcProj.LatestCcuSigForFile, tcProj.TcState.Ccu, tcProj.TcImports, tcProj.TcEnvAtEnd.AccessRights, @@ -1167,7 +1166,7 @@ type FSharpChecker(legacyReferenceResolver, // Apply command-line arguments and collect more source files if they are in the arguments let sourceFilesNew = ApplyCommandLineArgs(tcConfigBuilder, initialSourceFiles, argv) - FSharpParsingOptions.FromTcConfigBuidler(tcConfigBuilder, Array.ofList sourceFilesNew, isInteractive), errorScope.Diagnostics + FSharpParsingOptions.FromTcConfigBuilder(tcConfigBuilder, Array.ofList sourceFilesNew, isInteractive), errorScope.Diagnostics member ic.GetParsingOptionsFromCommandLineArgs(argv, ?isInteractive: bool) = ic.GetParsingOptionsFromCommandLineArgs([], argv, ?isInteractive=isInteractive) diff --git a/src/fsharp/sr.fs b/src/fsharp/sr.fs index ee64fcdb19e..ae81bb6abcf 100644 --- a/src/fsharp/sr.fs +++ b/src/fsharp/sr.fs @@ -2,13 +2,8 @@ namespace FSharp.Compiler open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Collections open Microsoft.FSharp.Reflection - open System.Globalization - open System.IO - open System.Text - open System.Reflection module internal SR = let private resources = lazy (new System.Resources.ResourceManager("fsstrings", System.Reflection.Assembly.GetExecutingAssembly())) @@ -24,9 +19,6 @@ namespace FSharp.Compiler module internal DiagnosticMessage = open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Reflection - open System.Reflection - open Internal.Utilities.StructuredFormat let mkFunctionValue (tys: System.Type[]) (impl:obj->obj) = FSharpValue.MakeFunction(FSharpType.MakeFunctionType(tys.[0],tys.[1]), impl) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index c246f8bf32c..b1f3a5a45f2 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -339,11 +339,11 @@ module FSharpExprConvert = and ConvExpr cenv env expr = Mk2 cenv expr (ConvExprPrim cenv env expr) - and ConvExprLinear cenv env expr contf = - ConvExprPrimLinear cenv env expr (fun exprR -> contf (Mk2 cenv expr exprR)) + and ConvExprLinear cenv env expr contF = + ConvExprPrimLinear cenv env expr (fun exprR -> contF (Mk2 cenv expr exprR)) // Tail recursive function to process the subset of expressions considered "linear" - and ConvExprPrimLinear cenv env expr contf = + and ConvExprPrimLinear cenv env expr contF = match expr with // Large lists @@ -352,15 +352,15 @@ module FSharpExprConvert = let typR = ConvType cenv (mkAppTy ucref.TyconRef tyargs) let e1R = ConvExpr cenv env e1 // tail recursive - ConvExprLinear cenv env e2 (contf << (fun e2R -> E.NewUnionCase(typR, mkR, [e1R; e2R]) )) + ConvExprLinear cenv env e2 (contF << (fun e2R -> E.NewUnionCase(typR, mkR, [e1R; e2R]) )) // Large sequences of let bindings | Expr.Let (bind, body, _, _) -> match ConvLetBind cenv env bind with - | None, env -> ConvExprPrimLinear cenv env body contf + | None, env -> ConvExprPrimLinear cenv env body contF | Some bindR, env -> // tail recursive - ConvExprLinear cenv env body (contf << (fun bodyR -> E.Let(bindR, bodyR))) + ConvExprLinear cenv env body (contF << (fun bodyR -> E.Let(bindR, bodyR))) // Remove initialization checks // Remove static initialization counter updates @@ -372,23 +372,23 @@ module FSharpExprConvert = | Expr.Sequential (ObjectInitializationCheck cenv.g, x1, NormalSeq, _, _) | Expr.Sequential (StaticInitializationCount, x1, NormalSeq, _, _) | Expr.Sequential (StaticInitializationCheck, x1, NormalSeq, _, _) -> - ConvExprPrim cenv env x1 |> contf + ConvExprPrim cenv env x1 |> contF // Large sequences of sequential code | Expr.Sequential (e1, e2, NormalSeq, _, _) -> let e1R = ConvExpr cenv env e1 // tail recursive - ConvExprLinear cenv env e2 (contf << (fun e2R -> E.Sequential(e1R, e2R))) + ConvExprLinear cenv env e2 (contF << (fun e2R -> E.Sequential(e1R, e2R))) | Expr.Sequential (x0, x1, ThenDoSeq, _, _) -> E.Sequential(ConvExpr cenv env x0, ConvExpr cenv env x1) | ModuleValueOrMemberUse cenv.g (vref, vFlags, _f, _fty, tyargs, curriedArgs) when (nonNil tyargs || nonNil curriedArgs) && vref.IsMemberOrModuleBinding -> - ConvModuleValueOrMemberUseLinear cenv env (expr, vref, vFlags, tyargs, curriedArgs) contf + ConvModuleValueOrMemberUseLinear cenv env (expr, vref, vFlags, tyargs, curriedArgs) contF | Expr.Match (_spBind, m, dtree, tgs, _, retTy) -> let dtreeR = ConvDecisionTree cenv env retTy dtree m // tailcall - ConvTargetsLinear cenv env (List.ofArray tgs) (contf << fun (targetsR: _ list) -> + ConvTargetsLinear cenv env (List.ofArray tgs) (contF << fun (targetsR: _ list) -> let (|E|) (x: FSharpExpr) = x.E // If the match is really an "if-then-else" then return it as such. @@ -397,11 +397,11 @@ module FSharpExprConvert = | _ -> E.DecisionTree(dtreeR, targetsR)) | _ -> - ConvExprPrim cenv env expr |> contf + ConvExprPrim cenv env expr |> contF /// A nasty function copied from creflect.fs. Made nastier by taking a continuation to process the /// arguments to the call in a tail-recursive fashion. - and ConvModuleValueOrMemberUseLinear (cenv: SymbolEnv) env (expr: Expr, vref, vFlags, tyargs, curriedArgs) contf = + and ConvModuleValueOrMemberUseLinear (cenv: SymbolEnv) env (expr: Expr, vref, vFlags, tyargs, curriedArgs) contF = let m = expr.Range let (numEnclTypeArgs, _, isNewObj, _valUseFlags, _isSelfInit, takesInstanceArg, _isPropGet, _isPropSet) = @@ -444,7 +444,7 @@ module FSharpExprConvert = let expr, exprty = AdjustValForExpectedArity cenv.g m vref vFlags topValInfo let splitCallExpr = MakeApplicationAndBetaReduce cenv.g (expr, exprty, [tyargs], curriedArgs, m) // tailcall - ConvExprPrimLinear cenv env splitCallExpr contf + ConvExprPrimLinear cenv env splitCallExpr contF else let curriedArgs, laterArgs = List.splitAt curriedArgInfos.Length curriedArgs @@ -459,8 +459,8 @@ module FSharpExprConvert = let contf2 = match laterArgs with - | [] -> contf - | _ -> (fun subCallR -> (subCallR, laterArgs) ||> List.fold (fun fR arg -> E.Application (Mk2 cenv arg fR, [], [ConvExpr cenv env arg])) |> contf) + | [] -> contF + | _ -> (fun subCallR -> (subCallR, laterArgs) ||> List.fold (fun fR arg -> E.Application (Mk2 cenv arg fR, [], [ConvExpr cenv env arg])) |> contF) if isMember then let callArgs = (objArgs :: untupledCurriedArgs) |> List.concat @@ -827,7 +827,7 @@ module FSharpExprConvert = let typR = ConvType cenv (mkAppTy tycr tyargs) E.UnionCaseTag(ConvExpr cenv env arg1, typR) - | TOp.TraitCall (TTrait(tys, nm, memFlags, argtys, _rty, _colution)), _, _ -> + | TOp.TraitCall (TTrait(tys, nm, memFlags, argtys, _rty, _solution)), _, _ -> let tysR = ConvTypes cenv tys let tyargsR = ConvTypes cenv tyargs let argtysR = ConvTypes cenv argtys @@ -849,7 +849,7 @@ module FSharpExprConvert = // 'let v = isinst e in .... if nonnull v then ...v .... ' // construct arising out the compilation of pattern matching. We decode these back to the form // 'if istype e then ...unbox e .... ' - // It's bit annoying that pattern matching does this tranformation. Like all premature optimization we pay a + // It's bit annoying that pattern matching does this transformation. Like all premature optimization we pay a // cost here to undo it. | Expr.Op (TOp.ILAsm ([ I_isinst _ ], _), [ty], [e], _) -> None, env.BindIsInstVal bind.Var (ty, e) @@ -951,7 +951,7 @@ module FSharpExprConvert = else let valR = ConvExpr cenv env callArgs.Head E.ValueSet (m, valR) - | _ -> failwith "Failed to resolve module value unambigously" + | _ -> failwith "Failed to resolve module value unambiguously" else failwith "Failed to resolve module member" | _ -> @@ -1077,7 +1077,7 @@ module FSharpExprConvert = with e -> failwithf "An IL call to '%s' could not be resolved: %s" (ilMethRef.ToString()) e.Message - and ConvObjectModelCallLinear cenv env (isNewObj, v: FSharpMemberOrFunctionOrValue, enclTyArgs, methTyArgs, callArgs) contf = + and ConvObjectModelCallLinear cenv env (isNewObj, v: FSharpMemberOrFunctionOrValue, enclTyArgs, methTyArgs, callArgs) contF = let enclTyArgsR = ConvTypes cenv enclTyArgs let methTyArgsR = ConvTypes cenv methTyArgs let obj, callArgs = @@ -1089,7 +1089,7 @@ module FSharpExprConvert = None, callArgs let objR = Option.map (ConvLValueExpr cenv env) obj // tailcall - ConvExprsLinear cenv env callArgs (contf << fun callArgsR -> + ConvExprsLinear cenv env callArgs (contF << fun callArgsR -> if isNewObj then E.NewObject(v, enclTyArgsR, callArgsR) else @@ -1098,21 +1098,21 @@ module FSharpExprConvert = and ConvExprs cenv env args = List.map (ConvExpr cenv env) args - // Process a list of expressions in a tail-recursive way. Identical to "ConvExprs" but the result is eventually passed to contf. - and ConvExprsLinear cenv env args contf = + // Process a list of expressions in a tail-recursive way. Identical to "ConvExprs" but the result is eventually passed to contF. + and ConvExprsLinear cenv env args contF = match args with - | [] -> contf [] - | [arg] -> ConvExprLinear cenv env arg (fun argR -> contf [argR]) - | arg :: rest -> ConvExprLinear cenv env arg (fun argR -> ConvExprsLinear cenv env rest (fun restR -> contf (argR :: restR))) + | [] -> contF [] + | [arg] -> ConvExprLinear cenv env arg (fun argR -> contF [argR]) + | arg :: rest -> ConvExprLinear cenv env arg (fun argR -> ConvExprsLinear cenv env rest (fun restR -> contF (argR :: restR))) - and ConvTargetsLinear cenv env tgs contf = + and ConvTargetsLinear cenv env tgs contF = match tgs with - | [] -> contf [] + | [] -> contF [] | TTarget(vars, rhs, _, _) :: rest -> let varsR = (List.rev vars) |> List.map (ConvVal cenv) ConvExprLinear cenv env rhs (fun targetR -> ConvTargetsLinear cenv env rest (fun restR -> - contf ((varsR, targetR) :: restR))) + contF ((varsR, targetR) :: restR))) and ConvValRef cenv env m (vref: ValRef) = let v = vref.Deref diff --git a/src/fsharp/symbols/Exprs.fsi b/src/fsharp/symbols/Exprs.fsi index fd5d88c0225..96c12024cc8 100644 --- a/src/fsharp/symbols/Exprs.fsi +++ b/src/fsharp/symbols/Exprs.fsi @@ -89,7 +89,7 @@ module public BasicPatterns = /// Matches expressions which are type abstractions val (|TypeLambda|_|) : FSharpExpr -> (FSharpGenericParameter list * FSharpExpr) option - /// Matches expressions with a decision expression, each branch of which ends in DecisionTreeSuccess pasing control and values to one of the targets. + /// Matches expressions with a decision expression, each branch of which ends in DecisionTreeSuccess passing control and values to one of the targets. val (|DecisionTree|_|) : FSharpExpr -> (FSharpExpr * (FSharpMemberOrFunctionOrValue list * FSharpExpr) list) option /// Special expressions at the end of a conditional decision structure in the decision expression node of a DecisionTree . diff --git a/src/fsharp/symbols/SymbolHelpers.fs b/src/fsharp/symbols/SymbolHelpers.fs index b1c46d9bd72..cec9bfaf52f 100644 --- a/src/fsharp/symbols/SymbolHelpers.fs +++ b/src/fsharp/symbols/SymbolHelpers.fs @@ -8,7 +8,6 @@ namespace FSharp.Compiler.SourceCodeServices open System -open System.Collections.Generic open System.IO open Microsoft.FSharp.Core.Printf @@ -117,7 +116,7 @@ type ErrorScope() = /// may hit internal compiler failures. /// /// In some calling cases, we get a chance to report the error as part of user text. For example - /// if there is a "msising assembly" error while formatting the text of the description of an + /// if there is a "missing assembly" error while formatting the text of the description of an /// autocomplete, then the error message is shown in replacement of the text (rather than crashing Visual /// Studio, or swallowing the exception completely) static member Protect<'a> (m: range) (f: unit->'a) (err: string->'a): 'a = @@ -212,7 +211,7 @@ type FSharpXmlDoc = type FSharpToolTipElementData<'T> = { MainDescription: 'T XmlDoc: FSharpXmlDoc - /// typar insantiation text, to go after xml + /// typar instantiation text, to go after xml TypeMapping: 'T list Remarks: 'T option ParamName : string option } @@ -762,7 +761,7 @@ module internal SymbolHelpers = | Item.Property(_, pi1s), Item.Property(_, pi2s) -> List.zip pi1s pi2s |> List.forall(fun (pi1, pi2) -> PropInfo.PropInfosUseIdenticalDefinitions pi1 pi2) | Item.Event evt1, Item.Event evt2 -> - EventInfo.EventInfosUseIdenticalDefintions evt1 evt2 + EventInfo.EventInfosUseIdenticalDefinitions evt1 evt2 | Item.AnonRecdField(anon1, _, i1, _), Item.AnonRecdField(anon2, _, i2, _) -> Tastops.anonInfoEquiv anon1 anon2 && i1 = i2 | Item.CtorGroup(_, meths1), Item.CtorGroup(_, meths2) -> @@ -1301,7 +1300,7 @@ module internal SymbolHelpers = #endif - /// Get the "F1 Keyword" associated with an item, for looking up documentatio help indexes on the web + /// Get the "F1 Keyword" associated with an item, for looking up documentation help indexes on the web let rec GetF1Keyword (g: TcGlobals) item = let getKeywordForMethInfo (minfo : MethInfo) = diff --git a/src/fsharp/symbols/SymbolHelpers.fsi b/src/fsharp/symbols/SymbolHelpers.fsi index 984654c461d..e6ece6fa2ca 100755 --- a/src/fsharp/symbols/SymbolHelpers.fsi +++ b/src/fsharp/symbols/SymbolHelpers.fsi @@ -64,7 +64,7 @@ type public Layout = Internal.Utilities.StructuredFormat.Layout type public FSharpToolTipElementData<'T> = { MainDescription: 'T XmlDoc: FSharpXmlDoc - /// typar insantiation text, to go after xml + /// typar instantiation text, to go after xml TypeMapping: 'T list /// Extra text, goes at the end Remarks: 'T option diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index fcfe2c085fb..d46313cb375 100644 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -781,9 +781,13 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) = checkIsResolved() v.Range + member __.HasFields = + if isUnresolved() then false else + v.UnionCase.RecdFieldsArray.Length <> 0 + member __.UnionCaseFields = if isUnresolved() then makeReadOnlyCollection [] else - v.UnionCase.RecdFields |> List.mapi (fun i _ -> FSharpField(cenv, FSharpFieldData.Union (v, i))) |> makeReadOnlyCollection + v.UnionCase.RecdFieldsArray |> Array.mapi (fun i _ -> FSharpField(cenv, FSharpFieldData.Union (v, i))) |> makeReadOnlyCollection member __.ReturnType = checkIsResolved() @@ -1954,7 +1958,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = // Note, returning "public" is wrong for IL members that are private match d with | E e -> - // For IL events, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private" + // For IL events, we get an approximate accessibility that at least reports "internal" as "internal" and "private" as "private" let access = match e with | ILEvent ileinfo -> @@ -1965,7 +1969,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = FSharpAccessibility access | P p -> - // For IL properties, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private" + // For IL properties, we get an approximate accessibility that at least reports "internal" as "internal" and "private" as "private" let access = match p with | ILProp ilpinfo -> @@ -1977,13 +1981,13 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | M m | C m -> - // For IL methods, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private" + // For IL methods, we get an approximate accessibility that at least reports "internal" as "internal" and "private" as "private" let access = match m with | ILMeth (_, x, _) -> getApproxFSharpAccessibilityOfMember x.DeclaringTyconRef x.RawMetadata.Access | _ -> taccessPublic - FSharpAccessibility(access, isProtected=m.IsProtectedAccessiblity) + FSharpAccessibility(access, isProtected=m.IsProtectedAccessibility) | V v -> FSharpAccessibility(v.Accessibility) @@ -2010,7 +2014,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match other with | :? FSharpMemberOrFunctionOrValue as other -> match d, other.Data with - | E evt1, E evt2 -> EventInfo.EventInfosUseIdenticalDefintions evt1 evt2 + | E evt1, E evt2 -> EventInfo.EventInfosUseIdenticalDefinitions evt1 evt2 | P p1, P p2 -> PropInfo.PropInfosUseIdenticalDefinitions p1 p2 | M m1, M m2 | C m1, C m2 -> MethInfo.MethInfosUseIdenticalDefinitions m1 m2 diff --git a/src/fsharp/symbols/Symbols.fsi b/src/fsharp/symbols/Symbols.fsi index 60c3cecedd3..6893097ed94 100644 --- a/src/fsharp/symbols/Symbols.fsi +++ b/src/fsharp/symbols/Symbols.fsi @@ -87,7 +87,7 @@ type [] public FSharpSymbol = /// Return true if two symbols are effectively the same when referred to in F# source code text. /// This sees through signatures (a symbol in a signature will be considered effectively the same as - /// the matching symbol in an implementation). In addition, other equivalances are applied + /// the matching symbol in an implementation). In addition, other equivalences are applied /// when the same F# source text implies the same declaration name - for example, constructors /// are considered to be effectively the same symbol as the corresponding type definition. /// @@ -382,6 +382,9 @@ and [] public FSharpUnionCase = /// Get the range of the name of the case member DeclarationLocation : range + /// Indicates if the union case has field definitions + member HasFields: bool + /// Get the data carried by the case. member UnionCaseFields: IList diff --git a/src/fsharp/tainted.fs b/src/fsharp/tainted.fs index ebdc96c746a..15d2378b3fb 100644 --- a/src/fsharp/tainted.fs +++ b/src/fsharp/tainted.fs @@ -9,9 +9,6 @@ open FSharp.Compiler.Range open Microsoft.FSharp.Core.CompilerServices open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal.Library -open System.Reflection -open System.Collections.Generic -open ErrorLogger type internal TypeProviderError ( diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs index 35235d6cd85..e7f2cb95a91 100644 --- a/src/fsharp/tast.fs +++ b/src/fsharp/tast.fs @@ -600,7 +600,7 @@ type EntityOptionalData = /// Indicates how visible is the entity is. // MUTABILITY: only for unpickle linkage - mutable entity_accessiblity: Accessibility + mutable entity_accessibility: Accessibility /// Field used when the 'tycon' is really an exception definition // @@ -678,7 +678,7 @@ and /// Represents a type definition, exception definition, module definition or entity_xmldocsig = "" entity_tycon_abbrev = None entity_tycon_repr_accessibility = TAccess [] - entity_accessiblity = TAccess [] + entity_accessibility = TAccess [] entity_exn_info = TExnNone } /// The name of the namespace, module or type, possibly with mangling, e.g. List`1, List or FailureException @@ -884,7 +884,7 @@ and /// Represents a type definition, exception definition, module definition or /// Get the value representing the accessibility of an F# type definition or module. member x.Accessibility = match x.entity_opt_data with - | Some optData -> optData.entity_accessiblity + | Some optData -> optData.entity_accessibility | _ -> TAccess [] /// Indicates the type prefers the "tycon" syntax for display etc. @@ -1049,7 +1049,7 @@ and /// Represents a type definition, exception definition, module definition or entity_xmldocsig = tg.entity_xmldocsig entity_tycon_abbrev = tg.entity_tycon_abbrev entity_tycon_repr_accessibility = tg.entity_tycon_repr_accessibility - entity_accessiblity = tg.entity_accessiblity + entity_accessibility = tg.entity_accessibility entity_exn_info = tg.entity_exn_info } | None -> () @@ -1235,8 +1235,8 @@ and /// Represents a type definition, exception definition, module definition or let rec top racc p = match p with | [] -> ILTypeRef.Create(sref, [], textOfPath (List.rev (item :: racc))) - | (h, istype) :: t -> - match istype with + | (h, isType) :: t -> + match isType with | FSharpModuleWithSuffix | ModuleOrType -> let outerTypeName = (textOfPath (List.rev (h :: racc))) ILTypeRef.Create(sref, (outerTypeName :: List.map (fun (nm, _) -> nm) t), item) @@ -1910,7 +1910,7 @@ and [] cacheOptRef tyconsByAccessNamesCache (fun () -> LayeredMultiMap.Empty.AddAndMarkAsCollapsible (mtyp.TypeAndExceptionDefinitions |> List.toArray |> Array.collect (fun (tc: Tycon) -> KeyTyconByAccessNames tc.LogicalName tc))) - // REVIEW: we can remove this lookup and use AllEntitiedByMangledName instead? + // REVIEW: we can remove this lookup and use AllEntitiesByMangledName instead? member mtyp.TypesByMangledName = let addTyconByMangledName (x: Tycon) tab = NameMap.add x.LogicalName x tab cacheOptRef tyconsByMangledNameCache (fun () -> @@ -2090,7 +2090,7 @@ and Construct = entity_opt_data = match kind, access with | TyparKind.Type, TAccess [] -> None - | _ -> Some { Entity.NewEmptyEntityOptData() with entity_kind = kind; entity_accessiblity = access } } + | _ -> Some { Entity.NewEmptyEntityOptData() with entity_kind = kind; entity_accessibility = access } } #endif static member NewModuleOrNamespace cpath access (id: Ident) xml attribs mtype = @@ -2112,7 +2112,7 @@ and Construct = entity_opt_data = match xml, access with | XmlDoc [||], TAccess [] -> None - | _ -> Some { Entity.NewEmptyEntityOptData() with entity_xmldoc = xml; entity_tycon_repr_accessibility = access; entity_accessiblity = access } } + | _ -> Some { Entity.NewEmptyEntityOptData() with entity_xmldoc = xml; entity_tycon_repr_accessibility = access; entity_accessibility = access } } and [] @@ -2398,7 +2398,7 @@ and [] TraitConstraintInfo = - /// TTrait(tys, nm, memFlags, argtys, rty, colution) + /// TTrait(tys, nm, memFlags, argtys, rty, solution) /// /// Indicates the signature of a member constraint. Contains a mutable solution cell /// to store the inferred solution of the constraint. @@ -5818,7 +5818,7 @@ let NewExn cpath (id: Ident) access repr attribs doc = entity_opt_data = match doc, access, repr with | XmlDoc [||], TAccess [], TExnNone -> None - | _ -> Some { Entity.NewEmptyEntityOptData() with entity_xmldoc = doc; entity_accessiblity = access; entity_tycon_repr_accessibility = access; entity_exn_info = repr } } + | _ -> Some { Entity.NewEmptyEntityOptData() with entity_xmldoc = doc; entity_accessibility = access; entity_tycon_repr_accessibility = access; entity_exn_info = repr } } /// Create a new TAST RecdField node for an F# class, struct or record field let NewRecdField stat konst id nameGenerated ty isMutable isVolatile pattribs fattribs docOption access secret = @@ -5856,7 +5856,7 @@ let NewTycon (cpath, nm, m, access, reprAccess, kind, typars, docOption, usesPre entity_opt_data = match kind, docOption, reprAccess, access with | TyparKind.Type, XmlDoc [||], TAccess [], TAccess [] -> None - | _ -> Some { Entity.NewEmptyEntityOptData() with entity_kind = kind; entity_xmldoc = docOption; entity_tycon_repr_accessibility = reprAccess; entity_accessiblity=access } } + | _ -> Some { Entity.NewEmptyEntityOptData() with entity_kind = kind; entity_xmldoc = docOption; entity_tycon_repr_accessibility = reprAccess; entity_accessibility=access } } let NewILTycon nlpath (nm, m) tps (scoref: ILScopeRef, enc, tdef: ILTypeDef) mtyp = @@ -5956,7 +5956,7 @@ let CombineCcuContentFragments m l = let entities = [ for e1 in mty1.AllEntities do match tab2.TryGetValue e1.LogicalName with - | true, e2 -> yield CombineEntites path e1 e2 + | true, e2 -> yield CombineEntities path e1 e2 | _ -> yield e1 for e2 in mty2.AllEntities do match tab1.TryGetValue e2.LogicalName with @@ -5973,7 +5973,7 @@ let CombineCcuContentFragments m l = | _-> error(Error(FSComp.SR.tastTwoModulesWithSameNameInAssembly(textOfPath path), m)) - and CombineEntites path (entity1: Entity) (entity2: Entity) = + and CombineEntities path (entity1: Entity) (entity2: Entity) = match entity1.IsModuleOrNamespace, entity2.IsModuleOrNamespace with | true, true -> diff --git a/src/ilx/EraseClosures.fs b/src/ilx/EraseClosures.fs index ca0dbfcdf8e..abc5e4bc977 100644 --- a/src/ilx/EraseClosures.fs +++ b/src/ilx/EraseClosures.fs @@ -2,18 +2,13 @@ module internal FSharp.Compiler.AbstractIL.Extensions.ILX.EraseClosures -open Internal.Utilities -open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Extensions.ILX open FSharp.Compiler.AbstractIL.Extensions.ILX.Types -open FSharp.Compiler.AbstractIL.Extensions.ILX.IlxSettings open FSharp.Compiler.AbstractIL.Morphs open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.PrettyNaming -open System.Reflection // -------------------------------------------------------------------- // Erase closures and function types diff --git a/src/ilx/EraseUnions.fs b/src/ilx/EraseUnions.fs index 1d0175676c8..c24a30a6105 100644 --- a/src/ilx/EraseUnions.fs +++ b/src/ilx/EraseUnions.fs @@ -9,10 +9,8 @@ module internal FSharp.Compiler.AbstractIL.Extensions.ILX.EraseUnions open System.Collections.Generic -open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal.Library -open FSharp.Compiler.AbstractIL.Extensions.ILX open FSharp.Compiler.AbstractIL.Extensions.ILX.Types open System.Reflection diff --git a/src/ilx/ilxsettings.fs b/src/ilx/ilxsettings.fs index 868a29d94e1..64ea572e02f 100644 --- a/src/ilx/ilxsettings.fs +++ b/src/ilx/ilxsettings.fs @@ -2,11 +2,9 @@ module internal FSharp.Compiler.AbstractIL.Extensions.ILX.IlxSettings -open Internal.Utilities open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Internal -open FSharp.Compiler.AbstractIL.Extensions.ILX type IlxCallImplementation = | VirtEntriesVirtCode diff --git a/src/utils/CompilerLocationUtils.fs b/src/utils/CompilerLocationUtils.fs index 95aa5c5a31e..6d2a929f453 100644 --- a/src/utils/CompilerLocationUtils.fs +++ b/src/utils/CompilerLocationUtils.fs @@ -3,7 +3,6 @@ namespace Internal.Utilities open System open System.IO -open System.Reflection open Microsoft.Win32 open System.Runtime.InteropServices @@ -124,7 +123,7 @@ module internal FSharpEnvironment = let tryRegKey(subKey:string) = - //if we are runing on mono simply return None + //if we are running on mono simply return None // GetDefaultRegistryStringValueViaDotNet will result in an access denied by default, // and Get32BitRegistryStringValueViaPInvoke will fail due to Advapi32.dll not existing if runningOnMono then None else @@ -188,7 +187,7 @@ module internal FSharpEnvironment = // Check for an app.config setting to redirect the default compiler location // Like fsharp-compiler-location try - // FSharp.Compiler support setting an appkey for compiler location. I've never seen this used. + // FSharp.Compiler support setting an appKey for compiler location. I've never seen this used. let result = tryAppConfig "fsharp-compiler-location" match result with | Some _ -> result @@ -210,10 +209,10 @@ module internal FSharpEnvironment = None - // Apply the given function to the registry entry corresponding to the subkey. + // Apply the given function to the registry entry corresponding to the subKey. // The reg key is disposed at the end of the scope. - let useKey subkey f = - let key = Registry.LocalMachine.OpenSubKey subkey + let useKey subKey f = + let key = Registry.LocalMachine.OpenSubKey subKey try f key finally match key with @@ -221,12 +220,12 @@ module internal FSharpEnvironment = | _ -> key.Dispose() // Check if the framework version 4.5 or above is installed at the given key entry - let IsNetFx45OrAboveInstalledAt subkey = + let IsNetFx45OrAboveInstalledAt subKey = try - useKey subkey (fun regkey -> - match regkey with + useKey subKey (fun regKey -> + match regKey with | null -> false - | _ -> regkey.GetValue("Release", 0) :?> int |> (fun s -> s >= 0x50000)) // 0x50000 implies 4.5.0 + | _ -> regKey.GetValue("Release", 0) :?> int |> (fun s -> s >= 0x50000)) // 0x50000 implies 4.5.0 with _ -> false // Check if the framework version 4.5 or above is installed diff --git a/src/utils/EditDistance.fs b/src/utils/EditDistance.fs index 503662400ff..bd66352d44d 100644 --- a/src/utils/EditDistance.fs +++ b/src/utils/EditDistance.fs @@ -4,7 +4,6 @@ module internal Internal.Utilities.EditDistance open System -open System.Collections.Generic /// Given an offset and a radius from that offset, does mChar exist in that part of str? let inline existsInWin (mChar: char) (str: string) (offset: int) (rad: int) = diff --git a/src/utils/HashMultiMap.fs b/src/utils/HashMultiMap.fs index 7f571c232d0..be3740f55d1 100644 --- a/src/utils/HashMultiMap.fs +++ b/src/utils/HashMultiMap.fs @@ -2,23 +2,22 @@ namespace Internal.Utilities.Collections -open System open System.Collections.Generic open Microsoft.FSharp.Collections // Each entry in the HashMultiMap dictionary has at least one entry. Under normal usage each entry has _only_ // one entry. So use two hash tables: one for the main entries and one for the overflow. [] -type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) = +type internal HashMultiMap<'Key,'Value>(n: int, hashEq: IEqualityComparer<'Key>) = - let firstEntries = Dictionary<_,_>(n,hasheq) + let firstEntries = Dictionary<_,_>(n,hashEq) - let rest = Dictionary<_,_>(3,hasheq) + let rest = Dictionary<_,_>(3,hashEq) - new (hasheq : IEqualityComparer<'Key>) = HashMultiMap<'Key,'Value>(11, hasheq) + new (hashEq : IEqualityComparer<'Key>) = HashMultiMap<'Key,'Value>(11, hashEq) - new (seq : seq<'Key * 'Value>, hasheq : IEqualityComparer<'Key>) as x = - new HashMultiMap<'Key,'Value>(11, hasheq) + new (seq : seq<'Key * 'Value>, hashEq : IEqualityComparer<'Key>) as x = + new HashMultiMap<'Key,'Value>(11, hashEq) then seq |> Seq.iter (fun (k,v) -> x.Add(k,v)) member x.GetRest(k) = diff --git a/src/utils/TaggedCollections.fs b/src/utils/TaggedCollections.fs index 232d3b75053..54f7e07fc5f 100644 --- a/src/utils/TaggedCollections.fs +++ b/src/utils/TaggedCollections.fs @@ -7,12 +7,8 @@ namespace Internal.Utilities.Collections.Tagged #nowarn "60" // override implementations in augmentations open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open System open System.Collections.Generic - open Internal.Utilities - open Internal.Utilities.Collections [] diff --git a/src/utils/prim-lexing.fsi b/src/utils/prim-lexing.fsi index bf9eb3171c1..b0579d71e2f 100644 --- a/src/utils/prim-lexing.fsi +++ b/src/utils/prim-lexing.fsi @@ -32,7 +32,7 @@ module SourceText = // // NOTE: the code in this file is a drop-in replacement runtime for Lexing.fsi from the FsLexYacc repository // and is referenced by generated code for the three FsLex generated lexers in the F# compiler. -// The underlying table format intepreted must precisely match the format generated by FsLex. +// The underlying table format interpreted must precisely match the format generated by FsLex. namespace Internal.Utilities.Text.Lexing open System.Collections.Generic diff --git a/src/utils/prim-parsing.fs b/src/utils/prim-parsing.fs index 9ce01bff907..b58e592278d 100644 --- a/src/utils/prim-parsing.fs +++ b/src/utils/prim-parsing.fs @@ -4,11 +4,9 @@ namespace Internal.Utilities.Text.Parsing -open Internal.Utilities open Internal.Utilities.Text.Lexing open System -open System.Collections.Generic exception RecoverableParseError exception Accept of obj @@ -341,7 +339,7 @@ module internal Implementation = if errorSuppressionCountDown > 0 then errorSuppressionCountDown <- errorSuppressionCountDown - 1 #if DEBUG - if Flags.debug then Console.WriteLine("shifting, reduced errorRecoverylevel to {0}\n", errorSuppressionCountDown) + if Flags.debug then Console.WriteLine("shifting, reduced errorRecoveryLevel to {0}\n", errorSuppressionCountDown) #endif let nextState = actionValue action if not haveLookahead then failwith "shift on end of input!" diff --git a/src/utils/sformat.fs b/src/utils/sformat.fs index 42cb18fa8d0..21b84f5bef7 100644 --- a/src/utils/sformat.fs +++ b/src/utils/sformat.fs @@ -25,18 +25,14 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // This is a fresh implementation of pre-existing ideas. open System - open System.Diagnostics - open System.Text open System.IO open System.Reflection open System.Globalization open System.Collections.Generic open Microsoft.FSharp.Core open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Reflection open Microsoft.FSharp.Collections - open Microsoft.FSharp.Primitives.Basics [] type LayoutTag = @@ -342,8 +338,6 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl module ReflectUtils = - open System - open System.Reflection [] type TypeInfo = diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs new file mode 100644 index 00000000000..cd7da3c7d3a --- /dev/null +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.Scripting.UnitTests + +open System +open System.Threading.Tasks +open FSharp.Compiler.Scripting +open NUnit.Framework + +[] +type CompletionTests() = + + [] + member _.``Instance completions in the same submission``() = + async { + use script = new FSharpScript() + let lines = [ "let x = 1" + "x." ] + let! completions = script.GetCompletionItems(String.Join("\n", lines), 2, 2) + let matchingCompletions = completions |> Array.filter (fun d -> d.Name = "CompareTo") + Assert.AreEqual(1, matchingCompletions.Length) + } |> Async.StartAsTask :> Task + + [] + member _.``Instance completions from a previous submission``() = + async { + use script = new FSharpScript() + script.Eval("let x = 1") |> ignoreValue + let! completions = script.GetCompletionItems("x.", 1, 2) + let matchingCompletions = completions |> Array.filter (fun d -> d.Name = "CompareTo") + Assert.AreEqual(1, matchingCompletions.Length) + } |> Async.StartAsTask :> Task + + [] + member _.``Static member completions``() = + async { + use script = new FSharpScript() + let! completions = script.GetCompletionItems("System.String.", 1, 14) + let matchingCompletions = completions |> Array.filter (fun d -> d.Name = "Join") + Assert.GreaterOrEqual(matchingCompletions.Length, 1) + } |> Async.StartAsTask :> Task + + [] + member _.``Type completions from namespace``() = + async { + use script = new FSharpScript() + let! completions = script.GetCompletionItems("System.", 1, 7) + let matchingCompletions = completions |> Array.filter (fun d -> d.Name = "String") + Assert.GreaterOrEqual(matchingCompletions.Length, 1) + } |> Async.StartAsTask :> Task + + [] + member _.``Namespace completions``() = + async { + use script = new FSharpScript() + let! completions = script.GetCompletionItems("System.", 1, 7) + let matchingCompletions = completions |> Array.filter (fun d -> d.Name = "Collections") + Assert.AreEqual(1, matchingCompletions.Length) + } |> Async.StartAsTask :> Task + + [] + member _.``Extension method completions``() = + async { + use script = new FSharpScript() + let lines = [ "open System.Linq" + "let list = new System.Collections.Generic.List()" + "list." ] + let! completions = script.GetCompletionItems(String.Join("\n", lines), 3, 5) + let matchingCompletions = completions |> Array.filter (fun d -> d.Name = "Select") + Assert.AreEqual(1, matchingCompletions.Length) + } |> Async.StartAsTask :> Task diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj index 51beecf2af1..7ecca98b7cd 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj @@ -11,7 +11,9 @@ + + diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index 1de9c9beaf9..70b6b2662e8 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -9,21 +9,11 @@ open System.Threading open System.Threading.Tasks open FSharp.Compiler.Interactive.Shell open FSharp.Compiler.Scripting -open FSharp.Compiler.SourceCodeServices open NUnit.Framework [] type InteractiveTests() = - let getValue ((value: Result), (errors: FSharpErrorInfo[])) = - if errors.Length > 0 then - failwith <| sprintf "Evaluation returned %d errors:\r\n\t%s" errors.Length (String.Join("\r\n\t", errors)) - match value with - | Ok(value) -> value - | Error ex -> raise ex - - let ignoreValue = getValue >> ignore - [] member __.``Eval object value``() = use script = new FSharpScript() @@ -110,7 +100,7 @@ type InteractiveTests() = | Ok(_) -> Assert.Fail("expected a failure") | Error(ex) -> Assert.IsInstanceOf(ex) - [] + [] member _.``Evaluation can be cancelled``() = use script = new FSharpScript() let sleepTime = 10000 @@ -132,3 +122,49 @@ type InteractiveTests() = Assert.True(wasCancelled) Assert.LessOrEqual(sw.ElapsedMilliseconds, sleepTime) Assert.AreEqual(None, result) + + [] + member _.``Values bound at the root trigger an event``() = + let mutable foundX = false + let mutable foundY = false + let mutable foundCount = 0 + use script = new FSharpScript() + script.ValueBound + |> Event.add (fun (value, typ, name) -> + foundX <- foundX || (name = "x" && typ = typeof && value :?> int = 1) + foundY <- foundY || (name = "y" && typ = typeof && value :?> int = 2) + foundCount <- foundCount + 1) + let code = @" +let x = 1 +let y = 2 +" + script.Eval(code) |> ignoreValue + Assert.True(foundX) + Assert.True(foundY) + Assert.AreEqual(2, foundCount) + + [] + member _.``Values re-bound trigger an event``() = + let mutable foundXCount = 0 + use script = new FSharpScript() + script.ValueBound + |> Event.add (fun (_value, typ, name) -> + if name = "x" && typ = typeof then foundXCount <- foundXCount + 1) + script.Eval("let x = 1") |> ignoreValue + script.Eval("let x = 2") |> ignoreValue + Assert.AreEqual(2, foundXCount) + + [] + member _.``Nested let bindings don't trigger event``() = + let mutable foundInner = false + use script = new FSharpScript() + script.ValueBound + |> Event.add (fun (_value, _typ, name) -> + foundInner <- foundInner || name = "inner") + let code = @" +let x = + let inner = 1 + () +" + script.Eval(code) |> ignoreValue + Assert.False(foundInner) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/TestHelpers.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/TestHelpers.fs new file mode 100644 index 00000000000..9238ff490a8 --- /dev/null +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/TestHelpers.fs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.Scripting.UnitTests + +open System +open FSharp.Compiler.Interactive.Shell +open FSharp.Compiler.SourceCodeServices + +[] +module TestHelpers = + + let getValue ((value: Result), (errors: FSharpErrorInfo[])) = + if errors.Length > 0 then + failwith <| sprintf "Evaluation returned %d errors:\r\n\t%s" errors.Length (String.Join("\r\n\t", errors)) + match value with + | Ok(value) -> value + | Error ex -> raise ex + + let ignoreValue = getValue >> ignore diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs index 67f95029091..98d626aaa65 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs @@ -99,7 +99,57 @@ type SeqModule2() = // null Seq let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () ->Seq.last nullSeq) + + + // ------ Test for Array ----- + let IntArr = Array.ofSeq IntSeq + if Seq.last IntArr <> 9 then Assert.Fail() + + // string Array + let strArr = Array.ofSeq strSeq + if Seq.last strArr <> "third" then Assert.Fail() + + // Empty Array + let emptyArr = [| |] + CheckThrowsArgumentException ( fun() -> Seq.last emptyArr) + + // null Array + let nullArr: array<'a> = null + CheckThrowsArgumentNullException (fun () ->Seq.last nullArr) + + // ---- Test for IList ----- + let IntRarr = ResizeArray(IntSeq) + if Seq.last IntRarr <> 9 then Assert.Fail() + + // string IList + let strRarr = ResizeArray(strSeq) + if Seq.last strRarr <> "third" then Assert.Fail() + + // Empty IList + let emptyRarr = ResizeArray() + CheckThrowsArgumentException ( fun() -> Seq.last emptyRarr) + + // null IList + let nullRarr: ResizeArray = null + CheckThrowsArgumentNullException (fun () ->Seq.last nullRarr) + + // ---- Test for list ----- + let Intlist = List.ofSeq(IntSeq) + if Seq.last Intlist <> 9 then Assert.Fail() + + // string list + let strlist = List.ofSeq(strSeq) + if Seq.last strlist <> "third" then Assert.Fail() + + // Empty list + let emptylist: list = [] + CheckThrowsArgumentException ( fun() -> Seq.last emptylist) + + // null list + let nullList: list = Unchecked.defaultof> + CheckThrowsArgumentNullException (fun () ->Seq.last nullList) () + [] member this.TryLast() = @@ -120,8 +170,63 @@ type SeqModule2() = // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullSeq |> ignore) + CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullSeq |> ignore) + + // ------ Test for Array ----- + let IntArr = Array.ofSeq IntSeq + let intResult = Seq.tryLast IntArr + Assert.AreEqual(9, intResult.Value) + + // string Array + let strResult = Seq.tryLast (Array.ofSeq (["first"; "second"; "third"])) + Assert.AreEqual("third", strResult.Value) + + // Empty Array + let emptyResult = Seq.tryLast Array.empty + Assert.IsTrue(emptyResult.IsNone) + + // null Array + let nullArr:array = null + CheckThrowsArgumentNullException (fun () -> Seq.tryLast nullArr |> ignore) + + + // ------ Test for IList ----- + let IntRarr = ResizeArray( IntSeq ) + let intResult = Seq.tryLast IntRarr + Assert.AreEqual(9, intResult.Value) + + // string IList + let strResult = Seq.tryLast (ResizeArray (["first"; "second"; "third"])) + Assert.AreEqual("third", strResult.Value) + + // Empty IList + let emptyResult = Seq.tryLast (ResizeArray()) + Assert.IsTrue(emptyResult.IsNone) + + // null IList + let nullRarr:ResizeArray = null + CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullRarr |> ignore) + + // ------ Test for list ----- + let Intlist= List.ofSeq( IntSeq ) + let intResult = Seq.tryLast Intlist + Assert.AreEqual(9, intResult.Value) + + // string list + let strResult = Seq.tryLast ["first"; "second"; "third"] + Assert.AreEqual("third", strResult.Value) + + // Empty list + let emptylist: list = [] + let emptyResult = Seq.tryLast emptylist + Assert.IsTrue(emptyResult.IsNone) + + // null list + let nullList: list = Unchecked.defaultof> + CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullList |> ignore) () + + [] member this.ExactlyOne() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs index cde67c3bfd3..0aaa16322bd 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs @@ -199,20 +199,6 @@ type AsyncType() = | _ -> reraise() Assert.IsTrue (tcs.Task.IsCompleted, "Task is not completed") - [] - member this.StartTask () = - let s = "Hello tasks!" - let a = async { return s } -#if !NET46 - let t = -#else - use t = -#endif - Async.StartAsTask a - this.WaitASec t - Assert.IsTrue (t.IsCompleted) - Assert.AreEqual(s, t.Result) - [] member this.RunSynchronouslyCancellationWithDelayedResult () = let cts = new CancellationTokenSource() diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs index a6f106dbc9c..92aa19339eb 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs @@ -222,6 +222,16 @@ type ValueOptionTests() = let assertWasNotCalledThunk () = raise (exn "Thunk should not have been called.") + [] + member _.``ValueNone gives "ValueNone" when calling ToString`` () = + Assert.AreEqual("ValueNone", ValueNone.ToString()) + Assert.AreEqual("ValueNone", string ValueNone) + + [] + member _.``ValueNone with sprintf`` () = + Assert.AreEqual("ValueNone", sprintf "%O" (ValueNone.ToString())) + Assert.AreEqual("ValueNone", sprintf "%A" ValueNone) + [] member this.ValueOptionBasics () = Assert.AreEqual((ValueNone: int voption), (ValueNone: int voption)) @@ -444,4 +454,4 @@ type ValueOptionTests() = member this.MapBindEquivalenceProperties () = let fn x = x + 3 Assert.AreEqual(ValueOption.map fn ValueNone, ValueOption.bind (fn >> ValueSome) ValueNone) - Assert.AreEqual(ValueOption.map fn (ValueSome 5), ValueOption.bind (fn >> ValueSome) (ValueSome 5)) \ No newline at end of file + Assert.AreEqual(ValueOption.map fn (ValueSome 5), ValueOption.bind (fn >> ValueSome) (ValueSome 5)) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs index b8e6d6b477b..dc6c6f1380f 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs @@ -1809,6 +1809,7 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueO Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_ValueNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] op_Implicit(T) Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.String ToString() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs index 958210df14c..458fb92bb67 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs @@ -1809,6 +1809,7 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueO Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_ValueNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] op_Implicit(T) Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.String ToString() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/TailCalls.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/TailCalls.fs new file mode 100644 index 00000000000..a61bd24ecb6 --- /dev/null +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/TailCalls.fs @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL + +open FSharp.Compiler.UnitTests +open NUnit.Framework + +[] +module ``TailCalls`` = + // Regression test for DevDiv:72571 + + [] + let ``TailCall 01``() = + CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|] + """ +module TailCall01 +let foo(x:int, y) = printfn "%d" x +let run() = let x = 0 in foo(x,5) + """ + (fun verifier -> verifier.VerifyIL [ + """ + .method public static void foo(int32 x, + !!a y) cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, + int32 V_1) + IL_0000: ldstr "%d" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: stloc.0 + IL_0010: ldarg.0 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldloc.1 + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: pop + IL_001a: ret + } + """ + """ + .method public static void run() cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldc.i4.5 + IL_0004: tail. + IL_0006: call void TailCall01::foo(int32, + !!0) + IL_000b: ret + } + """ + ]) + + [] + let ``TailCall 02``() = + CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|] + """ +module TailCall02 +let foo(x:int byref) = x +let run() = let mutable x = 0 in foo(&x) + """ + (fun verifier -> verifier.VerifyIL [ + """ + .method public static int32 foo(int32& x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj [runtime]System.Int32 + IL_0006: ret + } + """ + """ + .method public static int32 run() cil managed + { + + .maxstack 3 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call int32 TailCall02::foo(int32&) + IL_0009: ret + } + """ + ]) + + [] + let ``TailCall 03``() = + CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|] + """ +module TailCall03 +let foo (x:int byref) (y:int byref) z = printfn "%d" (x+y) +let run() = let mutable x = 0 in foo &x &x 5 + """ + (fun verifier -> verifier.VerifyIL [ + """ + .method public static void foo(int32& x, + int32& y, + !!a z) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, + int32 V_1) + IL_0000: ldstr "%d" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: stloc.0 + IL_0010: ldarg.0 + IL_0011: ldobj [runtime]System.Int32 + IL_0016: ldarg.1 + IL_0017: ldobj [runtime]System.Int32 + IL_001c: add + IL_001d: stloc.1 + IL_001e: ldloc.0 + IL_001f: ldloc.1 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: pop + IL_0026: ret + } + """ + """ + .method public static void run() cil managed + { + + .maxstack 5 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: ldloca.s V_0 + IL_0006: ldc.i4.5 + IL_0007: call void TailCall03::foo(int32&, + int32&, + !!0) + IL_000c: nop + IL_000d: ret + } + """ + ]) + + [] + let ``TailCall 04``() = + CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|] + """ +module TailCall04 +let foo(x:int byref, y) = printfn "%d" x +let run() = let mutable x = 0 in foo(&x,5) + """ + (fun verifier -> verifier.VerifyIL [ + """ + .method public static void foo(int32& x, + !!a y) cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, + int32 V_1) + IL_0000: ldstr "%d" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: stloc.0 + IL_0010: ldarg.0 + IL_0011: ldobj [runtime]System.Int32 + IL_0016: stloc.1 + IL_0017: ldloc.0 + IL_0018: ldloc.1 + IL_0019: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001e: pop + IL_001f: ret + } + """ + """ + .method public static void run() cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: ldc.i4.5 + IL_0005: call void TailCall04::foo(int32&, + !!0) + IL_000a: nop + IL_000b: ret + + """ + ]) + + [] + let ``TailCall 05``() = + CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|] + """ +module TailCall05 +let foo(x:int byref, y:int byref, z) = printfn "%d" (x+y) +let run() = let mutable x = 0 in foo(&x,&x,5) + """ + (fun verifier -> verifier.VerifyIL [ + """ + .method public static void foo(int32& x, + int32& y, + !!a z) cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, + int32 V_1) + IL_0000: ldstr "%d" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: stloc.0 + IL_0010: ldarg.0 + IL_0011: ldobj [runtime]System.Int32 + IL_0016: ldarg.1 + IL_0017: ldobj [runtime]System.Int32 + IL_001c: add + IL_001d: stloc.1 + IL_001e: ldloc.0 + IL_001f: ldloc.1 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: pop + IL_0026: ret + } + """ + """ + .method public static void run() cil managed + { + + .maxstack 5 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: ldloca.s V_0 + IL_0006: ldc.i4.5 + IL_0007: call void TailCall05::foo(int32&, + int32&, + !!0) + IL_000c: nop + IL_000d: ret + } + """ + ]) \ No newline at end of file diff --git a/tests/fsharp/Compiler/ILChecker.fs b/tests/fsharp/Compiler/ILChecker.fs index 7f29873bc60..4558d089113 100644 --- a/tests/fsharp/Compiler/ILChecker.fs +++ b/tests/fsharp/Compiler/ILChecker.fs @@ -40,7 +40,7 @@ module ILChecker = let unifyRuntimeAssemblyName ilCode = System.Text.RegularExpressions.Regex.Replace(ilCode, - "\[System.Runtime\]|\[mscorlib\]","[runtime]", + "\[System.Runtime\]|\[System.Runtime.Extensions\]|\[mscorlib\]","[runtime]", System.Text.RegularExpressions.RegexOptions.Singleline) let text = diff --git a/tests/fsharp/Compiler/Stress/LargeExprTests.fs b/tests/fsharp/Compiler/Stress/LargeExprTests.fs index 572c0e53550..004f737cb9c 100644 --- a/tests/fsharp/Compiler/Stress/LargeExprTests.fs +++ b/tests/fsharp/Compiler/Stress/LargeExprTests.fs @@ -1015,6 +1015,2031 @@ type TestRecord = test1000: int } +[] +let main _ = 0 + """ + + [] + let LargeRecordWithStringFieldsDoesNotStackOverflow() = + CompilerAssert.CompileExe + """ +type TestRecord = + { + test1: string + test2: string + test3: string + test4: string + test5: string + test6: string + test7: string + test8: string + test9: string + test10: string + test11: string + test12: string + test13: string + test14: string + test15: string + test16: string + test17: string + test18: string + test19: string + test20: string + test21: string + test22: string + test23: string + test24: string + test25: string + test26: string + test27: string + test28: string + test29: string + test30: string + test31: string + test32: string + test33: string + test34: string + test35: string + test36: string + test37: string + test38: string + test39: string + test40: string + test41: string + test42: string + test43: string + test44: string + test45: string + test46: string + test47: string + test48: string + test49: string + test50: string + test51: string + test52: string + test53: string + test54: string + test55: string + test56: string + test57: string + test58: string + test59: string + test60: string + test61: string + test62: string + test63: string + test64: string + test65: string + test66: string + test67: string + test68: string + test69: string + test70: string + test71: string + test72: string + test73: string + test74: string + test75: string + test76: string + test77: string + test78: string + test79: string + test80: string + test81: string + test82: string + test83: string + test84: string + test85: string + test86: string + test87: string + test88: string + test89: string + test90: string + test91: string + test92: string + test93: string + test94: string + test95: string + test96: string + test97: string + test98: string + test99: string + test100: string + test101: string + test102: string + test103: string + test104: string + test105: string + test106: string + test107: string + test108: string + test109: string + test110: string + test111: string + test112: string + test113: string + test114: string + test115: string + test116: string + test117: string + test118: string + test119: string + test120: string + test121: string + test122: string + test123: string + test124: string + test125: string + test126: string + test127: string + test128: string + test129: string + test130: string + test131: string + test132: string + test133: string + test134: string + test135: string + test136: string + test137: string + test138: string + test139: string + test140: string + test141: string + test142: string + test143: string + test144: string + test145: string + test146: string + test147: string + test148: string + test149: string + test150: string + test151: string + test152: string + test153: string + test154: string + test155: string + test156: string + test157: string + test158: string + test159: string + test160: string + test161: string + test162: string + test163: string + test164: string + test165: string + test166: string + test167: string + test168: string + test169: string + test170: string + test171: string + test172: string + test173: string + test174: string + test175: string + test176: string + test177: string + test178: string + test179: string + test180: string + test181: string + test182: string + test183: string + test184: string + test185: string + test186: string + test187: string + test188: string + test189: string + test190: string + test191: string + test192: string + test193: string + test194: string + test195: string + test196: string + test197: string + test198: string + test199: string + test200: string + test201: string + test202: string + test203: string + test204: string + test205: string + test206: string + test207: string + test208: string + test209: string + test210: string + test211: string + test212: string + test213: string + test214: string + test215: string + test216: string + test217: string + test218: string + test219: string + test220: string + test221: string + test222: string + test223: string + test224: string + test225: string + test226: string + test227: string + test228: string + test229: string + test230: string + test231: string + test232: string + test233: string + test234: string + test235: string + test236: string + test237: string + test238: string + test239: string + test240: string + test241: string + test242: string + test243: string + test244: string + test245: string + test246: string + test247: string + test248: string + test249: string + test250: string + test251: string + test252: string + test253: string + test254: string + test255: string + test256: string + test257: string + test258: string + test259: string + test260: string + test261: string + test262: string + test263: string + test264: string + test265: string + test266: string + test267: string + test268: string + test269: string + test270: string + test271: string + test272: string + test273: string + test274: string + test275: string + test276: string + test277: string + test278: string + test279: string + test280: string + test281: string + test282: string + test283: string + test284: string + test285: string + test286: string + test287: string + test288: string + test289: string + test290: string + test291: string + test292: string + test293: string + test294: string + test295: string + test296: string + test297: string + test298: string + test299: string + test300: string + test301: string + test302: string + test303: string + test304: string + test305: string + test306: string + test307: string + test308: string + test309: string + test310: string + test311: string + test312: string + test313: string + test314: string + test315: string + test316: string + test317: string + test318: string + test319: string + test320: string + test321: string + test322: string + test323: string + test324: string + test325: string + test326: string + test327: string + test328: string + test329: string + test330: string + test331: string + test332: string + test333: string + test334: string + test335: string + test336: string + test337: string + test338: string + test339: string + test340: string + test341: string + test342: string + test343: string + test344: string + test345: string + test346: string + test347: string + test348: string + test349: string + test350: string + test351: string + test352: string + test353: string + test354: string + test355: string + test356: string + test357: string + test358: string + test359: string + test360: string + test361: string + test362: string + test363: string + test364: string + test365: string + test366: string + test367: string + test368: string + test369: string + test370: string + test371: string + test372: string + test373: string + test374: string + test375: string + test376: string + test377: string + test378: string + test379: string + test380: string + test381: string + test382: string + test383: string + test384: string + test385: string + test386: string + test387: string + test388: string + test389: string + test390: string + test391: string + test392: string + test393: string + test394: string + test395: string + test396: string + test397: string + test398: string + test399: string + test400: string + test401: string + test402: string + test403: string + test404: string + test405: string + test406: string + test407: string + test408: string + test409: string + test410: string + test411: string + test412: string + test413: string + test414: string + test415: string + test416: string + test417: string + test418: string + test419: string + test420: string + test421: string + test422: string + test423: string + test424: string + test425: string + test426: string + test427: string + test428: string + test429: string + test430: string + test431: string + test432: string + test433: string + test434: string + test435: string + test436: string + test437: string + test438: string + test439: string + test440: string + test441: string + test442: string + test443: string + test444: string + test445: string + test446: string + test447: string + test448: string + test449: string + test450: string + test451: string + test452: string + test453: string + test454: string + test455: string + test456: string + test457: string + test458: string + test459: string + test460: string + test461: string + test462: string + test463: string + test464: string + test465: string + test466: string + test467: string + test468: string + test469: string + test470: string + test471: string + test472: string + test473: string + test474: string + test475: string + test476: string + test477: string + test478: string + test479: string + test480: string + test481: string + test482: string + test483: string + test484: string + test485: string + test486: string + test487: string + test488: string + test489: string + test490: string + test491: string + test492: string + test493: string + test494: string + test495: string + test496: string + test497: string + test498: string + test499: string + test500: string + test501: string + test502: string + test503: string + test504: string + test505: string + test506: string + test507: string + test508: string + test509: string + test510: string + test511: string + test512: string + test513: string + test514: string + test515: string + test516: string + test517: string + test518: string + test519: string + test520: string + test521: string + test522: string + test523: string + test524: string + test525: string + test526: string + test527: string + test528: string + test529: string + test530: string + test531: string + test532: string + test533: string + test534: string + test535: string + test536: string + test537: string + test538: string + test539: string + test540: string + test541: string + test542: string + test543: string + test544: string + test545: string + test546: string + test547: string + test548: string + test549: string + test550: string + test551: string + test552: string + test553: string + test554: string + test555: string + test556: string + test557: string + test558: string + test559: string + test560: string + test561: string + test562: string + test563: string + test564: string + test565: string + test566: string + test567: string + test568: string + test569: string + test570: string + test571: string + test572: string + test573: string + test574: string + test575: string + test576: string + test577: string + test578: string + test579: string + test580: string + test581: string + test582: string + test583: string + test584: string + test585: string + test586: string + test587: string + test588: string + test589: string + test590: string + test591: string + test592: string + test593: string + test594: string + test595: string + test596: string + test597: string + test598: string + test599: string + test600: string + test601: string + test602: string + test603: string + test604: string + test605: string + test606: string + test607: string + test608: string + test609: string + test610: string + test611: string + test612: string + test613: string + test614: string + test615: string + test616: string + test617: string + test618: string + test619: string + test620: string + test621: string + test622: string + test623: string + test624: string + test625: string + test626: string + test627: string + test628: string + test629: string + test630: string + test631: string + test632: string + test633: string + test634: string + test635: string + test636: string + test637: string + test638: string + test639: string + test640: string + test641: string + test642: string + test643: string + test644: string + test645: string + test646: string + test647: string + test648: string + test649: string + test650: string + test651: string + test652: string + test653: string + test654: string + test655: string + test656: string + test657: string + test658: string + test659: string + test660: string + test661: string + test662: string + test663: string + test664: string + test665: string + test666: string + test667: string + test668: string + test669: string + test670: string + test671: string + test672: string + test673: string + test674: string + test675: string + test676: string + test677: string + test678: string + test679: string + test680: string + test681: string + test682: string + test683: string + test684: string + test685: string + test686: string + test687: string + test688: string + test689: string + test690: string + test691: string + test692: string + test693: string + test694: string + test695: string + test696: string + test697: string + test698: string + test699: string + test700: string + test701: string + test702: string + test703: string + test704: string + test705: string + test706: string + test707: string + test708: string + test709: string + test710: string + test711: string + test712: string + test713: string + test714: string + test715: string + test716: string + test717: string + test718: string + test719: string + test720: string + test721: string + test722: string + test723: string + test724: string + test725: string + test726: string + test727: string + test728: string + test729: string + test730: string + test731: string + test732: string + test733: string + test734: string + test735: string + test736: string + test737: string + test738: string + test739: string + test740: string + test741: string + test742: string + test743: string + test744: string + test745: string + test746: string + test747: string + test748: string + test749: string + test750: string + test751: string + test752: string + test753: string + test754: string + test755: string + test756: string + test757: string + test758: string + test759: string + test760: string + test761: string + test762: string + test763: string + test764: string + test765: string + test766: string + test767: string + test768: string + test769: string + test770: string + test771: string + test772: string + test773: string + test774: string + test775: string + test776: string + test777: string + test778: string + test779: string + test780: string + test781: string + test782: string + test783: string + test784: string + test785: string + test786: string + test787: string + test788: string + test789: string + test790: string + test791: string + test792: string + test793: string + test794: string + test795: string + test796: string + test797: string + test798: string + test799: string + test800: string + test801: string + test802: string + test803: string + test804: string + test805: string + test806: string + test807: string + test808: string + test809: string + test810: string + test811: string + test812: string + test813: string + test814: string + test815: string + test816: string + test817: string + test818: string + test819: string + test820: string + test821: string + test822: string + test823: string + test824: string + test825: string + test826: string + test827: string + test828: string + test829: string + test830: string + test831: string + test832: string + test833: string + test834: string + test835: string + test836: string + test837: string + test838: string + test839: string + test840: string + test841: string + test842: string + test843: string + test844: string + test845: string + test846: string + test847: string + test848: string + test849: string + test850: string + test851: string + test852: string + test853: string + test854: string + test855: string + test856: string + test857: string + test858: string + test859: string + test860: string + test861: string + test862: string + test863: string + test864: string + test865: string + test866: string + test867: string + test868: string + test869: string + test870: string + test871: string + test872: string + test873: string + test874: string + test875: string + test876: string + test877: string + test878: string + test879: string + test880: string + test881: string + test882: string + test883: string + test884: string + test885: string + test886: string + test887: string + test888: string + test889: string + test890: string + test891: string + test892: string + test893: string + test894: string + test895: string + test896: string + test897: string + test898: string + test899: string + test900: string + test901: string + test902: string + test903: string + test904: string + test905: string + test906: string + test907: string + test908: string + test909: string + test910: string + test911: string + test912: string + test913: string + test914: string + test915: string + test916: string + test917: string + test918: string + test919: string + test920: string + test921: string + test922: string + test923: string + test924: string + test925: string + test926: string + test927: string + test928: string + test929: string + test930: string + test931: string + test932: string + test933: string + test934: string + test935: string + test936: string + test937: string + test938: string + test939: string + test940: string + test941: string + test942: string + test943: string + test944: string + test945: string + test946: string + test947: string + test948: string + test949: string + test950: string + test951: string + test952: string + test953: string + test954: string + test955: string + test956: string + test957: string + test958: string + test959: string + test960: string + test961: string + test962: string + test963: string + test964: string + test965: string + test966: string + test967: string + test968: string + test969: string + test970: string + test971: string + test972: string + test973: string + test974: string + test975: string + test976: string + test977: string + test978: string + test979: string + test980: string + test981: string + test982: string + test983: string + test984: string + test985: string + test986: string + test987: string + test988: string + test989: string + test990: string + test991: string + test992: string + test993: string + test994: string + test995: string + test996: string + test997: string + test998: string + test999: string + test1000: string + } + +[] +let main _ = 0 + """ + + [] + let LargeStructRecordDoesNotStackOverflow() = + CompilerAssert.CompileExe + """ +[] +type TestRecord = + { + test1: int + test2: int + test3: int + test4: int + test5: int + test6: int + test7: int + test8: int + test9: int + test10: int + test11: int + test12: int + test13: int + test14: int + test15: int + test16: int + test17: int + test18: int + test19: int + test20: int + test21: int + test22: int + test23: int + test24: int + test25: int + test26: int + test27: int + test28: int + test29: int + test30: int + test31: int + test32: int + test33: int + test34: int + test35: int + test36: int + test37: int + test38: int + test39: int + test40: int + test41: int + test42: int + test43: int + test44: int + test45: int + test46: int + test47: int + test48: int + test49: int + test50: int + test51: int + test52: int + test53: int + test54: int + test55: int + test56: int + test57: int + test58: int + test59: int + test60: int + test61: int + test62: int + test63: int + test64: int + test65: int + test66: int + test67: int + test68: int + test69: int + test70: int + test71: int + test72: int + test73: int + test74: int + test75: int + test76: int + test77: int + test78: int + test79: int + test80: int + test81: int + test82: int + test83: int + test84: int + test85: int + test86: int + test87: int + test88: int + test89: int + test90: int + test91: int + test92: int + test93: int + test94: int + test95: int + test96: int + test97: int + test98: int + test99: int + test100: int + test101: int + test102: int + test103: int + test104: int + test105: int + test106: int + test107: int + test108: int + test109: int + test110: int + test111: int + test112: int + test113: int + test114: int + test115: int + test116: int + test117: int + test118: int + test119: int + test120: int + test121: int + test122: int + test123: int + test124: int + test125: int + test126: int + test127: int + test128: int + test129: int + test130: int + test131: int + test132: int + test133: int + test134: int + test135: int + test136: int + test137: int + test138: int + test139: int + test140: int + test141: int + test142: int + test143: int + test144: int + test145: int + test146: int + test147: int + test148: int + test149: int + test150: int + test151: int + test152: int + test153: int + test154: int + test155: int + test156: int + test157: int + test158: int + test159: int + test160: int + test161: int + test162: int + test163: int + test164: int + test165: int + test166: int + test167: int + test168: int + test169: int + test170: int + test171: int + test172: int + test173: int + test174: int + test175: int + test176: int + test177: int + test178: int + test179: int + test180: int + test181: int + test182: int + test183: int + test184: int + test185: int + test186: int + test187: int + test188: int + test189: int + test190: int + test191: int + test192: int + test193: int + test194: int + test195: int + test196: int + test197: int + test198: int + test199: int + test200: int + test201: int + test202: int + test203: int + test204: int + test205: int + test206: int + test207: int + test208: int + test209: int + test210: int + test211: int + test212: int + test213: int + test214: int + test215: int + test216: int + test217: int + test218: int + test219: int + test220: int + test221: int + test222: int + test223: int + test224: int + test225: int + test226: int + test227: int + test228: int + test229: int + test230: int + test231: int + test232: int + test233: int + test234: int + test235: int + test236: int + test237: int + test238: int + test239: int + test240: int + test241: int + test242: int + test243: int + test244: int + test245: int + test246: int + test247: int + test248: int + test249: int + test250: int + test251: int + test252: int + test253: int + test254: int + test255: int + test256: int + test257: int + test258: int + test259: int + test260: int + test261: int + test262: int + test263: int + test264: int + test265: int + test266: int + test267: int + test268: int + test269: int + test270: int + test271: int + test272: int + test273: int + test274: int + test275: int + test276: int + test277: int + test278: int + test279: int + test280: int + test281: int + test282: int + test283: int + test284: int + test285: int + test286: int + test287: int + test288: int + test289: int + test290: int + test291: int + test292: int + test293: int + test294: int + test295: int + test296: int + test297: int + test298: int + test299: int + test300: int + test301: int + test302: int + test303: int + test304: int + test305: int + test306: int + test307: int + test308: int + test309: int + test310: int + test311: int + test312: int + test313: int + test314: int + test315: int + test316: int + test317: int + test318: int + test319: int + test320: int + test321: int + test322: int + test323: int + test324: int + test325: int + test326: int + test327: int + test328: int + test329: int + test330: int + test331: int + test332: int + test333: int + test334: int + test335: int + test336: int + test337: int + test338: int + test339: int + test340: int + test341: int + test342: int + test343: int + test344: int + test345: int + test346: int + test347: int + test348: int + test349: int + test350: int + test351: int + test352: int + test353: int + test354: int + test355: int + test356: int + test357: int + test358: int + test359: int + test360: int + test361: int + test362: int + test363: int + test364: int + test365: int + test366: int + test367: int + test368: int + test369: int + test370: int + test371: int + test372: int + test373: int + test374: int + test375: int + test376: int + test377: int + test378: int + test379: int + test380: int + test381: int + test382: int + test383: int + test384: int + test385: int + test386: int + test387: int + test388: int + test389: int + test390: int + test391: int + test392: int + test393: int + test394: int + test395: int + test396: int + test397: int + test398: int + test399: int + test400: int + test401: int + test402: int + test403: int + test404: int + test405: int + test406: int + test407: int + test408: int + test409: int + test410: int + test411: int + test412: int + test413: int + test414: int + test415: int + test416: int + test417: int + test418: int + test419: int + test420: int + test421: int + test422: int + test423: int + test424: int + test425: int + test426: int + test427: int + test428: int + test429: int + test430: int + test431: int + test432: int + test433: int + test434: int + test435: int + test436: int + test437: int + test438: int + test439: int + test440: int + test441: int + test442: int + test443: int + test444: int + test445: int + test446: int + test447: int + test448: int + test449: int + test450: int + test451: int + test452: int + test453: int + test454: int + test455: int + test456: int + test457: int + test458: int + test459: int + test460: int + test461: int + test462: int + test463: int + test464: int + test465: int + test466: int + test467: int + test468: int + test469: int + test470: int + test471: int + test472: int + test473: int + test474: int + test475: int + test476: int + test477: int + test478: int + test479: int + test480: int + test481: int + test482: int + test483: int + test484: int + test485: int + test486: int + test487: int + test488: int + test489: int + test490: int + test491: int + test492: int + test493: int + test494: int + test495: int + test496: int + test497: int + test498: int + test499: int + test500: int + test501: int + test502: int + test503: int + test504: int + test505: int + test506: int + test507: int + test508: int + test509: int + test510: int + test511: int + test512: int + test513: int + test514: int + test515: int + test516: int + test517: int + test518: int + test519: int + test520: int + test521: int + test522: int + test523: int + test524: int + test525: int + test526: int + test527: int + test528: int + test529: int + test530: int + test531: int + test532: int + test533: int + test534: int + test535: int + test536: int + test537: int + test538: int + test539: int + test540: int + test541: int + test542: int + test543: int + test544: int + test545: int + test546: int + test547: int + test548: int + test549: int + test550: int + test551: int + test552: int + test553: int + test554: int + test555: int + test556: int + test557: int + test558: int + test559: int + test560: int + test561: int + test562: int + test563: int + test564: int + test565: int + test566: int + test567: int + test568: int + test569: int + test570: int + test571: int + test572: int + test573: int + test574: int + test575: int + test576: int + test577: int + test578: int + test579: int + test580: int + test581: int + test582: int + test583: int + test584: int + test585: int + test586: int + test587: int + test588: int + test589: int + test590: int + test591: int + test592: int + test593: int + test594: int + test595: int + test596: int + test597: int + test598: int + test599: int + test600: int + test601: int + test602: int + test603: int + test604: int + test605: int + test606: int + test607: int + test608: int + test609: int + test610: int + test611: int + test612: int + test613: int + test614: int + test615: int + test616: int + test617: int + test618: int + test619: int + test620: int + test621: int + test622: int + test623: int + test624: int + test625: int + test626: int + test627: int + test628: int + test629: int + test630: int + test631: int + test632: int + test633: int + test634: int + test635: int + test636: int + test637: int + test638: int + test639: int + test640: int + test641: int + test642: int + test643: int + test644: int + test645: int + test646: int + test647: int + test648: int + test649: int + test650: int + test651: int + test652: int + test653: int + test654: int + test655: int + test656: int + test657: int + test658: int + test659: int + test660: int + test661: int + test662: int + test663: int + test664: int + test665: int + test666: int + test667: int + test668: int + test669: int + test670: int + test671: int + test672: int + test673: int + test674: int + test675: int + test676: int + test677: int + test678: int + test679: int + test680: int + test681: int + test682: int + test683: int + test684: int + test685: int + test686: int + test687: int + test688: int + test689: int + test690: int + test691: int + test692: int + test693: int + test694: int + test695: int + test696: int + test697: int + test698: int + test699: int + test700: int + test701: int + test702: int + test703: int + test704: int + test705: int + test706: int + test707: int + test708: int + test709: int + test710: int + test711: int + test712: int + test713: int + test714: int + test715: int + test716: int + test717: int + test718: int + test719: int + test720: int + test721: int + test722: int + test723: int + test724: int + test725: int + test726: int + test727: int + test728: int + test729: int + test730: int + test731: int + test732: int + test733: int + test734: int + test735: int + test736: int + test737: int + test738: int + test739: int + test740: int + test741: int + test742: int + test743: int + test744: int + test745: int + test746: int + test747: int + test748: int + test749: int + test750: int + test751: int + test752: int + test753: int + test754: int + test755: int + test756: int + test757: int + test758: int + test759: int + test760: int + test761: int + test762: int + test763: int + test764: int + test765: int + test766: int + test767: int + test768: int + test769: int + test770: int + test771: int + test772: int + test773: int + test774: int + test775: int + test776: int + test777: int + test778: int + test779: int + test780: int + test781: int + test782: int + test783: int + test784: int + test785: int + test786: int + test787: int + test788: int + test789: int + test790: int + test791: int + test792: int + test793: int + test794: int + test795: int + test796: int + test797: int + test798: int + test799: int + test800: int + test801: int + test802: int + test803: int + test804: int + test805: int + test806: int + test807: int + test808: int + test809: int + test810: int + test811: int + test812: int + test813: int + test814: int + test815: int + test816: int + test817: int + test818: int + test819: int + test820: int + test821: int + test822: int + test823: int + test824: int + test825: int + test826: int + test827: int + test828: int + test829: int + test830: int + test831: int + test832: int + test833: int + test834: int + test835: int + test836: int + test837: int + test838: int + test839: int + test840: int + test841: int + test842: int + test843: int + test844: int + test845: int + test846: int + test847: int + test848: int + test849: int + test850: int + test851: int + test852: int + test853: int + test854: int + test855: int + test856: int + test857: int + test858: int + test859: int + test860: int + test861: int + test862: int + test863: int + test864: int + test865: int + test866: int + test867: int + test868: int + test869: int + test870: int + test871: int + test872: int + test873: int + test874: int + test875: int + test876: int + test877: int + test878: int + test879: int + test880: int + test881: int + test882: int + test883: int + test884: int + test885: int + test886: int + test887: int + test888: int + test889: int + test890: int + test891: int + test892: int + test893: int + test894: int + test895: int + test896: int + test897: int + test898: int + test899: int + test900: int + test901: int + test902: int + test903: int + test904: int + test905: int + test906: int + test907: int + test908: int + test909: int + test910: int + test911: int + test912: int + test913: int + test914: int + test915: int + test916: int + test917: int + test918: int + test919: int + test920: int + test921: int + test922: int + test923: int + test924: int + test925: int + test926: int + test927: int + test928: int + test929: int + test930: int + test931: int + test932: int + test933: int + test934: int + test935: int + test936: int + test937: int + test938: int + test939: int + test940: int + test941: int + test942: int + test943: int + test944: int + test945: int + test946: int + test947: int + test948: int + test949: int + test950: int + test951: int + test952: int + test953: int + test954: int + test955: int + test956: int + test957: int + test958: int + test959: int + test960: int + test961: int + test962: int + test963: int + test964: int + test965: int + test966: int + test967: int + test968: int + test969: int + test970: int + test971: int + test972: int + test973: int + test974: int + test975: int + test976: int + test977: int + test978: int + test979: int + test980: int + test981: int + test982: int + test983: int + test984: int + test985: int + test986: int + test987: int + test988: int + test989: int + test990: int + test991: int + test992: int + test993: int + test994: int + test995: int + test996: int + test997: int + test998: int + test999: int + test1000: int + } + [] let main _ = 0 """ diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 66d44a523a3..563358e1a1f 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -36,6 +36,7 @@ + @@ -65,7 +66,6 @@ - @@ -82,7 +82,7 @@ - + diff --git a/tests/fsharp/core/span/test3.bsl b/tests/fsharp/core/span/test3.bsl index cb284695276..1e6859edcc6 100644 --- a/tests/fsharp/core/span/test3.bsl +++ b/tests/fsharp/core/span/test3.bsl @@ -10,5 +10,5 @@ test3.fsx(47,21,47,27): typecheck error FS0027: This value is not mutable. Consi test3.fsx(46,26,46,27): typecheck error FS0193: Type constraint mismatch. The type 'Span' is not compatible with type - 'seq<'a>' + 'seq' diff --git a/tests/fsharp/core/state-machines/avalue.fs b/tests/fsharp/core/state-machines/avalue.fs index b7292a7dd37..29a67e85411 100644 --- a/tests/fsharp/core/state-machines/avalue.fs +++ b/tests/fsharp/core/state-machines/avalue.fs @@ -2,175 +2,125 @@ module Tests.Value2 #nowarn "42" -open System -open System.Collections -open System.Collections.Generic open System.Runtime.CompilerServices -open FSharp.Core.CompilerServices open FSharp.Core.CompilerServices.StateMachineHelpers -type IValuator<'T> = - inherit IDisposable - abstract MoveNext : unit -> bool - abstract Current : 'T - -type IValuable<'T> = - abstract GetValuator: unit -> IValuator<'T> - [] -type ValueStateMachine<'T>() = - let disposalStack = ResizeArray<(unit -> unit)>() - - /// Proceed to the next state or raise an exception. Returns true if completed +type StateMachine<'T>() = abstract Step : unit -> bool - member val Current : 'T voption = ValueNone with get, set - - member val ResumptionPoint: int = 0 with get, set - - interface IDisposable with - member __.Dispose() = - let mutable exn = None - for d in Seq.rev disposalStack do - try - d() - with e -> - exn <- Some e // keep the last exception - TODO - check this - match exn with - | None -> () - | Some e -> raise e - - member __.PushDispose (f: unit -> unit) = disposalStack.Add(f) - - member __.PopDispose () = disposalStack.RemoveAt(disposalStack.Count - 1) - [] - member sm.Start() = (sm :> IValuable<'T>) + member sm.Start() : StateMachine<'T> = Unchecked.defaultof<_> - interface IValuable<'T> with - member this.GetValuator() = - (this :> IValuator<'T>) - - interface IValuator<'T> with - member sm.Current = match sm.Current with ValueNone -> failwith "no value available yet" | ValueSome x -> x - member sm.MoveNext() = sm.Step() - - -type ValueCode<'T> = ValueStateMachine<'T> -> bool +type ValueCode = unit -> bool type ValueBuilder() = - [] - member inline __.Delay(__expand_f : unit -> ValueCode<'T>) : ValueCode<'T> = (fun sm -> __expand_f () sm) - - [] - member inline __.Run(__expand_code : ValueCode<'T>) : IValuable<'T> = + member inline __.Run() : StateMachine<'T> = if __useResumableCode then (__resumableObject - { new ValueStateMachine<'T>() with + { new StateMachine<'T>() with member sm.Step () = - __resumeAt sm.ResumptionPoint - __expand_code sm }).Start() + //__resumeAt sm.ResumptionPoint + true }).Start() else - failwith "no dynamic implementation" - - [] - member inline __.Zero() : ValueCode<'T> = - (fun _sm -> true) - - [] - member inline __.Combine(__expand_task1: ValueCode<'T>, __expand_task2: ValueCode<'T>) : ValueCode<'T> = - (fun sm -> - if __useResumableCode then - let ``__machine_step$cont`` = __expand_task1 sm - if ``__machine_step$cont`` then - __expand_task2 sm - else - false - else - failwith "no dynamic implementation") - - [] - member inline __.While(__expand_condition : unit -> bool, __expand_body : ValueCode<'T>) : ValueCode<'T> = - (fun sm -> - if __useResumableCode then - let mutable __stack_completed = false - while __stack_completed && __expand_condition() do - // NOTE: The body of the 'while' may contain await points, resuming may branch directly into the while loop - let ``__machine_step$cont`` = __expand_body sm - // If we make it to the assignment we prove we've made a step - __stack_completed <- ``__machine_step$cont`` - __stack_completed - else - failwith "no dynamic implementation") - - [] - member inline __.TryWith(__expand_body : ValueCode<'T>, __expand_catch : exn -> ValueCode<'T>) : ValueCode<'T> = - (fun sm -> - if __useResumableCode then - let mutable __stack_completed = false - let mutable __stack_caught = false - let mutable __stack_savedExn = Unchecked.defaultof<_> - try - // The try block may contain await points. - let ``__machine_step$cont`` = __expand_body sm - // If we make it to the assignment we prove we've made a step - __stack_completed <- ``__machine_step$cont`` - with exn -> - __stack_caught <- true - __stack_savedExn <- exn - - if __stack_caught then - // Place the catch code outside the catch block - __expand_catch __stack_savedExn sm - else - __stack_completed - else - failwith "no dynamic implementation") - - [] - member inline __.TryFinally(__expand_body: ValueCode<'T>, compensation : unit -> unit) : ValueCode<'T> = - (fun sm -> - if __useResumableCode then - let mutable completed = false - sm.PushDispose compensation - try - let ``__machine_step$cont`` = __expand_body sm - // If we make it to the assignment we prove we've made a step without an exception - completed <- ``__machine_step$cont`` - with _ -> - sm.PopDispose() - compensation() - reraise() - - if completed then - sm.PopDispose() - compensation() - completed - else - failwith "no dynamic implementation") - - [] - member inline this.Using(disp : #IDisposable, __expand_body : #IDisposable -> ValueCode<'T>) = - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinally( - (fun sm -> __expand_body disp sm), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - [] - member inline __.Return (v: 'T) : ValueCode<'T> = + let sm = + { new StateMachine<'T>() with + member sm.Step () = + true } + sm.Start() + + // member inline __.Zero() : ValueCode<'T> = + // (fun _sm -> true) + + // member inline __.Combine(__expand_task1: ValueCode<'T>, __expand_task2: ValueCode<'T>) : ValueCode<'T> = + // (fun sm -> + // if __useResumableCode then + // let ``__machine_step$cont`` = __expand_task1 sm + // if ``__machine_step$cont`` then + // __expand_task2 sm + // else + // false + // else + // failwith "no dynamic implementation") + + // member inline __.While(__expand_condition : unit -> bool, __expand_body : ValueCode<'T>) : ValueCode<'T> = + // (fun sm -> + // if __useResumableCode then + // let mutable __stack_completed = false + // while __stack_completed && __expand_condition() do + // // NOTE: The body of the 'while' may contain await points, resuming may branch directly into the while loop + // let ``__machine_step$cont`` = __expand_body sm + // // If we make it to the assignment we prove we've made a step + // __stack_completed <- ``__machine_step$cont`` + // __stack_completed + // else + // failwith "no dynamic implementation") + + // member inline __.TryWith(__expand_body : ValueCode<'T>, __expand_catch : exn -> ValueCode<'T>) : ValueCode<'T> = + // (fun sm -> + // if __useResumableCode then + // let mutable __stack_completed = false + // let mutable __stack_caught = false + // let mutable __stack_savedExn = Unchecked.defaultof<_> + // try + // // The try block may contain await points. + // let ``__machine_step$cont`` = __expand_body sm + // // If we make it to the assignment we prove we've made a step + // __stack_completed <- ``__machine_step$cont`` + // with exn -> + // __stack_caught <- true + // __stack_savedExn <- exn + + // if __stack_caught then + // // Place the catch code outside the catch block + // __expand_catch __stack_savedExn sm + // else + // __stack_completed + // else + // failwith "no dynamic implementation") + + // member inline __.TryFinally(__expand_body: ValueCode<'T>, compensation : unit -> unit) : ValueCode<'T> = + // (fun sm -> + // if __useResumableCode then + // let mutable completed = false + // sm.PushDispose compensation + // try + // let ``__machine_step$cont`` = __expand_body sm + // // If we make it to the assignment we prove we've made a step without an exception + // completed <- ``__machine_step$cont`` + // with _ -> + // sm.PopDispose() + // compensation() + // reraise() + + // if completed then + // sm.PopDispose() + // compensation() + // completed + // else + // failwith "no dynamic implementation") + + // member inline this.Using(disp : #IDisposable, __expand_body : #IDisposable -> ValueCode<'T>) = + // // A using statement is just a try/finally with the finally block disposing if non-null. + // this.TryFinally( + // (fun sm -> __expand_body disp sm), + // (fun () -> if not (isNull (box disp)) then disp.Dispose())) + + member inline __.Return (v: 'T) : ValueCode = (fun sm -> - if __useResumableCode then - match __resumableEntry() with - | Some contID -> - sm.ResumptionPoint <- contID - sm.Current <- ValueSome v - false - | None -> - sm.Current <- ValueNone + //if __useResumableCode then + // match __resumableEntry() with + // | Some contID -> + // sm.ResumptionPoint <- contID + // sm.Current <- ValueSome v + // false + // | None -> + // sm.Current <- ValueNone true - else - failwith "no dynamic implementation") + //else + // failwith "no dynamic implementation" + ) //[] //member inline this.ReturnFrom (source: IValuable<'T>) : ValueCode<'T> = @@ -181,13 +131,7 @@ let value = ValueBuilder() module Examples = let t1 () = - value { - printfn "in t1" - return "a" - let x = 1 - return "b" - return "c" - } + value.Run() (* let t2 () = @@ -202,9 +146,9 @@ module Examples = } *) - let dumpSeq (t: IValuable<_>) = - let e = t.GetValuator() - while e.MoveNext() do - printfn "return %A" e.Current - dumpSeq (t1()) + //let dumpSeq (t: IValuable<_>) = + // let e = t.GetValuator() + // while e.MoveNext() do + // printfn "return %A" e.Current + //dumpSeq (t1()) //dumpSeq (t2()) diff --git a/tests/fsharp/core/state-machines/sync.fs b/tests/fsharp/core/state-machines/sync.fs index a3b2495de37..f13cbda8a08 100644 --- a/tests/fsharp/core/state-machines/sync.fs +++ b/tests/fsharp/core/state-machines/sync.fs @@ -2,6 +2,7 @@ module Tests.SyncBuilder open System +open System.Runtime.CompilerServices open FSharp.Core.CompilerServices.StateMachineHelpers [] @@ -9,83 +10,74 @@ type SyncMachine<'T>() = abstract Step : unit -> 'T + [] member this.Start() = this.Step() type SyncCode<'T> = unit -> 'T type SyncBuilder() = - [] - member inline __.Delay(__expand_f: unit -> SyncCode<'T>) : SyncCode<'T> = (fun () -> __expand_f () ()) + //member inline __.Delay(__expand_f: unit -> SyncCode<'T>) : SyncCode<'T> = (fun () -> __expand_f () ()) - [] member inline __.Run(__expand_code : SyncCode<'T>) : 'T = if __useResumableCode then (__resumableObject { new SyncMachine<'T>() with member __.Step () = __expand_code () }).Start() else - let sm = - { new SyncMachine<'T>() with - member sm.Step () = - __expand_code () } - sm.Start() + failwith "" + // let sm = + // { new SyncMachine<'T>() with + // member sm.Step () = + // __expand_code () } + // sm.Start() - [] - member inline __.Zero() : SyncCode = - (fun () -> ()) + // member inline __.Zero() : SyncCode = + // (fun () -> ()) - [] member inline __.Return (x: 'T) : SyncCode<'T> = (fun () -> x) - [] - member inline __.Combine(__expand_code1: SyncCode, __expand_code2: SyncCode<'T>) : SyncCode<'T> = - (fun () -> - __expand_code1() - __expand_code2()) - - [] - member inline __.While(__expand_condition : unit -> bool, __expand_body : SyncCode) : SyncCode = - (fun () -> - while __expand_condition() do - __expand_body ()) - - [] - member inline __.TryWith(__expand_body : SyncCode<'T>, __expand_catch : exn -> 'T) : SyncCode<'T> = - (fun () -> - try - __expand_body () - with exn -> - __expand_catch exn) - - [] - member inline __.TryFinally(__expand_body: SyncCode<'T>, compensation : unit -> unit) : SyncCode<'T> = - (fun () -> - let ``__machine_step$cont`` = - try - __expand_body () - with _ -> - compensation() - reraise() - compensation() - ``__machine_step$cont``) - - [] - member inline this.Using(disp : #IDisposable, __expand_body : #IDisposable -> SyncCode<'T>) : SyncCode<'T> = - this.TryFinally( - (fun () -> __expand_body disp ()), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - [] - member inline this.For(sequence : seq<'T>, __expand_body : 'T -> SyncCode) : SyncCode = - this.Using (sequence.GetEnumerator(), - (fun e -> this.While((fun () -> e.MoveNext()), (fun () -> __expand_body e.Current ())))) - - [] - member inline __.ReturnFrom (value: 'T) : SyncCode<'T> = - (fun () -> - value) + // member inline __.Combine(__expand_code1: SyncCode, __expand_code2: SyncCode<'T>) : SyncCode<'T> = + // (fun () -> + // __expand_code1() + // __expand_code2()) + + // member inline __.While(__expand_condition : unit -> bool, __expand_body : SyncCode) : SyncCode = + // (fun () -> + // while __expand_condition() do + // __expand_body ()) + + // member inline __.TryWith(__expand_body : SyncCode<'T>, __expand_catch : exn -> 'T) : SyncCode<'T> = + // (fun () -> + // try + // __expand_body () + // with exn -> + // __expand_catch exn) + + // member inline __.TryFinally(__expand_body: SyncCode<'T>, compensation : unit -> unit) : SyncCode<'T> = + // (fun () -> + // let ``__machine_step$cont`` = + // try + // __expand_body () + // with _ -> + // compensation() + // reraise() + // compensation() + // ``__machine_step$cont``) + + // member inline this.Using(disp : #IDisposable, __expand_body : #IDisposable -> SyncCode<'T>) : SyncCode<'T> = + // this.TryFinally( + // (fun () -> __expand_body disp ()), + // (fun () -> if not (isNull (box disp)) then disp.Dispose())) + + // member inline this.For(sequence : seq<'T>, __expand_body : 'T -> SyncCode) : SyncCode = + // this.Using (sequence.GetEnumerator(), + // (fun e -> this.While((fun () -> e.MoveNext()), (fun () -> __expand_body e.Current ())))) + + // member inline __.ReturnFrom (value: 'T) : SyncCode<'T> = + // (fun () -> + // value) (* [] @@ -94,28 +86,27 @@ type SyncBuilder() = let ``__machine_step$cont`` = __expand_code1 () __expand_continuation ``__machine_step$cont`` ()) *) - [] member inline __.Bind (v: 'TResult1, __expand_continuation: 'TResult1 -> SyncCode<'TResult2>) : SyncCode<'TResult2> = (fun () -> __expand_continuation v ()) let sync = SyncBuilder() -module Examples = +// module Examples = - let t1 y = - sync { - printfn "in t1" - let x = 4 + 5 + y - return x - } +// let t1 () = +// sync { +// //printfn "in t1" +// //let x = 4 + 5 + y +// return "" +// } - let t2 y = - sync { - printfn "in t2" - let! x = t1 y - return x + y - } + // let t2 y = + // sync { + // printfn "in t2" + // let! x = t1 y + // return x + y + // } - printfn "t2 6 = %d" (t2 6) + // printfn "t2 6 = %d" (t2 6) diff --git a/tests/fsharp/perf/tasks/FS/TaskPerf.fsproj b/tests/fsharp/perf/tasks/FS/TaskPerf.fsproj index 80c35242576..25c8e6c658c 100644 --- a/tests/fsharp/perf/tasks/FS/TaskPerf.fsproj +++ b/tests/fsharp/perf/tasks/FS/TaskPerf.fsproj @@ -7,12 +7,15 @@ + diff --git a/tests/fsharp/readme.md b/tests/fsharp/readme.md new file mode 100644 index 00000000000..c12bf5a5e44 --- /dev/null +++ b/tests/fsharp/readme.md @@ -0,0 +1,67 @@ +# F# Compiler Cross-Platform Test Suite + +## Layout + +The tests are NUNIT test cases.. They test a very wide range of compiler, interactive and FSharp.Core scenarios. + +The bulk of the test cases are enumerated in tests.fs, these are the old cambridge test suite. They build on a test-suite ported from windows batch files. They run the compiler and fsi as seperate processes, when built for the coreclr it runs the coreclr versions using dotnet.exe + +The framework and utilities can be found in test-framework.fs, single-test.fs, coreclr_utilities.fs. + +test cases look similar to: +```` + [] + let ``array-FSI_BASIC`` () = singleTestBuildAndRun "core/array" FSI_BASIC +```` +This test case builds and runs the test case in the folder core/array + +this #define is used to exclude from the build tests that run will not run correctly on the coreclr +__#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS__ + +There are some older tests in this section that looks similar to: +```` + [] + let events () = + let cfg = testConfig "core/events" + fsc cfg "%s -a -o:test.dll -g" cfg.fsc_flags ["test.fs"] + peverify cfg "test.dll" + csc cfg """/r:"%s" /reference:test.dll /debug+""" cfg.FSCOREDLLPATH ["testcs.cs"] + peverify cfg "testcs.exe" + use testOkFile = fileguard cfg "test.ok" + fsi cfg "" ["test.fs"] + testOkFile.CheckExists() + exec cfg ("." ++ "testcs.exe") "" +```` +These tests build, compile, peverify and run fsi. + +Below the Compiler directory there is a set of tests built on the compiler service. They are nunit and instead of executing the compiler and fsi using files on disk the tests are built from memory. These tests use the CompilerAssert framework and look similar to: + +This test verifies that a warning is produces when a value is implicitly discarded. The line ````x = 20``` looks like an assignment but in F# is a test for equality it yields and discards the value false. +```` + [] + let ``Unused compare with immutable when assignment might be intended``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = "hello" + +let changeX() = + x = 20 + y = "test" + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 11) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'." +```` + + +## Workflow when adding or fixing tests + +When a test is run, .err/.vserr output files are created and compared to their matching .bsl files. + +When many tests fail due to a change being worked on, the [update.base.line.with.actuals.fsx](update.base.line.with.actuals.fsx) script helps updating the .bsl against the actuals. + +After editing the folder list, evaluating the script should replace the .bsl files with actual .err/.vserr, after which the same test is supposed to pass. + +Tests are organized under modules as functions bearing NUnit `[]` attribute and can be run from an IDE or the command line (see the [Test Guide](../../TESTGUIDE.md)). diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index da940132179..89e103775f8 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -2155,6 +2155,12 @@ module TypecheckTests = fsc cfg "%s --target:library -o:pos32.dll --warnaserror" cfg.fsc_flags ["pos32.fs"] peverify cfg "pos32.dll" + [] + let ``sigs pos33`` () = + let cfg = testConfig "typecheck/sigs" + fsc cfg "%s --target:library -o:pos33.dll --warnaserror" cfg.fsc_flags ["pos33.fsi"; "pos33.fs"] + peverify cfg "pos33.dll" + [] let ``sigs pos23`` () = let cfg = testConfig "typecheck/sigs" diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl index 64088e1e9e8..c31220273da 100644 --- a/tests/fsharp/typecheck/sigs/neg10.bsl +++ b/tests/fsharp/typecheck/sigs/neg10.bsl @@ -35,9 +35,9 @@ neg10.fs(54,17,54,20): typecheck error FS0060: Override implementations in augme neg10.fs(66,19,66,21): typecheck error FS0069: Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type. -neg10.fs(77,27,77,34): typecheck error FS0896: Enumerations cannot have members +neg10.fs(77,13,77,34): typecheck error FS0896: Enumerations cannot have members -neg10.fs(84,20,84,29): typecheck error FS0896: Enumerations cannot have members +neg10.fs(84,13,84,29): typecheck error FS0896: Enumerations cannot have members neg10.fs(90,23,90,41): typecheck error FS0907: Enumerations cannot have interface declarations @@ -45,11 +45,11 @@ neg10.fs(99,23,99,29): typecheck error FS0907: Enumerations cannot have interfac neg10.fs(107,10,107,17): typecheck error FS0964: Type abbreviations cannot have augmentations -neg10.fs(109,27,109,34): typecheck error FS0895: Type abbreviations cannot have members +neg10.fs(109,13,109,34): typecheck error FS0895: Type abbreviations cannot have members neg10.fs(114,10,114,17): typecheck error FS0964: Type abbreviations cannot have augmentations -neg10.fs(116,20,116,29): typecheck error FS0895: Type abbreviations cannot have members +neg10.fs(116,13,116,29): typecheck error FS0895: Type abbreviations cannot have members neg10.fs(120,10,120,17): typecheck error FS0964: Type abbreviations cannot have augmentations diff --git a/tests/fsharp/typecheck/sigs/neg62.bsl b/tests/fsharp/typecheck/sigs/neg62.bsl index d2bbd52d880..de4ae9d68ac 100644 --- a/tests/fsharp/typecheck/sigs/neg62.bsl +++ b/tests/fsharp/typecheck/sigs/neg62.bsl @@ -15,15 +15,15 @@ neg62.fs(22,5,22,14): typecheck error FS0960: 'let' and 'do' bindings must come neg62.fs(28,5,28,18): typecheck error FS0960: 'let' and 'do' bindings must come before member and interface definitions in type definitions -neg62.fs(31,19,31,32): typecheck error FS3133: 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. +neg62.fs(31,5,31,32): typecheck error FS3133: 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. -neg62.fs(31,19,31,32): typecheck error FS0902: Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'. +neg62.fs(31,5,31,32): typecheck error FS0902: Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'. -neg62.fs(34,12,34,25): typecheck error FS3133: 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. +neg62.fs(34,5,34,25): typecheck error FS3133: 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. neg62.fs(49,6,49,26): typecheck error FS0081: Implicit object constructors for structs must take at least one argument -neg62.fs(50,12,50,21): typecheck error FS0901: Structs cannot contain value definitions because the default constructor for structs will not execute these bindings. Consider adding additional arguments to the primary constructor for the type. +neg62.fs(50,5,50,21): typecheck error FS0901: Structs cannot contain value definitions because the default constructor for structs will not execute these bindings. Consider adding additional arguments to the primary constructor for the type. neg62.fs(54,26,54,34): typecheck error FS3135: To indicate that this property can be set, use 'member val PropertyName = expr with get,set'. diff --git a/tests/fsharp/typecheck/sigs/neg91.bsl b/tests/fsharp/typecheck/sigs/neg91.bsl index 7021297a7f1..559a4871f92 100644 --- a/tests/fsharp/typecheck/sigs/neg91.bsl +++ b/tests/fsharp/typecheck/sigs/neg91.bsl @@ -1,5 +1,5 @@ -neg91.fs(7,16,7,30): typecheck error FS0896: Enumerations cannot have members +neg91.fs(7,9,7,30): typecheck error FS0896: Enumerations cannot have members neg91.fs(10,10,10,15): typecheck error FS0956: Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope. diff --git a/tests/fsharp/typecheck/sigs/pos33.fs b/tests/fsharp/typecheck/sigs/pos33.fs new file mode 100644 index 00000000000..716dfc54a32 --- /dev/null +++ b/tests/fsharp/typecheck/sigs/pos33.fs @@ -0,0 +1,11 @@ +module Pos33 + +let x = 1 +[] +let y = 1 +let z = 1 +[] +let w = "w" +let q = "q" +[] +let u = "u" \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos33.fsi b/tests/fsharp/typecheck/sigs/pos33.fsi new file mode 100644 index 00000000000..3ba98f32d9d --- /dev/null +++ b/tests/fsharp/typecheck/sigs/pos33.fsi @@ -0,0 +1,12 @@ +module Pos33 + +val x : int +[] +val y : int = 1 +val z : int +[] +val w : string = "w" +val q : string +[] +val u : string = + "u" \ No newline at end of file diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.fs b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.fs deleted file mode 100644 index 4a3f78fcfc0..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.fs +++ /dev/null @@ -1,4 +0,0 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall -// Regression test for DevDiv:72571 -let foo(x:int, y) = printfn "%d" x -let run() = let x = 0 in foo(x,5) diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl deleted file mode 100644 index 028bdaec338..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl +++ /dev/null @@ -1,111 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. - .ver 4:0:0:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 -} -.assembly TailCall01 -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.TailCall01 -{ - // Offset: 0x00000000 Length: 0x0000021D -} -.mresource public FSharpOptimizationData.TailCall01 -{ - // Offset: 0x00000228 Length: 0x0000007C -} -.module TailCall01.exe -// MVID: {59B19213-7D8F-CF4A-A745-03831392B159} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x02E90000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public abstract auto ansi sealed TailCall01 - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public static void foo(int32 x, - !!a y) cil managed - { - // Code size 27 (0x1b) - .maxstack 4 - .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, - [1] int32 V_1) - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 3,3 : 21,33 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall01.fs' - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: stloc.0 - IL_0010: ldarg.0 - IL_0011: stloc.1 - IL_0012: ldloc.0 - IL_0013: ldloc.1 - IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0019: pop - IL_001a: ret - } // end of method TailCall01::foo - - .method public static void run() cil managed - { - // Code size 12 (0xc) - .maxstack 4 - .locals init ([0] int32 x) - .line 4,4 : 13,22 '' - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - .line 4,4 : 26,34 '' - IL_0002: ldloc.0 - IL_0003: ldc.i4.5 - IL_0004: tail. - IL_0006: call void TailCall01::foo(int32, - !!0) - IL_000b: ret - } // end of method TailCall01::run - -} // end of class TailCall01 - -.class private abstract auto ansi sealed ''.$TailCall01 - extends [mscorlib]System.Object -{ - .method public static void main@() cil managed - { - .entrypoint - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method $TailCall01::main@ - -} // end of class ''.$TailCall01 - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.fs b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.fs deleted file mode 100644 index 362e37f7716..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.fs +++ /dev/null @@ -1,5 +0,0 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall -// Regression test for DevDiv:72571 -let foo(x:int byref) = x -let run() = let mutable x = 0 in foo(&x) - diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl deleted file mode 100644 index 8a7cd2907e0..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl +++ /dev/null @@ -1,97 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. - .ver 4:0:0:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 -} -.assembly TailCall02 -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.TailCall02 -{ - // Offset: 0x00000000 Length: 0x00000202 -} -.mresource public FSharpOptimizationData.TailCall02 -{ - // Offset: 0x00000208 Length: 0x0000007C -} -.module TailCall02.exe -// MVID: {59B19213-7D8F-CE9D-A745-03831392B159} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x00E20000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public abstract auto ansi sealed TailCall02 - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public static int32 foo(int32& x) cil managed - { - // Code size 7 (0x7) - .maxstack 8 - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 3,3 : 24,25 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall02.fs' - IL_0000: ldarg.0 - IL_0001: ldobj [mscorlib]System.Int32 - IL_0006: ret - } // end of method TailCall02::foo - - .method public static int32 run() cil managed - { - // Code size 10 (0xa) - .maxstack 3 - .locals init ([0] int32 x) - .line 4,4 : 13,30 '' - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - .line 4,4 : 34,41 '' - IL_0002: ldloca.s x - IL_0004: call int32 TailCall02::foo(int32&) - IL_0009: ret - } // end of method TailCall02::run - -} // end of class TailCall02 - -.class private abstract auto ansi sealed ''.$TailCall02 - extends [mscorlib]System.Object -{ - .method public static void main@() cil managed - { - .entrypoint - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method $TailCall02::main@ - -} // end of class ''.$TailCall02 - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.fs b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.fs deleted file mode 100644 index 8311ca7af25..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.fs +++ /dev/null @@ -1,4 +0,0 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall -// Regression test for DevDiv:72571 -let foo (x:int byref) (y:int byref) z = printfn "%d" (x+y) -let run() = let mutable x = 0 in foo &x &x 5 diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl deleted file mode 100644 index 0b27a3419b2..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl +++ /dev/null @@ -1,120 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. - .ver 4:0:0:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 -} -.assembly TailCall03 -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.TailCall03 -{ - // Offset: 0x00000000 Length: 0x00000241 -} -.mresource public FSharpOptimizationData.TailCall03 -{ - // Offset: 0x00000248 Length: 0x0000007C -} -.module TailCall03.exe -// MVID: {59B19213-7D8F-CE88-A745-03831392B159} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x00E50000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public abstract auto ansi sealed TailCall03 - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public static void foo(int32& x, - int32& y, - !!a z) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 - 00 00 00 00 ) - // Code size 39 (0x27) - .maxstack 4 - .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, - [1] int32 V_1) - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 3,3 : 41,53 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall03.fs' - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: stloc.0 - IL_0010: ldarg.0 - IL_0011: ldobj [mscorlib]System.Int32 - IL_0016: ldarg.1 - IL_0017: ldobj [mscorlib]System.Int32 - IL_001c: add - IL_001d: stloc.1 - IL_001e: ldloc.0 - IL_001f: ldloc.1 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: pop - IL_0026: ret - } // end of method TailCall03::foo - - .method public static void run() cil managed - { - // Code size 14 (0xe) - .maxstack 5 - .locals init ([0] int32 x) - .line 4,4 : 13,30 '' - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - .line 4,4 : 34,45 '' - IL_0002: ldloca.s x - IL_0004: ldloca.s x - IL_0006: ldc.i4.5 - IL_0007: call void TailCall03::foo(int32&, - int32&, - !!0) - IL_000c: nop - IL_000d: ret - } // end of method TailCall03::run - -} // end of class TailCall03 - -.class private abstract auto ansi sealed ''.$TailCall03 - extends [mscorlib]System.Object -{ - .method public static void main@() cil managed - { - .entrypoint - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method $TailCall03::main@ - -} // end of class ''.$TailCall03 - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.fs b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.fs deleted file mode 100644 index 0872b95f9c7..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.fs +++ /dev/null @@ -1,5 +0,0 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall -// Regression test for DevDiv:72571 -let foo(x:int byref, y) = printfn "%d" x -let run() = let mutable x = 0 in foo(&x,5) - diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl deleted file mode 100644 index 309f764e782..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl +++ /dev/null @@ -1,112 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. - .ver 4:0:0:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 -} -.assembly TailCall04 -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.TailCall04 -{ - // Offset: 0x00000000 Length: 0x0000022F -} -.mresource public FSharpOptimizationData.TailCall04 -{ - // Offset: 0x00000238 Length: 0x0000007C -} -.module TailCall04.exe -// MVID: {59B19213-7D8F-CFE3-A745-03831392B159} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x00B70000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public abstract auto ansi sealed TailCall04 - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public static void foo(int32& x, - !!a y) cil managed - { - // Code size 32 (0x20) - .maxstack 4 - .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, - [1] int32 V_1) - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 3,3 : 27,39 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall04.fs' - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: stloc.0 - IL_0010: ldarg.0 - IL_0011: ldobj [mscorlib]System.Int32 - IL_0016: stloc.1 - IL_0017: ldloc.0 - IL_0018: ldloc.1 - IL_0019: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001e: pop - IL_001f: ret - } // end of method TailCall04::foo - - .method public static void run() cil managed - { - // Code size 12 (0xc) - .maxstack 4 - .locals init ([0] int32 x) - .line 4,4 : 13,30 '' - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - .line 4,4 : 34,43 '' - IL_0002: ldloca.s x - IL_0004: ldc.i4.5 - IL_0005: call void TailCall04::foo(int32&, - !!0) - IL_000a: nop - IL_000b: ret - } // end of method TailCall04::run - -} // end of class TailCall04 - -.class private abstract auto ansi sealed ''.$TailCall04 - extends [mscorlib]System.Object -{ - .method public static void main@() cil managed - { - .entrypoint - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method $TailCall04::main@ - -} // end of class ''.$TailCall04 - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.fs b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.fs deleted file mode 100644 index 2796d18d97c..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.fs +++ /dev/null @@ -1,4 +0,0 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall -// Regression test for DevDiv:72571 -let foo(x:int byref, y:int byref, z) = printfn "%d" (x+y) -let run() = let mutable x = 0 in foo(&x,&x,5) diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl deleted file mode 100644 index 5ae3bd0b331..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl +++ /dev/null @@ -1,118 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. - .ver 4:0:0:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 -} -.assembly TailCall05 -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.TailCall05 -{ - // Offset: 0x00000000 Length: 0x0000023F -} -.mresource public FSharpOptimizationData.TailCall05 -{ - // Offset: 0x00000248 Length: 0x0000007C -} -.module TailCall05.exe -// MVID: {59B19213-7D8F-CFC6-A745-03831392B159} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x03210000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public abstract auto ansi sealed TailCall05 - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public static void foo(int32& x, - int32& y, - !!a z) cil managed - { - // Code size 39 (0x27) - .maxstack 4 - .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0, - [1] int32 V_1) - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 3,3 : 40,52 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall05.fs' - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: stloc.0 - IL_0010: ldarg.0 - IL_0011: ldobj [mscorlib]System.Int32 - IL_0016: ldarg.1 - IL_0017: ldobj [mscorlib]System.Int32 - IL_001c: add - IL_001d: stloc.1 - IL_001e: ldloc.0 - IL_001f: ldloc.1 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: pop - IL_0026: ret - } // end of method TailCall05::foo - - .method public static void run() cil managed - { - // Code size 14 (0xe) - .maxstack 5 - .locals init ([0] int32 x) - .line 4,4 : 13,30 '' - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - .line 4,4 : 34,46 '' - IL_0002: ldloca.s x - IL_0004: ldloca.s x - IL_0006: ldc.i4.5 - IL_0007: call void TailCall05::foo(int32&, - int32&, - !!0) - IL_000c: nop - IL_000d: ret - } // end of method TailCall05::run - -} // end of class TailCall05 - -.class private abstract auto ansi sealed ''.$TailCall05 - extends [mscorlib]System.Object -{ - .method public static void main@() cil managed - { - .entrypoint - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method $TailCall05::main@ - -} // end of class ''.$TailCall05 - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/env.lst b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/env.lst deleted file mode 100644 index 0c87dd2fbb3..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/env.lst +++ /dev/null @@ -1,5 +0,0 @@ - SOURCE=TailCall01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall01.exe" # TailCall01.fs - - SOURCE=TailCall02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall02.exe" # TailCall02.fs - - SOURCE=TailCall03.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall03.exe" # TailCall03.fs - - SOURCE=TailCall04.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall04.exe" # TailCall04.fs - - SOURCE=TailCall05.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall05.exe" # TailCall05.fs - diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/keep.lst b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/keep.lst deleted file mode 100644 index f59ec20aabf..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/keep.lst +++ /dev/null @@ -1 +0,0 @@ -* \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion-culture.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion-culture.fsx new file mode 100644 index 00000000000..d1e6d620d70 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion-culture.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4,7' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion-decimal.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion-decimal.fsx new file mode 100644 index 00000000000..d92c376bc39 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion-decimal.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4.70000000000' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst index bba306f616a..6ecc5030f21 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst @@ -2,3 +2,5 @@ ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 +ReqENU SOURCE=badlangversion-culture.fsx SCFLAGS=" --langversion:4,7" # --langversion:4,7 +ReqENU SOURCE=badlangversion-decimal.fsx SCFLAGS=" --langversion:4.70000000000" # --langversion:4.70000000000 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion-culture.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion-culture.fsx new file mode 100644 index 00000000000..d1e6d620d70 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion-culture.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4,7' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion-decimal.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion-decimal.fsx new file mode 100644 index 00000000000..d92c376bc39 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion-decimal.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4.70000000000' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst index fa31a7b0e41..ebaceafa745 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst @@ -2,3 +2,6 @@ ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE --langversion:? >langversionhelp.txt 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 +ReqENU SOURCE=badlangversion-culture.fsx SCFLAGS=" --langversion:4,7" # --langversion:4,7 +ReqENU SOURCE=badlangversion-decimal.fsx SCFLAGS=" --langversion:4.70000000000" # --langversion:4.70000000000 + diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs index 4458338c770..b4e05661698 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #ObjectOrientedTypes #Enums -//Enumerations cannot have members$ +//Enumerations cannot have members$ //The type 'Season' does not support the operator 'get_One'$ type Season = Spring=0 | Summer=1 | Autumn=2 | Winter=3 diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbrev.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbrev.fs index beeac13d7e4..2883306a70a 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbrev.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbrev.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Verify you can't add type extensions to a type abbreviation //Type abbreviations cannot have augmentations$ -//Type abbreviations cannot have members$ +//Type abbreviations cannot have members$ type string with member this.ReturnFive() = 5 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs index e80950ee9e4..4ff94cf8683 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs +++ b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs @@ -2,7 +2,7 @@ // Test error when adding instance methods to Measure types. -//Measure declarations may have only static members$ +//Measure declarations may have only static members$ [] type kg = diff --git a/tests/fsharpqa/run.fsharpqa.test.fsx b/tests/fsharpqa/run.fsharpqa.test.fsx index a29a242625b..18a2e118b81 100644 --- a/tests/fsharpqa/run.fsharpqa.test.fsx +++ b/tests/fsharpqa/run.fsharpqa.test.fsx @@ -36,7 +36,7 @@ let runPerl arguments = use perlProcess = ProcessStartInfo( - FileName = Path.Combine(nugetCache, "StrawberryPerl64", "5.22.2.1", "Tools", "perl", "bin", "perl.exe"), + FileName = Path.Combine(nugetCache, "StrawberryPerl", "5.28.0.1", "bin", "perl.exe"), Arguments = (arguments |> Array.map(fun a -> @"""" + a + @"""") |> String.concat " "), WorkingDirectory = Path.Combine(rootFolder, "tests", "fsharpqa", "source"), RedirectStandardOutput = true, diff --git a/tests/service/AssemblyReaderShim.fs b/tests/service/AssemblyReaderShim.fs index 329fce81989..71ad67809db 100644 --- a/tests/service/AssemblyReaderShim.fs +++ b/tests/service/AssemblyReaderShim.fs @@ -7,7 +7,6 @@ module FSharp.Compiler.Service.Tests.AssemblyReaderShim #endif -open FSharp.Compiler.Service.Tests.Common open FsUnit open FSharp.Compiler.AbstractIL.ILBinaryReader open NUnit.Framework diff --git a/tests/service/CSharpProjectAnalysis.fs b/tests/service/CSharpProjectAnalysis.fs index bac536c294b..8f787e90e5a 100644 --- a/tests/service/CSharpProjectAnalysis.fs +++ b/tests/service/CSharpProjectAnalysis.fs @@ -12,14 +12,8 @@ module FSharp.Compiler.Service.Tests.CSharpProjectAnalysis open NUnit.Framework open FsUnit -open System open System.IO -open System.Collections.Generic - -open FSharp.Compiler -open FSharp.Compiler.Service.Tests open FSharp.Compiler.SourceCodeServices - open FSharp.Compiler.Service.Tests.Common let internal getProjectReferences (content, dllFiles, libDirs, otherFlags) = diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 6920e682afe..4b34c861d02 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -5,6 +5,7 @@ open System.IO open System.Collections.Generic open FSharp.Compiler open FSharp.Compiler.SourceCodeServices +open FsUnit #if NETCOREAPP2_0 let readRefs (folder : string) (projectFile: string) = @@ -76,7 +77,6 @@ let sysLib nm = [] module Helpers = - open System type DummyType = A | B let PathRelativeToTestAssembly p = Path.Combine(Path.GetDirectoryName(Uri(typeof.Assembly.CodeBase).LocalPath), p) @@ -190,7 +190,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") let args = mkProjectCommandLineArgs(dllPath, [filePath]) @@ -198,6 +197,13 @@ let parseSourceCode (name: string, code: string) = let parseResults = checker.ParseFile(filePath, FSharp.Compiler.Text.SourceText.ofString code, options) |> Async.RunSynchronously parseResults.ParseTree +open FSharp.Compiler.Ast + +let parseSourceCodeAndGetModule (source: string) = + match parseSourceCode ("test", source) with + | Some (ParsedInput.ImplFile (ParsedImplFileInput (_, _, _, _, _, [ moduleOrNamespace ], _))) -> moduleOrNamespace + | _ -> failwith "Could not get module decls" + /// Extract range info let tups (m:Range.range) = (m.StartLine, m.StartColumn), (m.EndLine, m.EndColumn) @@ -298,6 +304,34 @@ let rec allSymbolsInEntities compGen (entities: IList) = yield! allSymbolsInEntities compGen e.NestedEntities ] +let getSymbolUses (source: string) = + let _, typeCheckResults = parseAndCheckScript("/home/user/Test.fsx", source) + typeCheckResults.GetAllUsesOfAllSymbolsInFile() |> Async.RunSynchronously + +let getSymbols (source: string) = + getSymbolUses source + |> Array.map (fun symbolUse -> symbolUse.Symbol) + + +let getSymbolName (symbol: FSharpSymbol) = + match symbol with + | :? FSharpMemberOrFunctionOrValue as mfv -> Some mfv.LogicalName + | :? FSharpEntity as entity -> Some entity.LogicalName + | :? FSharpGenericParameter as parameter -> Some parameter.Name + | :? FSharpParameter as parameter -> parameter.Name + | :? FSharpStaticParameter as parameter -> Some parameter.Name + | :? FSharpActivePatternCase as case -> Some case.Name + | :? FSharpUnionCase as case -> Some case.Name + | _ -> None + + +let assertContainsSymbolWithName name source = + getSymbols source + |> Array.choose getSymbolName + |> Array.contains name + |> shouldEqual true + + let coreLibAssemblyName = #if NETCOREAPP2_0 "System.Runtime" diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index 69b9e407645..e194f004c42 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -30,7 +30,6 @@ module Tests.Service.Editor open NUnit.Framework open FsUnit open System -open System.IO open FSharp.Compiler open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common @@ -1319,3 +1318,40 @@ let ``FSharpField.IsNameGenerated`` () = "type U = Case of string * Item2: string * string * Name: string", ["Item1", true; "Item2", false; "Item3", true; "Name", false]] |> List.iter (fun (source, expected) -> checkFields source |> shouldEqual expected) + + +[] +let ``ValNoMutable recovery`` () = + let source = """ +let x = 1 +x <- + let y = 1 + y +""" + assertContainsSymbolWithName "y" source + + +[] +let ``PropertyCannotBeSet recovery`` () = + let source = """ +type T = + static member P = 1 + +T.P <- + let y = 1 + y +""" + assertContainsSymbolWithName "y" source + + +[] +let ``FieldNotMutable recovery`` () = + let source = """ +type R = + { F: int } + +{ F = 1 }.F <- + let y = 1 + y +""" + assertContainsSymbolWithName "y" source diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index a92301bcefb..f2215974b95 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -15,9 +15,7 @@ open FsUnit open System open System.IO open System.Collections.Generic -open FSharp.Compiler open FSharp.Compiler.SourceCodeServices -open FSharp.Compiler.Service open FSharp.Compiler.Service.Tests.Common let internal exprChecker = FSharpChecker.Create(keepAssemblyContents=true) @@ -282,7 +280,6 @@ module internal Utils = // This project is a smoke test for a whole range of standard and obscure expressions module internal Project1 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2669,7 +2666,6 @@ let ``Test Operator Declarations for String`` () = // This big list expression was causing us trouble module internal ProjectStressBigExpressions = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() diff --git a/tests/service/FileSystemTests.fs b/tests/service/FileSystemTests.fs index 24b45414fd2..8580462c2b6 100644 --- a/tests/service/FileSystemTests.fs +++ b/tests/service/FileSystemTests.fs @@ -12,9 +12,7 @@ open NUnit.Framework open FsUnit open System open System.IO -open System.Collections.Generic open System.Text -open FSharp.Compiler open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.Service.Tests.Common diff --git a/tests/service/InteractiveCheckerTests.fs b/tests/service/InteractiveCheckerTests.fs index ea892fc1b5e..3d7e13769bd 100644 --- a/tests/service/InteractiveCheckerTests.fs +++ b/tests/service/InteractiveCheckerTests.fs @@ -12,7 +12,6 @@ open NUnit.Framework open FsUnit open System open FSharp.Compiler -open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common let internal longIdentToString (longIdent: Ast.LongIdent) = diff --git a/tests/service/MultiProjectAnalysisTests.fs b/tests/service/MultiProjectAnalysisTests.fs index 04ba820da0d..26d430f5000 100644 --- a/tests/service/MultiProjectAnalysisTests.fs +++ b/tests/service/MultiProjectAnalysisTests.fs @@ -13,12 +13,8 @@ open FSharp.Compiler.SourceCodeServices open NUnit.Framework open FsUnit -open System open System.IO -open System -open System.Collections.Generic -open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common let numProjectsForStressTest = 100 @@ -29,7 +25,6 @@ let internal tups (m:Range.range) = (m.StartLine, m.StartColumn), (m.EndLine, m. module internal Project1A = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName = Path.GetTempFileName() @@ -69,7 +64,6 @@ type U = //----------------------------------------------------------------------------------------- module internal Project1B = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName = Path.GetTempFileName() @@ -97,7 +91,6 @@ let x = // A project referencing two sub-projects module internal MultiProject1 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName = Path.GetTempFileName() @@ -248,7 +241,6 @@ let ``Test multi project 1 xmldoc`` () = // A project referencing many sub-projects module internal ManyProjectsStressTest = - open System.IO let numProjectsForStressTest = 100 @@ -390,7 +382,6 @@ let ``Test ManyProjectsStressTest all symbols`` () = //----------------------------------------------------------------------------------------- module internal MultiProjectDirty1 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName = Path.GetTempFileName() @@ -412,7 +403,6 @@ let x = "F#" checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) module internal MultiProjectDirty2 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") @@ -608,7 +598,6 @@ let ``Test multi project symbols should pick up changes in dependent projects`` module internal Project2A = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName1 = Path.GetTempFileName() @@ -638,7 +627,6 @@ type C() = //Project2A.fileSource1 // A project referencing Project2A module internal Project2B = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let dllName = Path.ChangeExtension(Project2A.baseName2, ".dll") @@ -663,7 +651,6 @@ let v = Project2A.C().InternalMember // access an internal symbol //Project2A.fileSource1 // A project referencing Project2A but without access to the internals of A module internal Project2C = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let dllName = Path.ChangeExtension(Project2A.baseName3, ".dll") @@ -728,7 +715,6 @@ let ``Test multi project 2 all symbols`` () = //------------------------------------------------------------------------------------ module internal Project3A = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName = Path.GetTempFileName() @@ -752,7 +738,6 @@ let (|DivisibleBy|_|) by n = // A project referencing a sub-project module internal MultiProject3 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let baseName = Path.GetTempFileName() diff --git a/tests/service/PerfTests.fs b/tests/service/PerfTests.fs index c5f2afbc7af..ffffa412a36 100644 --- a/tests/service/PerfTests.fs +++ b/tests/service/PerfTests.fs @@ -10,11 +10,8 @@ module FSharp.Compiler.Service.Tests.PerfTests open NUnit.Framework open FsUnit -open System open System.IO -open System.Collections.Generic -open FSharp.Compiler open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common @@ -23,7 +20,6 @@ open FSharp.Compiler.Service.Tests.Common let internal checker = FSharpChecker.Create() module internal Project1 = - open System.IO let fileNamesI = [ for i in 1 .. 10 -> (i, Path.ChangeExtension(Path.GetTempFileName(), ".fs")) ] let base2 = Path.GetTempFileName() diff --git a/tests/service/ProjectAnalysisTests.fs b/tests/service/ProjectAnalysisTests.fs index c9635c70830..45b5dc1b50f 100644 --- a/tests/service/ProjectAnalysisTests.fs +++ b/tests/service/ProjectAnalysisTests.fs @@ -13,7 +13,6 @@ open NUnit.Framework open FsUnit open System open System.IO -open System.Collections.Generic open FSharp.Compiler open FSharp.Compiler.SourceCodeServices @@ -21,7 +20,6 @@ open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common module internal Project1 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -639,7 +637,6 @@ let ``Test file explicit parse all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project2 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -836,7 +833,6 @@ let ``Test project2 all uses of all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project3 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -1277,7 +1273,6 @@ let ``Test project3 all uses of all signature symbols`` () = //----------------------------------------------------------------------------------------- module internal Project4 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -1432,7 +1427,6 @@ let ``Test project4 T symbols`` () = module internal Project5 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") @@ -1648,7 +1642,6 @@ let ``Test partial active patterns' exact ranges from uses of symbols`` () = //----------------------------------------------------------------------------------------- module internal Project6 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -1702,7 +1695,6 @@ let ``Test project 6 all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project7 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -1764,7 +1756,6 @@ let ``Test project 7 all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project8 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -1849,7 +1840,6 @@ let ``Test project 8 all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project9 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -1927,7 +1917,6 @@ let ``Test project 9 all symbols`` () = // see https://github.com/fsharp/FSharp.Compiler.Service/issues/95 module internal Project10 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2010,7 +1999,6 @@ let ``Test Project10 all symbols`` () = // see https://github.com/fsharp/FSharp.Compiler.Service/issues/92 module internal Project11 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2078,7 +2066,6 @@ let ``Test Project11 all symbols`` () = // see https://github.com/fsharp/FSharp.Compiler.Service/issues/92 module internal Project12 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2147,7 +2134,6 @@ let ``Test Project12 all symbols`` () = // Test fetching information about some external types (e.g. System.Object, System.DateTime) module internal Project13 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2296,7 +2282,6 @@ let ``Test Project13 all symbols`` () = // Misc - structs module internal Project14 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2365,7 +2350,6 @@ let ``Test Project14 all symbols`` () = // Misc - union patterns module internal Project15 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2425,7 +2409,6 @@ let ``Test Project15 all symbols`` () = // Misc - signature files module internal Project16 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let sigFileName1 = Path.ChangeExtension(fileName1, ".fsi") @@ -2725,7 +2708,6 @@ let ``Test project16 DeclaringEntity`` () = // Misc - namespace symbols module internal Project17 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2818,7 +2800,6 @@ let ``Test Project17 all symbols`` () = // Misc - generic type definnitions module internal Project18 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2869,7 +2850,6 @@ let ``Test Project18 all symbols`` () = // Misc - enums module internal Project19 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -2948,7 +2928,6 @@ let ``Test Project19 all symbols`` () = // Misc - https://github.com/fsharp/FSharp.Compiler.Service/issues/109 module internal Project20 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3001,7 +2980,6 @@ let ``Test Project20 all symbols`` () = // Misc - https://github.com/fsharp/FSharp.Compiler.Service/issues/137 module internal Project21 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3080,7 +3058,6 @@ let ``Test Project21 all symbols`` () = // Misc - namespace symbols module internal Project22 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3220,7 +3197,6 @@ let ``Test Project22 IList properties`` () = // Misc - properties module internal Project23 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3353,7 +3329,6 @@ let ``Test Project23 extension properties' getters/setters should refer to the c // Misc - property symbols module internal Project24 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3646,7 +3621,6 @@ let ``Test symbol uses of properties with both getters and setters`` () = #endif // Misc - type provider symbols module internal Project25 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3787,7 +3761,6 @@ let ``Test symbol uses of fully-qualified records`` () = module internal Project26 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3879,7 +3852,6 @@ let ``Test Project26 parameter symbols`` () = ("M3", None, "type Microsoft.FSharp.Core.unit", "")]) module internal Project27 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -3925,7 +3897,6 @@ let ``Test project27 all symbols in signature`` () = ("member AbstractMethod", ["member"; "overridemem"])] module internal Project28 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4028,7 +3999,6 @@ let ``Test project28 all symbols in signature`` () = ("FSharpGenericParameter", "?", "")|] #endif module internal Project29 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4085,7 +4055,6 @@ let ``Test project29 event symbols`` () = module internal Project30 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4146,7 +4115,6 @@ let ``Test project30 Format attributes`` () = """[]""")]) module internal Project31 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4264,7 +4232,6 @@ let ``Test project31 Format C# method attributes`` () = ]) module internal Project32 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let sigFileName1 = Path.ChangeExtension(fileName1, ".fsi") @@ -4337,7 +4304,6 @@ let ``Test Project32 should be able to find impl symbols`` () = ("file1", ((3, 4), (3, 8)), ["val"])] module internal Project33 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4383,7 +4349,6 @@ let ``Test Project33 extension methods`` () = ("GetValue", ["member"; "extmem"])] module internal Project34 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4448,7 +4413,6 @@ let ``Test project34 should report correct accessibility for System.Data.Listene //------------------------------------------------------ module internal Project35 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4526,7 +4490,6 @@ let ``Test project35 CurriedParameterGroups should be available for nested funct //------------------------------------------------------ module internal Project35b = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fsx") let fileSource1Text = """ @@ -4581,7 +4544,6 @@ let ``Test project35b Dependency files for check of project`` () = //------------------------------------------------------ module internal Project36 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4679,7 +4641,6 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.LiteralValue`` () = shouldEqual true notLit.LiteralValue.IsNone module internal Project37 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4831,7 +4792,6 @@ let ``Test project37 DeclaringEntity`` () = module internal Project38 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -4929,7 +4889,6 @@ let ``Test project38 abstract slot information`` () = //-------------------------------------------- module internal Project39 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -5010,7 +4969,6 @@ let ``Test project39 all symbols`` () = //-------------------------------------------- module internal Project40 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -5075,7 +5033,6 @@ let ``Test Project40 all symbols`` () = //-------------------------------------------- module internal Project41 = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") // We need to us a stable name to keep the hashes stable @@ -5169,7 +5126,6 @@ let ``Test project41 all symbols`` () = module internal ProjectBig = - open System.IO let fileNamesI = [ for i in 1 .. 10 -> (i, Path.ChangeExtension(Path.GetTempFileName(), ".fs")) ] let base2 = Path.GetTempFileName() @@ -5206,7 +5162,6 @@ let ``add files with same name from different folders`` () = shouldEqual 0 errors.Length module internal ProjectStructUnions = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() @@ -5253,7 +5208,6 @@ let ``Test typed AST for struct unions`` () = // See https://github.com/fsharp/F |> shouldEqual true module internal ProjectLineDirectives = - open System.IO let fileName1 = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let base2 = Path.GetTempFileName() diff --git a/tests/service/ProjectOptionsTests.fs b/tests/service/ProjectOptionsTests.fs index de7aed16756..1b1e252055b 100644 --- a/tests/service/ProjectOptionsTests.fs +++ b/tests/service/ProjectOptionsTests.fs @@ -10,7 +10,6 @@ module FSharp.Compiler.Service.Tests.ProjectOptionsTests let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false -open System open System.IO open NUnit.Framework open FsUnit diff --git a/tests/service/ServiceUntypedParseTests.fs b/tests/service/ServiceUntypedParseTests.fs index ac4e1565617..ecf91ee4cab 100644 --- a/tests/service/ServiceUntypedParseTests.fs +++ b/tests/service/ServiceUntypedParseTests.fs @@ -127,25 +127,139 @@ let foo6 = () [<>] let foo7 = () """ - match parseSourceCode ("test", source) with - | Some (ParsedInput.ImplFile (ParsedImplFileInput (_,_,_,_,_,[SynModuleOrNamespace (_,_,_,decls,_,_,_,_)],_))) -> - decls |> List.map (fun decl -> - match decl with - | SynModuleDecl.Let (_,[Binding(_,_,_,_,attributeLists,_,_,_,_,_,_,_)],_) -> - attributeLists |> List.map (fun list -> - let r = list.Range - - list.Attributes.Length, - ((r.StartLine, r.StartColumn), (r.EndLine, r.EndColumn))) - - | _ -> failwith "Could not get binding") - |> shouldEqual - [ [ (1, ((2, 0), (2, 5))) ] - [ (1, ((5, 0), (5, 5))); (2, ((6, 0), (6, 7))) ] - [ (1, ((9, 0), (9, 5))); (2, ((9, 6), (9, 13))) ] - [ (1, ((12, 0), (13, 0))) ] - [ (1, ((15, 0), (15, 4))) ] - [ (0, ((18, 0), (18, 2))) ] - [ (0, ((21, 0), (21, 4))) ] ] - - | _ -> failwith "Could not get module decls" + let (SynModuleOrNamespace (_, _, _, decls, _, _, _, _)) = parseSourceCodeAndGetModule source + decls |> List.map (fun decl -> + match decl with + | SynModuleDecl.Let (_,[Binding(_,_,_,_,attributeLists,_,_,_,_,_,_,_)],_) -> + attributeLists |> List.map (fun list -> + let r = list.Range + + list.Attributes.Length, + ((r.StartLine, r.StartColumn), (r.EndLine, r.EndColumn))) + + | _ -> failwith "Could not get binding") + |> shouldEqual + [ [ (1, ((2, 0), (2, 5))) ] + [ (1, ((5, 0), (5, 5))); (2, ((6, 0), (6, 7))) ] + [ (1, ((9, 0), (9, 5))); (2, ((9, 6), (9, 13))) ] + [ (1, ((12, 0), (13, 0))) ] + [ (1, ((15, 0), (15, 4))) ] + [ (0, ((18, 0), (18, 2))) ] + [ (0, ((21, 0), (21, 4))) ] ] + + +module TypeMemberRanges = + + let getTypeMemberRange source = + let (SynModuleOrNamespace (_, _, _, decls, _, _, _, _)) = parseSourceCodeAndGetModule source + match decls with + | [ SynModuleDecl.Types ([ TypeDefn (_, SynTypeDefnRepr.ObjectModel (_, memberDecls, _), _, _) ], _) ] -> + memberDecls |> List.map (fun memberDecl -> + let range = memberDecl.Range + (range.StartLine, range.StartColumn), (range.EndLine, range.EndColumn)) + + | _ -> failwith "Could not get member" + + + [] + let ``Member range 01 - Simple``() = + let source = """ +type T = + member x.Foo() = () +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 23) ] + + + [] + let ``Member range 02 - Static``() = + let source = """ +type T = + static member Foo() = () +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 28) ] + + + [] + let ``Member range 03 - Attribute``() = + let source = """ +type T = + [] + static member Foo() = () +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (4, 28) ] + + + [] + let ``Member range 04 - Property``() = + let source = """ +type T = + member x.P = () +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 19) ] + + + [] + let ``Member range 05 - Setter only property``() = + let source = """ +type T = + member x.P with set (value) = v <- value +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 44) ] + + + [] + let ``Member range 06 - Read-write property``() = + let source = """ +type T = + member this.MyReadWriteProperty + with get () = x + and set (value) = x <- value +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (5, 36) + (3, 4), (5, 36) ] + + + [] + let ``Member range 07 - Auto property``() = + let source = """ +type T = + member val Property1 = "" +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 29) ] + + + [] + let ``Member range 08 - Auto property with setter``() = + let source = """ +type T = + member val Property1 = "" with get, set +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 29) ] + + + [] + let ``Member range 09 - Abstract slot``() = + let source = """ +type T = + abstract P: int + abstract M: unit -> unit +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 19) + (4, 4), (4, 28) ] + + [] + let ``Member range 10 - Val field``() = + let source = """ +type T = + val x: int +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 14) ] + + + [] + let ``Member range 11 - Ctor``() = + let source = """ +type T = + new (x:int) = () +""" + getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 20) ] diff --git a/tests/service/StructureTests.fs b/tests/service/StructureTests.fs index e3f7b7fe9b2..c3583fe5ab1 100644 --- a/tests/service/StructureTests.fs +++ b/tests/service/StructureTests.fs @@ -106,7 +106,7 @@ type Color = => [ (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) + (8, 8, 9, 55), (8, 27, 9, 55) (8, 15, 9, 55), (8, 27, 9, 55) ] [] @@ -127,7 +127,7 @@ type Color = (3, 4, 4, 14), (3, 4, 4, 14) (3, 6, 4, 13), (3, 6, 4, 13) (8, 4, 10, 55), (8, 25, 10, 55) - (9, 15, 10, 55), (9, 27, 10, 55) + (9, 8, 10, 55), (9, 27, 10, 55) (9, 15, 10, 55), (9, 27, 10, 55) ] [] @@ -181,13 +181,13 @@ module MyModule = // 2 (7, 9, 15, 59), (7, 15, 15, 59) (8, 8, 11, 9), (8, 8, 11, 9) (13, 8, 15, 59), (13, 29, 15, 59) - (14, 19, 15, 59), (14, 31, 15, 59) + (14, 12, 15, 59), (14, 31, 15, 59) (14, 19, 15, 59), (14, 31, 15, 59) (17, 4, 27, 63), (17, 24, 27, 63) (19, 13, 27, 63), (19, 25, 27, 63) (20, 12, 23, 13), (20, 12, 23, 13) (25, 12, 27, 63), (25, 33, 27, 63) - (26, 23, 27, 63), (26, 35, 27, 63) + (26, 16, 27, 63), (26, 35, 27, 63) (26, 23, 27, 63), (26, 35, 27, 63) ] diff --git a/tests/service/TokenizerTests.fs b/tests/service/TokenizerTests.fs index c03fbce9370..0827ff35027 100644 --- a/tests/service/TokenizerTests.fs +++ b/tests/service/TokenizerTests.fs @@ -8,14 +8,9 @@ module FSharp.Compiler.Service.Tests.TokenizerTests #endif -open FSharp.Compiler -open FSharp.Compiler.Interactive.Shell open FSharp.Compiler.SourceCodeServices open NUnit.Framework -open FsUnit -open System -open System.IO let sourceTok = FSharpSourceTokenizer([], Some "C:\\test.fsx")