diff --git a/.vsts-ci.yml b/.vsts-ci.yml
index 4eac359176e30..3970d6664b993 100644
--- a/.vsts-ci.yml
+++ b/.vsts-ci.yml
@@ -11,6 +11,8 @@ queue:
variables:
BuildPlatform: 'Any CPU'
+ InsertTargetBranchFullName: 'lab/d16.0stg472'
+ InsertTargetBranchShortName: 'd16.0stg472'
steps:
- task: NuGetCommand@2
inputs:
@@ -22,6 +24,11 @@ steps:
signType: real
condition: and(succeeded(), in(variables['PB_SignType'], 'test', 'real'))
+- task: ms-vseng.MicroBuildTasks.965C8DC6-1483-45C9-B384-5AC75DA1F1A4.MicroBuildOptProfPlugin@1
+ inputs:
+ skipRunOptimize: true
+ displayName: 'Install OptProf Plugin'
+
- task: ms-vseng.MicroBuildTasks.32f78468-e895-4f47-962c-58a699361df8.MicroBuildSwixPlugin@1
inputs:
feedSource: 'https://devdiv-test.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json'
@@ -53,6 +60,65 @@ steps:
filePath: 'build\scripts\publish-assets.ps1'
condition: succeeded()
+### BEGIN OPTPROF TASKS ###
+
+# Publish optprof configuration files
+- task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0
+ inputs:
+ dropServiceURI: 'https://devdiv.artifacts.visualstudio.com'
+ buildNumber: 'ProfilingInputs/DevDiv/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildId)'
+ sourcePath: '$(Build.SourcesDirectory)\Binaries\$(BuildConfiguration)\DevDivInsertionFiles\OptProf'
+ toLowerCase: false
+ usePat: false
+ displayName: 'OPTPROF - Publish to Artifact Services - ProfilingInputs'
+ condition: succeededOrFailed()
+
+# Created a exe that will install visual studio with this version
+- task: PowerShell@2
+ inputs:
+ filePath: build\scripts\setmanifestpaths.ps1
+ failOnStderr: true
+ displayName: 'OPTPROF - Set VSTS variables for vsman files'
+ condition: succeededOrFailed()
+
+- task: ms-vseng.MicroBuildTasks.0e9d0d4d-71ec-4e4e-ae40-db9896f1ae74.MicroBuildBuildVSBootstrapper@1
+ inputs:
+ vsMajorVersion: 16
+ channelName: int.$(InsertTargetBranchShortName)
+ manifests: $(SetupManifests)
+ outputFolder: '$(Build.SourcesDirectory)\Binaries\VSSetup\$(BuildConfiguration)\Insertion'
+ displayName: 'OPTPROF - Build VS bootstrapper'
+ condition: succeededOrFailed()
+
+# Publish run settings
+- task: PowerShell@2
+ inputs:
+ filePath: build\scripts\createrunsettings.ps1
+ arguments: -release
+ failOnStderr: true
+ displayName: 'OPTPROF - generate runsettings file'
+ condition: succeededOrFailed()
+
+# Publish bootstrapper info
+- task: PublishBuildArtifacts@1
+ inputs:
+ PathtoPublish: $(Build.StagingDirectory)\MicroBuild\Output
+ ArtifactName: MicroBuildOutputs
+ ArtifactType: Container
+ displayName: 'OPTPROF - Publish Artifact: MicroBuildOutputs'
+ condition: succeededOrFailed()
+
+# Publish scripts to get the branch of VS that this inserts into
+- task: PublishBuildArtifacts@1
+ inputs:
+ PathtoPublish: '$(Build.SourcesDirectory)\Binaries\$(BuildConfiguration)\DevDivInsertionFiles\BranchInfo'
+ ArtifactName: BranchInfo
+ ArtifactType: Container
+ displayName: 'OPTPROF - Publish Artifact: BranchInfo'
+ condition: succeededOrFailed()
+
+### END OPTPROF TASKS ###
+
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
diff --git a/Roslyn.sln b/Roslyn.sln
index e95bd88166528..f34b9afc6e195 100644
--- a/Roslyn.sln
+++ b/Roslyn.sln
@@ -367,10 +367,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Pool
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests", "src\Workspaces\MSBuildTest\Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests.csproj", "{037F06F0-3BE8-42D0-801E-2F74FC380AB8}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevDivPackagesDebugger_DoNotUse", "src\Setup\DevDivPackages\Debugger\DevDivPackagesDebugger_DoNotUse.csproj", "{18BDB5D5-340B-4834-B4FC-0327729A4A26}"
-EndProject
-Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Roslyn.BuildDevDivInsertionFiles", "src\Setup\DevDivInsertionFiles\Roslyn.BuildDevDivInsertionFiles.vbproj", "{5FE910A9-E7C9-40E1-AAF1-6C6C7DD61B67}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost64", "src\Interactive\Host\InteractiveHost64.csproj", "{2F11618A-9251-4609-B3D5-CE4D2B3D3E49}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.IntegrationService", "src\VisualStudio\IntegrationTest\IntegrationService\Microsoft.VisualStudio.IntegrationTest.IntegrationService.csproj", "{764D2C19-0187-4837-A2A3-96DDC6EF4CE2}"
@@ -397,14 +393,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS.Tools.Roslyn.Package", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Package", "src\NuGet\Microsoft.CodeAnalysis.Package.csproj", "{B9843F65-262E-4F40-A0BC-2CBEF7563A44}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PortableFacades.Setup", "src\Setup\DevDivVsix\PortableFacades\PortableFacades.Setup.csproj", "{952808C5-799A-4CAA-964C-2AA78458CEC7}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compilers.Setup", "src\Setup\DevDivVsix\CompilersPackage\Microsoft.CodeAnalysis.Compilers.Setup.csproj", "{03607817-6800-40B6-BEAA-D6F437CD62B7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-format", "src\Tools\dotnet-format\dotnet-format.csproj", "{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Installer.Package", "src\Setup\Installer\Installer.Package.csproj", "{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests", "src\Workspaces\DesktopTest\Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests.csproj", "{23405307-7EFF-4774-8B11-8F5885439761}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Insertion", "Insertion", "{AFA5F921-0650-45E8-B293-51A0BB89DEA0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevDivInsertionFiles", "src\Setup\DevDivInsertionFiles\DevDivInsertionFiles.csproj", "{6362616E-6A47-48F0-9EE0-27800B306ACB}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 4
@@ -1006,14 +1006,6 @@ Global
{037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.Build.0 = Release|Any CPU
- {18BDB5D5-340B-4834-B4FC-0327729A4A26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {18BDB5D5-340B-4834-B4FC-0327729A4A26}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {18BDB5D5-340B-4834-B4FC-0327729A4A26}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {18BDB5D5-340B-4834-B4FC-0327729A4A26}.Release|Any CPU.Build.0 = Release|Any CPU
- {5FE910A9-E7C9-40E1-AAF1-6C6C7DD61B67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5FE910A9-E7C9-40E1-AAF1-6C6C7DD61B67}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5FE910A9-E7C9-40E1-AAF1-6C6C7DD61B67}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5FE910A9-E7C9-40E1-AAF1-6C6C7DD61B67}.Release|Any CPU.Build.0 = Release|Any CPU
{2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1058,10 +1050,6 @@ Global
{B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.Build.0 = Release|Any CPU
- {952808C5-799A-4CAA-964C-2AA78458CEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {952808C5-799A-4CAA-964C-2AA78458CEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {952808C5-799A-4CAA-964C-2AA78458CEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {952808C5-799A-4CAA-964C-2AA78458CEC7}.Release|Any CPU.Build.0 = Release|Any CPU
{03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1074,6 +1062,14 @@ Global
{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1245,8 +1241,6 @@ Global
{FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89} = {C2D1346B-9665-4150-B644-075CF1636BAA}
{49E7C367-181B-499C-AC2E-8E17C81418D6} = {C2D1346B-9665-4150-B644-075CF1636BAA}
{037F06F0-3BE8-42D0-801E-2F74FC380AB8} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
- {18BDB5D5-340B-4834-B4FC-0327729A4A26} = {C2D1346B-9665-4150-B644-075CF1636BAA}
- {5FE910A9-E7C9-40E1-AAF1-6C6C7DD61B67} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{2F11618A-9251-4609-B3D5-CE4D2B3D3E49} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087}
{764D2C19-0187-4837-A2A3-96DDC6EF4CE2} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70}
{9860FCF7-3111-4C12-A16F-ACEBA42D930F} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
@@ -1260,10 +1254,12 @@ Global
{0EB22BD1-B8B1-417D-8276-F475C2E190FF} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{3636D3E2-E3EF-4815-B020-819F382204CD} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{B9843F65-262E-4F40-A0BC-2CBEF7563A44} = {C52D8057-43AF-40E6-A01B-6CDBB7301985}
- {952808C5-799A-4CAA-964C-2AA78458CEC7} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{03607817-6800-40B6-BEAA-D6F437CD62B7} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5} = {BE25E872-1667-4649-9D19-96B83E75A44E}
+ {23405307-7EFF-4774-8B11-8F5885439761} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
+ {AFA5F921-0650-45E8-B293-51A0BB89DEA0} = {8DBA5174-B0AA-4561-82B1-A46607697753}
+ {6362616E-6A47-48F0-9EE0-27800B306ACB} = {AFA5F921-0650-45E8-B293-51A0BB89DEA0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29}
diff --git a/build/Targets/GenerateCompilerExecutableBindingRedirects.targets b/build/Targets/GenerateCompilerExecutableBindingRedirects.targets
index c53025d6cadde..2d1972cf4c583 100644
--- a/build/Targets/GenerateCompilerExecutableBindingRedirects.targets
+++ b/build/Targets/GenerateCompilerExecutableBindingRedirects.targets
@@ -30,44 +30,17 @@
1.2.3.0
-
- 4.0.1.0
-
-
- 4.0.1.0
-
-
- 4.0.3.0
-
-
- 4.1.2.0
-
-
- 4.0.2.0
-
-
- 4.0.2.0
-
-
- 4.0.1.0
-
1.4.3.0
-
- 4.0.1.0
-
-
- 4.0.1.0
-
-
- 4.0.1.0
+
+ 4.0.4.0
-
- 4.0.1.0
+
+ 4.1.1.0
-
- 4.1.0.0
+
+ 4.2.0.0
diff --git a/build/Targets/Imports.targets b/build/Targets/Imports.targets
index ed70d10b6ab43..542b7c9158ed9 100644
--- a/build/Targets/Imports.targets
+++ b/build/Targets/Imports.targets
@@ -15,7 +15,7 @@
- false
+ false
$(ArtifactsConfigurationDir)DevDivPackages\Roslyn\
diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props
index 70ef45e98fba7..502f31d1efae8 100644
--- a/build/Targets/Packages.props
+++ b/build/Targets/Packages.props
@@ -59,14 +59,14 @@
0.8.31-beta
1.0.35
1.3.0
- 1.1.0-beta1-63011-01
- 1.1.0-beta1-63011-01
+ 1.1.0-beta1-63314-01
+ 1.1.0-beta1-63314-01
1.7.0
1.5.0
- 4.7.2-alpha-00001
+ 4.7.2-alpha-00001
1.0.27-prerelease-01811-02
2.1.0-prerelease-02419-02
- 1.0.0-beta.18455.10
+ 1.0.0-beta.18519.9
2.1.1
2.1.1
3.13.8
@@ -74,6 +74,8 @@
14.3.25407-alpha
1.0.0-beta1-63011-01
8.0.0.0-alpha
+
+ 15.9.0-dev2
2.9.0-beta7-63018-03
$(RoslynDiagnosticsNugetPackageVersion)
2.0.0
@@ -162,94 +164,34 @@
4.0.0-rc-2048
1.1.0-beta1-62506-02
105.2.3
- 2.11.0-beta1-63312-06
+ 2.11.0-beta3.20181025.2
$(RoslynDiagnosticsNugetPackageVersion)
0.2.4-beta
1.0.0-beta2-63222-01
1.0.0-beta2-63222-01
0.5.0-alpha
- 1.0.0-beta3.18523.2
+ 1.0.0-beta3.18526.1
0.1.3
- 1.0.0-beta3.18525.2
+ 1.0.0-beta3.18526.1
+ 1.0.0-beta3.18524.2
+ 1.0.0-beta3.18524.2
4.3.0
0.0.4
1.3.23
- 4.3.0
- 4.3.0
- 4.3.0
1.5.0
0.1.0-alpha-63227-01
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
4.5.0
- 4.3.0
- 4.3.0
- 5.0.0
- 4.3.0
- 4.3.0
- 4.3.0
4.3.0
- 4.3.0
4.3.0
- 4.3.0
- 4.3.0
4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.3
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
1.6.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
+ 4.5.0
+ 4.5.0
4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
4.5.24
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
- 4.3.0
+
+ 4.5.0
+ 4.5.0
1.1.2
1.1.0.14
15.8.68-develop-g109a00ff
diff --git a/build/Targets/RepoToolset/OptimizationData.targets b/build/Targets/RepoToolset/OptimizationData.targets
index 8316e4122f362..f480da9eb22fa 100644
--- a/build/Targets/RepoToolset/OptimizationData.targets
+++ b/build/Targets/RepoToolset/OptimizationData.targets
@@ -1,31 +1,31 @@
-
+
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
-
-
+
+
+
+ <_PreviousOptimizedFile>$([System.IO.Path]::Combine($(IbcOptimizationDataDir), '$(TargetName).pgo'))
$(IntermediateOutputPath)$(TargetFileName).pcbm
- $(NuGetPackageRoot)\RoslynDependencies.OptimizationData\$(RoslynDependenciesOptimizationDataVersion)\content\OptimizationData
- $([System.IO.Path]::GetFullPath('$(OptimizationDataFolderPath)\$(TargetName).pgo'))
- $(NuGetPackageRoot)\Microsoft.DotNet.IBCMerge\$(MicrosoftDotNetIBCMerge)\lib\net45\ibcmerge.exe
-
+
+
@@ -36,27 +36,55 @@
-
+
+
+
+
+ <_IbcArgs>-q -f -partialNGEN -minify -delete -mo "%(OptimizeAssembly.Identity)" -incremental "%(OptimizeAssembly.PreviousOptimizedFile)"
+
+
+
- A local build emulating an official build can pass /p:SkipApplyOptimizations=true to avoid this error.
- -->
-
+ DependsOnTargets="_CalculateIbcArgs"
+ Condition="'@(OptimizeAssembly)' != '' and '$(Configuration)' == 'Release' and '$(ContinuousIntegrationBuild)' == 'true'">
+
+
+ <_IbcMergePath>$(NuGetPackageRoot)microsoft.dotnet.ibcmerge\$(MicrosoftDotNetIBCMergeVersion)\lib\net45\ibcmerge.exe
-
+ <_RunIbcMerge>false
+ <_RunIbcMerge Condition="'$(OfficialBuild)' == 'true' or Exists('$(_IbcMergePath)')">true
+
-
+
+
+ Condition="'$(_RunIbcMerge)' == 'true'">
+
+
+
+
\ No newline at end of file
diff --git a/build/Targets/RepoToolset/Sign.proj b/build/Targets/RepoToolset/Sign.proj
index 42683eeb48d1b..79dfa28dc6467 100644
--- a/build/Targets/RepoToolset/Sign.proj
+++ b/build/Targets/RepoToolset/Sign.proj
@@ -5,13 +5,23 @@
+
+
+
+
-
+
-
-
+
+
+
+
-
-
-
+
+
@@ -60,15 +69,16 @@
-
+
diff --git a/build/Targets/Roslyn.Toolsets.Xunit.targets b/build/Targets/Roslyn.Toolsets.Xunit.targets
index 5d58888befc44..660e23d069881 100644
--- a/build/Targets/Roslyn.Toolsets.Xunit.targets
+++ b/build/Targets/Roslyn.Toolsets.Xunit.targets
@@ -11,6 +11,9 @@
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/ToolsetPackages/InternalToolset.csproj b/build/ToolsetPackages/InternalToolset.csproj
index baa1f68cdd1e6..8f50d4f74073a 100644
--- a/build/ToolsetPackages/InternalToolset.csproj
+++ b/build/ToolsetPackages/InternalToolset.csproj
@@ -2,9 +2,9 @@
- net46
+ net472
-
+
diff --git a/build/ToolsetPackages/RoslynToolset.csproj b/build/ToolsetPackages/RoslynToolset.csproj
index f754ace6d13f0..a723d48f69310 100644
--- a/build/ToolsetPackages/RoslynToolset.csproj
+++ b/build/ToolsetPackages/RoslynToolset.csproj
@@ -2,7 +2,7 @@
- net46;netcoreapp2.1
+ net472;netcoreapp2.1
@@ -14,12 +14,11 @@
-
-
+
@@ -31,6 +30,8 @@
+
+
diff --git a/build/config/optprof.json b/build/config/optprof.json
new file mode 100644
index 0000000000000..90ad3bf17922e
--- /dev/null
+++ b/build/config/optprof.json
@@ -0,0 +1,214 @@
+{
+ "products": [
+ {
+ "name": "Roslyn.VisualStudio.Setup.vsix",
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.EditingAndDesigner"
+ ]
+ },
+ {
+ "container": "VSPE",
+ "testCases": [
+ "VSPE.OptProfTests.vs_perf_designtime_ide_searchtest",
+ "VSPE.OptProfTests.vs_perf_designtime_editor_intellisense_globalcompletionlist_cs",
+ "VSPE.OptProfTests.vs_asl_cs_scenario",
+ "VSPE.OptProfTests.vs_ddbvtqa_vbwi",
+ "VSPE.OptProfTests.vs_asl_vb_scenario",
+ "VSPE.OptProfTests.vs_env_solution_createnewproject_vb_winformsapp"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "ExpressionEvaluatorPackage.vsix",
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Microsoft.CodeAnalysis.Compilers.vsix",
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Roslyn.VisualStudio.InteractiveComponents.vsix",
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.EditingAndDesigner"
+ ]
+ }
+ ]
+ }
+ ],
+ "assemblies" : [
+ {
+ "assembly": "System.Collections.Immutable.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "Common7/IDE/PrivateAssemblies",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "System.Reflection.Metadata.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "Common7/IDE/PrivateAssemblies",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "Microsoft.Build.Conversion.Core.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "Microsoft.Build.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "Microsoft.Build.Engine.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "Microsoft.Build.Framework.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "Microsoft.Build.Tasks.Core.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "Microsoft.Build.Utilities.Core.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ },
+ {
+ "assembly": "System.Threading.Tasks.Dataflow.dll",
+ "instrumentationArguments": [
+ {
+ "relativeInstallationFolder": "MSBuild/15.0/Bin",
+ "instrumentationExecutable" : "Common7/IDE/vsn.exe"
+ }
+ ],
+ "tests": [
+ {
+ "container": "DDRIT.RPS.CSharp",
+ "testCases": [
+ "DDRIT.RPS.CSharp.CSharpTest.BuildAndDebugging"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1
index 27892d6a7b62b..afd8ac3780195 100644
--- a/build/scripts/build.ps1
+++ b/build/scripts/build.ps1
@@ -251,7 +251,7 @@ function Build-Artifacts() {
}
if ($build -and $pack -and (-not $buildCoreClr)) {
- Build-InsertionItems
+ Build-OptProfData
}
if ($cibuild) {
@@ -260,17 +260,23 @@ function Build-Artifacts() {
}
}
-function Build-InsertionItems() {
-
- $setupDir = Join-Path $RepoRoot "src\Setup"
- Push-Location $setupDir
- try {
- Write-Host "Building VS Insertion artifacts"
- Exec-Console (Join-Path $configDir "Exes\Roslyn.BuildDevDivInsertionFiles\Roslyn.BuildDevDivInsertionFiles.exe") "$configDir $(Get-PackagesDir)"
- }
- finally {
- Pop-Location
- }
+function Build-OptProfData() {
+ $optProfToolDir = Get-PackageDir "RoslynTools.OptProf"
+ $optProfToolExe = Join-Path $optProfToolDir "tools\roslyn.optprof.exe"
+ $configFile = Join-Path $RepoRoot "build\config\optprof.json"
+ $insertionFolder = Join-Path $vsSetupDir "Insertion"
+ $outputFolder = Join-Path $configDir "DevDivInsertionFiles\OptProf"
+ Write-Host "Generating optprof data using '$configFile' into '$outputFolder'"
+ $optProfArgs = "--configFile $configFile --insertionFolder $insertionFolder --outputFolder $outputFolder"
+ Exec-Console $optProfToolExe $optProfArgs
+
+ # Write Out Branch we are inserting into
+ $vsBranchFolder = Join-Path $configDir "DevDivInsertionFiles\BranchInfo"
+ New-Item -ItemType Directory -Force -Path $vsBranchFolder
+ $vsBranchText = Join-Path $vsBranchFolder "vsbranch.txt"
+ # InsertTargetBranchFullName is defined in .vsts-ci.yml
+ $vsBranch = $Env:InsertTargetBranchFullName
+ $vsBranch >> $vsBranchText
}
function Build-CheckLocStatus() {
@@ -350,7 +356,7 @@ function Test-XUnit() {
$unitDir = Join-Path $configDir "UnitTests"
$runTests = Join-Path $configDir "Exes\RunTests\RunTests.exe"
- $xunitDir = Join-Path (Get-PackageDir "xunit.runner.console") "tools\net452"
+ $xunitDir = Join-Path (Get-PackageDir "xunit.runner.console") "tools\net472"
$args = "$xunitDir"
$args += " -logpath:$logsDir"
$args += " -nocache"
diff --git a/build/scripts/createrunsettings.ps1 b/build/scripts/createrunsettings.ps1
new file mode 100644
index 0000000000000..8ae3a10994988
--- /dev/null
+++ b/build/scripts/createrunsettings.ps1
@@ -0,0 +1,35 @@
+[CmdletBinding(PositionalBinding=$false)]
+param (
+ [switch]$release = $false)
+
+Set-StrictMode -version 2.0
+$ErrorActionPreference = "Stop"
+
+try {
+ . (Join-Path $PSScriptRoot "build-utils.ps1")
+ Push-Location $repoDir
+
+ Write-Host "Repo Dir $repoDir"
+ Write-Host "Binaries Dir $binariesDir"
+
+ $buildConfiguration = if ($release) { "Release" } else { "Debug" }
+ $configDir = Join-Path (Join-Path $binariesDir "VSSetup") $buildConfiguration
+
+ $optProfToolDir = Get-PackageDir "Roslyn.OptProf.RunSettings.Generator"
+ $optProfToolExe = Join-Path $optProfToolDir "tools\roslyn.optprof.runsettings.generator.exe"
+ $configFile = Join-Path $repoDir "build\config\optprof.json"
+ $outputFolder = Join-Path $configDir "Insertion\RunSettings"
+ $optProfArgs = "--configFile $configFile --outputFolder $outputFolder --buildNumber 28218.3001 "
+
+ Exec-Console $optProfToolExe $optProfArgs
+ exit 0
+}
+catch {
+ Write-Host $_
+ Write-Host $_.Exception
+ Write-Host $_.ScriptStackTrace
+ exit 1
+}
+finally {
+ Pop-Location
+}
\ No newline at end of file
diff --git a/build/scripts/findibc.ps1 b/build/scripts/findibc.ps1
new file mode 100644
index 0000000000000..f962065278636
--- /dev/null
+++ b/build/scripts/findibc.ps1
@@ -0,0 +1,39 @@
+[CmdletBinding(PositionalBinding=$false)]
+param (
+ [string]$intermediateAssembly,
+ [string]$ibcRootFolder)
+
+try {
+ $assemblyName = [System.IO.Path]::GetFileName($intermediateAssembly)
+ $fullPath = [System.IO.Path]::GetFullPath($ibcRootFolder)
+ if(![System.IO.Directory]::Exists($fullPath)){
+ # There is no product data directory return
+ return ""
+ }
+ $root = (New-Object -TypeName System.IO.DirectoryInfo -ArgumentList $fullPath)
+ $dllEntry = [System.Linq.Enumerable]::SingleOrDefault($root.EnumerateFiles($assemblyName,[System.IO.SearchOption]::AllDirectories))
+ if (!$dllEntry)
+ {
+ return "";
+ }
+
+ $ibcFileInfos = $dllEntry.Directory.EnumerateFiles("*.ibc")
+ $strings = (New-Object "System.Collections.Generic.List[System.String]")
+ foreach ($ibcFileInfo in $ibcFileInfos)
+ {
+ $name = $ibcFileInfo.FullName
+ $strings.Add($name)
+ }
+ $ibcFiles = $strings -join ' '
+
+ return $ibcFiles
+}
+catch {
+ Write-Host $_
+ Write-Host $_.Exception
+ Write-Host $_.ScriptStackTrace
+ exit 1
+}
+finally {
+ Pop-Location
+}
\ No newline at end of file
diff --git a/build/scripts/setmanifestpaths.ps1 b/build/scripts/setmanifestpaths.ps1
new file mode 100644
index 0000000000000..38f5aa463225e
--- /dev/null
+++ b/build/scripts/setmanifestpaths.ps1
@@ -0,0 +1,15 @@
+# Take care to return nothing if we don't yet have any vsman files
+# as will occur at the start of the build.
+# This will allow us to set it after the build when called again.
+
+$vsmanpath = "Binaries/VSSetup/$Env:BuildConfiguration/Insertion"
+if (Test-Path $vsmanpath) {
+ $SetupManifests = [string]::Join(',', (Get-ChildItem "Binaries/VSSetup/$Env:BuildConfiguration/Insertion/*.vsman"))
+ Write-Host "Using the following manifests '$SetupManifests'"
+ Write-Host "SetupManifests=$SetupManifests"
+ Write-Host "##vso[task.setvariable variable=SetupManifests;]$SetupManifests"
+ Set-Item -Path "env:SetupManifests" -Value $SetupManifests
+}
+else {
+ Write-Host "Unable to find manifest files"
+}
\ No newline at end of file
diff --git a/build/scripts/tests.sh b/build/scripts/tests.sh
index ce8505360f63a..77210ba684038 100755
--- a/build/scripts/tests.sh
+++ b/build/scripts/tests.sh
@@ -43,7 +43,7 @@ if [[ "${runtime}" == "dotnet" ]]; then
)
xunit_console="${nuget_dir}"/xunit.runner.console/"${xunit_console_version}"/tools/netcoreapp2.0/xunit.console.dll
elif [[ "${runtime}" =~ ^(mono|mono-debug)$ ]]; then
- file_list=( "${unittest_dir}"/*/net46/*.UnitTests.dll )
+ file_list=( "${unittest_dir}"/*/net472/*.UnitTests.dll )
file_skiplist=(
# Omitted because we appear to be missing things necessary to compile vb.net.
# See https://github.com/mono/mono/issues/10679
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
index 7cc11f35bd6e5..708d8b90b67a7 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
@@ -411,7 +411,7 @@ internal bool CheckValueKind(SyntaxNode node, BoundExpression expr, BindValueKin
}
var receiver = ((BoundPointerElementAccess)expr).Expression;
- if (receiver is BoundFieldAccess fieldAccess && fieldAccess.FieldSymbol.IsFixed)
+ if (receiver is BoundFieldAccess fieldAccess && fieldAccess.FieldSymbol.IsFixedSizeBuffer)
{
return CheckValueKind(node, fieldAccess.ReceiverOpt, valueKind, checkingReceiver: true, diagnostics);
}
@@ -692,7 +692,7 @@ private bool CheckFieldValueKind(SyntaxNode node, BoundFieldAccess fieldAccess,
}
}
- if (fieldSymbol.IsFixed)
+ if (fieldSymbol.IsFixedSizeBuffer)
{
Error(diagnostics, GetStandardLvalueError(valueKind), node);
return false;
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs
index 70847b2a115d5..de97086ec5b39 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs
@@ -222,7 +222,7 @@ internal static bool IsValidConstraint(
}
// Ignore nullability when comparing constraints.
- if (constraintTypes.Contains(c => type.Equals(c, TypeCompareKind.ConsiderEverything)))
+ if (constraintTypes.Contains(c => type.Equals(c, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)))
{
// "Duplicate constraint '{0}' for type parameter '{1}'"
Error(diagnostics, ErrorCode.ERR_DuplicateBound, syntax, type.TypeSymbol.SetUnknownNullabilityForReferenceTypes(), typeParameterName);
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
index b0ea9a8725f18..35a1e30d33436 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
@@ -80,7 +80,7 @@ protected BoundExpression CreateConversion(
// We need to preserve any conversion that changes the type (even identity conversions, like object->dynamic),
// or that was explicitly written in code (so that GetSemanticInfo can find the syntax in the bound tree).
- if (!isCast && source.Type == destination)
+ if (!isCast && source.Type.Equals(destination, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
return source;
}
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
index ad59105515904..534ce82d634bc 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
@@ -6329,7 +6329,7 @@ protected BoundExpression BindFieldAccess(
hasError = this.CheckInstanceOrStatic(node, receiver, fieldSymbol, ref resultKind, diagnostics);
}
- if (!hasError && fieldSymbol.IsFixed && !IsInsideNameof)
+ if (!hasError && fieldSymbol.IsFixedSizeBuffer && !IsInsideNameof)
{
// SPEC: In a member access of the form E.I, if E is of a struct type and a member lookup of I in
// that struct type identifies a fixed size member, then E.I is evaluated an classified as follows:
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
index 64794fe61442d..8d4f33f35803f 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
@@ -1388,7 +1388,7 @@ private ImmutableArray BuildArgumentsForErrorRecovery(AnalyzedA
{
candidateType = parameterType;
}
- else if (!candidateType.Equals(parameterType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds))
+ else if (!candidateType.Equals(parameterType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// type mismatch
candidateType = null;
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
index 3f674b83e0ec9..fac79146f0a33 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
@@ -2263,7 +2263,7 @@ internal bool IsMoveableVariable(BoundExpression expr, out Symbol accessedLocalO
// is not a fixed size buffer expression, or if the expression is a fixed size buffer
// member_access of the form E.I and E is a fixed variable
BoundExpression underlyingExpr = ((BoundPointerElementAccess)expr).Expression;
- if (underlyingExpr is BoundFieldAccess fieldAccess && fieldAccess.FieldSymbol.IsFixed)
+ if (underlyingExpr is BoundFieldAccess fieldAccess && fieldAccess.FieldSymbol.IsFixedSizeBuffer)
{
expr = fieldAccess.ReceiverOpt;
continue;
diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
index 5c4e2aedb3eb5..4a8ff5348bebf 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
@@ -1105,7 +1105,7 @@ private bool IsValidFixedVariableInitializer(TypeSymbol declType, SourceLocalSym
case BoundKind.FieldAccess:
var fa = (BoundFieldAccess)initializerOpt;
- if (fa.FieldSymbol.IsFixed)
+ if (fa.FieldSymbol.IsFixedSizeBuffer)
{
elementType = ((PointerTypeSymbol)fa.Type).PointedAtType.TypeSymbol;
break;
@@ -1517,6 +1517,11 @@ internal static bool AccessingAutoPropertyFromConstructor(BoundPropertyAccess pr
private static bool AccessingAutoPropertyFromConstructor(BoundExpression receiver, PropertySymbol propertySymbol, Symbol fromMember)
{
+ if (!propertySymbol.IsDefinition && propertySymbol.ContainingType.Equals(propertySymbol.ContainingType.OriginalDefinition, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
+ {
+ propertySymbol = propertySymbol.OriginalDefinition;
+ }
+
var sourceProperty = propertySymbol as SourcePropertySymbol;
var propertyIsStatic = propertySymbol.IsStatic;
diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/BestTypeInferrer.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/BestTypeInferrer.cs
index 691d1d631dd0c..9895cb4b544ac 100644
--- a/src/Compilers/CSharp/Portable/Binder/Semantics/BestTypeInferrer.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Semantics/BestTypeInferrer.cs
@@ -63,7 +63,7 @@ public static TypeSymbol InferBestType(
// SPEC: If no such S exists, the expressions have no best common type.
// All non-null types are candidates for best type inference.
- IEqualityComparer comparer = conversions.IncludeNullability ? TypeSymbol.EqualsIncludingNullableComparer : TypeSymbol.EqualsConsiderEverything;
+ IEqualityComparer comparer = conversions.IncludeNullability ? TypeSymbol.EqualsConsiderEverything : TypeSymbol.EqualsIgnoringNullableComparer;
HashSet candidateTypes = new HashSet(comparer);
foreach (BoundExpression expr in exprs)
{
@@ -201,7 +201,7 @@ internal static TypeSymbol GetBestType(
}
else
{
- if (!better.Equals(best, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ if (!better.Equals(best, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
hadNullabilityMismatch = false;
}
@@ -224,7 +224,7 @@ internal static TypeSymbol GetBestType(
{
TypeSymbol type = types[i];
TypeSymbol better = Better(best, type, conversions, out bool hadMismatch, ref useSiteDiagnostics);
- if (!best.Equals(better, TypeCompareKind.ConsiderEverything))
+ if (!best.Equals(better, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
hadNullabilityMismatch = false;
return null;
@@ -275,7 +275,7 @@ private static TypeSymbol Better(
return type2;
}
- if (type1.Equals(type2, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ if (type1.Equals(type2, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
return MethodTypeInferrer.Merge(
TypeSymbolWithAnnotations.Create(type1),
diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
index 400337420c5ce..c21ae19ebfd58 100644
--- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
@@ -1379,7 +1379,7 @@ private static bool HasIdentityConversionInternal(TypeSymbol type1, TypeSymbol t
Debug.Assert((object)type2 != null);
var compareKind = includeNullability ?
- TypeCompareKind.AllIgnoreOptions | TypeCompareKind.CompareNullableModifiersForReferenceTypes | TypeCompareKind.UnknownNullableModifierMatchesAny :
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes :
TypeCompareKind.AllIgnoreOptions;
return type1.Equals(type2, compareKind);
}
diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MethodTypeInference.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MethodTypeInference.cs
index 9a437199b774f..37de9b74f51e3 100644
--- a/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MethodTypeInference.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MethodTypeInference.cs
@@ -2337,7 +2337,7 @@ private bool Fix(int iParam, ref bool hadNullabilityMismatch, ref HashSet(EqualsIgnoringDynamicAndTupleNamesComparer.Instance);
+ var candidates = new Dictionary(EqualsIgnoringDynamicTupleNamesAndNullabilityComparer.Instance);
// Optimization: if we have one exact bound then we need not add any
// inexact bounds; we're just going to remove them anyway.
@@ -2430,7 +2430,7 @@ private static TypeSymbolWithAnnotations Fix(
{
foreach (var candidate2 in initialCandidates)
{
- if (!candidate.Equals(candidate2, TypeCompareKind.CompareNullableModifiersForReferenceTypes) &&
+ if (!candidate.Equals(candidate2, TypeCompareKind.ConsiderEverything) &&
!ImplicitConversionExists(candidate2, candidate, ref useSiteDiagnostics, conversions.WithNullability(false)))
{
goto OuterBreak;
@@ -2443,7 +2443,7 @@ private static TypeSymbolWithAnnotations Fix(
}
else
{
- Debug.Assert(!best.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(!best.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
// best candidate is not unique
best = default;
break;
@@ -2630,7 +2630,7 @@ private TypeSymbolWithAnnotations InferReturnType(BoundExpression source, NamedT
{
for (int p = 0; p < anonymousFunction.ParameterCount; ++p)
{
- if (!anonymousFunction.ParameterType(p).TypeSymbol.Equals(fixedDelegateParameters[p].Type.TypeSymbol, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ if (!anonymousFunction.ParameterType(p).TypeSymbol.Equals(fixedDelegateParameters[p].Type.TypeSymbol, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
return default;
}
@@ -2823,7 +2823,7 @@ private static void AddOrMergeCandidate(
ref bool hadNullabilityMismatch)
{
Debug.Assert(conversions.IncludeNullability ||
- newCandidate.SetUnknownNullabilityForReferenceTypes().Equals(newCandidate, TypeCompareKind.CompareNullableModifiersForReferenceTypes));
+ newCandidate.SetUnknownNullabilityForReferenceTypes().Equals(newCandidate, TypeCompareKind.ConsiderEverything));
if (candidates.TryGetValue(newCandidate, out TypeSymbolWithAnnotations oldCandidate))
{
@@ -2852,7 +2852,7 @@ private static void MergeOrRemoveCandidates(
Debug.Assert(variance == VarianceKind.In || variance == VarianceKind.Out);
// SPEC: For each lower (upper) bound U of Xi all types to which there is not an
// SPEC: implicit conversion from (to) U are removed from the candidate set.
- var comparison = conversions.IncludeNullability ? TypeCompareKind.CompareNullableModifiersForReferenceTypes : TypeCompareKind.ConsiderEverything;
+ var comparison = conversions.IncludeNullability ? TypeCompareKind.ConsiderEverything : TypeCompareKind.IgnoreNullableModifiersForReferenceTypes;
foreach (var bound in bounds)
{
foreach (var candidate in initialCandidates)
@@ -2877,7 +2877,7 @@ private static void MergeOrRemoveCandidates(
{
candidates.Remove(candidate);
}
- else if (bound.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ else if (bound.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// SPEC: 4.7 The Dynamic Type
// Type inference (7.5.2) will prefer dynamic over object if both are candidates.
@@ -2928,9 +2928,9 @@ private static void MergeAndReplaceIfStillCandidate(
/// This is a comparer that ignores differences in dynamic-ness and tuple names.
/// But it has a special case for top-level object vs. dynamic for purpose of method type inference.
///
- private sealed class EqualsIgnoringDynamicAndTupleNamesComparer : EqualityComparer
+ private sealed class EqualsIgnoringDynamicTupleNamesAndNullabilityComparer : EqualityComparer
{
- internal static readonly EqualsIgnoringDynamicAndTupleNamesComparer Instance = new EqualsIgnoringDynamicAndTupleNamesComparer();
+ internal static readonly EqualsIgnoringDynamicTupleNamesAndNullabilityComparer Instance = new EqualsIgnoringDynamicTupleNamesAndNullabilityComparer();
public override int GetHashCode(TypeSymbolWithAnnotations obj)
{
@@ -2943,7 +2943,7 @@ public override bool Equals(TypeSymbolWithAnnotations x, TypeSymbolWithAnnotatio
// but dynamic and object are not considered equal for backwards compatibility.
if (x.IsDynamic() ^ y.IsDynamic()) { return false; }
- return x.Equals(y, TypeCompareKind.IgnoreDynamicAndTupleNames);
+ return x.Equals(y, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
}
}
}
diff --git a/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs b/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs
index 7bf33d7aa149f..74444f1c61160 100644
--- a/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs
+++ b/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs
@@ -185,7 +185,7 @@ private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundConstantPatte
private DecisionTree AddByValue(DecisionTree.ByValue byValue, BoundConstantPattern value, DecisionMaker makeDecision)
{
- Debug.Assert(value.Value.Type.Equals(byValue.Type, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(value.Value.Type.Equals(byValue.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
if (byValue.Default != null)
{
return AddByValue(byValue.Default, value, makeDecision);
@@ -277,7 +277,7 @@ private DecisionTree AddByValue(DecisionTree.ByType byType, BoundConstantPattern
var kvp = byType.TypeAndDecision[i];
var matchedType = kvp.Key;
var decision = kvp.Value;
- if (matchedType.Equals(value.Value.Type, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ if (matchedType.Equals(value.Value.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
forType = decision;
break;
@@ -354,7 +354,7 @@ private DecisionTree AddByType(DecisionTree decision, TypeSymbol type, DecisionM
DecisionTree result;
if (byValue.Default == null)
{
- if (byValue.Type.Equals(type, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ if (byValue.Type.Equals(type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
result = byValue.Default = makeDecision(byValue.Expression, byValue.Type);
}
@@ -421,7 +421,7 @@ private DecisionTree AddByType(DecisionTree.ByType byType, TypeSymbol type, Deci
if (byType.TypeAndDecision.Count != 0)
{
var lastTypeAndDecision = byType.TypeAndDecision.Last();
- if (lastTypeAndDecision.Key.Equals(type, TypeCompareKind.IgnoreDynamicAndTupleNames))
+ if (lastTypeAndDecision.Key.Equals(type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
result = Add(lastTypeAndDecision.Value, makeDecision);
}
diff --git a/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs b/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs
index e5780e1cdda50..ba1c3ad0eaad3 100644
--- a/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs
+++ b/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs
@@ -334,7 +334,7 @@ internal abstract class UnboundLambdaState
[PerformanceSensitive(
"https://github.com/dotnet/roslyn/issues/23582",
Constraint = "Avoid " + nameof(ConcurrentDictionary) + " which has a large default size, but this cache is normally small.")]
- private ImmutableDictionary _bindingCache = ImmutableDictionary.Empty.WithComparers(TypeSymbol.EqualsIncludingNullableComparer);
+ private ImmutableDictionary _bindingCache = ImmutableDictionary.Empty.WithComparers(TypeSymbol.EqualsConsiderEverything);
[PerformanceSensitive(
"https://github.com/dotnet/roslyn/issues/23582",
@@ -468,7 +468,7 @@ private BoundLambda ReallyBind(NamedTypeSymbol delegateType)
lambdaSymbol = returnInferenceLambda.Symbol;
var lambdaReturnType = lambdaSymbol.ReturnType;
if ((object)LambdaSymbol.InferenceFailureReturnType != lambdaReturnType.TypeSymbol &&
- lambdaReturnType.Equals(returnType, TypeCompareKind.CompareNullableModifiersForReferenceTypes) && lambdaSymbol.RefKind == refKind)
+ lambdaReturnType.Equals(returnType, TypeCompareKind.ConsiderEverything) && lambdaSymbol.RefKind == refKind)
{
lambdaBodyBinder = returnInferenceLambda.Binder;
block = returnInferenceLambda.Body;
@@ -663,7 +663,7 @@ public override bool Equals(object obj)
for (int i = 0; i < this.ParameterTypes.Length; i++)
{
- if (!other.ParameterTypes[i].Equals(this.ParameterTypes[i], TypeCompareKind.CompareNullableModifiersForReferenceTypes) ||
+ if (!other.ParameterTypes[i].Equals(this.ParameterTypes[i], TypeCompareKind.ConsiderEverything) ||
other.ParameterRefKinds[i] != this.ParameterRefKinds[i])
{
return false;
diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs
index b0b697474d60a..af42a145ccc77 100644
--- a/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs
+++ b/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs
@@ -531,7 +531,7 @@ private LocalDefinition EmitInstanceFieldAddress(BoundFieldAccess fieldAccess, A
// Both the buffer backing struct and its only field should be at the same location,
// so we could in theory just use address of the struct, but in some contexts that causes
// PEVerify errors because the struct has unexpected type. (Ex: struct& when int& is expected)
- if (field.IsFixed)
+ if (field.IsFixedSizeBuffer)
{
var fixedImpl = field.FixedImplementationType(_module);
var fixedElementField = fixedImpl.FixedElementField;
diff --git a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs
index f5fdea521a92c..aabfdffc21c4c 100644
--- a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs
+++ b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs
@@ -1010,7 +1010,7 @@ public override BoundNode VisitAssignmentOperator(BoundAssignmentOperator node)
internal static bool IsFixedBufferAssignmentToRefLocal(BoundExpression left, BoundExpression right, bool isRef)
=> isRef &&
right is BoundFieldAccess fieldAccess &&
- fieldAccess.FieldSymbol.IsFixed &&
+ fieldAccess.FieldSymbol.IsFixedSizeBuffer &&
left.Type.Equals(((PointerTypeSymbol)right.Type).PointedAtType.TypeSymbol, TypeCompareKind.AllIgnoreOptions);
// indirect assignment is assignment to a value referenced indirectly
diff --git a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
index aa2695bdfdfc7..cb0c3fde3b66d 100644
--- a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
+++ b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
@@ -540,7 +540,7 @@ private void CompileNamedType(NamedTypeSymbol containingType)
SetGlobalErrorIfTrue(constantValue == null || constantValue.IsBad);
}
- if (fieldSymbol.IsFixed && compilationState.Emitting)
+ if (fieldSymbol.IsFixedSizeBuffer && compilationState.Emitting)
{
// force the generation of implementation types for fixed-size buffers
TypeSymbol discarded = fieldSymbol.FixedImplementationType(compilationState.ModuleBuilderOpt);
diff --git a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs
index ec58ec40bc43e..e37394f5280b1 100644
--- a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs
+++ b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs
@@ -850,7 +850,7 @@ public bool Equals(TypeSymbol source, TypeSymbol other)
var visitedSource = (TypeSymbol)_matcher.Visit(source);
var visitedOther = (_deepTranslatorOpt != null) ? (TypeSymbol)_deepTranslatorOpt.Visit(other) : other;
- return visitedSource?.Equals(visitedOther, TypeCompareKind.IgnoreDynamicAndTupleNames) == true;
+ return visitedSource?.Equals(visitedOther, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) == true;
}
}
}
diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/FieldSymbolAdapter.cs b/src/Compilers/CSharp/Portable/Emitter/Model/FieldSymbolAdapter.cs
index 38151e94bc152..91c7bb7b84f91 100644
--- a/src/Compilers/CSharp/Portable/Emitter/Model/FieldSymbolAdapter.cs
+++ b/src/Compilers/CSharp/Portable/Emitter/Model/FieldSymbolAdapter.cs
@@ -22,7 +22,7 @@ Cci.ITypeReference Cci.IFieldReference.GetType(EmitContext context)
TypeSymbolWithAnnotations fieldType = this.Type;
var customModifiers = fieldType.CustomModifiers;
- var isFixed = this.IsFixed;
+ var isFixed = this.IsFixedSizeBuffer;
var implType = isFixed ? this.FixedImplementationType(moduleBeingBuilt) : fieldType.TypeSymbol;
var type = moduleBeingBuilt.Translate(implType,
syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNodeOpt,
diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs b/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs
index 3a60b1f639820..f316dc92b9c17 100644
--- a/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs
+++ b/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs
@@ -48,10 +48,7 @@ void Cci.IReference.Dispatch(Cci.MetadataVisitor visitor)
///
internal bool IsDefinitionOrDistinct()
{
- return this.IsDefinition ||
- !(this is NamedTypeSymbol namedTypeSymbol ?
- namedTypeSymbol.Equals(namedTypeSymbol.OriginalDefinition, TypeCompareKind.CompareNullableModifiersForReferenceTypes) :
- this.Equals(this.OriginalDefinition));
+ return this.IsDefinition || !this.Equals(this.OriginalDefinition);
}
IEnumerable Cci.IReference.GetAttributes(EmitContext context)
diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs
index aaf26b3171589..bca81cb3ac975 100644
--- a/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs
+++ b/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs
@@ -375,7 +375,7 @@ public static void Analyze(CSharpCompilation compilation, MethodSymbol member, B
walker.Free();
}
- if (member.NonNullTypes != null &&
+ if (member.NonNullTypes == true &&
compilation.LanguageVersion >= MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())
{
NullableWalker.Analyze(compilation, member, node, diagnostics);
@@ -771,7 +771,7 @@ protected override bool TryGetReceiverAndMember(BoundExpression expr, out BoundE
{
var fieldAccess = (BoundFieldAccess)expr;
var fieldSymbol = fieldAccess.FieldSymbol;
- if (fieldSymbol.IsStatic || fieldSymbol.IsFixed)
+ if (fieldSymbol.IsStatic || fieldSymbol.IsFixedSizeBuffer)
{
return false;
}
@@ -827,7 +827,7 @@ protected bool MayRequireTracking(BoundExpression receiverOpt, FieldSymbol field
(object)fieldSymbol != null && //simplifies calling pattern for events
receiverOpt != null &&
!fieldSymbol.IsStatic &&
- !fieldSymbol.IsFixed &&
+ !fieldSymbol.IsFixedSizeBuffer &&
receiverOpt.Kind != BoundKind.TypeExpression &&
MayRequireTrackingReceiverType(receiverOpt.Type) &&
!receiverOpt.Type.IsPrimitiveRecursiveStruct();
@@ -1885,7 +1885,7 @@ protected void CheckAssigned(BoundExpression expr, SyntaxNode node)
case BoundKind.FieldAccess:
var field = (BoundFieldAccess)expr;
var symbol = field.FieldSymbol;
- if (!symbol.IsFixed && MayRequireTracking(field.ReceiverOpt, symbol))
+ if (!symbol.IsFixedSizeBuffer && MayRequireTracking(field.ReceiverOpt, symbol))
{
CheckAssigned(expr, symbol, node);
}
@@ -2050,7 +2050,7 @@ public override BoundNode VisitFieldAccess(BoundFieldAccess node)
var result = base.VisitFieldAccess(node);
NoteRead(node.FieldSymbol);
- if (node.FieldSymbol.IsFixed && node.Syntax != null && !SyntaxFacts.IsFixedStatementExpression(node.Syntax))
+ if (node.FieldSymbol.IsFixedSizeBuffer && node.Syntax != null && !SyntaxFacts.IsFixedStatementExpression(node.Syntax))
{
Symbol receiver = UseNonFieldSymbolUnsafely(node.ReceiverOpt);
if ((object)receiver != null)
diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/EmptyStructTypeCache.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/EmptyStructTypeCache.cs
index cd59f17be5d39..a5677c4bbe0c6 100644
--- a/src/Compilers/CSharp/Portable/FlowAnalysis/EmptyStructTypeCache.cs
+++ b/src/Compilers/CSharp/Portable/FlowAnalysis/EmptyStructTypeCache.cs
@@ -175,7 +175,7 @@ private FieldSymbol GetActualInstanceField(Symbol member, NamedTypeSymbol type)
return null;
}
- return (field.IsFixed || ShouldIgnoreStructField(field, field.Type.TypeSymbol)) ? null : field.AsMember(type);
+ return (field.IsFixedSizeBuffer || ShouldIgnoreStructField(field, field.Type.TypeSymbol)) ? null : field.AsMember(type);
case SymbolKind.Event:
EventSymbol eventSymbol = (EventSymbol)member;
diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
index 097b93cd0a3bd..b31afaaa67013 100644
--- a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
+++ b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
@@ -333,7 +333,7 @@ protected override bool TryGetReceiverAndMember(BoundExpression expr, out BoundE
{
var fieldAccess = (BoundFieldAccess)expr;
var fieldSymbol = fieldAccess.FieldSymbol;
- if (fieldSymbol.IsStatic || fieldSymbol.IsFixed)
+ if (fieldSymbol.IsStatic || fieldSymbol.IsFixedSizeBuffer)
{
return false;
}
@@ -651,7 +651,7 @@ private void TrackNullableStateForAssignment(BoundExpression value, TypeSymbolWi
// }
// For now, we copy a limited set of BoundNode types that shouldn't contain cycles.
if ((value.Kind == BoundKind.ObjectCreationExpression || value.Kind == BoundKind.AnonymousObjectCreationExpression || value.Kind == BoundKind.DynamicObjectCreationExpression || targetType.TypeSymbol.IsAnonymousType) &&
- targetType.TypeSymbol.Equals(valueType.TypeSymbol, TypeCompareKind.ConsiderEverything)) // https://github.com/dotnet/roslyn/issues/29968 Allow assignment to base type.
+ targetType.TypeSymbol.Equals(valueType.TypeSymbol, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)) // https://github.com/dotnet/roslyn/issues/29968 Allow assignment to base type.
{
if (valueSlot > 0)
{
@@ -660,7 +660,7 @@ private void TrackNullableStateForAssignment(BoundExpression value, TypeSymbolWi
}
}
else if (EmptyStructTypeCache.IsTrackableStructType(targetType.TypeSymbol) &&
- targetType.TypeSymbol.Equals(valueType.TypeSymbol, TypeCompareKind.ConsiderEverything))
+ targetType.TypeSymbol.Equals(valueType.TypeSymbol, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
InheritNullableStateOfTrackableStruct(targetType.TypeSymbol, targetSlot, valueSlot, IsByRefTarget(targetSlot), slotWatermark: GetSlotWatermark());
}
@@ -1051,7 +1051,7 @@ private static bool AreCloseEnough(TypeSymbol typeA, TypeSymbol typeB)
bool canIgnoreType(TypeSymbol type) => (object)type.VisitType((t, unused1, unused2) => t.IsErrorType() || t.IsDynamic() || t.HasUseSiteError, (object)null) != null;
return canIgnoreType(typeA) ||
canIgnoreType(typeB) ||
- typeA.Equals(typeB, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames); // Ignore TupleElementNames (see https://github.com/dotnet/roslyn/issues/23651).
+ typeA.Equals(typeB, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames); // Ignore TupleElementNames (see https://github.com/dotnet/roslyn/issues/23651).
}
#endif
@@ -2846,7 +2846,7 @@ private static Symbol AsMemberOfType(NamedTypeSymbol containingType, Symbol symb
private static Symbol AsMemberOfTupleType(TupleTypeSymbol tupleType, Symbol symbol)
{
- if (symbol.ContainingType.Equals(tupleType, TypeCompareKind.CompareNullableModifiersForReferenceTypes))
+ if (symbol.ContainingType.Equals(tupleType))
{
return symbol;
}
@@ -4367,13 +4367,13 @@ private void CheckPossibleNullReceiver(BoundExpression receiverOpt)
private static bool IsNullabilityMismatch(TypeSymbolWithAnnotations type1, TypeSymbolWithAnnotations type2)
{
return type1.Equals(type2, TypeCompareKind.AllIgnoreOptions) &&
- !type1.Equals(type2, TypeCompareKind.AllIgnoreOptions | TypeCompareKind.CompareNullableModifiersForReferenceTypes | TypeCompareKind.UnknownNullableModifierMatchesAny);
+ !type1.Equals(type2, TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
}
private static bool IsNullabilityMismatch(TypeSymbol type1, TypeSymbol type2)
{
return type1.Equals(type2, TypeCompareKind.AllIgnoreOptions) &&
- !type1.Equals(type2, TypeCompareKind.AllIgnoreOptions | TypeCompareKind.CompareNullableModifiersForReferenceTypes | TypeCompareKind.UnknownNullableModifierMatchesAny);
+ !type1.Equals(type2, TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
}
private bool? InferResultNullabilityFromApplicableCandidates(ImmutableArray applicableMembers)
diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs
index 32db9a9042319..bed20ffa04b78 100644
--- a/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs
+++ b/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs
@@ -1775,7 +1775,7 @@ public override BoundNode VisitFieldAccess(BoundFieldAccess node)
private void VisitFieldAccessInternal(BoundExpression receiverOpt, FieldSymbol fieldSymbol)
{
bool asLvalue = (object)fieldSymbol != null &&
- (fieldSymbol.IsFixed ||
+ (fieldSymbol.IsFixedSizeBuffer ||
!fieldSymbol.IsStatic &&
fieldSymbol.ContainingType.TypeKind == TypeKind.Struct &&
receiverOpt != null &&
diff --git a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs
index 8f10678866700..9e4a18f355222 100644
--- a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs
@@ -92,7 +92,7 @@ internal AsyncMethodToStateMachineRewriter(
: null;
_dynamicFactory = new LoweredDynamicOperationFactory(F, methodOrdinal);
- _awaiterFields = new Dictionary(TypeSymbol.EqualsIgnoringDynamicAndTupleNamesComparer);
+ _awaiterFields = new Dictionary(TypeSymbol.EqualsIgnoringDynamicTupleNamesAndNullabilityComparer);
_nextAwaiterId = slotAllocatorOpt?.PreviousAwaiterSlotCount ?? 0;
}
diff --git a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs
index e91a51dc012ed..a5c7ec109a010 100644
--- a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs
@@ -589,6 +589,15 @@ public override BoundNode VisitReturnStatement(BoundReturnStatement node)
return UpdateStatement(builder, node.Update(node.RefKind, expression), substituteTemps: true);
}
+ public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node)
+ {
+ EnterStatement(node);
+
+ BoundSpillSequenceBuilder builder = null;
+ var expression = VisitExpression(ref builder, node.Expression);
+ return UpdateStatement(builder, node.Update(expression), substituteTemps: true);
+ }
+
#if DEBUG
public override BoundNode DefaultVisit(BoundNode node)
{
diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/ExpressionLambdaRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/ExpressionLambdaRewriter.cs
index a3e1a77b45683..65236d5964ae2 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/ExpressionLambdaRewriter.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/ExpressionLambdaRewriter.cs
@@ -113,7 +113,7 @@ internal static BoundNode RewriteLambda(BoundLambda node, TypeCompilationState c
{
var r = new ExpressionLambdaRewriter(compilationState, typeMap, node.Syntax, recursionDepth, diagnostics);
var result = r.VisitLambdaInternal(node);
- if (node.Type != result.Type)
+ if (!node.Type.Equals(result.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, node.Syntax.Location, r.ExpressionType, "Lambda");
}
diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs
index caf896e29d44b..b9ec618b3d71a 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs
@@ -937,7 +937,7 @@ private ImmutableArray SubstituteTypeArguments(Immuta
// https://github.com/dotnet/roslyn/issues/30069 Is this weaker assert sufficient?
//Debug.Assert((object)oldTypeArg == newTypeArg);
- Debug.Assert(oldTypeArg.Equals(newTypeArg, TypeCompareKind.CompareNullableModifiersForReferenceTypes | TypeCompareKind.UnknownNullableModifierMatchesAny));
+ Debug.Assert(oldTypeArg.Equals(newTypeArg, TypeCompareKind.UnknownNullableModifierMatchesAny));
builder.Add(newTypeArg);
}
diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs
index 378bf70199890..e664171430cb3 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs
@@ -187,7 +187,7 @@ private BoundExpression VisitExpressionImpl(BoundExpression node)
// Dynamic type will be erased in emit phase. It is considered equivalent to Object in lowered bound trees.
// Unused deconstructions are lowered to produce a return value that isn't a tuple type.
Debug.Assert(visited == null || visited.HasErrors || ReferenceEquals(visited.Type, node.Type) ||
- visited.Type.Equals(node.Type, TypeCompareKind.IgnoreDynamicAndTupleNames) ||
+ visited.Type.Equals(node.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) ||
IsUnusedDeconstruction(node));
if (visited != null && visited != node)
diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
index 2d402b94e2f77..a5d4bec52a19b 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
@@ -30,7 +30,7 @@ public override BoundNode VisitConversion(BoundConversion node)
var result = MakeConversionNode(node, node.Syntax, rewrittenOperand, node.Conversion, node.Checked, node.ExplicitCastInCode, node.ConstantValue, rewrittenType);
var toType = node.Type;
- Debug.Assert(result.Type.Equals(toType, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(result.Type.Equals(toType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
// 4.1.6 C# spec: To force a value of a floating point type to the exact precision of its type, an explicit cast can be used.
// It means that explicit casts to (double) or (float) should be preserved on the node.
@@ -241,7 +241,7 @@ private BoundExpression MakeConversionNode(
{
// we keep tuple literal conversions in the tree for the purpose of semantic model (for example when they are casts in the source)
// for the purpose of lowering/codegeneration they are identity conversions.
- Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
return rewrittenOperand;
}
diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Field.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Field.cs
index 224a821c32b85..bb0af1ed10825 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Field.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Field.cs
@@ -31,7 +31,7 @@ private BoundExpression MakeFieldAccess(
oldNodeOpt.Update(rewrittenReceiver, fieldSymbol, constantValueOpt, resultKind, type) :
new BoundFieldAccess(syntax, rewrittenReceiver, fieldSymbol, constantValueOpt, resultKind, type);
- if (fieldSymbol.IsFixed)
+ if (fieldSymbol.IsFixedSizeBuffer)
{
// a reference to a fixed buffer is translated into its address
result = new BoundAddressOfOperator(syntax, result, type, false);
diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_NullCoalescingOperator.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_NullCoalescingOperator.cs
index 639e0e6311094..13fbc77e938a2 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_NullCoalescingOperator.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_NullCoalescingOperator.cs
@@ -31,7 +31,7 @@ private BoundExpression MakeNullCoalescingOperator(
Debug.Assert(rewrittenRight != null);
Debug.Assert(leftConversion.IsValid);
Debug.Assert((object)rewrittenResultType != null);
- Debug.Assert(rewrittenRight.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(rewrittenRight.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
if (_inExpressionLambda)
{
@@ -143,7 +143,7 @@ private BoundExpression MakeNullCoalescingOperator(
// MakeConversion(temp, rewrittenResultType)
BoundExpression convertedLeft = GetConvertedLeftForNullCoalescingOperator(boundTemp, leftConversion, rewrittenResultType);
- Debug.Assert(convertedLeft.HasErrors || convertedLeft.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(convertedLeft.HasErrors || convertedLeft.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
// (temp != null) ? MakeConversion(temp, LeftConversion) : RightOperand
BoundExpression conditionalExpression = RewriteConditionalOperator(
@@ -156,7 +156,7 @@ private BoundExpression MakeNullCoalescingOperator(
isRef: false);
Debug.Assert(conditionalExpression.ConstantValue == null); // we shouldn't have hit this else case otherwise
- Debug.Assert(conditionalExpression.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(conditionalExpression.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
return new BoundSequence(
syntax: syntax,
diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PointerElementAccess.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PointerElementAccess.cs
index 48cb147be083f..b9a409a85f04e 100644
--- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PointerElementAccess.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PointerElementAccess.cs
@@ -16,7 +16,7 @@ public override BoundNode VisitPointerElementAccess(BoundPointerElementAccess no
private BoundExpression LowerReceiverOfPointerElementAccess(BoundExpression receiver)
{
- if (receiver is BoundFieldAccess fieldAccess && fieldAccess.FieldSymbol.IsFixed)
+ if (receiver is BoundFieldAccess fieldAccess && fieldAccess.FieldSymbol.IsFixedSizeBuffer)
{
var loweredFieldReceiver = VisitExpression(fieldAccess.ReceiverOpt);
fieldAccess = fieldAccess.Update(loweredFieldReceiver, fieldAccess.FieldSymbol, fieldAccess.ConstantValueOpt, fieldAccess.ResultKind, fieldAccess.Type);
diff --git a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs
index e9de055560733..b965b16b19106 100644
--- a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs
@@ -452,7 +452,7 @@ private void FreeReusableHoistedField(StateMachineFieldSymbol field)
{
if (_lazyAvailableReusableHoistedFields == null)
{
- _lazyAvailableReusableHoistedFields = new Dictionary>(TypeSymbol.EqualsIgnoringDynamicAndTupleNamesComparer);
+ _lazyAvailableReusableHoistedFields = new Dictionary>(TypeSymbol.EqualsIgnoringDynamicTupleNamesAndNullabilityComparer);
}
_lazyAvailableReusableHoistedFields.Add(field.Type.TypeSymbol, fields = new ArrayBuilder());
diff --git a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
index 5e42dfa48723b..80ec461ae3850 100644
--- a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
@@ -670,7 +670,7 @@ public BoundExpression ComplexConditionalReceiver(BoundExpression valueTypeRecei
public BoundExpression Coalesce(BoundExpression left, BoundExpression right)
{
- Debug.Assert(left.Type.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds));
+ Debug.Assert(left.Type.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
Debug.Assert(left.Type.IsReferenceType);
return new BoundNullCoalescingOperator(Syntax, left, right, Conversion.Identity, BoundNullCoalescingOperatorResultKind.LeftType, left.Type) { WasCompilerGenerated = true };
diff --git a/src/Compilers/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.csproj b/src/Compilers/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.csproj
index 68eed022cf446..e17fce94e4be9 100644
--- a/src/Compilers/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.csproj
+++ b/src/Compilers/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.csproj
@@ -7,7 +7,7 @@
Library
Microsoft.CodeAnalysis.CSharp
true
- netstandard1.3
+ netstandard2.0
..\CSharpCodeAnalysisRules.ruleset
true
@@ -19,10 +19,8 @@
-
+
-
-
diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
index 2baf5159cb080..c1733fcb9ae36 100644
--- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
@@ -1188,7 +1188,7 @@ private ICoalesceOperation CreateBoundNullCoalescingOperatorOperation(BoundNullC
Conversion valueConversion = boundNullCoalescingOperator.LeftConversion;
if (valueConversion.Exists && !valueConversion.IsIdentity &&
- boundNullCoalescingOperator.Type.Equals(boundNullCoalescingOperator.LeftOperand.Type?.StrippedType(), TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds))
+ boundNullCoalescingOperator.Type.Equals(boundNullCoalescingOperator.LeftOperand.Type?.StrippedType(), TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
valueConversion = Conversion.Identity;
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/ArrayTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/ArrayTypeSymbol.cs
index e55316b75fc3d..7ca8893987b84 100644
--- a/src/Compilers/CSharp/Portable/Symbols/ArrayTypeSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/ArrayTypeSymbol.cs
@@ -406,7 +406,7 @@ internal override TypeSymbol SetUnknownNullabilityForReferenceTypes()
internal override TypeSymbol MergeNullability(TypeSymbol other, VarianceKind variance, out bool hadNullabilityMismatch)
{
- Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
TypeSymbolWithAnnotations elementType = ElementType.MergeNullability(((ArrayTypeSymbol)other).ElementType, VarianceKind.None, out hadNullabilityMismatch);
return WithElementType(elementType);
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs b/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs
index db855f0948726..a76ddfdace1ca 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs
@@ -1076,7 +1076,7 @@ protected override bool MatchTypeToTypeId(TypeSymbol type, int typeId)
return true;
}
- return type == type.OriginalDefinition;
+ return type.Equals(type.OriginalDefinition, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
}
return false;
@@ -1097,7 +1097,7 @@ protected override bool MatchTypeToTypeId(TypeSymbol type, int typeId)
WellKnownType wellKnownId = (WellKnownType)typeId;
if (wellKnownId.IsWellKnownType())
{
- return (type == _compilation.GetWellKnownType(wellKnownId));
+ return type.Equals(_compilation.GetWellKnownType(wellKnownId), TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
}
return base.MatchTypeToTypeId(type, typeId);
diff --git a/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs b/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs
index f24187bcf5201..74ef5b90fc132 100644
--- a/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs
@@ -689,7 +689,7 @@ private static bool HasDuplicateInterfaces(NamedTypeSymbol type, ConsList
- public virtual bool IsFixed { get { return false; } }
+ public virtual bool IsFixedSizeBuffer { get { return false; } }
///
- /// If IsFixed is true, the value between brackets in the fixed-size-buffer declaration.
- /// If IsFixed is false FixedSize is 0.
+ /// If IsFixedSizeBuffer is true, the value between brackets in the fixed-size-buffer declaration.
+ /// If IsFixedSizeBuffer is false FixedSize is 0.
/// Note that for fixed-a size buffer declaration, this.Type will be a pointer type, of which
/// the pointed-to type will be the declared element type of the fixed-size buffer.
///
public virtual int FixedSize { get { return 0; } }
///
- /// If this.IsFixed is true, returns the underlying implementation type for the
+ /// If this.IsFixedSizeBuffer is true, returns the underlying implementation type for the
/// fixed-size buffer when emitted. Otherwise returns null.
///
internal virtual NamedTypeSymbol FixedImplementationType(PEModuleBuilder emitModule)
diff --git a/src/Compilers/CSharp/Portable/Symbols/MemberSignatureComparer.cs b/src/Compilers/CSharp/Portable/Symbols/MemberSignatureComparer.cs
index 85a5b608eb6f1..d36812bdbe684 100644
--- a/src/Compilers/CSharp/Portable/Symbols/MemberSignatureComparer.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/MemberSignatureComparer.cs
@@ -44,7 +44,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerRefKindDifferences: true,
considerCallingConvention: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// Same as except that it specially treats nullable types.
@@ -56,7 +56,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerRefKindDifferences: true,
considerCallingConvention: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames,
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames,
useSpecialHandlingForNullableTypes: true);
///
@@ -79,7 +79,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false, // constraints are checked by caller instead
considerCallingConvention: true,
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// This instance is used as a fallback when it is determined that one member does not implicitly implement
@@ -93,7 +93,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false,
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames); //shouldn't actually matter for source members
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames); //shouldn't actually matter for source members
///
/// This instance is used to determine if two C# member declarations in source conflict with each other.
@@ -110,7 +110,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false,
considerRefKindDifferences: false,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames); //shouldn't actually matter for source members
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames); //shouldn't actually matter for source members
///
/// This instance is used to determine if a partial method implementation matches the definition.
@@ -123,7 +123,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false,
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// This instance is used to check whether one member overrides another, according to the C# definition.
@@ -135,7 +135,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// Same as except that it specially treats nullable types.
@@ -147,7 +147,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames,
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames,
useSpecialHandlingForNullableTypes: true);
///
@@ -161,7 +161,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: false,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamic);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamic);
///
/// This instance checks whether two signatures match excluding tuples names, in both return type and parameters.
@@ -174,7 +174,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: false,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// This instance is used to check whether one property or event overrides another, according to the C# definition.
@@ -188,7 +188,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// Same as except that it pays attention to custom modifiers and return type.
@@ -202,7 +202,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
///
/// Same as except that it specially treats nullable types.
@@ -214,7 +214,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames,
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes,
useSpecialHandlingForNullableTypes: true);
///
@@ -228,7 +228,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: false,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
///
/// This instance is intended to reflect the definition of signature equality used by the runtime
@@ -243,7 +243,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: true,
considerRefKindDifferences: false,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
///
/// Same as , but distinguishes between ref and out. During override resolution,
@@ -257,7 +257,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: true,
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
///
/// This instance is the same as RuntimeSignatureComparer.
@@ -270,7 +270,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false, // constraints are checked by caller instead
considerCallingConvention: true,
considerRefKindDifferences: false,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
// NOTE: Not used anywhere. Do we still need to keep it?
///
@@ -284,7 +284,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: true,
considerCallingConvention: true,
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
///
/// This instance is used to search for members that have identical signatures in every regard.
@@ -296,7 +296,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: true,
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames); //if it was a true explicit impl, we expect it to remain so after retargeting
+ typeComparison: TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes); //if it was a true explicit impl, we expect it to remain so after retargeting
///
/// This instance is used for performing approximate overload resolution of documentation
@@ -309,7 +309,7 @@ internal class MemberSignatureComparer : IEqualityComparer
considerTypeConstraints: false,
considerCallingConvention: false, //ignore static-ness
considerRefKindDifferences: true,
- typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamicAndTupleNames);
+ typeComparison: TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames);
// Compare the "unqualified" part of the member name (no explicit part)
private readonly bool _considerName;
@@ -512,7 +512,7 @@ public int GetHashCode(Symbol member)
}
if (_considerReturnType && member.GetMemberArity() == 0 &&
- (_typeComparison & TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds) == 0) // If it is generic, then type argument might be in return type.
+ (_typeComparison & TypeCompareKind.AllIgnoreOptions) == 0) // If it is generic, then type argument might be in return type.
{
hash = Hash.Combine(member.GetTypeOrReturnType().GetHashCode(), hash);
}
@@ -638,7 +638,7 @@ public static bool HaveSameConstraints(TypeParameterSymbol typeParameter1, TypeM
return false;
}
- return HaveSameTypeConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2, TypeSymbol.EqualsIgnoringDynamicAndTupleNamesComparer);
+ return HaveSameTypeConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2, TypeSymbol.EqualsIgnoringDynamicTupleNamesAndNullabilityComparer);
}
private static bool HaveSameTypeConstraints(TypeParameterSymbol typeParameter1, TypeMap typeMap1, TypeParameterSymbol typeParameter2, TypeMap typeMap2, EqualityComparer comparer)
diff --git a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/MetadataDecoder.cs b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/MetadataDecoder.cs
index d582ed8bbb64d..20efc3c035c76 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/MetadataDecoder.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/MetadataDecoder.cs
@@ -515,8 +515,8 @@ internal override Symbol GetSymbolForMemberRef(MemberReferenceHandle memberRef,
HashSet useSiteDiagnostics = null;
if (scope != targetTypeSymbol &&
!(targetTypeSymbol.IsInterfaceType()
- ? scope.AllInterfacesNoUseSiteDiagnostics.Contains((NamedTypeSymbol)targetTypeSymbol)
- : scope.IsDerivedFrom(targetTypeSymbol, TypeCompareKind.ConsiderEverything, useSiteDiagnostics: ref useSiteDiagnostics)))
+ ? scope.AllInterfacesNoUseSiteDiagnostics.IndexOf((NamedTypeSymbol)targetTypeSymbol, 0, TypeSymbol.EqualsIgnoringNullableComparer) != -1
+ : scope.IsDerivedFrom(targetTypeSymbol, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes, useSiteDiagnostics: ref useSiteDiagnostics)))
{
return null;
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs
index c6f59804d5a6f..9cfe239476a88 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs
@@ -273,7 +273,7 @@ internal override TypeSymbolWithAnnotations GetFieldType(ConsList f
return _lazyType.ToType();
}
- public override bool IsFixed
+ public override bool IsFixedSizeBuffer
{
get
{
diff --git a/src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs
index 2c8eff92257ff..db8d6cb9f5375 100644
--- a/src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs
@@ -684,7 +684,7 @@ internal override bool Equals(TypeSymbol t2, TypeCompareKind comparison)
}
if ((thisIsOriginalDefinition || otherIsOriginalDefinition) &&
- (comparison & (TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.CompareNullableModifiersForReferenceTypes)) == TypeCompareKind.CompareNullableModifiersForReferenceTypes)
+ (comparison & (TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.AllNullableIgnoreOptions)) == 0)
{
return false;
}
@@ -733,7 +733,7 @@ private bool EqualsComplicatedCases(NamedTypeSymbol other, TypeCompareKind compa
}
if ((thisIsNotConstructed || otherIsNotConstructed) &&
- (comparison & (TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.CompareNullableModifiersForReferenceTypes)) == TypeCompareKind.CompareNullableModifiersForReferenceTypes)
+ (comparison & (TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.AllNullableIgnoreOptions)) == 0)
{
return false;
}
@@ -849,7 +849,7 @@ internal override TypeSymbol SetUnknownNullabilityForReferenceTypes()
internal override TypeSymbol MergeNullability(TypeSymbol other, VarianceKind variance, out bool hadNullabilityMismatch)
{
- Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
if (!IsGenericType)
{
@@ -892,7 +892,7 @@ private static bool MergeTypeArgumentNullability(
out bool hadNullabilityMismatch)
{
Debug.Assert(typeA.IsGenericType);
- Debug.Assert(typeA.Equals(typeB, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(typeA.Equals(typeB, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
hadNullabilityMismatch = false;
diff --git a/src/Compilers/CSharp/Portable/Symbols/PointerTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/PointerTypeSymbol.cs
index da043006d9000..cabc47f1402da 100644
--- a/src/Compilers/CSharp/Portable/Symbols/PointerTypeSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/PointerTypeSymbol.cs
@@ -276,7 +276,7 @@ internal override TypeSymbol SetUnknownNullabilityForReferenceTypes()
internal override TypeSymbol MergeNullability(TypeSymbol other, VarianceKind variance, out bool hadNullabilityMismatch)
{
- Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
TypeSymbolWithAnnotations pointedAtType = PointedAtType.MergeNullability(((PointerTypeSymbol)other).PointedAtType, VarianceKind.None, out hadNullabilityMismatch);
return WithPointedAtType(pointedAtType);
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs b/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs
index 94bd4c929af47..5658a163d6df3 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs
@@ -78,7 +78,7 @@ internal static TypeSymbol CopyTypeCustomModifiers(TypeSymbol sourceType, TypeSy
TypeSymbol typeWithDynamic = DynamicTypeDecoder.TransformTypeWithoutCustomModifierFlags(sourceType, containingAssembly, refKind, flags);
TypeSymbol resultType;
- if (destinationType.ContainsTuple() && !sourceType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamic))
+ if (destinationType.ContainsTuple() && !sourceType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamic))
{
// We also preserve tuple names, if present and different
ImmutableArray names = CSharpCompilation.TupleNamesEncoder.Encode(destinationType);
@@ -101,10 +101,10 @@ internal static TypeSymbol CopyTypeCustomModifiers(TypeSymbol sourceType, TypeSy
bool transformResult = resultType.ApplyNullableTransforms(flagsBuilder.ToImmutableAndFree(), nonNullTypesContext, ref position, out resultType);
Debug.Assert(transformResult && position == length);
- Debug.Assert(resultType.Equals(sourceType, TypeCompareKind.IgnoreDynamicAndTupleNames)); // Same custom modifiers as source type.
- // Note: We would want to check nullability, but that would pull on NonNullTypes too early (ie. cause cycles).
+ Debug.Assert(resultType.Equals(sourceType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); // Same custom modifiers as source type.
+
Debug.Assert(resultType.Equals(destinationType,
- TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds)); // Same object/dynamic and tuple names as destination type.
+ TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); // Same object/dynamic and tuple names as destination type.
return resultType;
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/FieldSymbolWithAttributesAndModifiers.cs b/src/Compilers/CSharp/Portable/Symbols/Source/FieldSymbolWithAttributesAndModifiers.cs
index 962a644fc8afd..b7b5420157e53 100755
--- a/src/Compilers/CSharp/Portable/Symbols/Source/FieldSymbolWithAttributesAndModifiers.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/FieldSymbolWithAttributesAndModifiers.cs
@@ -54,7 +54,7 @@ public sealed override bool IsConst
public sealed override bool IsVolatile
=> (Modifiers & DeclarationModifiers.Volatile) != 0;
- public sealed override bool IsFixed
+ public sealed override bool IsFixedSizeBuffer
=> (Modifiers & DeclarationModifiers.Fixed) != 0;
///
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEnumConstantSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEnumConstantSymbol.cs
index 13df4f1b43453..9bed9037874ee 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEnumConstantSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEnumConstantSymbol.cs
@@ -111,7 +111,7 @@ internal sealed override void ForceComplete(SourceLocation locationOpt, Cancella
break;
case CompletionPart.FixedSize:
- Debug.Assert(!this.IsFixed);
+ Debug.Assert(!this.IsFixedSizeBuffer);
state.NotePartComplete(CompletionPart.FixedSize);
break;
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs
index 3d2e602e62d41..5a12942208cf9 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs
@@ -568,7 +568,7 @@ protected static void CopyEventCustomModifiers(EventSymbol eventWithCustomModifi
// We do an extra check before copying the type to handle the case where the overriding
// event (incorrectly) has a different type than the overridden event. In such cases,
// we want to retain the original (incorrect) type to avoid hiding the type given in source.
- if (type.TypeSymbol.Equals(overriddenEventType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamic))
+ if (type.TypeSymbol.Equals(overriddenEventType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamic))
{
type = type.WithTypeAndModifiers(CustomModifierUtils.CopyTypeCustomModifiers(overriddenEventType, type.TypeSymbol, containingAssembly, nonNullTypesContext),
eventWithCustomModifiers.Type.CustomModifiers);
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceFixedFieldSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceFixedFieldSymbol.cs
index 3c2c61c1bb632..a9c607679f9d7 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceFixedFieldSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceFixedFieldSymbol.cs
@@ -30,7 +30,7 @@ internal SourceFixedFieldSymbol(
{
// Checked in parser: a fixed field declaration requires a length in square brackets
- Debug.Assert(this.IsFixed);
+ Debug.Assert(this.IsFixedSizeBuffer);
}
internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder attributes)
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
index 3f637e54187ba..4a6edd640d076 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
@@ -596,7 +596,7 @@ private void NoteFieldDefinitions()
foreach (var member in _lazyMembersAndInitializers.NonTypeNonIndexerMembers)
{
FieldSymbol field;
- if (!member.IsFieldOrFieldLikeEvent(out field) || field.IsConst || field.IsFixed)
+ if (!member.IsFieldOrFieldLikeEvent(out field) || field.IsConst || field.IsFixedSizeBuffer)
{
continue;
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs
index 9a0e0a8417fdf..43bef68795f89 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs
@@ -730,9 +730,7 @@ private static void CheckOverrideMember(Symbol overridingMember, OverriddenOrHid
else if (((CSharpParseOptions)overridingMemberLocation.SourceTree?.Options)?.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes) == true &&
(compilation = overridingMember.DeclaringCompilation) != null &&
!overridingMemberType.Equals(overriddenProperty.Type,
- TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny))
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInTypeOnOverride, overridingMemberLocation);
}
@@ -776,9 +774,7 @@ private static void CheckOverrideMember(Symbol overridingMember, OverriddenOrHid
else if (((CSharpParseOptions)overridingMemberLocation.SourceTree?.Options)?.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes) == true &&
(compilation = overridingMember.DeclaringCompilation) != null &&
!overridingMemberType.Equals(overriddenEvent.Type,
- TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny))
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInTypeOnOverride, overridingMemberLocation);
}
@@ -813,9 +809,7 @@ private static void CheckOverrideMember(Symbol overridingMember, OverriddenOrHid
!overridingMember.IsImplicitlyDeclared && !overridingMember.IsAccessor() &&
(compilation = overridingMember.DeclaringCompilation) != null &&
!overridingMethod.ReturnType.Equals(overriddenMethod.ReturnType,
- TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny))
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride, overridingMemberLocation);
}
@@ -842,9 +836,7 @@ private static void CheckOverrideMember(Symbol overridingMember, OverriddenOrHid
{
var overridenParameterType = overriddenParameters[i].Type;
if (!overridingParameters[i].Type.Equals(overridenParameterType,
- TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny) &&
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
overridingParameters[i].Type.Equals(overridenParameterType, TypeCompareKind.AllIgnoreOptions))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride, overridingMemberLocation, new FormattedSymbol(overridingParameters[i], SymbolDisplayFormat.ShortFormat));
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberFieldSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberFieldSymbol.cs
index 46648056971b3..a09913b3cbf2f 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberFieldSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberFieldSymbol.cs
@@ -124,7 +124,7 @@ public override int FixedSize
{
get
{
- Debug.Assert(!this.IsFixed, "Subclasses representing fixed fields must override");
+ Debug.Assert(!this.IsFixedSizeBuffer, "Subclasses representing fixed fields must override");
state.NotePartComplete(CompletionPart.FixedSize);
return 0;
}
@@ -267,7 +267,7 @@ internal sealed override void ForceComplete(SourceLocation locationOpt, Cancella
internal override NamedTypeSymbol FixedImplementationType(PEModuleBuilder emitModule)
{
- Debug.Assert(!this.IsFixed, "Subclasses representing fixed fields must override");
+ Debug.Assert(!this.IsFixedSizeBuffer, "Subclasses representing fixed fields must override");
return null;
}
}
@@ -487,7 +487,7 @@ internal sealed override TypeSymbolWithAnnotations GetFieldType(ConsList definitionParameters = definition.ConstructIfGeneric(implementation.TypeArguments).Parameters;
for (int i = 0; i < implementationParameters.Length; i++)
{
- if (!implementationParameters[i].Type.Equals(definitionParameters[i].Type, TypeCompareKind.AllIgnoreOptions | TypeCompareKind.CompareNullableModifiersForReferenceTypes) &&
+ if (!implementationParameters[i].Type.Equals(definitionParameters[i].Type, TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.AllNullableIgnoreOptions) &&
implementationParameters[i].Type.Equals(definitionParameters[i].Type, TypeCompareKind.AllIgnoreOptions))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial, implementation.Locations[0], new FormattedSymbol(implementationParameters[i], SymbolDisplayFormat.ShortFormat));
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs
index 1f57503d90e6b..6548d3f21cfa0 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs
@@ -271,7 +271,7 @@ private SourcePropertySymbol(
// We do an extra check before copying the type to handle the case where the overriding
// property (incorrectly) has a different type than the overridden property. In such cases,
// we want to retain the original (incorrect) type to avoid hiding the type given in source.
- if (type.TypeSymbol.Equals(overriddenPropertyType.TypeSymbol, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamic))
+ if (type.TypeSymbol.Equals(overriddenPropertyType.TypeSymbol, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamic))
{
type = type.WithTypeAndModifiers(
CustomModifierUtils.CopyTypeCustomModifiers(overriddenPropertyType.TypeSymbol, type.TypeSymbol, this.ContainingAssembly, nonNullTypesContext: this),
diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs
index 19d20d0f924ea..25d5d69be297c 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs
@@ -281,9 +281,11 @@ private void CheckUserDefinedConversionSignature(DiagnosticBag diagnostics)
// SPEC: Either S0 or T0 is the class or struct type in which the operator
// SPEC: declaration takes place.
- if (source0.TupleUnderlyingTypeOrSelf() != this.ContainingType && target0.TupleUnderlyingTypeOrSelf() != this.ContainingType &&
+ if (!source0.TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
+ !target0.TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
// allow conversion between T and Nullable in declaration of Nullable
- source != this.ContainingType && target != this.ContainingType)
+ !source.Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
+ !target.Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// CS0556: User-defined conversion must convert to or from the enclosing type
diagnostics.Add(ErrorCode.ERR_ConversionNotInvolvingContainedType, this.Locations[0]);
@@ -293,8 +295,8 @@ private void CheckUserDefinedConversionSignature(DiagnosticBag diagnostics)
// SPEC: * S0 and T0 are different types:
if ((ContainingType.SpecialType == SpecialType.System_Nullable_T)
- ? source.Equals(target, TypeCompareKind.IgnoreTupleNames)
- : source0.Equals(target0, TypeCompareKind.IgnoreTupleNames))
+ ? source.Equals(target, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)
+ : source0.Equals(target0, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// CS0555: User-defined operator cannot take an object of the enclosing type
// and convert to an object of the enclosing type
@@ -373,7 +375,7 @@ private void CheckUserDefinedConversionSignature(DiagnosticBag diagnostics)
TypeSymbol same;
TypeSymbol different;
- if (source0.Equals(this.ContainingType, TypeCompareKind.IgnoreTupleNames))
+ if (source0.Equals(this.ContainingType, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
same = source;
different = target;
@@ -394,12 +396,12 @@ private void CheckUserDefinedConversionSignature(DiagnosticBag diagnostics)
HashSet useSiteDiagnostics = null;
- if (same.IsDerivedFrom(different, TypeCompareKind.IgnoreTupleNames, useSiteDiagnostics: ref useSiteDiagnostics)) // tomat: ignoreDynamic should be true, but we don't want to introduce breaking change. See bug 605326.
+ if (same.IsDerivedFrom(different, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes, useSiteDiagnostics: ref useSiteDiagnostics)) // tomat: ignoreDynamic should be true, but we don't want to introduce breaking change. See bug 605326.
{
// '{0}': user-defined conversions to or from a base class are not allowed
diagnostics.Add(ErrorCode.ERR_ConversionWithBase, this.Locations[0], this);
}
- else if (different.IsDerivedFrom(same, TypeCompareKind.IgnoreTupleNames, useSiteDiagnostics: ref useSiteDiagnostics)) // tomat: ignoreDynamic should be true, but we don't want to introduce breaking change. See bug 605326.
+ else if (different.IsDerivedFrom(same, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes, useSiteDiagnostics: ref useSiteDiagnostics)) // tomat: ignoreDynamic should be true, but we don't want to introduce breaking change. See bug 605326.
{
// '{0}': user-defined conversions to or from a derived class are not allowed
diagnostics.Add(ErrorCode.ERR_ConversionWithDerived, this.Locations[0], this);
@@ -414,7 +416,7 @@ private void CheckUnarySignature(DiagnosticBag diagnostics)
// SPEC: A unary + - ! ~ operator must take a single parameter of type
// SPEC: T or T? and can return any type.
- if (this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf() != this.ContainingType)
+ if (!this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// The parameter of a unary operator must be the containing type
diagnostics.Add(ErrorCode.ERR_BadUnaryOperatorSignature, this.Locations[0]);
@@ -439,7 +441,7 @@ private void CheckTrueFalseSignature(DiagnosticBag diagnostics)
diagnostics.Add(ErrorCode.ERR_OpTFRetType, this.Locations[0]);
}
- if (this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf() != this.ContainingType)
+ if (!this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// The parameter of a unary operator must be the containing type
diagnostics.Add(ErrorCode.ERR_BadUnaryOperatorSignature, this.Locations[0]);
@@ -489,12 +491,12 @@ private void CheckIncrementDecrementSignature(DiagnosticBag diagnostics)
var parameterType = this.ParameterTypes[0].TypeSymbol;
HashSet useSiteDiagnostics = null;
- if (parameterType.StrippedType().TupleUnderlyingTypeOrSelf() != this.ContainingType)
+ if (!parameterType.StrippedType().TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// CS0559: The parameter type for ++ or -- operator must be the containing type
diagnostics.Add(ErrorCode.ERR_BadIncDecSignature, this.Locations[0]);
}
- else if (!this.ReturnType.TypeSymbol.EffectiveTypeNoUseSiteDiagnostics.IsEqualToOrDerivedFrom(parameterType, TypeCompareKind.IgnoreTupleNames, useSiteDiagnostics: ref useSiteDiagnostics))
+ else if (!this.ReturnType.TypeSymbol.EffectiveTypeNoUseSiteDiagnostics.IsEqualToOrDerivedFrom(parameterType, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes, useSiteDiagnostics: ref useSiteDiagnostics))
{
// CS0448: The return type for ++ or -- operator must match the parameter type
// or be derived from the parameter type
@@ -510,7 +512,7 @@ private void CheckShiftSignature(DiagnosticBag diagnostics)
// SPEC: of which must have type T or T? and the second of which must
// SPEC: have type int or int?, and can return any type.
- if (this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf() != this.ContainingType ||
+ if (!this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) ||
this.ParameterTypes[1].TypeSymbol.StrippedType().SpecialType != SpecialType.System_Int32)
{
// CS0546: The first operand of an overloaded shift operator must have the
@@ -531,8 +533,8 @@ private void CheckBinarySignature(DiagnosticBag diagnostics)
{
// SPEC: A binary nonshift operator must take two parameters, at least
// SPEC: one of which must have the type T or T?, and can return any type.
- if (this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf() != this.ContainingType &&
- this.ParameterTypes[1].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf() != this.ContainingType)
+ if (!this.ParameterTypes[0].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
+ !this.ParameterTypes[1].TypeSymbol.StrippedType().TupleUnderlyingTypeOrSelf().Equals(this.ContainingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
// CS0563: One of the parameters of a binary operator must be the containing type
diagnostics.Add(ErrorCode.ERR_BadBinaryOperatorSignature, this.Locations[0]);
diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedIntrinsicOperatorSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedIntrinsicOperatorSymbol.cs
index b0c4ef5dd7abc..033342ba5e29a 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedIntrinsicOperatorSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedIntrinsicOperatorSymbol.cs
@@ -18,17 +18,17 @@ internal sealed class SynthesizedIntrinsicOperatorSymbol : MethodSymbol
public SynthesizedIntrinsicOperatorSymbol(TypeSymbol leftType, string name, TypeSymbol rightType, TypeSymbol returnType, bool isCheckedBuiltin)
{
- if (leftType.Equals(rightType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds))
+ if (leftType.Equals(rightType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
_containingType = leftType;
}
- else if (rightType.Equals(returnType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds))
+ else if (rightType.Equals(returnType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
{
_containingType = rightType;
}
else
{
- Debug.Assert(leftType.Equals(returnType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds));
+ Debug.Assert(leftType.Equals(returnType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
_containingType = leftType;
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/Tuples/TupleTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Tuples/TupleTypeSymbol.cs
index 9ee50e5c14a80..13feaadca1d23 100644
--- a/src/Compilers/CSharp/Portable/Symbols/Tuples/TupleTypeSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/Tuples/TupleTypeSymbol.cs
@@ -1458,7 +1458,7 @@ internal override TypeSymbol SetUnknownNullabilityForReferenceTypes()
internal override TypeSymbol MergeNullability(TypeSymbol other, VarianceKind variance, out bool hadNullabilityMismatch)
{
- Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
var otherTuple = other as TupleTypeSymbol;
if (otherTuple is null)
{
diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs
index 80d165ab09c40..740c500f85406 100644
--- a/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs
@@ -684,7 +684,7 @@ internal override TypeSymbol SetUnknownNullabilityForReferenceTypes()
internal override TypeSymbol MergeNullability(TypeSymbol other, VarianceKind variance, out bool hadNullabilityMismatch)
{
- Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames));
+ Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
hadNullabilityMismatch = false;
return this;
}
diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs
index 24fcd1346d67d..b036fe1e073d7 100644
--- a/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs
@@ -108,20 +108,17 @@ private InterfaceInfo GetInterfaceInfo()
internal static readonly EqualityComparer EqualsIgnoringTupleNames = new TypeSymbolComparer(TypeCompareKind.IgnoreTupleNames);
+ internal static readonly EqualityComparer EqualsIgnoringTupleNamesAndNullability = new TypeSymbolComparer(TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
+
///
/// A comparer that treats dynamic and object as "the same" types, and also ignores tuple element names differences.
///
- internal static readonly EqualityComparer EqualsIgnoringDynamicAndTupleNamesComparer = new TypeSymbolComparer(TypeCompareKind.IgnoreDynamicAndTupleNames);
+ internal static readonly EqualityComparer EqualsIgnoringDynamicTupleNamesAndNullabilityComparer = new TypeSymbolComparer(TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
- ///
- /// A comparator that pays attention to nullable modifiers in addition to default behavior.
- ///
- internal static readonly EqualityComparer EqualsIncludingNullableComparer = new TypeSymbolComparer(TypeCompareKind.CompareNullableModifiersForReferenceTypes);
+ internal static readonly EqualityComparer EqualsIgnoringNullableComparer = new TypeSymbolComparer(TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
internal static readonly EqualityComparer EqualsAllIgnoreOptionsPlusNullableWithUnknownMatchesAnyComparer =
- new TypeSymbolComparer(TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny);
+ new TypeSymbolComparer(TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
///
/// The original definition of this symbol. If this symbol is constructed from another
@@ -360,7 +357,7 @@ protected virtual ImmutableArray GetAllInterfaces()
protected virtual ImmutableArray MakeAllInterfaces()
{
var result = ArrayBuilder.GetInstance();
- var visited = new HashSet(EqualsIgnoringTupleNames);
+ var visited = new HashSet(EqualsIgnoringTupleNamesAndNullability);
for (var baseType = this; !ReferenceEquals(baseType, null); baseType = baseType.BaseTypeNoUseSiteDiagnostics)
{
@@ -1161,9 +1158,7 @@ internal static void CheckNullableReferenceTypeMismatchOnImplementingMember(Symb
TypeSymbolWithAnnotations implementedMemberType = implementedMember.GetTypeOrReturnType();
if (!implementingMemberType.Equals(implementedMemberType,
- TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny) &&
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
implementingMemberType.Equals(implementedMemberType, TypeCompareKind.AllIgnoreOptions))
{
diagnostics.Add(implementingMember.Kind == SymbolKind.Method ?
@@ -1184,9 +1179,7 @@ internal static void CheckNullableReferenceTypeMismatchOnImplementingMember(Symb
var implementedParameterType = implementedParameters[i].Type;
if (!implementingParameters[i].Type.Equals(implementedParameterType,
- TypeCompareKind.AllIgnoreOptions |
- TypeCompareKind.CompareNullableModifiersForReferenceTypes |
- TypeCompareKind.UnknownNullableModifierMatchesAny) &&
+ TypeCompareKind.AllIgnoreOptions & ~TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) &&
implementingParameters[i].Type.Equals(implementedParameterType, TypeCompareKind.AllIgnoreOptions))
{
diagnostics.Add(isExplicit ?
diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeSymbolWithAnnotations.cs b/src/Compilers/CSharp/Portable/Symbols/TypeSymbolWithAnnotations.cs
index 723852d5e40d8..6aeec3bb73c28 100644
--- a/src/Compilers/CSharp/Portable/Symbols/TypeSymbolWithAnnotations.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/TypeSymbolWithAnnotations.cs
@@ -441,7 +441,7 @@ public bool Equals(TypeSymbolWithAnnotations other, TypeCompareKind comparison)
return false;
}
- if ((comparison & TypeCompareKind.CompareNullableModifiersForReferenceTypes) != 0)
+ if ((comparison & TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) == 0)
{
var thisIsNullable = IsNullable;
var otherIsNullable = other.IsNullable;
@@ -481,7 +481,7 @@ public override bool Equals(TypeSymbolWithAnnotations x, TypeSymbolWithAnnotatio
{
return y.IsNull;
}
- return x.Equals(y, TypeCompareKind.CompareNullableModifiersForReferenceTypes);
+ return x.Equals(y, TypeCompareKind.ConsiderEverything);
}
}
@@ -524,7 +524,7 @@ internal TypeSymbolWithAnnotations SubstituteTypeCore(AbstractTypeMap typeMap, b
Debug.Assert(newTypeWithModifiers.NonNullTypesContext.NonNullTypes == null);
Debug.Assert(newTypeWithModifiers.CustomModifiers.IsEmpty);
- if (typeSymbol.Equals(newTypeWithModifiers.TypeSymbol, TypeCompareKind.CompareNullableModifiersForReferenceTypes) &&
+ if (typeSymbol.Equals(newTypeWithModifiers.TypeSymbol, TypeCompareKind.ConsiderEverything) &&
newCustomModifiers == CustomModifiers)
{
return this; // substitution had no effect on the type or modifiers
@@ -770,7 +770,7 @@ public override int GetHashCode()
{
return 0;
}
- return Hash.Combine(TypeSymbol.GetHashCode(), IsAnnotated.GetHashCode());
+ return TypeSymbol.GetHashCode();
}
#pragma warning disable CS0809
@@ -1078,7 +1078,7 @@ internal override TypeSymbolWithAnnotations SubstituteType(TypeSymbolWithAnnotat
var newUnderlying = _underlying.SubstituteTypeCore(typeMap, withTupleUnification);
if (!newUnderlying.IsSameAs(this._underlying))
{
- if ((newUnderlying.TypeSymbol.Equals(this._underlying.TypeSymbol, TypeCompareKind.CompareNullableModifiersForReferenceTypes) ||
+ if ((newUnderlying.TypeSymbol.Equals(this._underlying.TypeSymbol, TypeCompareKind.ConsiderEverything) ||
newUnderlying.TypeSymbol is IndexedTypeParameterSymbolForOverriding) &&
newUnderlying.CustomModifiers.IsEmpty)
{
diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeUnification.cs b/src/Compilers/CSharp/Portable/Symbols/TypeUnification.cs
index 564414d9b2fbd..14b180383a9a8 100644
--- a/src/Compilers/CSharp/Portable/Symbols/TypeUnification.cs
+++ b/src/Compilers/CSharp/Portable/Symbols/TypeUnification.cs
@@ -28,7 +28,7 @@ public static bool CanUnify(TypeSymbol t1, TypeSymbol t2)
var substituted1 = SubstituteAllTypeParameters(substitution, TypeSymbolWithAnnotations.Create(t1));
var substituted2 = SubstituteAllTypeParameters(substitution, TypeSymbolWithAnnotations.Create(t2));
- Debug.Assert(substituted1.TypeSymbol.Equals(substituted2.TypeSymbol, TypeCompareKind.IgnoreTupleNames));
+ Debug.Assert(substituted1.TypeSymbol.Equals(substituted2.TypeSymbol, TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
Debug.Assert(substituted1.CustomModifiers.SequenceEqual(substituted2.CustomModifiers));
}
#endif
diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
index ccd1a1af876c9..161381872f3e8 100644
--- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
+++ b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
@@ -5041,7 +5041,7 @@ public class CS1698_a {}
CleanupAllGeneratedFiles(cs1698.Path);
}
- [Fact]
+ [ConditionalFact(typeof(ClrOnly), Reason="https://github.com/dotnet/roslyn/issues/30926")]
public void BinaryFileErrorTest()
{
var binaryPath = Temp.CreateFile().WriteAllBytes(TestResources.NetFX.v4_0_30319.mscorlib).Path;
@@ -9852,7 +9852,7 @@ public void MissingCompilerAssembly()
$"Could not load file or assembly '{typeof(ImmutableArray).Assembly.FullName}' or one of its dependencies. The system cannot find the file specified.",
result.Output.Trim());
}
-
+#if NET472
[ConditionalFact(typeof(WindowsDesktopOnly), typeof(IsEnglishLocal), Reason = "https://github.com/dotnet/roslyn/issues/30321")]
public void LoadingAnalyzerNetStandard13()
{
@@ -9860,7 +9860,7 @@ public void LoadingAnalyzerNetStandard13()
var srcFileName = "src.cs";
var analyzerDir = Temp.CreateDirectory();
- var analyzerFile = analyzerDir.CreateFile(analyzerFileName).WriteAllBytes(CreateCSharpAnalyzerNetStandard13(Path.GetFileNameWithoutExtension(analyzerFileName)));
+ var analyzerFile = analyzerDir.CreateFile(analyzerFileName).WriteAllBytes(DesktopTestHelpers.CreateCSharpAnalyzerNetStandard13(Path.GetFileNameWithoutExtension(analyzerFileName)));
var srcFile = analyzerDir.CreateFile(srcFileName).WriteAllText("public class C { }");
var result = ProcessUtilities.Run(s_CSharpCompilerExecutable, arguments: $"/nologo /t:library /analyzer:{analyzerFileName} {srcFileName}", workingDirectory: analyzerDir.Path);
@@ -9869,198 +9869,7 @@ public void LoadingAnalyzerNetStandard13()
Assert.Equal(0, result.ExitCode);
}
-
- private static ImmutableArray CreateCSharpAnalyzerNetStandard13(string analyzerAssemblyName)
- {
- var minSystemCollectionsImmutableSource = @"
-[assembly: System.Reflection.AssemblyVersion(""1.2.3.0"")]
-
-namespace System.Collections.Immutable
-{
- public struct ImmutableArray
- {
- }
-}
-";
-
- var minCodeAnalysisSource = @"
-using System;
-
-[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")]
-
-namespace Microsoft.CodeAnalysis.Diagnostics
-{
- [AttributeUsage(AttributeTargets.Class)]
- public sealed class DiagnosticAnalyzerAttribute : Attribute
- {
- public DiagnosticAnalyzerAttribute(string firstLanguage, params string[] additionalLanguages) {}
- }
-
- public abstract class DiagnosticAnalyzer
- {
- public abstract System.Collections.Immutable.ImmutableArray SupportedDiagnostics { get; }
- public abstract void Initialize(AnalysisContext context);
- }
-
- public abstract class AnalysisContext
- {
- }
-}
-
-namespace Microsoft.CodeAnalysis
-{
- public sealed class DiagnosticDescriptor
- {
- }
-}
-";
- var minSystemCollectionsImmutableImage = CSharpCompilation.Create(
- "System.Collections.Immutable",
- new[] { SyntaxFactory.ParseSyntaxTree(minSystemCollectionsImmutableSource) },
- new[] { MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime) },
- new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, cryptoPublicKey: TestResources.TestKeys.PublicKey_b03f5f7f11d50a3a)).EmitToArray();
-
- var minSystemCollectionsImmutableRef = MetadataReference.CreateFromImage(minSystemCollectionsImmutableImage);
-
- var minCodeAnalysisImage = CSharpCompilation.Create(
- "Microsoft.CodeAnalysis",
- new[] { SyntaxFactory.ParseSyntaxTree(minCodeAnalysisSource) },
- new[]
- {
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime),
- minSystemCollectionsImmutableRef
- },
- new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, cryptoPublicKey: TestResources.TestKeys.PublicKey_31bf3856ad364e35)).EmitToArray();
-
- var minCodeAnalysisRef = MetadataReference.CreateFromImage(minCodeAnalysisImage);
-
- var analyzerSource = @"
-using System;
-using System.Collections.ObjectModel;
-using System.Collections.Immutable;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.IO.Compression;
-using System.Net.Http;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
-using System.Security.AccessControl;
-using System.Security.Cryptography;
-using System.Security.Principal;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Xml;
-using System.Xml.Serialization;
-using System.Xml.XPath;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Diagnostics;
-using Microsoft.Win32.SafeHandles;
-
-[DiagnosticAnalyzer(""C#"")]
-public class TestAnalyzer : DiagnosticAnalyzer
-{
- public override ImmutableArray SupportedDiagnostics => throw new NotImplementedException(new[]
- {
- typeof(Win32Exception), // Microsoft.Win32.Primitives
- typeof(AppContext), // System.AppContext
- typeof(Console), // System.Console
- typeof(ValueTuple), // System.ValueTuple
- typeof(FileVersionInfo), // System.Diagnostics.FileVersionInfo
- typeof(Process), // System.Diagnostics.Process
- typeof(ChineseLunisolarCalendar), // System.Globalization.Calendars
- typeof(ZipArchive), // System.IO.Compression
- typeof(ZipFile), // System.IO.Compression.ZipFile
- typeof(FileOptions), // System.IO.FileSystem
- typeof(FileAttributes), // System.IO.FileSystem.Primitives
- typeof(HttpClient), // System.Net.Http
- typeof(AuthenticatedStream), // System.Net.Security
- typeof(IOControlCode), // System.Net.Sockets
- typeof(RuntimeInformation), // System.Runtime.InteropServices.RuntimeInformation
- typeof(SerializationException), // System.Runtime.Serialization.Primitives
- typeof(GenericIdentity), // System.Security.Claims
- typeof(Aes), // System.Security.Cryptography.Algorithms
- typeof(CspParameters), // System.Security.Cryptography.Csp
- typeof(AsnEncodedData), // System.Security.Cryptography.Encoding
- typeof(AsymmetricAlgorithm), // System.Security.Cryptography.Primitives
- typeof(SafeX509ChainHandle), // System.Security.Cryptography.X509Certificates
- typeof(IXmlLineInfo), // System.Xml.ReaderWriter
- typeof(XmlNode), // System.Xml.XmlDocument
- typeof(XPathDocument), // System.Xml.XPath
- typeof(XDocumentExtensions), // System.Xml.XPath.XDocument
- typeof(CodePagesEncodingProvider),// System.Text.Encoding.CodePages
- typeof(ValueTask<>), // System.Threading.Tasks.Extensions
-
- // csc doesn't ship with facades for the following assemblies.
- // Analyzers can't use them unless they carry the facade with them.
-
- // typeof(SafePipeHandle), // System.IO.Pipes
- // typeof(StackFrame), // System.Diagnostics.StackTrace
- // typeof(BindingFlags), // System.Reflection.TypeExtensions
- // typeof(AccessControlActions), // System.Security.AccessControl
- // typeof(SafeAccessTokenHandle), // System.Security.Principal.Windows
- // typeof(Thread), // System.Threading.Thread
- }.Length.ToString());
-
- public override void Initialize(AnalysisContext context)
- {
- }
-}";
-
- var analyzerImage = CSharpCompilation.Create(
- analyzerAssemblyName,
- new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(analyzerSource) },
- new MetadataReference[]
- {
- minCodeAnalysisRef,
- minSystemCollectionsImmutableRef,
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.Microsoft_Win32_Primitives),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_AppContext),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Console),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard10.System_ValueTuple),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Diagnostics_FileVersionInfo),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Diagnostics_Process),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Diagnostics_StackTrace),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Globalization_Calendars),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_Compression),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_Compression_ZipFile),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_FileSystem),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_FileSystem_Primitives),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_Pipes),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Net_Http),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Net_Security),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Net_Sockets),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Reflection_TypeExtensions),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard11.System_Runtime_InteropServices_RuntimeInformation),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime_Serialization_Primitives),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_AccessControl),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Claims),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Algorithms),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Csp),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Encoding),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Primitives),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_X509Certificates),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Principal_Windows),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Threading_Thread),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard10.System_Threading_Tasks_Extensions),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_ReaderWriter),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_XmlDocument),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_XPath),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_XPath_XDocument),
- MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Text_Encoding_CodePages)
- },
- new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)).EmitToArray();
-
- return analyzerImage;
- }
-
-
+#endif
[WorkItem(406649, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=484417")]
[ConditionalFact(typeof(WindowsDesktopOnly), typeof(IsEnglishLocal), Reason = "https://github.com/dotnet/roslyn/issues/30321")]
public void MicrosoftDiaSymReaderNativeAltLoadPath()
diff --git a/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs b/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs
index befcdb409ab2b..f4a062527d609 100644
--- a/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs
+++ b/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+// The use of SigningTestHelpers makes this necessary for now. Fix is tracked by https://github.com/dotnet/roslyn/issues/25228
+#if NET472
using System;
using System.Collections.Immutable;
using System.IO;
@@ -161,3 +163,4 @@ public static void Main(string[] args) { }
}
}
}
+#endif
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs
index 11d0bf1f3edde..af896e6e8f8ca 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs
@@ -56,6 +56,252 @@ class C
comp.VerifyEmitDiagnostics(expected);
}
+ private CSharpCompilation CreateCompilationWithAsyncIterator(string source, CSharpCompilationOptions options = null)
+ => CreateCompilationWithTasksExtensions(new[] { source, s_common }, options: options);
+
+ [Fact]
+ [WorkItem(30566, "https://github.com/dotnet/roslyn/issues/30566")]
+ public void AsyncIteratorBug30566()
+ {
+ var comp = CreateCompilationWithAsyncIterator(@"
+using System;
+class C
+{
+ public async System.Collections.Generic.IAsyncEnumerable M()
+ {
+ yield return await GetTemperatureAsync();
+ yield return await GetTemperatureAsync();
+ }
+
+ private static Random CapturedRandom = new Random();
+
+ public async System.Threading.Tasks.Task GetTemperatureAsync()
+ {
+ await System.Threading.Tasks.Task.Delay(CapturedRandom.Next(1, 8));
+ return CapturedRandom.Next(50, 100);
+ }
+}");
+ CompileAndVerify(comp);
+ }
+
+ [Fact]
+ [WorkItem(30566, "https://github.com/dotnet/roslyn/issues/30566")]
+ public void YieldReturnAwait1()
+ {
+ var comp = CreateCompilationWithAsyncIterator(@"
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+class C
+{
+ public static async IAsyncEnumerable M()
+ {
+ yield return await Task.FromResult(2);
+ await Task.Delay(1);
+ yield return await Task.FromResult(8);
+ }
+ public static async Task Main(string[] args)
+ {
+ await foreach (var i in M())
+ {
+ Console.WriteLine(i);
+ }
+ }
+}", TestOptions.ReleaseExe);
+ var verifier = CompileAndVerify(comp, expectedOutput: @"
+2
+8");
+ }
+
+ [Fact]
+ [WorkItem(30566, "https://github.com/dotnet/roslyn/issues/30566")]
+ public void YieldReturnAwait2()
+ {
+ var comp = CreateCompilationWithAsyncIterator(@"
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+class C
+{
+ public static async IAsyncEnumerable M(Task[]> arr)
+ {
+ foreach (var t in await arr)
+ {
+ yield return await t;
+ }
+ }
+ public static async Task Main(string[] args)
+ {
+ var arr = new Task[] {
+ Task.FromResult(2),
+ Task.FromResult(8)
+ };
+ await foreach (var i in M(Task.FromResult(arr)))
+ {
+ Console.WriteLine(i);
+ }
+ }
+}", TestOptions.ReleaseExe);
+ var verifier = CompileAndVerify(comp, expectedOutput: @"
+2
+8");
+ verifier.VerifyIL("C.d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", @"
+{
+ // Code size 362 (0x16a)
+ .maxstack 3
+ .locals init (int V_0,
+ System.Threading.Tasks.Task[] V_1,
+ System.Runtime.CompilerServices.TaskAwaiter[]> V_2,
+ C.d__0 V_3,
+ int V_4,
+ System.Runtime.CompilerServices.TaskAwaiter V_5,
+ System.Exception V_6)
+ IL_0000: ldarg.0
+ IL_0001: ldfld ""int C.d__0.<>1__state""
+ IL_0006: stloc.0
+ .try
+ {
+ IL_0007: ldloc.0
+ IL_0008: switch (
+ IL_0054,
+ IL_00cf,
+ IL_0112)
+ IL_0019: ldarg.0
+ IL_001a: ldfld ""System.Threading.Tasks.Task[]> C.d__0.arr""
+ IL_001f: callvirt ""System.Runtime.CompilerServices.TaskAwaiter[]> System.Threading.Tasks.Task[]>.GetAwaiter()""
+ IL_0024: stloc.2
+ IL_0025: ldloca.s V_2
+ IL_0027: call ""bool System.Runtime.CompilerServices.TaskAwaiter[]>.IsCompleted.get""
+ IL_002c: brtrue.s IL_0070
+ IL_002e: ldarg.0
+ IL_002f: ldc.i4.0
+ IL_0030: dup
+ IL_0031: stloc.0
+ IL_0032: stfld ""int C.d__0.<>1__state""
+ IL_0037: ldarg.0
+ IL_0038: ldloc.2
+ IL_0039: stfld ""System.Runtime.CompilerServices.TaskAwaiter[]> C.d__0.<>u__1""
+ IL_003e: ldarg.0
+ IL_003f: stloc.3
+ IL_0040: ldarg.0
+ IL_0041: ldflda ""System.Runtime.CompilerServices.AsyncVoidMethodBuilder C.d__0.<>t__builder""
+ IL_0046: ldloca.s V_2
+ IL_0048: ldloca.s V_3
+ IL_004a: call ""void System.Runtime.CompilerServices.AsyncVoidMethodBuilder.AwaitUnsafeOnCompleted[]>, C.d__0>(ref System.Runtime.CompilerServices.TaskAwaiter[]>, ref C.d__0)""
+ IL_004f: leave IL_0169
+ IL_0054: ldarg.0
+ IL_0055: ldfld ""System.Runtime.CompilerServices.TaskAwaiter[]> C.d__0.<>u__1""
+ IL_005a: stloc.2
+ IL_005b: ldarg.0
+ IL_005c: ldflda ""System.Runtime.CompilerServices.TaskAwaiter[]> C.d__0.<>u__1""
+ IL_0061: initobj ""System.Runtime.CompilerServices.TaskAwaiter[]>""
+ IL_0067: ldarg.0
+ IL_0068: ldc.i4.m1
+ IL_0069: dup
+ IL_006a: stloc.0
+ IL_006b: stfld ""int C.d__0.<>1__state""
+ IL_0070: ldloca.s V_2
+ IL_0072: call ""System.Threading.Tasks.Task[] System.Runtime.CompilerServices.TaskAwaiter[]>.GetResult()""
+ IL_0077: stloc.1
+ IL_0078: ldarg.0
+ IL_0079: ldloc.1
+ IL_007a: stfld ""System.Threading.Tasks.Task[] C.d__0.<>7__wrap1""
+ IL_007f: ldarg.0
+ IL_0080: ldc.i4.0
+ IL_0081: stfld ""int C.d__0.<>7__wrap2""
+ IL_0086: br IL_0120
+ IL_008b: ldarg.0
+ IL_008c: ldfld ""System.Threading.Tasks.Task[] C.d__0.<>7__wrap1""
+ IL_0091: ldarg.0
+ IL_0092: ldfld ""int C.d__0.<>7__wrap2""
+ IL_0097: ldelem.ref
+ IL_0098: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
+ IL_009d: stloc.s V_5
+ IL_009f: ldloca.s V_5
+ IL_00a1: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
+ IL_00a6: brtrue.s IL_00ec
+ IL_00a8: ldarg.0
+ IL_00a9: ldc.i4.1
+ IL_00aa: dup
+ IL_00ab: stloc.0
+ IL_00ac: stfld ""int C.d__0.<>1__state""
+ IL_00b1: ldarg.0
+ IL_00b2: ldloc.s V_5
+ IL_00b4: stfld ""System.Runtime.CompilerServices.TaskAwaiter C.d__0.<>u__2""
+ IL_00b9: ldarg.0
+ IL_00ba: stloc.3
+ IL_00bb: ldarg.0
+ IL_00bc: ldflda ""System.Runtime.CompilerServices.AsyncVoidMethodBuilder C.d__0.<>t__builder""
+ IL_00c1: ldloca.s V_5
+ IL_00c3: ldloca.s V_3
+ IL_00c5: call ""void System.Runtime.CompilerServices.AsyncVoidMethodBuilder.AwaitUnsafeOnCompleted, C.d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref C.d__0)""
+ IL_00ca: leave IL_0169
+ IL_00cf: ldarg.0
+ IL_00d0: ldfld ""System.Runtime.CompilerServices.TaskAwaiter C.d__0.<>u__2""
+ IL_00d5: stloc.s V_5
+ IL_00d7: ldarg.0
+ IL_00d8: ldflda ""System.Runtime.CompilerServices.TaskAwaiter C.d__0.<>u__2""
+ IL_00dd: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
+ IL_00e3: ldarg.0
+ IL_00e4: ldc.i4.m1
+ IL_00e5: dup
+ IL_00e6: stloc.0
+ IL_00e7: stfld ""int C.d__0.<>1__state""
+ IL_00ec: ldloca.s V_5
+ IL_00ee: call ""int System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
+ IL_00f3: stloc.s V_4
+ IL_00f5: ldarg.0
+ IL_00f6: ldloc.s V_4
+ IL_00f8: stfld ""int C.d__0.<>2__current""
+ IL_00fd: ldarg.0
+ IL_00fe: ldc.i4.2
+ IL_00ff: stfld ""int C.d__0.<>1__state""
+ IL_0104: ldarg.0
+ IL_0105: ldflda ""System.Threading.Tasks.ManualResetValueTaskSourceLogic C.d__0.<>v__promiseOfValueOrEnd""
+ IL_010a: ldc.i4.1
+ IL_010b: call ""void System.Threading.Tasks.ManualResetValueTaskSourceLogic.SetResult(bool)""
+ IL_0110: leave.s IL_0169
+ IL_0112: ldarg.0
+ IL_0113: ldarg.0
+ IL_0114: ldfld ""int C.d__0.<>7__wrap2""
+ IL_0119: ldc.i4.1
+ IL_011a: add
+ IL_011b: stfld ""int C.d__0.<>7__wrap2""
+ IL_0120: ldarg.0
+ IL_0121: ldfld ""int C.d__0.<>7__wrap2""
+ IL_0126: ldarg.0
+ IL_0127: ldfld ""System.Threading.Tasks.Task[] C.d__0.<>7__wrap1""
+ IL_012c: ldlen
+ IL_012d: conv.i4
+ IL_012e: blt IL_008b
+ IL_0133: ldarg.0
+ IL_0134: ldnull
+ IL_0135: stfld ""System.Threading.Tasks.Task[] C.d__0.<>7__wrap1""
+ IL_013a: leave.s IL_0155
+ }
+ catch System.Exception
+ {
+ IL_013c: stloc.s V_6
+ IL_013e: ldarg.0
+ IL_013f: ldc.i4.s -2
+ IL_0141: stfld ""int C.d__0.<>1__state""
+ IL_0146: ldarg.0
+ IL_0147: ldflda ""System.Threading.Tasks.ManualResetValueTaskSourceLogic C.d__0.<>v__promiseOfValueOrEnd""
+ IL_014c: ldloc.s V_6
+ IL_014e: call ""void System.Threading.Tasks.ManualResetValueTaskSourceLogic.SetException(System.Exception)""
+ IL_0153: leave.s IL_0169
+ }
+ IL_0155: ldarg.0
+ IL_0156: ldc.i4.s -2
+ IL_0158: stfld ""int C.d__0.<>1__state""
+ IL_015d: ldarg.0
+ IL_015e: ldflda ""System.Threading.Tasks.ManualResetValueTaskSourceLogic C.d__0.<>v__promiseOfValueOrEnd""
+ IL_0163: ldc.i4.0
+ IL_0164: call ""void System.Threading.Tasks.ManualResetValueTaskSourceLogic.SetResult(bool)""
+ IL_0169: ret
+}");
+ }
+
[Fact]
public void AsyncIteratorInCSharp7_3()
{
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/FixedSizeBufferTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/FixedSizeBufferTests.cs
index f27c2dcdd4a26..70344f7569b94 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/FixedSizeBufferTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/FixedSizeBufferTests.cs
@@ -570,7 +570,7 @@ static void Main()
var f = (FieldSymbol)comp2.GlobalNamespace.GetTypeMembers("S")[0].GetMembers("x")[0];
Assert.Equal("x", f.Name);
- Assert.True(f.IsFixed);
+ Assert.True(f.IsFixedSizeBuffer);
Assert.Equal("int*", f.Type.ToString());
Assert.Equal(10, f.FixedSize);
}
diff --git a/src/Compilers/CSharp/Test/Emit/Emit/NoPiaEmbedTypes.cs b/src/Compilers/CSharp/Test/Emit/Emit/NoPiaEmbedTypes.cs
index 3d7bd77179bdc..50bb3b37f5a30 100644
--- a/src/Compilers/CSharp/Test/Emit/Emit/NoPiaEmbedTypes.cs
+++ b/src/Compilers/CSharp/Test/Emit/Emit/NoPiaEmbedTypes.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-#if NET46
+#if NET472
using Microsoft.Cci;
using Microsoft.CodeAnalysis.CSharp.Symbols;
diff --git a/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj b/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj
index 0d4f6ffefde82..1774fb693eb8f 100644
--- a/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj
+++ b/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj
@@ -35,7 +35,6 @@
-
diff --git a/src/Compilers/CSharp/Test/Emit/PrivateProtected.cs b/src/Compilers/CSharp/Test/Emit/PrivateProtected.cs
index 754a3d7f024de..8f7da5d025798 100644
--- a/src/Compilers/CSharp/Test/Emit/PrivateProtected.cs
+++ b/src/Compilers/CSharp/Test/Emit/PrivateProtected.cs
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-#if NET46
+#if NET472
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
index 752a6d35701f5..d5d2381a23d92 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
@@ -318,6 +318,144 @@ partial class C9 { }
Diagnostic(ErrorCode.WRN_NullabilityMismatchInArgument, "new C9()").WithArguments("C9", "Base