Ensure custom attributes bag of a parameter backing field is properly initialized during "completion" of a primary constructor.#80424
Conversation
… initialized during "completion" of a primary constructor. Closes dotnet#78433 Closes dotnet#78188 Also relaxed some asserts that looked to "tight" and were blocking investigation.
|
@dotnet/roslyn-compiler Please review |
| } | ||
| "; | ||
| var comp = CreateCompilation(source); | ||
| var comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.WithFeature("run-nullable-analysis", "never")); |
There was a problem hiding this comment.
Is .WithFeature("run-nullable-analysis", "never") somehow important for the test?
There was a problem hiding this comment.
Is
.WithFeature("run-nullable-analysis", "never")somehow important for the test?
Yes, by default debug build performs nullable analysis even if one is not enabled in source. That requests attributes from symbols. We want to control when attributes are requested and from what symbols.
| var test1 = comp.GetTypeByMetadataName("Test1"); | ||
| var ctor = test1.InstanceConstructors.Where(c => !c.IsDefaultValueTypeConstructor()).Single(); | ||
|
|
||
| ctor.GetAttributes(); |
There was a problem hiding this comment.
Consider asserting at least number of the attributes returned by this call.
There was a problem hiding this comment.
Consider asserting at least number of the attributes returned by this call.
This is not interesting. We are requesting the attributes to get symbol into a certain state.
Closes #78433
Closes #78188
Also relaxed some asserts that looked to "tight" and were blocking investigation.