Skip to content

Commit

Permalink
Merge remote-tracking branch 'dotnet/master' into ivt-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Apr 19, 2019
2 parents 6da27fc + af9d30a commit 7c36f97
Show file tree
Hide file tree
Showing 64 changed files with 2,239 additions and 183 deletions.
7 changes: 7 additions & 0 deletions Roslyn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Exte
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote", "src\Tools\ExternalAccess\Xamarin.Remote\Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote.csproj", "{DE53934B-7FC1-48A0-85AB-C519FBBD02CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup.ServiceHub", "src\Setup\DevDivVsix\ServiceHubConfig\Roslyn.VisualStudio.Setup.ServiceHub.csproj", "{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 4
Expand Down Expand Up @@ -1063,6 +1065,10 @@ Global
{DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.Build.0 = Release|Any CPU
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1251,6 +1257,7 @@ Global
{655A5B07-39B8-48CD-8590-8AC0C2B708D8} = {8977A560-45C2-4EC2-A849-97335B382C74}
{FA51A3CB-5174-4D99-B76E-DC31C5361DF3} = {8977A560-45C2-4EC2-A849-97335B382C74}
{DE53934B-7FC1-48A0-85AB-C519FBBD02CF} = {8977A560-45C2-4EC2-A849-97335B382C74}
{3D33BBFD-EC63-4E8C-A714-0A48A3809A87} = {BE25E872-1667-4649-9D19-96B83E75A44E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29}
Expand Down
13 changes: 11 additions & 2 deletions docs/features/nullable-reference-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ namespace System.Runtime.CompilerServices
AllowMultiple = false)]
public sealed class NullableAttribute : Attribute
{
public NullableAttribute(byte b) { }
public NullableAttribute(byte[] b) { }
public readonly byte[] NullableFlags;

public NullableAttribute(byte b)
{
NullableFlags = new byte[] { b };
}

public NullableAttribute(byte[] b)
{
NullableFlags = b;
}
}
}
```
Expand Down
57 changes: 57 additions & 0 deletions eng/targets/GenerateServiceHubConfigurationFiles.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project>
<!--
The inclusion of this file will cause *.servicehub.service.json files to be created. and these json files contain configuration for the servicehub on how it
should configure our services in servicehub process
-->
<ItemGroup>
<ServiceHubService Include="roslynCodeAnalysis" ClassName="Microsoft.CodeAnalysis.Remote.CodeAnalysisService" />
<ServiceHubService Include="roslynRemoteHost" ClassName="Microsoft.CodeAnalysis.Remote.RemoteHostService" />
<ServiceHubService Include="roslynSnapshot" ClassName="Microsoft.CodeAnalysis.Remote.SnapshotService" />
<ServiceHubService Include="roslynRemoteSymbolSearchUpdateEngine" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSymbolSearchUpdateEngine" />
</ItemGroup>

<PropertyGroup>
<GetVsixSourceItemsDependsOn>$(GetVsixSourceItemsDependsOn);GenerateServiceHubConfigurationFiles</GetVsixSourceItemsDependsOn>
</PropertyGroup>

<Target Name="CalculateServiceHubConfigurationFiles">
<ItemGroup>
<_ServicesWithBitness Include="@(ServiceHubService)" FileSuffix="" HostSuffix=".x86" HostIdSuffix="32" />
<_ServicesWithBitness Include="@(ServiceHubService)" FileSuffix="64" HostSuffix="" HostIdSuffix="" />

<_JsonFile Include="$(IntermediateOutputPath)%(_ServicesWithBitness.FileName)%(_ServicesWithBitness.FileSuffix).servicehub.service.json">
<Content>
<![CDATA[{
"host": "desktopClr%(_ServicesWithBitness.HostSuffix)",
"hostId": "RoslynCodeAnalysisService%(_ServicesWithBitness.HostIdSuffix)",
"hostGroupAllowed": true,
"serviceOverride": true,
"entryPoint": {
"assemblyPath": "$(ServiceHubAssemblyBasePath.Replace('\', '\\'))Microsoft.CodeAnalysis.Remote.ServiceHub.dll",
"fullClassName": "%(_ServicesWithBitness.ClassName)",
"appBasePath": "%VSAPPIDDIR%",
"configPath": "%PkgDefApplicationConfigFile%"
}
}
]]>
</Content>
</_JsonFile>
</ItemGroup>
</Target>

<Target Name="GenerateServiceHubConfigurationFiles"
DependsOnTargets="CalculateServiceHubConfigurationFiles"
BeforeTargets="CreateVsixContainer"
Inputs="$(MSBuildProjectFullPath)"
Outputs="@(_JsonFile)">

<WriteLinesToFile File="%(_JsonFile.Identity)" Lines="%(_JsonFile.Content)" Overwrite="true"/>

<ItemGroup>
<FileWrites Include="@(_JsonFile->'%(Identity)')"/>
<VSIXSourceItem Include="@(_JsonFile->'%(Identity)')" />
</ItemGroup>
</Target>
</Project>
3 changes: 3 additions & 0 deletions eng/targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>

<CommonExtensionInstallationRoot>CommonExtensions</CommonExtensionInstallationRoot>
<LanguageServicesExtensionInstallationFolder>Microsoft\ManagedLanguages\VBCSharp\LanguageServices</LanguageServicesExtensionInstallationFolder>

<!-- Disable the implicit nuget fallback folder as it makes it hard to locate and copy ref assemblies to the test output folder -->
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<ToolsetPackagesDir>$(RepoRoot)build\ToolsetPackages\</ToolsetPackagesDir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal override Machine Machine
case Platform.X64:
return Machine.Amd64;
case Platform.Arm64:
return (Machine)0xAA64;//Machine.Arm64; https://github.com/dotnet/roslyn/issues/25185
return Machine.Arm64;
case Platform.Itanium:
return Machine.IA64;
default:
Expand Down
8 changes: 4 additions & 4 deletions src/Compilers/CSharp/Portable/Symbols/Symbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ internal virtual void AfterAddingTypeMembersChecks(ConversionsBase conversions,
// resorting to .Equals

// the condition is expected to be folded when inlining "someSymbol == null"
if (((object)right == null))
if (right is null)
{
return (object)left == (object)null;
return left is null;
}

// this part is expected to disappear when inlining "someSymbol == null"
Expand All @@ -581,9 +581,9 @@ internal virtual void AfterAddingTypeMembersChecks(ConversionsBase conversions,
// since that sometimes results in a worse code

// the condition is expected to be folded when inlining "someSymbol != null"
if (((object)right == null))
if (right is null)
{
return (object)left != (object)null;
return left is object;
}

// this part is expected to disappear when inlining "someSymbol != null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13184,6 +13184,121 @@ public override void M2<T>(T? x) where T : struct
Assert.True(m2.OverriddenMethod.Parameters[0].Type.IsNullableType());
}

[Fact]
[WorkItem(33276, "https://github.com/dotnet/roslyn/issues/33276")]
public void Overriding_34()
{
var source1 =
@"
public class MyEntity
{
}

public abstract class BaseController<T>
where T : MyEntity
{
public abstract void SomeMethod<R>(R? lite)
where R : MyEntity;
}
";

var source2 =
@"
class DerivedController<T> : BaseController<T>
where T : MyEntity
{
Table<T> table = null!;
public override void SomeMethod<R>(R? lite) where R : class
{
table.OtherMethod(lite);
}
}

class Table<T>
where T : MyEntity
{
public void OtherMethod<R>(R? lite) where R : MyEntity
{
lite?.ToString();
}
}
";
var compilation1 = CreateCompilation(new[] { source1 }, options: WithNonNullTypesTrue());
compilation1.VerifyDiagnostics();

foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() })
{
var compilation2 = CreateCompilation(new[] { source2 }, options: WithNonNullTypesTrue(),
references: new[] { reference });
compilation2.VerifyDiagnostics();
CompileAndVerify(compilation2);
}
}

[Fact]
[WorkItem(31676, "https://github.com/dotnet/roslyn/issues/31676")]
public void Overriding_35()
{
var source1 =
@"
using System;

namespace Microsoft.EntityFrameworkCore.TestUtilities
{
public abstract class QueryAsserterBase
{
public abstract void AssertQueryScalar<TItem1, TResult>(
Func<IQueryable<TItem1>, IQueryable<Nullable<TResult>>> actualQuery)
where TResult : struct;
}
}

public interface IQueryable<out T>
{
}
";

var source2 =
@"
using System;

namespace Microsoft.EntityFrameworkCore.TestUtilities
{
public class QueryAsserter<TContext> : QueryAsserterBase
{
public override void AssertQueryScalar<TItem1, TResult>(
Func<IQueryable<TItem1>, IQueryable<TResult?>> actualQuery)
{
}
}
}
";
foreach (var options1 in new[] { WithNonNullTypesTrue(), WithNonNullTypesFalse() })
{
var compilation1 = CreateCompilation(new[] { source1 }, options: options1);
compilation1.VerifyDiagnostics();

foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() })
{
foreach (var options2 in new[] { WithNonNullTypesTrue(), WithNonNullTypesFalse() })
{
var compilation2 = CreateCompilation(new[] { source2 }, options: options2,
references: new[] { reference });
compilation2.VerifyDiagnostics();
CompileAndVerify(compilation2);
}
}

var compilation3 = CreateCompilation(new[] { source1, source2 }, options: options1);
compilation3.VerifyDiagnostics();
CompileAndVerify(compilation3);

var compilation4 = CreateCompilation(new[] { source2, source1 }, options: options1);
compilation4.VerifyDiagnostics();
CompileAndVerify(compilation4);
}
}

[Fact]
public void Implementing_07()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Get
Select Case DeclaringCompilation.Options.Platform
Case Platform.Arm64
' Use real enum instead of casting value https://github.com/dotnet/roslyn/issues/25185
Return CType(CInt(&HAA64), System.Reflection.PortableExecutable.Machine)
Return System.Reflection.PortableExecutable.Machine.Arm64
Case Platform.Arm
Return System.Reflection.PortableExecutable.Machine.ArmThumb2
Case Platform.X64
Expand Down
Loading

0 comments on commit 7c36f97

Please sign in to comment.