Skip to content

Commit

Permalink
Merge pull request #32109 from dotnet/merges/master-to-features/edito…
Browse files Browse the repository at this point in the history
…rconfig-in-compiler

Merge master to features/editorconfig-in-compiler
  • Loading branch information
dotnet-automerge-bot committed Jan 3, 2019
2 parents 5318dbf + 8063fb0 commit e5fdf94
Show file tree
Hide file tree
Showing 84 changed files with 3,552 additions and 996 deletions.
10 changes: 10 additions & 0 deletions azure-pipelines-integration.yml
@@ -1,3 +1,13 @@
# Branches that trigger a build on commit
trigger:
- master
- master-vs-deps

# Branches that trigger builds on PR
pr:
- master
- master-vs-deps

jobs:
- job: Windows_VisualStudio_Integration_Tests
pool: dotnet-external-temp-vs2017
Expand Down
17 changes: 17 additions & 0 deletions azure-pipelines.yml
@@ -1,3 +1,20 @@
# Branches that trigger a build on commit
trigger:
- master
- master-vs-deps

# Branches that trigger builds on PR
pr:
- master
- master-vs-deps
- features/NullableReferenceTypes
- features/recursive-patterns
- features/enhanced-using
- features/nullabledogfood
- features/unmanaged-constructed-types
- features/editorconfig-in-compiler
- features/NegatedConditionStatements

jobs:
- job: Windows_Desktop_Unit_Tests
pool: dotnet-external-temp
Expand Down
26 changes: 14 additions & 12 deletions docs/contributing/Building, Debugging, and Testing on Windows.md
Expand Up @@ -5,15 +5,15 @@
Using the command line Roslyn can be developed using the following pattern:

1. Clone https://github.com/dotnet/roslyn
1. Run Restore.cmd
1. Run Restore.cmd
1. Run Build.cmd
1. Run Test.cmd

## Recommended version of .NET Framework

The minimal required version of .NET Framework is 4.6, however 4.7.2 is recommended for best developer experience.
The minimal required version of .NET Framework is 4.6, however 4.7.2 is recommended for best developer experience.

The projects in this repository are configured to build with Portable PDBs, which are supported in stack traces starting with .NET Framework 4.7.2.
The projects in this repository are configured to build with Portable PDBs, which are supported in stack traces starting with .NET Framework 4.7.2.
If a stack trace is displayed on .NET Framework older than 4.7.2 (e.g. by xUnit when a test fails) it won't contain source and line information.

