1 instantiation of SynthesizedPrimaryConstructor
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Source\SourceMemberContainerSymbol.cs (1)
3992
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)
1160
parameterSymbol.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryConstructor &&
Binder\Binder_Expressions.cs (7)
1770
ContainingType is SourceMemberContainerTypeSymbol { IsRecord: false, IsRecordStruct: false, PrimaryConstructor:
SynthesizedPrimaryConstructor
{ ParameterCount: not 0 } primaryConstructor, OriginalDefinition: var containingTypeDefinition } &&
2117
var
primaryCtor = parameter.ContainingSymbol as
SynthesizedPrimaryConstructor
;
2267
private bool IsInDeclaringTypeInstanceMember(
SynthesizedPrimaryConstructor
primaryCtor)
5035
if (constructor is
SynthesizedPrimaryConstructor
primaryConstructor)
5141
private static (ParameterSymbol, SyntaxNode) TryGetPrimaryConstructorParameterUsedAsValue(
SynthesizedPrimaryConstructor
primaryConstructor, BoundExpression boundExpression)
5172
constructor is not
SynthesizedPrimaryConstructor
&&
Binder\Binder_Operators.cs (1)
4076
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)
5183
var
primaryConstructor = TryGetSynthesizedPrimaryConstructor(
5240
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)
2485
case TypeDeclarationSyntax typeDeclaration when TryGetSynthesizedPrimaryConstructor(typeDeclaration) is
SynthesizedPrimaryConstructor
ctor:
2552
when typeDeclaration.PrimaryConstructorBaseTypeIfClass == declaredNode && TryGetSynthesizedPrimaryConstructor(typeDeclaration) is
SynthesizedPrimaryConstructor
ctor:
Compiler\MethodCompiler.cs (3)
1066
methodSymbol is
SynthesizedPrimaryConstructor
||
1256
if (methodSymbol is
SynthesizedPrimaryConstructor
primaryCtor)
1746
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
):
690
!(captured is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryConstructor } parameter &&
747
if (symbol is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
} parameter)
1958
if (!parameter.IsThis && parameter.RefKind != RefKind.Out && parameter.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryCtor)
FlowAnalysis\NullableWalker.cs (4)
662
var exitLocation = method is
SynthesizedPrimaryConstructor
|| method.DeclaringSyntaxReferences.IsEmpty ? null : method.TryGetFirstLocation();
2229
if (symbol is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryConstructor } parameter &&
2946
if (methodSymbol is
SynthesizedPrimaryConstructor
)
10622
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)
111
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)
1055
internal readonly
SynthesizedPrimaryConstructor
? PrimaryConstructor;
1064
SynthesizedPrimaryConstructor
? primaryConstructor,
3211
public
SynthesizedPrimaryConstructor
? PrimaryConstructor;
3271
public readonly
SynthesizedPrimaryConstructor
? PrimaryConstructor;
3289
SynthesizedPrimaryConstructor
? primaryConstructor,
3712
internal
SynthesizedPrimaryConstructor
? PrimaryConstructor
3720
SynthesizedPrimaryConstructor
? result;
3738
SynthesizedPrimaryConstructor
? primaryConstructor;
3808
SynthesizedPrimaryConstructor
? primaryConstructor;
3992
var
ctor = new SynthesizedPrimaryConstructor(this, syntax);
4810
var
ctor = declaredMembersAndInitializers.PrimaryConstructor;
4860
var
ctor = declaredMembersAndInitializers.PrimaryConstructor;
4923
void addDeconstruct(
SynthesizedPrimaryConstructor
ctor, ImmutableArray<Symbol> positionalMembers)
5452
!(SynthesizedRecordCopyCtor.HasCopyConstructorSignature(method) && method is not
SynthesizedPrimaryConstructor
))
Symbols\Source\SourceMemberMethodSymbol.cs (1)
905
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)
14021
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
14063
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
19315
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
19405
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20187
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());
6058
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6212
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6294
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6362
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6396
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6437
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6472
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6511
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6544
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6589
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6633
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6673
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6709
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6763
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
7838
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters();
8703
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
9886
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
9946
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
9947
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
9999
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10000
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10001
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10002
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10021
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10048
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10150
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10193
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10228
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10271
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10309
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10340
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10380
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10416
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10452
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10491
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10530
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10566
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10602
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10641
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10680
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10719
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10755
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10791
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10831
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10878
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10922
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10962
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11005
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11052
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11094
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11139
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11174
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11204
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11239
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11269
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11304
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11335
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11371
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11402
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11445
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11484
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11523
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11563
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11606
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11796
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().IsEmpty());
11840
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11841
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11842
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11914
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11950
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11993
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12041
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Single().Key.ToTestDisplayString());
12042
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Single().Key.ToTestDisplayString());
12043
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
12073
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12074
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12114
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12158
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12204
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
14620
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
14816
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15017
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15243
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15554
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
16379
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
19767
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20258
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
)