Skip to content

Commit 3e1ff61

Browse files
author
Julien Couvreur
committed
Close some tracked follow-ups
1 parent f360fd6 commit 3e1ff61

31 files changed

+302
-19
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ internal override void GetExtensionDeclarations(ArrayBuilder<NamedTypeSymbol> ex
133133
{
134134
Debug.Assert(extensions.Count == 0);
135135

136-
// Tracked by https://github.com/dotnet/roslyn/issues/79440 : using directives, test this flag (see TestUnusedExtensionMarksImportsAsUsed)
137136
bool callerIsSemanticModel = originalBinder.IsSemanticModelBinder;
138137

139138
// We need to avoid collecting multiple candidates for an extension declaration imported both through a namespace and a static class

src/Compilers/CSharp/Portable/CSharpResources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8202,4 +8202,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
82028202
<data name="ERR_ExplicitInterfaceMemberReturnTypeMismatch" xml:space="preserve">
82038203
<value>'{0}': return type must be '{1}' to match implemented member '{2}'</value>
82048204
</data>
8205+
<data name="ParameterRequiresTypeOrIdentifier" xml:space="preserve">
8206+
<value>ParameterSyntax requires either a type or an identifier.</value>
8207+
</data>
82058208
</root>

src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,6 @@ forSemanticModel.Syntax is { } semanticModelSyntax &&
11811181
});
11821182
}
11831183

1184-
// Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, Ensure we are not messing up relative order of events for extension members (with relation to events for enclosing types, etc.)
11851184
_compilation.EventQueue.TryEnqueue(new SymbolDeclaredCompilationEvent(
11861185
_compilation, methodSymbol, semanticModelWithCachedBoundNodes));
11871186
}

src/Compilers/CSharp/Portable/Emitter/Model/MethodSymbolAdapter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ Cci.ITypeDefinition Cci.ITypeDefinitionMember.ContainingTypeDefinition
310310
return synthesizedGlobalMethod.ContainingPrivateImplementationDetailsType;
311311
}
312312

313-
// Tracked by https://github.com/dotnet/roslyn/issues/78827 : code quality, share logic with Cci.ITypeMemberReference.GetContainingType implementation?
314313
if (AdaptedMethodSymbol is SynthesizedExtensionMarker marker)
315314
{
316315
return ((SourceMemberContainerTypeSymbol)AdaptedMethodSymbol.ContainingType.ContainingType).GetExtensionGroupingInfo().GetCorrespondingMarkerType(marker);

src/Compilers/CSharp/Portable/Emitter/Model/PropertySymbolAdapter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ ITypeDefinition ITypeDefinitionMember.ContainingTypeDefinition
221221
{
222222
CheckDefinitionInvariant();
223223

224-
// Tracked by https://github.com/dotnet/roslyn/issues/78827 : code quality, share logic with Cci.ITypeMemberReference.GetContainingType implementation?
225224
if (AdaptedPropertySymbol.GetIsNewExtensionMember())
226225
{
227226
var containingType = AdaptedPropertySymbol.ContainingType;
@@ -249,7 +248,6 @@ ITypeReference ITypeMemberReference.GetContainingType(EmitContext context)
249248
{
250249
CheckDefinitionInvariant();
251250

252-
// Tracked by https://github.com/dotnet/roslyn/issues/78827 : code quality, share logic with Cci.ITypeMemberReference.GetContainingType implementation in MethodSymbolAdapter?
253251
if (AdaptedPropertySymbol.GetIsNewExtensionMember())
254252
{
255253
var containingType = AdaptedPropertySymbol.ContainingType;

src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13766,8 +13766,11 @@ public sealed partial class ParameterSyntax : BaseParameterSyntax
1376613766
internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
1376713767
: base(green, parent, position)
1376813768
{
13769+
Validate();
1376913770
}
1377013771

13772+
private partial void Validate();
13773+
1377113774
/// <summary>Gets the attribute declaration list.</summary>
1377213775
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(GetRed(ref this.attributeLists, 0));
1377313776

src/Compilers/CSharp/Portable/Syntax/ParameterSyntax.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@ internal bool IsArgList
1313
return this.Type == null && this.Identifier.ContextualKind() == SyntaxKind.ArgListKeyword;
1414
}
1515
}
16+
17+
private partial void Validate()
18+
{
19+
if (Type is null && Identifier.IsKind(SyntaxKind.None))
20+
{
21+
throw new System.NotSupportedException(CSharpResources.ParameterRequiresTypeOrIdentifier);
22+
}
23+
}
1624
}
1725
}

src/Compilers/CSharp/Portable/Syntax/Syntax.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4342,7 +4342,7 @@
43424342
</Field>
43434343
<Field Name="Type" Type="TypeSyntax" Optional="true"/>
43444344
</AbstractNode>
4345-
<Node Name="ParameterSyntax" Base="BaseParameterSyntax" SkipConvenienceFactories="true">
4345+
<Node Name="ParameterSyntax" Base="BaseParameterSyntax" SkipConvenienceFactories="true" HasValidate="true">
43464346
<TypeComment>
43474347
<summary>Parameter syntax.</summary>
43484348
</TypeComment>
@@ -4357,9 +4357,8 @@
43574357
<summary>Gets the modifier list.</summary>
43584358
</PropertyComment>
43594359
</Field>
4360-
<Field Name="Type" Type="TypeSyntax" Optional="true" Override="true"/>
4360+
<Field Name="Type" Type="TypeSyntax" Optional="true" RequiredForTest="true" Override="true"/>
43614361
<Field Name="Identifier" Type="SyntaxToken" Optional="true">
4362-
<!-- Tracked by https://github.com/dotnet/roslyn/issues/78961 : enforce that a ParameterSyntax cannot be created with both Type and Identifier missing -->
43634362
<PropertyComment>
43644363
<summary>Gets the identifier.</summary>
43654364
</PropertyComment>

src/Compilers/CSharp/Portable/Syntax/SyntaxKindFacts.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,6 @@ public static SyntaxKind GetBaseTypeDeclarationKind(SyntaxKind kind)
853853
return kind == SyntaxKind.EnumKeyword ? SyntaxKind.EnumDeclaration : GetTypeDeclarationKind(kind);
854854
}
855855

856-
// Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, decide what we want for extension declaration
857856
public static SyntaxKind GetTypeDeclarationKind(SyntaxKind kind)
858857
{
859858
switch (kind)
@@ -866,6 +865,8 @@ public static SyntaxKind GetTypeDeclarationKind(SyntaxKind kind)
866865
return SyntaxKind.InterfaceDeclaration;
867866
case SyntaxKind.RecordKeyword:
868867
return SyntaxKind.RecordDeclaration;
868+
case SyntaxKind.ExtensionKeyword:
869+
return SyntaxKind.ExtensionBlockDeclaration;
869870
default:
870871
return SyntaxKind.None;
871872
}

src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)