The current implementation of implicit struct initialization in #59788 only initializes fields directly contained in 'this', but it's possible that it's more optimal to initialize nested fields in some scenarios.
using System;
public struct Pair
{
public int X, Y;
}
public struct S {
public Pair Pair;
public S()
{
// Here we insert `Pair = default;` but we could perhaps insert `Pair.Y = default;`
Pair.X = 42;
}
}
From chat with Rikki, triaged this into Compiler.Next milestone. Let's do a quick test/benchmark. Depending on the evaluation, we can address or close.
The current implementation of implicit struct initialization in #59788 only initializes fields directly contained in 'this', but it's possible that it's more optimal to initialize nested fields in some scenarios.
SharpLab