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 main to main-vs-deps #56926

Merged
merged 34 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f905ef9
Add info to logs so we can determine issue serializing options
CyrusNajmabadi Sep 30, 2021
8d64c12
Simplify
CyrusNajmabadi Sep 30, 2021
2a8fae4
NRT
CyrusNajmabadi Sep 30, 2021
5ba37e0
Delete unnecessary code
jasonmalinowski Oct 1, 2021
bd8a222
Give each process a unique DB, not each workspace
CyrusNajmabadi Oct 1, 2021
c9a4314
Merge branch 'deleteDeadCode' into singleSharedDB
CyrusNajmabadi Oct 1, 2021
8df71e2
Merge remote-tracking branch 'upstream/main' into singleSharedDB
CyrusNajmabadi Oct 1, 2021
1ddda1c
Fix comment
CyrusNajmabadi Oct 1, 2021
b9f1e5d
Merge pull request #56881 from CyrusNajmabadi/addDebugInfo
CyrusNajmabadi Oct 1, 2021
d96002a
Avoid UI thread dependency in IAsyncServiceProvider.GetServiceAsync<T…
tmat Oct 1, 2021
93e50e3
Merge pull request #56897 from CyrusNajmabadi/singleSharedDB
CyrusNajmabadi Oct 1, 2021
45dbd92
Add telemetry to let us know how often our navto cache is benefitting…
CyrusNajmabadi Oct 1, 2021
84ecf57
Add docs
CyrusNajmabadi Oct 1, 2021
6c65f4a
Don't offer to remove variable in situations where we would crash (#5…
davidwengier Oct 1, 2021
327732d
Obsolete the legacy persistence service.
CyrusNajmabadi Oct 1, 2021
d9cf3ab
Merge pull request #56895 from jasonmalinowski/delete-obsolete-hierar…
jasonmalinowski Oct 1, 2021
46e91dc
Add test verifying VB error ranges (#56772)
333fred Oct 1, 2021
e43614f
Merge pull request #56909 from CyrusNajmabadi/logging
CyrusNajmabadi Oct 1, 2021
9affcef
Merge pull request #56913 from dotnet/merges/release/dev17.0-to-main
dotnet-bot Oct 1, 2021
7e02f60
Update src/Workspaces/Core/Portable/Storage/LegacyPersistentStorageSe…
CyrusNajmabadi Oct 1, 2021
87c72ca
Update src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/…
CyrusNajmabadi Oct 1, 2021
50c9338
added fatal error reporting
akhera99 Oct 1, 2021
72a99a8
Unskip AttributeTests.GenericAttributeParameter_01 (#56915)
RikkiGibson Oct 1, 2021
0a26602
Add back
CyrusNajmabadi Oct 1, 2021
5dd4fe3
Merge branch 'obsoletePersistence' of https://github.com/CyrusNajmaba…
CyrusNajmabadi Oct 1, 2021
856e580
Add A/B option so we can test how important recoverable syntax trees …
CyrusNajmabadi Oct 1, 2021
cde4870
REvert
CyrusNajmabadi Oct 1, 2021
d33494b
REvert
CyrusNajmabadi Oct 1, 2021
f23b88f
Merge pull request #56917 from akhera99/inline_hints_error_reporting
akhera99 Oct 1, 2021
e96cac6
Remove
CyrusNajmabadi Oct 1, 2021
42c848b
Merge remote-tracking branch 'upstream/release/dev17.0' into merges/r…
Cosifne Oct 1, 2021
a053ed8
Merge pull request #56921 from CyrusNajmabadi/recoverableTrees
CyrusNajmabadi Oct 1, 2021
7a65d5f
Merge pull request #56912 from CyrusNajmabadi/obsoletePersistence
CyrusNajmabadi Oct 2, 2021
8137685
Merge pull request #56918 from dotnet/merges/release/dev17.0-to-main
dotnet-bot Oct 2, 2021
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
7 changes: 3 additions & 4 deletions src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2995,7 +2995,6 @@ private void CoerceArguments<TMember>(
ArrayBuilder<BoundExpression> arguments,
BindingDiagnosticBag diagnostics,
TypeSymbol? receiverType,
RefKind? receiverRefKind,
uint receiverEscapeScope)
where TMember : Symbol
{
Expand All @@ -3014,7 +3013,7 @@ private void CoerceArguments<TMember>(
Debug.Assert(argument is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true });
TypeWithAnnotations parameterTypeWithAnnotations = GetCorrespondingParameterTypeWithAnnotations(ref result, parameters, arg);
reportUnsafeIfNeeded(methodResult, diagnostics, argument, parameterTypeWithAnnotations);
arguments[arg] = BindInterpolatedStringHandlerInMemberCall(argument, arguments, parameters, ref result, arg, receiverType, receiverRefKind, receiverEscapeScope, diagnostics);
arguments[arg] = BindInterpolatedStringHandlerInMemberCall(argument, arguments, parameters, ref result, arg, receiverType, receiverEscapeScope, diagnostics);
}
// https://github.com/dotnet/roslyn/issues/37119 : should we create an (Identity) conversion when the kind is Identity but the types differ?
else if (!kind.IsIdentity)
Expand Down Expand Up @@ -5723,7 +5722,7 @@ internal bool TryPerformConstructorOverloadResolution(

if (succeededIgnoringAccessibility)
{
this.CoerceArguments<MethodSymbol>(result.ValidResult, analyzedArguments.Arguments, diagnostics, receiverType: null, receiverRefKind: null, receiverEscapeScope: Binder.ExternalScope);
this.CoerceArguments<MethodSymbol>(result.ValidResult, analyzedArguments.Arguments, diagnostics, receiverType: null, receiverEscapeScope: Binder.ExternalScope);
}

// Fill in the out parameter with the result, if there was one; it might be inaccessible.
Expand Down Expand Up @@ -7967,7 +7966,7 @@ private BoundExpression BindIndexerOrIndexedPropertyAccess(
uint receiverEscapeScope = property.RequiresInstanceReceiver && receiverOpt != null
? receiverRefKind?.IsWritableReference() == true ? GetRefEscape(receiverOpt, LocalScopeDepth) : GetValEscape(receiverOpt, LocalScopeDepth)
: Binder.ExternalScope;
this.CoerceArguments<PropertySymbol>(resolutionResult, analyzedArguments.Arguments, diagnostics, receiverOpt?.Type, receiverRefKind, receiverEscapeScope);
this.CoerceArguments<PropertySymbol>(resolutionResult, analyzedArguments.Arguments, diagnostics, receiverOpt?.Type, receiverEscapeScope);

var isExpanded = resolutionResult.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm;
var argsToParams = resolutionResult.Result.ArgsToParamsOpt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ private BoundExpression BindInterpolatedStringHandlerInMemberCall(
ref MemberAnalysisResult memberAnalysisResult,
int interpolatedStringArgNum,
TypeSymbol? receiverType,
RefKind? receiverRefKind,
uint receiverEscapeScope,
BindingDiagnosticBag diagnostics)
{
Expand Down Expand Up @@ -874,8 +873,8 @@ private BoundExpression BindInterpolatedStringHandlerInMemberCall(
switch (argumentIndex)
{
case BoundInterpolatedStringArgumentPlaceholder.InstanceParameter:
Debug.Assert(receiverRefKind != null && receiverType is not null);
refKind = receiverRefKind.GetValueOrDefault();
Debug.Assert(receiverType is not null);
refKind = RefKind.None;
placeholderType = receiverType;
break;
case BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter:
Expand Down
3 changes: 1 addition & 2 deletions src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ private BoundCall BindInvocationExpressionContinued(
uint receiverValEscapeScope = method.RequiresInstanceReceiver && receiver != null
? receiverRefKind?.IsWritableReference() == true ? GetRefEscape(receiver, LocalScopeDepth) : GetValEscape(receiver, LocalScopeDepth)
: Binder.ExternalScope;
this.CoerceArguments(methodResult, analyzedArguments.Arguments, diagnostics, receiver?.Type, receiverRefKind, receiverValEscapeScope);
this.CoerceArguments(methodResult, analyzedArguments.Arguments, diagnostics, receiver?.Type, receiverValEscapeScope);

var expanded = methodResult.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm;
var argsToParams = methodResult.Result.ArgsToParamsOpt;
Expand Down Expand Up @@ -2033,7 +2033,6 @@ private BoundFunctionPointerInvocation BindFunctionPointerInvocation(SyntaxNode
analyzedArguments.Arguments,
diagnostics,
receiverType: null,
receiverRefKind: null,
receiverEscapeScope: Binder.ExternalScope);

var args = analyzedArguments.Arguments.ToImmutable();
Expand Down
6 changes: 2 additions & 4 deletions src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10291,7 +10291,7 @@ class Program2 { }
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "default(T2)").WithLocation(10, 22));
}

[ConditionalFact(typeof(CoreClrOnly), AlwaysSkip = "https://github.com/dotnet/roslyn/issues/56664"), WorkItem(55190, "https://github.com/dotnet/roslyn/issues/55190")]
[ConditionalFact(typeof(CoreClrOnly)), WorkItem(55190, "https://github.com/dotnet/roslyn/issues/55190")]
public void GenericAttributeParameter_01()
{
var source = @"
Expand Down Expand Up @@ -10325,9 +10325,7 @@ static void Main()
}
}
";
// The expected output here will change once we consume a runtime
// which has a fix for https://github.com/dotnet/runtime/issues/56492
var verifier = CompileAndVerify(source, sourceSymbolValidator: verify, symbolValidator: verifyMetadata, expectedOutput: "CustomAttributeFormatException");
var verifier = CompileAndVerify(source, sourceSymbolValidator: verify, symbolValidator: verifyMetadata, expectedOutput: "a");

verifier.VerifyTypeIL("Holder", @"
.class private auto ansi beforefieldinit Holder
Expand Down
94 changes: 91 additions & 3 deletions src/Compilers/CSharp/Test/Semantic/Semantics/DelegateTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3267,6 +3267,7 @@ static void Main()
CompileAndVerify(source, expectedOutput: expectedOutput);
}

[WorkItem(56623, "https://github.com/dotnet/roslyn/issues/56623")]
[Fact]
public void OverloadResolution_16()
{
Expand All @@ -3277,21 +3278,47 @@ class Program
static void F(Func<Func<object>> f, int i) => Report(f);
static void F(Func<Func<int>> f, object o) => Report(f);
static void Main()
{
M(false);
}
static void M(bool b)
{
F(() => () => 1, 2);
F(() => () => { if (b) return 0; return 1; }, 2);
F(() => { if (b) return () => 0; return () => 1; }, 2);
}
static void Report(Delegate d) => Console.WriteLine(d.GetType());
}";

CompileAndVerify(source, parseOptions: TestOptions.Regular9, expectedOutput:
@"System.Func`1[System.Func`1[System.Object]]");
@"System.Func`1[System.Func`1[System.Object]]
System.Func`1[System.Func`1[System.Object]]
System.Func`1[System.Func`1[System.Object]]
");

// Breaking change from C#9 which binds calls to F(Func<Func<object>>, int).
//
// The calls such as F(() => () => 1, 2) should be considered ambiguous in C#9 as per the C# spec.
// But for compatibility with the legacy compiler, the implementation of "better conversion
// from expression" ignores delegate types for certain cases when the corresponding
// argument is a lambda expression, such as when the inferred return type of the lambda
// expression is null (see OverloadResolution.CanDowngradeConversionFromLambdaToNeither()).
// With the code example above, in C#10, the inferred return type of lambdas such as () => () => 1
// is Func<int> rather than null so the compatibility exception no longer applies for this example.
//
// We've decided to take the breaking change and match the C# spec rather than the
// legacy compiler in this particular case.
var expectedDiagnostics = new[]
{
// (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.F(Func<Func<object>>, int)' and 'Program.F(Func<Func<int>>, object)'
// (12,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.F(Func<Func<object>>, int)' and 'Program.F(Func<Func<int>>, object)'
// F(() => () => 1, 2);
Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("Program.F(System.Func<System.Func<object>>, int)", "Program.F(System.Func<System.Func<int>>, object)").WithLocation(8, 9)
Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("Program.F(System.Func<System.Func<object>>, int)", "Program.F(System.Func<System.Func<int>>, object)").WithLocation(12, 9),
// (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.F(Func<Func<object>>, int)' and 'Program.F(Func<Func<int>>, object)'
// F(() => () => { if (b) return 0; return 1; }, 2);
Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("Program.F(System.Func<System.Func<object>>, int)", "Program.F(System.Func<System.Func<int>>, object)").WithLocation(13, 9),
// (14,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.F(Func<Func<object>>, int)' and 'Program.F(Func<Func<int>>, object)'
// F(() => { if (b) return () => 0; return () => 1; }, 2);
Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("Program.F(System.Func<System.Func<object>>, int)", "Program.F(System.Func<System.Func<int>>, object)").WithLocation(14, 9)
};
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular10);
comp.VerifyDiagnostics(expectedDiagnostics);
Expand Down Expand Up @@ -4218,6 +4245,67 @@ static void Main()
CompileAndVerify(source, expectedOutput: expectedOutput);
}

