Skip to content

Commit 2c5cde5

Browse files
author
Julien Couvreur
committed
Close some tracked follow-ups
1 parent cdc5fd7 commit 2c5cde5

File tree

19 files changed

+237
-16
lines changed

19 files changed

+237
-16
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/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.Internal.Generated.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics;
78
using System.Diagnostics.CodeAnalysis;
89
using Microsoft.CodeAnalysis.Syntax.InternalSyntax;
910
using Roslyn.Utilities;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics;
78
using System.Diagnostics.CodeAnalysis;
89
using Microsoft.CodeAnalysis.Syntax.InternalSyntax;
910
using Roslyn.Utilities;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics;
78
using System.Diagnostics.CodeAnalysis;
89
using Microsoft.CodeAnalysis.Syntax.InternalSyntax;
910
using Roslyn.Utilities;
@@ -13766,8 +13767,12 @@ public sealed partial class ParameterSyntax : BaseParameterSyntax
1376613767
internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
1376713768
: base(green, parent, position)
1376813769
{
13770+
Validate();
1376913771
}
1377013772

13773+
[Conditional("DEBUG")]
13774+
private partial void Validate();
13775+
1377113776
/// <summary>Gets the attribute declaration list.</summary>
1377213777
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(GetRed(ref this.attributeLists, 0));
1377313778

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();
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
}

0 commit comments

Comments
 (0)