.NET Framework 4.7.2 is included in [Windows 10 April 2018 Update](https://blogs.windows.com/windowsexperience/2018/04/30/how-to-get-the-windows-10-april-2018-update/). It can also be installed from the [Microsoft Download Center](https://www.microsoft.com/net/download/dotnet-framework-runtime).
Expand All @@ -33,7 +33,7 @@ do the following:

- Run the Visual Studio Installer from your start menu. You can just search for "Visual Studio Installer". If you can't find it, it's typically located at "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe"
- The Visual Studio installation will be listed under the Installed section
- Click on the menu icon (three horizontal lines), click Modify
- Click on the menu icon (three horizontal lines), click Modify
- Choose the workloads listed above and click Modify

## Running Tests
Expand All @@ -42,13 +42,13 @@ There are a number of options for running the core Roslyn unit tests:

### Command Line

The Test.cmd script will run our unit test on already built binaries. It can be passed the -build arguments to force a new build before running tests.
The Test.cmd script will run our unit test on already built binaries. It can be passed the -build arguments to force a new build before running tests.

1. Run the "Developer Command Prompt for VS2017" from your start menu.
2. Navigate to the directory of your Git clone.
3. Run `msbuild /v:m /m /nodereuse:false BuildAndTest.proj` in the command prompt.

### Test Explorer
### Test Explorer

Tests can be run and debugged from the Test Explorer window. For best performance, we recommend the following:

Expand All @@ -71,20 +71,19 @@ give it a try.
## Trying Your Changes in Visual Studio

The Rosyln solution is designed to support easy debugging via F5. Several of our
projects produce VSIX which deploy into Visual Studio during build. The F5 operation
projects produce VSIX which deploy into Visual Studio during build. The F5 operation
will start a new Visual Studio instance using those VSIX which override our installed
binaries. This means trying out a change to the language, IDE or debugger is as
simple as hitting F5.

The startup project needs to be set to VisualStudioSetup. This should be
The startup project needs to be set to `RoslynDeployment`. This should be
the default but in same cases will need to be set explicitly.

Here are what is deployed with each extension, by project that builds it. If
you're working on a particular area, you probably want to set the appropriate
project as your startup project to ensure the right things are built and
deployed.
project as your startup project to optimize building and deploying only the relevant bits.

- **VisualStudioSetup**: this project can be found inside the VisualStudio folder
- **Roslyn.VisualStudio.Setup**: this project can be found inside the VisualStudio folder
from the Solution Explorer, and builds Roslyn.VisualStudio.Setup.vsix. It
contains the core language services that provide C# and VB editing. It also
contains the copy of the compiler that is used to drive IntelliSense and
Expand All @@ -93,7 +92,10 @@ deployed.
compiler used to actually produce your final .exe or .dll when you do a
build. If you're working on fixing an IDE bug, this is the project you want
to use.
- **CompilerExtension**: this project can be found inside the Compilers folder
- **Roslyn.VisualStudio.InteractiveComponents**: this project can be found in the
Interactive\Setup folder from the Solution Explorer, and builds
Roslyn.VisualStudio.InteractiveComponents.vsix.
- **Roslyn.Compilers.Extension**: this project can be found inside the Compilers\Packages folder
from the Solution Explorer, and builds Roslyn.Compilers.Extension.vsix.
This deploys a copy of the command line compilers that are used to do actual
builds in the IDE. It only affects builds triggered from the Visual Studio
Expand Down
4 changes: 2 additions & 2 deletions docs/features/nullable-reference-types.md
Expand Up @@ -6,10 +6,10 @@ Reference types may be nullable, non-nullable, or null-oblivious (abbreviated he

Project level nullable context can be set by using "nullable" command line switch:
-nullable[+|-] Specify nullable context option enable|disable.
-nullable:{enable|disable|safeonly} Specify nullable context option enable|disable|safeonly.
-nullable:{enable|disable|safeonly|warnings|safeonlywarnings} Specify nullable context option enable|disable|safeonly|warnings|safeonlywarnings.

Through msbuild the context could be set by supplying an argument for a "NullableContextOptions" parameter of Csc build task.
Accepted values are "enable", "disable", "safeonly", or null (for the default nullable context according to the compiler).
Accepted values are "enable", "disable", "safeonly", "warnings", "safeonlywarnings", or null (for the default nullable context according to the compiler).
The Microsoft.CSharp.Core.targets passes value of msbuild property named "NullableContextOptions" for that parameter.

## Annotations
Expand Down
32 changes: 32 additions & 0 deletions docs/infrastructure/feature branches azure.md
@@ -0,0 +1,32 @@
# Creating Feature Branches
This document describes the process for setting up CI on a feature branch of roslyn.

## Push the branch
The first step is to create the branch seeded with the initial change on roslyn. This branch should have the name `features/<feature name>`. For example: `features/mono` for working on mono work.

Assuming the branch should start with the contents of `master` the branch can be created by doing the following:

Note: these steps assume the remote `origin` points to the official [roslyn repository](https://github.com/dotnet/roslyn).

``` cmd
> git fetch origin
> git checkout -B init origin/master
> git push origin init:features/mono
```

## Adding branch to Azure Pipelines
The following files need to be edited in order for GitHub to trigger Azure Pipelines Test runs on PRs:

- [azure-pipelines.yml](https://github.com/dotnet/roslyn/blob/master/azure-pipelines.yml)
- [azure-pipelines-integration.yml](https://github.com/dotnet/roslyn/blob/master/azure-pipelines-integration.yml)

Under the `pr` section in the file add your branch name.

``` yaml
pr:
- master
- master-vs-deps
- ...
- features/mono
```

50 changes: 0 additions & 50 deletions docs/infrastructure/feature branches jenkins.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs
Expand Up @@ -358,7 +358,7 @@ internal NamespaceOrTypeOrAliasSymbolWithAnnotations BindNamespaceOrTypeOrAliasS
var conversions = this.Conversions.WithNullability(includeNullability: true);
type.CheckConstraints(this.Compilation, conversions, location, diagnostics);
}
else if (constructedType.TypeSymbol.IsUnconstrainedTypeParameter())
else if (constructedType.TypeSymbol.IsTypeParameterDisallowingAnnotation())
{
diagnostics.Add(ErrorCode.ERR_NullableUnconstrainedTypeParameter, syntax.Location);
}
Expand Down
15 changes: 14 additions & 1 deletion src/Compilers/CSharp/Portable/Binder/BuckStopsHereBinder.cs
Expand Up @@ -159,7 +159,20 @@ internal override Symbol ContainingMemberOrLambda

internal override bool IsNullableGloballyEnabled()
{
return Compilation.Options.NullableContextOptions != NullableContextOptions.Disable;
switch (Compilation.Options.NullableContextOptions)
{
case NullableContextOptions.Enable:
case NullableContextOptions.SafeOnly:
return true;

case NullableContextOptions.Disable:
case NullableContextOptions.Warnings:
case NullableContextOptions.SafeOnlyWarnings:
return false;

default:
throw ExceptionUtilities.UnexpectedValue(Compilation.Options.NullableContextOptions);
}
}

internal override Binder GetBinder(SyntaxNode node)
Expand Down
65 changes: 11 additions & 54 deletions src/Compilers/CSharp/Portable/Binder/Semantics/BestTypeInferrer.cs
Expand Up @@ -10,65 +10,18 @@ namespace Microsoft.CodeAnalysis.CSharp
{
internal static class BestTypeInferrer
{
public static NullableAnnotation GetNullableAnnotation(TypeSymbol bestType, ArrayBuilder<TypeSymbolWithAnnotations> types)
public static NullableAnnotation GetNullableAnnotation(ArrayBuilder<TypeSymbolWithAnnotations> types)
{
bool bestTypeIsPossiblyNullableReferenceTypeTypeParameter = bestType.IsPossiblyNullableReferenceTypeTypeParameter();
NullableAnnotation? result = null;
NullableAnnotation result = NullableAnnotation.NotAnnotated;
foreach (var type in types)
{
if (type.IsNull)
{
// https://github.com/dotnet/roslyn/issues/27961 Should ignore untyped
// expressions such as unbound lambdas and typeless tuples.
result = NullableAnnotation.Nullable;
continue;
}

if (!type.IsReferenceType && !type.TypeSymbol.IsPossiblyNullableReferenceTypeTypeParameter())
{
return NullableAnnotation.Unknown;
}

NullableAnnotation nullableAnnotation;

if (type.IsPossiblyNullableReferenceTypeTypeParameter() && !bestTypeIsPossiblyNullableReferenceTypeTypeParameter)
{
nullableAnnotation = NullableAnnotation.Nullable;
}
else
{
nullableAnnotation = type.NullableAnnotation;
}

if (nullableAnnotation == NullableAnnotation.Unknown)
{
if (result?.IsAnyNotNullable() != false)
{
result = NullableAnnotation.Unknown;
}
}
else if (nullableAnnotation.IsAnyNullable())
{
if (result?.IsAnyNullable() != true)
{
result = nullableAnnotation;
}
else if (result != nullableAnnotation)
{
result = NullableAnnotation.Annotated;
}
}
else if (result == null)
{
result = nullableAnnotation;
}
else if (result.GetValueOrDefault() == NullableAnnotation.NotNullable && nullableAnnotation == NullableAnnotation.NotAnnotated)
{
result = NullableAnnotation.NotAnnotated;
}
Debug.Assert(!type.IsNull);
Debug.Assert(type.Equals(types[0], TypeCompareKind.AllIgnoreOptions));
// This uses the covariant merging rules.
result = result.JoinForFixingLowerBounds(type.AsSpeakable().NullableAnnotation);
}

return result ?? NullableAnnotation.NotAnnotated;
return result;
}

/// <remarks>
Expand Down Expand Up @@ -106,6 +59,10 @@ public static NullableAnnotation GetNullableAnnotation(TypeSymbol bestType, Arra
return type;
}

if (conversions.IncludeNullability)
{
type = type.SetSpeakableNullabilityForReferenceTypes();
}
candidateTypes.Add(type);
}
}
Expand Down
Expand Up @@ -1915,7 +1915,8 @@ private Conversion GetImplicitTupleLiteralConversion(BoundTupleLiteral source, T
destination,
ref useSiteDiagnostics,
ConversionKind.ImplicitTupleLiteral,
(ConversionsBase conversions, BoundExpression s, TypeSymbolWithAnnotations d, ref HashSet<DiagnosticInfo> u, bool a) => conversions.ClassifyImplicitConversionFromExpression(s, d.TypeSymbol, ref u),
(ConversionsBase conversions, BoundExpression s, TypeSymbolWithAnnotations d, ref HashSet<DiagnosticInfo> u, bool a)
=> conversions.ClassifyImplicitConversionFromExpression(s, d.TypeSymbol, ref u),
arg: false);
}

Expand Down

0 comments on commit e5fdf94

Please sign in to comment.