[Fact]
public void OverloadResolution_46()
{
var source =
@"using System;
class Program
{
static void F(Func<Func<object>> f, int i) => Report(f);
static void F(Func<Func<int>> f, object o) => Report(f);
static void Main()
{
M(false);
}
static void M(bool b)
{
F(() => b ? () => 0 : () => 1, 2);
}
static void Report(Delegate d) => Console.WriteLine(d.GetType());
}";

var expectedDiagnostics = new[]
{
// (12,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.F(Func<Func<object>>, int)' and 'Program.F(Func<Func<int>>, object)'
// F(() => b ? () => 0 : () => 1, 2);
Diagnostic(ErrorCode.ERR_AmbigCall, "F").WithArguments("Program.F(System.Func<System.Func<object>>, int)", "Program.F(System.Func<System.Func<int>>, object)").WithLocation(12, 9)
};
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
comp = CreateCompilation(source, parseOptions: TestOptions.Regular10);
comp.VerifyDiagnostics(expectedDiagnostics);
comp = CreateCompilation(source);
comp.VerifyDiagnostics(expectedDiagnostics);
}

[Fact]
public void OverloadResolution_47()
{
var source =
@"using System;
class Program
{
static void F(int i, Func<Func<object>> f) => Report(f);
static void F(object o, Func<Func<int>> f) => Report(f);
static void Main()
{
F(2, () => new[] { () => 0, () => 1 }[0]);
}
static void Report(Delegate d) => Console.WriteLine(d.GetType());
}";

var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (8,20): error CS0826: No best type found for implicitly-typed array
// F(2, () => new[] { () => 0, () => 1 }[0]);
Diagnostic(ErrorCode.ERR_ImplicitlyTypedArrayNoBestType, "new[] { () => 0, () => 1 }").WithLocation(8, 20));

var expectedOutput = @"System.Func`1[System.Func`1[System.Int32]]";
CompileAndVerify(source, parseOptions: TestOptions.Regular10, expectedOutput: expectedOutput);
CompileAndVerify(source, expectedOutput: expectedOutput);
}

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