Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonchou committed Jul 27, 2021
2 parents 0481001 + ebbae5b commit e039f51
Show file tree
Hide file tree
Showing 37 changed files with 2,051 additions and 282 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- job: VS_Integration
pool:
name: NetCorePublic-Pool
queue: $(queueName)
queue: BuildPool.Windows.VS2019.Pre.Scouting.Open
strategy:
maxParallel: 4
matrix:
Expand Down
7 changes: 4 additions & 3 deletions eng/targets/Services.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<Project>
<!--
Roslyn ServiceHub services.
Used to generate
Used to generate
1) {service-name}.servicehub.service.json files included in Roslyn setup VSIX and in ServiceHub install directory.
2) ServiceHub brokered service registrations in pkgdef file.
Expand Down Expand Up @@ -37,9 +37,10 @@
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.EditAndContinue" ClassName="Microsoft.CodeAnalysis.EditAndContinue.RemoteEditAndContinueService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.ValueTracking" ClassName="Microsoft.CodeAnalysis.Remote.RemoteValueTrackingService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.InheritanceMargin" ClassName="Microsoft.CodeAnalysis.Remote.RemoteInheritanceMarginService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.UnusedReferenceAnalysis" ClassName="Microsoft.CodeAnalysis.Remote.RemoteUnusedReferenceAnalysisService+Factory" IsBrokered="true" />
<ServiceHubService Include="roslynRemoteLanguageServer" ClassName="Microsoft.CodeAnalysis.Remote.RemoteLanguageServer" />
</ItemGroup>

<!--
Roslyn in-proc brokered services.
-->
Expand Down
8 changes: 4 additions & 4 deletions src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10001,18 +10001,18 @@ private ExpressionSyntax ParseExpressionCore()
/// </summary>
private bool CanStartExpression()
{
return IsPossibleExpression(allowBinaryExpressions: false, allowAssignmentExpressions: false);
return IsPossibleExpression(allowBinaryExpressions: false, allowAssignmentExpressions: false, allowAttributes: false);
}

/// <summary>
/// Is the current token one that could be in an expression?
/// </summary>
private bool IsPossibleExpression()
{
return IsPossibleExpression(allowBinaryExpressions: true, allowAssignmentExpressions: true);
return IsPossibleExpression(allowBinaryExpressions: true, allowAssignmentExpressions: true, allowAttributes: true);
}

private bool IsPossibleExpression(bool allowBinaryExpressions, bool allowAssignmentExpressions)
private bool IsPossibleExpression(bool allowBinaryExpressions, bool allowAssignmentExpressions, bool allowAttributes)
{
SyntaxKind tk = this.CurrentToken.Kind;
switch (tk)
Expand Down Expand Up @@ -10048,7 +10048,7 @@ private bool IsPossibleExpression(bool allowBinaryExpressions, bool allowAssignm
case SyntaxKind.StaticKeyword:
return IsPossibleAnonymousMethodExpression() || IsPossibleLambdaExpression(Precedence.Expression);
case SyntaxKind.OpenBracketToken:
return IsPossibleLambdaExpression(Precedence.Expression);
return allowAttributes && IsPossibleLambdaExpression(Precedence.Expression);
case SyntaxKind.IdentifierToken:
// Specifically allow the from contextual keyword, because it can always be the start of an
// expression (whether it is used as an identifier or a keyword).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ private SubpatternSyntax ParseSubpatternElement()
/// </summary>
private bool IsPossibleSubpatternElement()
{
return this.IsPossibleExpression(allowBinaryExpressions: false, allowAssignmentExpressions: false) ||
return this.IsPossibleExpression(allowBinaryExpressions: false, allowAssignmentExpressions: false, allowAttributes: false) ||
this.CurrentToken.Kind switch
{
SyntaxKind.OpenBraceToken => true,
Expand Down
24 changes: 24 additions & 0 deletions src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4173,6 +4173,30 @@ static void Main()
Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(8, 50));
}

[WorkItem(55013, "https://github.com/dotnet/roslyn/issues/55013")]
[Fact]
public void NullableTypeArraySwitchPattern()
{
var source =
@"#nullable enable
class C
{
object? field;
string Prop => field switch
{
string?[] a => ""a""
};
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (4,13): warning CS0649: Field 'C.field' is never assigned to, and will always have its default value null
// object? field;
Diagnostic(ErrorCode.WRN_UnassignedInternalField, "field").WithArguments("C.field", "null").WithLocation(4, 13),
// (5,26): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '_' is not covered.
// string Prop => field switch
Diagnostic(ErrorCode.WRN_SwitchExpressionNotExhaustive, "switch").WithArguments("_").WithLocation(5, 26));
}

[Fact]
public void LambdaAttributes_DoesNotReturn()
{
Expand Down
Loading

0 comments on commit e039f51

Please sign in to comment.