Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master to features/static-lambdas #39183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fb86546
Enable warnAsError for correctness builds
JoeRobich Oct 3, 2019
f544a13
Allow FormattingAnalyzer warnings to be errors
JoeRobich Oct 3, 2019
9e3dd5f
Separate the concepts of checking CodeStyle from enforcing CodeStyle
JoeRobich Oct 3, 2019
e7c3cef
Fix formatting errors
dotnet-bot Oct 3, 2019
c51975f
Annotate types in Binding
sharwell Oct 1, 2019
c78ba38
Annotate types in Code Generation
sharwell Oct 1, 2019
e1b36f9
Avoid unnecessary changes and defer suppression decisions
sharwell Oct 4, 2019
a1d3e97
Initial bugfix for #38708
petrroll Oct 6, 2019
8250aed
Enable interleaving [| and {| in tests + more tests for #38708
petrroll Oct 6, 2019
58a4542
Add more tests for IsUnderselected helper.
petrroll Oct 6, 2019
dbe9f7b
PR feedback.
petrroll Oct 7, 2019
be29a10
Cleanup tuple usage.
petrroll Oct 7, 2019
9d025c3
Merge remote-tracking branch 'dotnet/master' into compiler-annotations-2
sharwell Oct 7, 2019
7383620
PR feedback + fix comment.
petrroll Oct 8, 2019
61ef664
Pass skipAnalyzer instead of warnOnError from Desktop CI builds
JoeRobich Oct 8, 2019
748b0ae
No longer qualify the MSBuild warnAsError flag
JoeRobich Oct 8, 2019
579132a
Merge remote-tracking branch 'origin/master' into enable-warnaserror
JoeRobich Oct 8, 2019
724306e
Fix formatting errors
dotnet-bot Oct 8, 2019
ffba208
Remove code to generate type switches
sharwell Oct 9, 2019
36b4bc5
Merge pull request #39091 from petrroll/underselectionTestBug
mavasani Oct 9, 2019
7deb45e
Merge pull request #39156 from sharwell/rm-typeswitch-gen
sharwell Oct 9, 2019
2ae01f8
Merge pull request #39014 from JoeRobich/enable-warnaserror
RikkiGibson Oct 9, 2019
82f09c4
Link issues
sharwell Oct 9, 2019
dddac7b
Merge pull request #39053 from sharwell/compiler-annotations-2
sharwell Oct 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
timeoutInMinutes: 90

steps:
- script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testDesktop -$(_testKind) -procdump -warnAsError
- script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testDesktop -$(_testKind) -procdump -skipAnalyzers
displayName: Build and Test

- task: PublishTestResults@2
Expand Down
6 changes: 2 additions & 4 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,10 @@ function BuildSolution() {
$suppressExtensionDeployment = if (!$deployExtensions) { "/p:DeployExtension=false" } else { "" }

# The warnAsError flag for MSBuild will promote all warnings to errors. This is true for warnings
# that MSBuild output as well as ones that custom tasks output. This causes problems for us as
# portions of our build will issue warnings: style analyzers being the most prominent example. Hence
# rather than a blanket include of warnings we include a fixed set.
# that MSBuild output as well as ones that custom tasks output.
#
# In all cases we pass /p:TreatWarningsAsErrors=true to promote compiler warnings to errors
$msbuildWarnAsError = if ($warnAsError) { "/warnAsError:MSB3270,MSB3277" } else { "" }
$msbuildWarnAsError = if ($warnAsError) { "/warnAsError" } else { "" }

# Workaround for some machines in the AzDO pool not allowing long paths (%5c is msbuild escaped backslash)
$ibcDir = Join-Path $RepoRoot ".o%5c"
Expand Down
8 changes: 4 additions & 4 deletions eng/targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ToolsetPackagesDir>$(RepoRoot)build\ToolsetPackages\</ToolsetPackagesDir>

<RoslynPortableTargetFrameworks>net472;netcoreapp2.1</RoslynPortableTargetFrameworks>
<RoslynEnforceCodeStyle Condition="'$(ContinuousIntegrationBuild)' != 'true'">true</RoslynEnforceCodeStyle>
<RoslynCheckCodeStyle Condition="'$(ContinuousIntegrationBuild)' != 'true' or '$(RoslynEnforceCodeStyle)' == 'true'">true</RoslynCheckCodeStyle>
<UseSharedCompilation>true</UseSharedCompilation>

<Features>strict, IOperation</Features>
Expand Down Expand Up @@ -126,20 +126,20 @@

<!-- Language-specific analyzer packages -->
<Choose>
<When Condition="'$(Language)' == 'VB' and '$(RoslynEnforceCodeStyle)' == 'true'">
<When Condition="'$(Language)' == 'VB' and '$(RoslynCheckCodeStyle)' == 'true'">
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" Version="$(MicrosoftCodeAnalysisVisualBasicCodeStyleVersion)" PrivateAssets="all" />
</ItemGroup>
</When>

<When Condition="'$(Language)' == 'C#' and '$(RoslynEnforceCodeStyle)' == 'true'">
<When Condition="'$(Language)' == 'C#' and '$(RoslynCheckCodeStyle)' == 'true'">
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="$(MicrosoftCodeAnalysisCSharpCodeStyleVersion)" PrivateAssets="all" />
</ItemGroup>
</When>
</Choose>

<PropertyGroup>
<PropertyGroup Condition="'$(RoslynEnforceCodeStyle)' != 'true'">
<!-- Don't treat FormattingAnalyzer as an error, even when TreatWarningsAsErrors is specified. -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);IDE0055</WarningsNotAsErrors>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/test-build-correctness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ try {
Push-Location $RepoRoot

Write-Host "Building Roslyn"
Exec-Block { & (Join-Path $PSScriptRoot "build.ps1") -restore -build -ci:$ci -configuration:$configuration -pack -binaryLog -useGlobalNuGetCache:$false -warnAsError:$false -properties "/p:RoslynEnforceCodeStyle=true"}
Exec-Block { & (Join-Path $PSScriptRoot "build.ps1") -restore -build -ci:$ci -configuration:$configuration -pack -binaryLog -useGlobalNuGetCache:$false -warnAsError:$true -properties "/p:RoslynEnforceCodeStyle=true"}

# Verify the state of our various build artifacts
Write-Host "Running BuildBoss"
Expand Down
26 changes: 15 additions & 11 deletions src/Compilers/Core/Portable/Binding/AbstractLookupSymbolsInfo.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -15,12 +17,12 @@ public struct ArityEnumerator : IEnumerator<int>
{
private int _current;
private readonly int _low32bits;
private int[] _arities;
private int[]? _arities;

private const int resetValue = -1;
private const int reachedEndValue = int.MaxValue;

internal ArityEnumerator(int bitVector, HashSet<int> arities)
internal ArityEnumerator(int bitVector, HashSet<int>? arities)
{
_current = resetValue;
_low32bits = bitVector;
Expand All @@ -39,7 +41,7 @@ internal ArityEnumerator(int bitVector, HashSet<int> arities)

public void Dispose() => _arities = null;

object System.Collections.IEnumerator.Current => _current;
object? System.Collections.IEnumerator.Current => _current;

public bool MoveNext()
{
Expand Down Expand Up @@ -118,7 +120,7 @@ private struct UniqueSymbolOrArities : IArityEnumerable
// Then arityBitVectorOrUniqueArity is interpreted as a bitvector
// of arities for arities from zero to 31 and the HashSet contains
// arities of 32 or more.
private object _uniqueSymbolOrArities;
private object? _uniqueSymbolOrArities;
private int _arityBitVectorOrUniqueArity;

public UniqueSymbolOrArities(int arity, TSymbol uniqueSymbol)
Expand Down Expand Up @@ -181,12 +183,14 @@ private void AddArity(int arity)
hashSet.Add(arity);
}

public void GetUniqueSymbolOrArities(out IArityEnumerable arities, out TSymbol uniqueSymbol)
public void GetUniqueSymbolOrArities(out IArityEnumerable? arities, out TSymbol? uniqueSymbol)
{
if (this.HasUniqueSymbol)
{
arities = null;
#nullable disable // Can '_uniqueSymbolOrArities' be null? https://github.com/dotnet/roslyn/issues/39166
uniqueSymbol = (TSymbol)_uniqueSymbolOrArities;
#nullable enable
}
else
{
Expand All @@ -198,7 +202,7 @@ public void GetUniqueSymbolOrArities(out IArityEnumerable arities, out TSymbol u
public ArityEnumerator GetEnumerator()
{
Debug.Assert(!this.HasUniqueSymbol);
return new ArityEnumerator(_arityBitVectorOrUniqueArity, (HashSet<int>)_uniqueSymbolOrArities);
return new ArityEnumerator(_arityBitVectorOrUniqueArity, (HashSet<int>?)_uniqueSymbolOrArities);
}

public int Count
Expand All @@ -207,7 +211,7 @@ public int Count
{
Debug.Assert(!this.HasUniqueSymbol);
int count = BitArithmeticUtilities.CountBits(_arityBitVectorOrUniqueArity);
var set = (HashSet<int>)_uniqueSymbolOrArities;
var set = (HashSet<int>?)_uniqueSymbolOrArities;
if (set != null)
{
count += set.Count;
Expand All @@ -218,13 +222,13 @@ public int Count
}

#if DEBUG
internal TSymbol UniqueSymbol => _uniqueSymbolOrArities as TSymbol;
internal TSymbol? UniqueSymbol => _uniqueSymbolOrArities as TSymbol;
#endif
}

private readonly IEqualityComparer<string> _comparer;
private readonly Dictionary<string, UniqueSymbolOrArities> _nameMap;
internal string FilterName { get; set; }
internal string? FilterName { get; set; }

protected AbstractLookupSymbolsInfo(IEqualityComparer<string> comparer)
{
Expand Down Expand Up @@ -275,8 +279,8 @@ public void AddSymbol(TSymbol symbol, string name, int arity)
/// <returns></returns>
public bool TryGetAritiesAndUniqueSymbol(
string name,
out IArityEnumerable arities,
out TSymbol uniqueSymbol)
out IArityEnumerable? arities,
out TSymbol? uniqueSymbol)
{
Debug.Assert(CanBeAdded(name));

Expand Down
10 changes: 6 additions & 4 deletions src/Compilers/Core/Portable/CodeGen/ArrayMembers.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;
using System;
Expand Down Expand Up @@ -324,14 +326,14 @@ protected virtual ImmutableArray<ArrayMethodParameterInfo> MakeParameters()

public bool IsGeneric => false;

public Cci.IMethodDefinition GetResolvedMethod(EmitContext context) => null;
public Cci.IMethodDefinition? GetResolvedMethod(EmitContext context) => null;

public ImmutableArray<Cci.IParameterTypeInformation> ExtraParameters
=> ImmutableArray<Cci.IParameterTypeInformation>.Empty;

public Cci.IGenericMethodInstanceReference AsGenericMethodInstanceReference => null;
public Cci.IGenericMethodInstanceReference? AsGenericMethodInstanceReference => null;

public Cci.ISpecializedMethodReference AsSpecializedMethodReference => null;
public Cci.ISpecializedMethodReference? AsSpecializedMethodReference => null;

public Cci.CallingConvention CallingConvention => Cci.CallingConvention.HasThis;

Expand All @@ -356,7 +358,7 @@ public Cci.ITypeReference GetContainingType(EmitContext context)
public void Dispatch(Cci.MetadataVisitor visitor)
=> visitor.Visit(this);

public Cci.IDefinition AsDefinition(EmitContext context)
public Cci.IDefinition? AsDefinition(EmitContext context)
=> null;

public override string ToString()
Expand Down
4 changes: 3 additions & 1 deletion src/Compilers/Core/Portable/CodeGen/ClosureDebugInfo.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Diagnostics;
using Roslyn.Utilities;
Expand All @@ -24,7 +26,7 @@ public bool Equals(ClosureDebugInfo other)
ClosureId.Equals(other.ClosureId);
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return obj is ClosureDebugInfo && Equals((ClosureDebugInfo)obj);
}
Expand Down
8 changes: 5 additions & 3 deletions src/Compilers/Core/Portable/CodeGen/CompilationTestData.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using Microsoft.CodeAnalysis.Emit;
using Microsoft.DiaSymReader;
using System;
Expand Down Expand Up @@ -29,16 +31,16 @@ public MethodData(ILBuilder ilBuilder, IMethodSymbol method)
public readonly ConcurrentDictionary<IMethodSymbol, MethodData> Methods = new ConcurrentDictionary<IMethodSymbol, MethodData>();

// The emitted module.
public CommonPEModuleBuilder Module;
public CommonPEModuleBuilder? Module;

public Func<ISymWriterMetadataProvider, SymUnmanagedWriter> SymWriterFactory;
public Func<ISymWriterMetadataProvider, SymUnmanagedWriter>? SymWriterFactory;

public ILBuilder GetIL(Func<IMethodSymbol, bool> predicate)
{
return Methods.Single(p => predicate(p.Key)).Value.ILBuilder;
}

private ImmutableDictionary<string, MethodData> _lazyMethodsByName;
private ImmutableDictionary<string, MethodData>? _lazyMethodsByName;

// Returns map indexed by name for those methods that have a unique name.
public ImmutableDictionary<string, MethodData> GetMethodsByName()
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/DebugDocumentProvider.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

namespace Microsoft.CodeAnalysis.CodeGen
{
internal delegate Cci.DebugSourceDocument DebugDocumentProvider(string path, string basePath);
Expand Down
4 changes: 3 additions & 1 deletion src/Compilers/Core/Portable/CodeGen/DebugId.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Diagnostics;
using Roslyn.Utilities;
Expand Down Expand Up @@ -43,7 +45,7 @@ public bool Equals(DebugId other)
&& this.Generation == other.Generation;
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return obj is DebugId && Equals((DebugId)obj);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System.Collections.Immutable;
using System.Diagnostics;

Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/EmitState.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Text;
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/ILBuilderConversions.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Diagnostics;
using System.Reflection.Metadata;
Expand Down
4 changes: 3 additions & 1 deletion src/Compilers/Core/Portable/CodeGen/ILBuilderEmit.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
Expand Down Expand Up @@ -240,7 +242,7 @@ internal void EmitStringSwitchJumpTable(
KeyValuePair<ConstantValue, object>[] caseLabels,
object fallThroughLabel,
LocalOrParameter key,
LocalDefinition keyHash,
LocalDefinition? keyHash,
SwitchStringJumpTableEmitter.EmitStringCompareAndBranch emitStringCondBranchDelegate,
SwitchStringJumpTableEmitter.GetStringHashCode computeStringHashcodeDelegate)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/ILEmitStyle.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

namespace Microsoft.CodeAnalysis.CodeGen
{
internal enum ILEmitStyle : byte
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/ILOpCodeExtensions.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Diagnostics;
using System.Reflection.Metadata;
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/ITokenDeferral.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System.Collections.Immutable;

namespace Microsoft.CodeAnalysis.CodeGen
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/Core/Portable/CodeGen/ItemTokenMap.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System.Collections.Concurrent;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.PooledObjects;
Expand Down
8 changes: 5 additions & 3 deletions src/Compilers/Core/Portable/CodeGen/LabelInfo.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.CodeGen
Expand All @@ -17,7 +19,7 @@ private struct LabelInfo
//if a label is marked before any branches to the label have been seen
//the stack is considered to be 0.
internal readonly int stack;
internal readonly BasicBlock bb;
internal readonly BasicBlock? bb;

/// <summary>
/// Sometimes we need to know if a label is targeted by conditional branches.
Expand All @@ -37,14 +39,14 @@ internal LabelInfo(int stack, bool targetOfConditionalBranches)
/// <summary>
/// Used when label is marked to the code.
/// </summary>
internal LabelInfo(BasicBlock bb, int stack, bool targetOfConditionalBranches)
internal LabelInfo(BasicBlock? bb, int stack, bool targetOfConditionalBranches)
{
this.stack = stack;
this.bb = bb;
this.targetOfConditionalBranches = targetOfConditionalBranches;
}

internal LabelInfo WithNewTarget(BasicBlock bb)
internal LabelInfo WithNewTarget(BasicBlock? bb)
{
return new LabelInfo(bb, this.stack, this.targetOfConditionalBranches);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Compilers/Core/Portable/CodeGen/LambdaDebugInfo.cs
Original file line number Diff line number Diff line change
@@ -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.

#nullable enable

using System;
using System.Diagnostics;
using Roslyn.Utilities;
Expand Down Expand Up @@ -49,7 +51,7 @@ public bool Equals(LambdaDebugInfo other)
&& LambdaId.Equals(other.LambdaId);
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return obj is LambdaDebugInfo && Equals((LambdaDebugInfo)obj);
}
Expand Down
Loading