1 instantiation of SynthesizedPrimaryConstructor
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Source\SourceMemberContainerSymbol.cs (1)
3938
var ctor = new
SynthesizedPrimaryConstructor
(this, syntax);
206 references to SynthesizedPrimaryConstructor
Microsoft.CodeAnalysis.CSharp (59)
Binder\Binder.CapturedParametersFinder.cs (3)
19
private readonly
SynthesizedPrimaryConstructor
_primaryConstructor;
23
private CapturedParametersFinder(
SynthesizedPrimaryConstructor
primaryConstructor, HashSet<string> namesToCheck, ArrayBuilder<ParameterSymbol> captured)
30
public static IReadOnlyDictionary<ParameterSymbol, FieldSymbol> GetCapturedParameters(
SynthesizedPrimaryConstructor
primaryConstructor)
Binder\Binder.ValueChecks.cs (1)
1384
parameterSymbol.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryConstructor &&
Binder\Binder_Expressions.cs (7)
1793
ContainingType is SourceMemberContainerTypeSymbol { IsRecord: false, IsRecordStruct: false, PrimaryConstructor:
SynthesizedPrimaryConstructor
{ ParameterCount: not 0 } primaryConstructor, OriginalDefinition: var containingTypeDefinition } &&
2140
var
primaryCtor = parameter.ContainingSymbol as
SynthesizedPrimaryConstructor
;
2290
private bool IsInDeclaringTypeInstanceMember(
SynthesizedPrimaryConstructor
primaryCtor)
5058
if (constructor is
SynthesizedPrimaryConstructor
primaryConstructor)
5165
private static (ParameterSymbol, SyntaxNode) TryGetPrimaryConstructorParameterUsedAsValue(
SynthesizedPrimaryConstructor
primaryConstructor, BoundExpression boundExpression)
5196
constructor is not
SynthesizedPrimaryConstructor
&&
Binder\Binder_Operators.cs (1)
4108
if (parameterSymbol.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryConstructor &&
Binder\Binder_Symbols.cs (1)
1526
if (colorColorValueReceiver is BoundParameter { ParameterSymbol: { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryConstructor } parameter } &&
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
1263
var
primaryConstructor = type.PrimaryConstructor;
Binder\BinderFactory.cs (1)
155
internal InMethodBinder GetPrimaryConstructorInMethodBinder(
SynthesizedPrimaryConstructor
constructor)
Compilation\CSharpSemanticModel.cs (2)
5203
var
primaryConstructor = TryGetSynthesizedPrimaryConstructor(
5260
protected static
SynthesizedPrimaryConstructor
TryGetSynthesizedPrimaryConstructor(TypeDeclarationSyntax node, NamedTypeSymbol type)
Compilation\MethodBodySemanticModel.cs (1)
259
if (MemberSymbol is
SynthesizedPrimaryConstructor
primaryCtor &&
Compilation\SyntaxTreeSemanticModel.cs (5)
184
case TypeDeclarationSyntax { ParameterList: { }, PrimaryConstructorBaseTypeIfClass: { } } typeDeclaration when TryGetSynthesizedPrimaryConstructor(typeDeclaration) is
SynthesizedPrimaryConstructor
:
1093
SynthesizedPrimaryConstructor
symbol = TryGetSynthesizedPrimaryConstructor((TypeDeclarationSyntax)node);
1254
private
SynthesizedPrimaryConstructor
TryGetSynthesizedPrimaryConstructor(TypeDeclarationSyntax node)
2497
case TypeDeclarationSyntax typeDeclaration when TryGetSynthesizedPrimaryConstructor(typeDeclaration) is
SynthesizedPrimaryConstructor
ctor:
2564
when typeDeclaration.PrimaryConstructorBaseTypeIfClass == declaredNode && TryGetSynthesizedPrimaryConstructor(typeDeclaration) is
SynthesizedPrimaryConstructor
ctor:
Compiler\MethodCompiler.cs (3)
1081
methodSymbol is
SynthesizedPrimaryConstructor
||
1270
if (methodSymbol is
SynthesizedPrimaryConstructor
primaryCtor)
1777
isPrimaryConstructor: method is
SynthesizedPrimaryConstructor
);
FlowAnalysis\DataFlowsOutWalker.cs (1)
234
param.ContainingSymbol is
SynthesizedPrimaryConstructor
); // Primary constructor parameter can be used in other initializers and methods
FlowAnalysis\DefiniteAssignment.cs (4)
342
(not
SynthesizedPrimaryConstructor
):
641
!(captured is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryConstructor } parameter &&
698
if (symbol is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
} parameter)
1909
if (!parameter.IsThis && parameter.RefKind != RefKind.Out && parameter.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryCtor)
FlowAnalysis\NullableWalker.cs (4)
679
var exitLocation = method is
SynthesizedPrimaryConstructor
|| method.DeclaringSyntaxReferences.IsEmpty ? null : method.TryGetFirstLocation();
2247
if (symbol is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryConstructor } parameter &&
2964
if (methodSymbol is
SynthesizedPrimaryConstructor
)
10761
parameter.ContainingSymbol is not
SynthesizedPrimaryConstructor
primaryConstructor || !primaryConstructor.GetCapturedParameters().ContainsKey(parameter):
FlowAnalysis\ReadWriteWalker.cs (1)
95
Debug.Assert(!ignoreThisParameter || m is
SynthesizedPrimaryConstructor
);
Lowering\ClosureConversion\ClosureConversion.cs (2)
804
_currentMethod is not
SynthesizedPrimaryConstructor
)
814
Debug.Assert(_currentMethod is not
SynthesizedPrimaryConstructor
primaryConstructor ||
Lowering\LocalRewriter\LocalRewriter.cs (1)
314
if (node.ParameterSymbol.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryCtor &&
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
641
return expression is BoundParameter { ParameterSymbol: { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryCtor } parameter } &&
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
118
Debug.Assert(!allVariables.Any((s, method) => s.Symbol is ParameterSymbol { ContainingSymbol: var container } && container != method && container is not
SynthesizedPrimaryConstructor
, method));
Symbols\Source\SourceMemberContainerSymbol.cs (14)
1068
internal readonly
SynthesizedPrimaryConstructor
? PrimaryConstructor;
1077
SynthesizedPrimaryConstructor
? primaryConstructor,
3175
public
SynthesizedPrimaryConstructor
? PrimaryConstructor;
3235
public readonly
SynthesizedPrimaryConstructor
? PrimaryConstructor;
3253
SynthesizedPrimaryConstructor
? primaryConstructor,
3676
internal
SynthesizedPrimaryConstructor
? PrimaryConstructor
3684
SynthesizedPrimaryConstructor
? result;
3702
SynthesizedPrimaryConstructor
? primaryConstructor;
3772
SynthesizedPrimaryConstructor
? primaryConstructor;
3938
var
ctor = new SynthesizedPrimaryConstructor(this, syntax);
4756
var
ctor = declaredMembersAndInitializers.PrimaryConstructor;
4806
var
ctor = declaredMembersAndInitializers.PrimaryConstructor;
4869
void addDeconstruct(
SynthesizedPrimaryConstructor
ctor, ImmutableArray<Symbol> positionalMembers)
5398
!(SynthesizedRecordCopyCtor.HasCopyConstructorSignature(method) && method is not
SynthesizedPrimaryConstructor
))
Symbols\Source\SourceMemberMethodSymbol.cs (1)
925
if (this is
SynthesizedPrimaryConstructor
primaryConstructor)
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (2)
15
private readonly
SynthesizedPrimaryConstructor
_ctor;
20
SynthesizedPrimaryConstructor
ctor,
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (1)
102
return parameter.ContainingSymbol is
SynthesizedPrimaryConstructor
&&
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (144)
Semantics\ExtensionTests.cs (5)
14990
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
15032
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20328
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20418
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
21200
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
Semantics\PrimaryConstructorTests.cs (106)
556
Assert.IsType<
SynthesizedPrimaryConstructor
>(ctor);
720
if (ctor is
SynthesizedPrimaryConstructor
)
776
Assert.IsType<
SynthesizedPrimaryConstructor
>(ctor);
823
Assert.IsType<
SynthesizedPrimaryConstructor
>(c.InstanceConstructors[0]);
1979
Assert.Empty(((
SynthesizedPrimaryConstructor
)symbol.GetSymbol().ContainingSymbol).GetCapturedParameters());
6068
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6222
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6304
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6372
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6406
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6447
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6482
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6521
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6554
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6599
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6643
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6683
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6719
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6773
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
7848
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters();
8713
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
9896
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
9956
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
9957
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10009
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10010
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10011
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10012
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10031
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10058
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10160
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10203
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10238
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10281
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10319
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10350
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10390
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10426
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10462
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10501
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10540
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10576
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10612
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10651
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10690
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10729
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10765
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10801
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10841
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10888
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10932
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10972
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11015
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11062
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11104
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11149
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11184
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11214
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11249
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11279
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11314
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11345
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11381
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11412
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11455
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11494
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11533
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11573
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11616
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11806
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().IsEmpty());
11850
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11851
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11852
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11924
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11960
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12003
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12051
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Single().Key.ToTestDisplayString());
12052
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Single().Key.ToTestDisplayString());
12053
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
12083
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12084
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12124
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12168
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12214
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
14630
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
14826
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15027
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15253
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15564
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
16389
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
19777
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20268
Assert.Empty(comp.GetTypeByMetadataName("C").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
Semantics\RecordTests.cs (33)
10040
var
b1Ctor = comp.GetTypeByMetadataName("B1")!.GetMembersUnordered().OfType<
SynthesizedPrimaryConstructor
>().Single();
22195
Assert.Empty(((
SynthesizedPrimaryConstructor
)symbol.GetSymbol().ContainingSymbol).GetCapturedParameters());
28247
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28399
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28538
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28609
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28693
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28740
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28794
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28842
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28893
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28939
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
28997
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
29055
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
29104
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
29153
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
29222
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\RecordStructTests.cs (2)
3278
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\RecordTests.cs (1)
123
if (ctor is
SynthesizedPrimaryConstructor
)