Skip to content

Commit 5de646e

Browse files
authored
Merge pull request #58362 from dotnet/merges/main-to-features/rename_ui_rework
Merge main to features/rename_ui_rework
2 parents 2f8a90c + 9cbcb29 commit 5de646e

File tree

145 files changed

+11832
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+11832
-555
lines changed

docs/Language Feature Status.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ efforts behind them.
1010

1111
| Feature | Branch | State | Developer | Reviewer | LDM Champ |
1212
| ------- | ------ | ----- | --------- | -------- | --------- |
13+
| [Newlines in interpolations](https://github.com/dotnet/csharplang/issues/4935) | main | [Merged in 17.1p1](https://github.com/dotnet/roslyn/issues/57154) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv), [chsienki](https://github.com/chsienki) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
14+
| [List patterns](https://github.com/dotnet/csharplang/issues/3435) | [list-patterns](https://github.com/dotnet/roslyn/tree/features/list-patterns) | [Merged in 17.1p2](https://github.com/dotnet/roslyn/issues/51289) | [alrz](https://github.com/alrz) | [jcouv](https://github.com/jcouv), [333fred](https://github.com/333fred) | [333fred](https://github.com/333fred) |
15+
| [Parameter null-checking](https://github.com/dotnet/csharplang/issues/2145) | [param-nullchecking](https://github.com/dotnet/roslyn/tree/features/param-nullchecking) | [In Progress](https://github.com/dotnet/roslyn/issues/36024) | [RikkiGibson](https://github.com/RikkiGibson), [fayrose](https://github.com/fayrose) | [cston](https://github.com/cston), [chsienki](https://github.com/chsienki) | [jaredpar](https://github.com/jaredpar) |
16+
| [Raw string literals](https://github.com/dotnet/csharplang/issues/4304) | [RawStringLiterals](https://github.com/dotnet/roslyn/tree/features/features/RawStringLiterals) | [In Progress](https://github.com/dotnet/roslyn/issues/55306) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
1317
| [nameof(parameter)](https://github.com/dotnet/csharplang/issues/373) | main | [In Progress](https://github.com/dotnet/roslyn/issues/40524) | [jcouv](https://github.com/jcouv) | TBD | [jcouv](https://github.com/jcouv) |
1418
| [Relax ordering of `ref` and `partial` modifiers](https://github.com/dotnet/csharplang/issues/946) | [ref-partial](https://github.com/dotnet/roslyn/tree/features/ref-partial) | In Progress | [alrz](https://github.com/alrz) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
15-
| [Parameter null-checking](https://github.com/dotnet/csharplang/issues/2145) | [param-nullchecking](https://github.com/dotnet/roslyn/tree/features/param-nullchecking) | [In Progress](https://github.com/dotnet/roslyn/issues/36024) | [RikkiGibson](https://github.com/RikkiGibson), [fayrose](https://github.com/fayrose) | [cston](https://github.com/cston), [chsienki](https://github.com/chsienki) | [jaredpar](https://github.com/jaredpar) |
1619
| [Generic attributes](https://github.com/dotnet/csharplang/issues/124) | [generic-attributes](https://github.com/dotnet/roslyn/tree/features/generic-attributes) | [Merged into 17.0p4 (preview langver)](https://github.com/dotnet/roslyn/issues/36285) | [AviAvni](https://github.com/AviAvni) | [RikkiGibson](https://github.com/RikkiGibson), [jcouv](https://github.com/jcouv) | [mattwar](https://github.com/mattwar) |
1720
| [Default in deconstruction](https://github.com/dotnet/roslyn/pull/25562) | [decon-default](https://github.com/dotnet/roslyn/tree/features/decon-default) | [Implemented](https://github.com/dotnet/roslyn/issues/25559) | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
18-
| [List patterns](https://github.com/dotnet/csharplang/issues/3435) | [list-patterns](https://github.com/dotnet/roslyn/tree/features/list-patterns) | [In Progress](https://github.com/dotnet/roslyn/issues/51289) | [alrz](https://github.com/alrz) | [jcouv](https://github.com/jcouv), [333fred](https://github.com/333fred) | [333fred](https://github.com/333fred) |
19-
| [Raw string literals](https://github.com/dotnet/csharplang/issues/4304) | [RawStringLiterals](https://github.com/dotnet/roslyn/tree/features/features/RawStringLiterals) | [In Progress](https://github.com/dotnet/roslyn/issues/55306) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
2021
| [Semi-auto-properties](https://github.com/dotnet/csharplang/issues/140) | [semi-auto-properties](https://github.com/dotnet/roslyn/tree/features/features/semi-auto-properties) | [In Progress](https://github.com/dotnet/roslyn/issues/57012) | [Youssef1313](https://github.com/Youssef1313) | TBD | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
2122
| [Required members](https://github.com/dotnet/csharplang/issues/3630) | [required-members](https://github.com/dotnet/roslyn/tree/features/required-members) | [In Progress](https://github.com/dotnet/roslyn/issues/57046) | [333fred](https://github.com/333fred) | [jcouv](https://github.com/jcouv), [RikkiGibson](https://github.com/RikkiGibson) | [333fred](https://github.com/333fred) |
2223
| [Top Level statement attribute specifiers](https://github.com/dotnet/csharplang/issues/5045) | [main-attributes](https://github.com/dotnet/roslyn/tree/features/features/main-attributes) | [In Progress](https://github.com/dotnet/roslyn/issues/57047) | [chsienki](https://github.com/chsienki) | TBD | [jaredpar](https://github.com/jaredpar) |
2324
| [Primary Constructors](https://github.com/dotnet/csharplang/issues/2691) | [primary-constructors](https://github.com/dotnet/roslyn/tree/features/features/primary-constructors) | [In Progress](https://github.com/dotnet/roslyn/issues/57048) | TBD | TBD | [MadsTorgersen](https://github.com/MadsTorgersen) |
2425
| [Params Span<T> + Stackalloc any array type](https://github.com/dotnet/csharplang/issues/1757) | [params-span](https://github.com/dotnet/roslyn/tree/features/features/params-span) | [In Progress](https://github.com/dotnet/roslyn/issues/57049) | [cston](https://github.com/cston) | TBD | [jaredpar](https://github.com/jaredpar) |
25-
| [Newlines in interpolations](https://github.com/dotnet/csharplang/issues/4935) | main | [In Progress](https://github.com/dotnet/roslyn/issues/57154) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv), TBD | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
26+
2627

2728
# C# 10.0
2829

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
</Dependency>
1414
</ProductDependencies>
1515
<ToolsetDependencies>
16-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21610.4">
16+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21614.1">
1717
<Uri>https://github.com/dotnet/arcade</Uri>
18-
<Sha>18adc5b47acce8bb03948baf578fca442d1029d4</Sha>
18+
<Sha>cc0fa942bf43c2814af778868d4e7ddf21146b96</Sha>
1919
<SourceBuild RepoName="arcade" ManagedOnly="true" />
2020
</Dependency>
2121
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.1.0-2.21609.7">
2222
<Uri>https://github.com/dotnet/roslyn</Uri>
2323
<Sha>818313426323d979747781a17c78860c833776da</Sha>
2424
</Dependency>
25-
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="7.0.0-beta.21610.4">
25+
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="7.0.0-beta.21614.1">
2626
<Uri>https://github.com/dotnet/arcade</Uri>
27-
<Sha>18adc5b47acce8bb03948baf578fca442d1029d4</Sha>
27+
<Sha>cc0fa942bf43c2814af778868d4e7ddf21146b96</Sha>
2828
</Dependency>
2929
</ToolsetDependencies>
3030
</Dependencies>

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"xcopy-msbuild": "16.10.0-preview2"
1313
},
1414
"msbuild-sdks": {
15-
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21610.4",
16-
"Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.21610.4"
15+
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21614.1",
16+
"Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.21614.1"
1717
}
1818
}

src/Compilers/CSharp/Portable/Binder/Binder.QueryUnboundLambdaState.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public QueryUnboundLambdaState(Binder binder, RangeVariableMap rangeVariableMap,
3232

3333
public override string ParameterName(int index) { return _parameters[index].Name; }
3434
public override bool ParameterIsDiscard(int index) { return false; }
35+
public override bool ParameterIsNullChecked(int index) { return false; }
3536
public override SyntaxList<AttributeListSyntax> ParameterAttributes(int index) => default;
3637
public override bool HasNames { get { return true; } }
3738
public override bool HasSignature { get { return true; } }

src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,12 +2798,7 @@ internal static uint GetValEscape(BoundExpression expr, uint scopeOfTheContainin
27982798

27992799
if (conversion.ConversionKind == ConversionKind.InterpolatedStringHandler)
28002800
{
2801-
var data = conversion.Operand switch
2802-
{
2803-
BoundInterpolatedString { InterpolationData: { } d } => d,
2804-
BoundBinaryOperator { InterpolatedStringHandlerData: { } d } => d,
2805-
_ => throw ExceptionUtilities.UnexpectedValue(conversion.Operand.Kind)
2806-
};
2801+
var data = conversion.Operand.GetInterpolatedStringHandlerData();
28072802
return GetInterpolatedStringHandlerConversionEscapeScope(data, scopeOfTheContainingExpression);
28082803
}
28092804

@@ -3592,12 +3587,7 @@ private static bool CheckValEscape(ImmutableArray<BoundExpression> expressions,
35923587
private static bool CheckInterpolatedStringHandlerConversionEscape(BoundExpression expression, uint escapeFrom, uint escapeTo, BindingDiagnosticBag diagnostics)
35933588
{
35943589

3595-
var data = expression switch
3596-
{
3597-
BoundInterpolatedString { InterpolationData: { } d } => d,
3598-
BoundBinaryOperator { InterpolatedStringHandlerData: { } d } => d,
3599-
_ => throw ExceptionUtilities.UnexpectedValue(expression.Kind)
3600-
};
3590+
var data = expression.GetInterpolatedStringHandlerData();
36013591

36023592
// We need to check to see if any values could potentially escape outside the max depth via the handler type.
36033593
// Consider the case where a ref-struct handler saves off the result of one call to AppendFormatted,

src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,8 +2993,7 @@ private void CoerceArguments<TMember>(
29932993
MemberResolutionResult<TMember> methodResult,
29942994
ArrayBuilder<BoundExpression> arguments,
29952995
BindingDiagnosticBag diagnostics,
2996-
TypeSymbol? receiverType,
2997-
uint receiverEscapeScope)
2996+
BoundExpression? receiver)
29982997
where TMember : Symbol
29992998
{
30002999
var result = methodResult.Result;
@@ -3012,7 +3011,7 @@ private void CoerceArguments<TMember>(
30123011
Debug.Assert(argument is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true });
30133012
TypeWithAnnotations parameterTypeWithAnnotations = GetCorrespondingParameterTypeWithAnnotations(ref result, parameters, arg);
30143013
reportUnsafeIfNeeded(methodResult, diagnostics, argument, parameterTypeWithAnnotations);
3015-
arguments[arg] = BindInterpolatedStringHandlerInMemberCall(argument, arguments, parameters, ref result, arg, receiverType, receiverEscapeScope, diagnostics);
3014+
arguments[arg] = BindInterpolatedStringHandlerInMemberCall(argument, arguments, parameters, ref result, arg, receiver, methodResult.LeastOverriddenMember.RequiresInstanceReceiver(), diagnostics);
30163015
}
30173016
// https://github.com/dotnet/roslyn/issues/37119 : should we create an (Identity) conversion when the kind is Identity but the types differ?
30183017
else if (!kind.IsIdentity)
@@ -4809,13 +4808,7 @@ private BoundExpression BindObjectInitializerMember(
48094808
{
48104809
if (argument is BoundConversion { Conversion.IsInterpolatedStringHandler: true, Operand: var operand })
48114810
{
4812-
var handlerPlaceholders = operand switch
4813-
{
4814-
BoundBinaryOperator { InterpolatedStringHandlerData: { } data } => data.ArgumentPlaceholders,
4815-
BoundInterpolatedString { InterpolationData: { } data } => data.ArgumentPlaceholders,
4816-
_ => throw ExceptionUtilities.UnexpectedValue(operand.Kind)
4817-
};
4818-
4811+
var handlerPlaceholders = operand.GetInterpolatedStringHandlerData().ArgumentPlaceholders;
48194812
if (handlerPlaceholders.Any(placeholder => placeholder.ArgumentIndex == BoundInterpolatedStringArgumentPlaceholder.InstanceParameter))
48204813
{
48214814
diagnostics.Add(ErrorCode.ERR_InterpolatedStringsReferencingInstanceCannotBeInObjectInitializers, argument.Syntax.Location);
@@ -5745,7 +5738,7 @@ internal bool TryPerformConstructorOverloadResolution(
57455738

57465739
if (succeededIgnoringAccessibility)
57475740
{
5748-
this.CoerceArguments<MethodSymbol>(result.ValidResult, analyzedArguments.Arguments, diagnostics, receiverType: null, receiverEscapeScope: Binder.ExternalScope);
5741+
this.CoerceArguments<MethodSymbol>(result.ValidResult, analyzedArguments.Arguments, diagnostics, receiver: null);
57495742
}
57505743

57515744
// Fill in the out parameter with the result, if there was one; it might be inaccessible.
@@ -8012,11 +8005,6 @@ private BoundExpression BindIndexerOrIndexedPropertyAccess(
80128005
{
80138006
MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
80148007
PropertySymbol property = resolutionResult.Member;
8015-
RefKind? receiverRefKind = receiver.GetRefKind();
8016-
uint receiverEscapeScope = property.RequiresInstanceReceiver && receiver != null
8017-
? receiverRefKind?.IsWritableReference() == true ? GetRefEscape(receiver, LocalScopeDepth) : GetValEscape(receiver, LocalScopeDepth)
8018-
: Binder.ExternalScope;
8019-
this.CoerceArguments<PropertySymbol>(resolutionResult, analyzedArguments.Arguments, diagnostics, receiver.Type, receiverEscapeScope);
80208008

80218009
var isExpanded = resolutionResult.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm;
80228010
var argsToParams = resolutionResult.Result.ArgsToParamsOpt;
@@ -8028,6 +8016,8 @@ private BoundExpression BindIndexerOrIndexedPropertyAccess(
80288016

80298017
receiver = ReplaceTypeOrValueReceiver(receiver, property.IsStatic, diagnostics);
80308018

8019+
this.CoerceArguments<PropertySymbol>(resolutionResult, analyzedArguments.Arguments, diagnostics, receiver);
8020+
80318021
if (!gotError && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated)
80328022
{
80338023
gotError = IsRefOrOutThisParameterCaptured(syntax, diagnostics);

src/Compilers/CSharp/Portable/Binder/Binder_InterpolatedString.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,8 @@ private BoundExpression BindInterpolatedStringHandlerInMemberCall(
808808
ImmutableArray<ParameterSymbol> parameters,
809809
ref MemberAnalysisResult memberAnalysisResult,
810810
int interpolatedStringArgNum,
811-
TypeSymbol? receiverType,
812-
uint receiverEscapeScope,
811+
BoundExpression? receiver,
812+
bool requiresInstanceReceiver,
813813
BindingDiagnosticBag diagnostics)
814814
{
815815
Debug.Assert(unconvertedString is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true });
@@ -916,9 +916,9 @@ private BoundExpression BindInterpolatedStringHandlerInMemberCall(
916916
switch (argumentIndex)
917917
{
918918
case BoundInterpolatedStringArgumentPlaceholder.InstanceParameter:
919-
Debug.Assert(receiverType is not null);
919+
Debug.Assert(receiver!.Type is not null);
920920
refKind = RefKind.None;
921-
placeholderType = receiverType;
921+
placeholderType = receiver.Type;
922922
break;
923923
case BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter:
924924
{
@@ -964,33 +964,40 @@ private BoundExpression BindInterpolatedStringHandlerInMemberCall(
964964

965965
SyntaxNode placeholderSyntax;
966966
uint valSafeToEscapeScope;
967+
bool isSuppressed;
967968

968969
switch (argumentIndex)
969970
{
970971
case BoundInterpolatedStringArgumentPlaceholder.InstanceParameter:
971-
placeholderSyntax = unconvertedString.Syntax;
972-
valSafeToEscapeScope = receiverEscapeScope;
972+
Debug.Assert(receiver != null);
973+
valSafeToEscapeScope = requiresInstanceReceiver
974+
? receiver.GetRefKind().IsWritableReference() == true ? GetRefEscape(receiver, LocalScopeDepth) : GetValEscape(receiver, LocalScopeDepth)
975+
: Binder.ExternalScope;
976+
isSuppressed = receiver.IsSuppressed;
977+
placeholderSyntax = receiver.Syntax;
973978
break;
974979
case BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter:
975980
placeholderSyntax = unconvertedString.Syntax;
976981
valSafeToEscapeScope = Binder.ExternalScope;
982+
isSuppressed = false;
977983
break;
978984
case >= 0:
979985
placeholderSyntax = arguments[argumentIndex].Syntax;
980986
valSafeToEscapeScope = GetValEscape(arguments[argumentIndex], LocalScopeDepth);
987+
isSuppressed = arguments[argumentIndex].IsSuppressed;
981988
break;
982989
default:
983990
throw ExceptionUtilities.UnexpectedValue(argumentIndex);
984991
}
985992

986993
argumentPlaceholdersBuilder.Add(
987-
new BoundInterpolatedStringArgumentPlaceholder(
994+
(BoundInterpolatedStringArgumentPlaceholder)(new BoundInterpolatedStringArgumentPlaceholder(
988995
placeholderSyntax,
989996
argumentIndex,
990997
valSafeToEscapeScope,
991998
placeholderType,
992999
hasErrors: argumentIndex == BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter)
993-
{ WasCompilerGenerated = true });
1000+
{ WasCompilerGenerated = true }.WithSuppression(isSuppressed)));
9941001
// We use the parameter refkind, rather than what the argument was actually passed with, because that will suppress duplicated errors
9951002
// about arguments being passed with the wrong RefKind. The user will have already gotten an error about mismatched RefKinds or it will
9961003
// be a place where refkinds are allowed to differ

0 commit comments

Comments
 (0)