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)
1386
parameterSymbol.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryConstructor &&
Binder\Binder_Expressions.cs (7)
1831
ContainingType is SourceMemberContainerTypeSymbol { IsRecord: false, IsRecordStruct: false, PrimaryConstructor:
SynthesizedPrimaryConstructor
{ ParameterCount: not 0 } primaryConstructor, OriginalDefinition: var containingTypeDefinition } &&
2076
var
primaryCtor = parameter.ContainingSymbol as
SynthesizedPrimaryConstructor
;
2324
private bool IsInDeclaringTypeInstanceMember(
SynthesizedPrimaryConstructor
primaryCtor)
5092
if (constructor is
SynthesizedPrimaryConstructor
primaryConstructor)
5200
private static (ParameterSymbol, SyntaxNode) TryGetPrimaryConstructorParameterUsedAsValue(
SynthesizedPrimaryConstructor
primaryConstructor, BoundExpression boundExpression)
5231
constructor is not
SynthesizedPrimaryConstructor
&&
Binder\Binder_Operators.cs (1)
4249
if (parameterSymbol.ContainingSymbol is
SynthesizedPrimaryConstructor
primaryConstructor &&
Binder\Binder_Symbols.cs (1)
1527
if (colorColorValueSymbol is ParameterSymbol { ContainingSymbol:
SynthesizedPrimaryConstructor
primaryConstructor } parameter &&
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
1272
var
primaryConstructor = type.PrimaryConstructor;
Binder\BinderFactory.cs (1)
155
internal InMethodBinder GetPrimaryConstructorInMethodBinder(
SynthesizedPrimaryConstructor
constructor)
Compilation\CSharpSemanticModel.cs (2)
5221
var
primaryConstructor = TryGetSynthesizedPrimaryConstructor(
5278
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)
1083
methodSymbol is
SynthesizedPrimaryConstructor
||
1272
if (methodSymbol is
SynthesizedPrimaryConstructor
primaryCtor)
1779
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
)
10760
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);
4762
var
ctor = declaredMembersAndInitializers.PrimaryConstructor;
4812
var
ctor = declaredMembersAndInitializers.PrimaryConstructor;
4875
void addDeconstruct(
SynthesizedPrimaryConstructor
ctor, ImmutableArray<Symbol> positionalMembers)
5404
!(SynthesizedRecordCopyCtor.HasCopyConstructorSignature(method) && method is not
SynthesizedPrimaryConstructor
))
Symbols\Source\SourceMemberMethodSymbol.cs (1)
917
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)
15050
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
15092
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20393
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20483
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
21265
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
Semantics\PrimaryConstructorTests.cs (106)
686
Assert.IsType<
SynthesizedPrimaryConstructor
>(ctor);
850
if (ctor is
SynthesizedPrimaryConstructor
)
906
Assert.IsType<
SynthesizedPrimaryConstructor
>(ctor);
953
Assert.IsType<
SynthesizedPrimaryConstructor
>(c.InstanceConstructors[0]);
2109
Assert.Empty(((
SynthesizedPrimaryConstructor
)symbol.GetSymbol().ContainingSymbol).GetCapturedParameters());
6198
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6352
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6434
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6502
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6536
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6577
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6612
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6651
var
cConstructor = c.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6684
var
dConstructor = d.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6729
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6773
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6813
var
eConstructor = e.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6849
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
6903
var
constructor = cMember.GetMembers(".ctor").OfType<
SynthesizedPrimaryConstructor
>().Single();
7978
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters();
8843
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10026
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10086
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10087
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10139
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10140
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10141
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10142
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10161
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10188
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10290
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
10333
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10368
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10411
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10449
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10480
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10520
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10556
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10592
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10631
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10670
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10706
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10742
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10781
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10820
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10859
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10895
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10931
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
10971
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11018
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11062
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11102
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11145
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11192
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11234
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());
11344
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11379
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11409
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11444
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11475
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11511
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11542
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11585
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11624
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11663
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11703
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11746
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11936
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().IsEmpty());
11980
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11981
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
11982
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12054
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12090
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12133
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12181
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Single().Key.ToTestDisplayString());
12182
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Single().Key.ToTestDisplayString());
12183
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters().Count);
12213
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12214
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12254
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12298
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
12344
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
14760
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
14956
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15157
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15383
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
15694
Assert.All(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetBackingFields(), f => Assert.True(f.IsReadOnly));
16519
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
19907
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<
SynthesizedPrimaryConstructor
>().Single().GetCapturedParameters());
20398
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
)