Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test plan for "auto-default structs" #60167

Closed
37 of 38 tasks
RikkiGibson opened this issue Mar 14, 2022 · 0 comments · Fixed by #60688
Closed
37 of 38 tasks

Test plan for "auto-default structs" #60167

RikkiGibson opened this issue Mar 14, 2022 · 0 comments · Fixed by #60688
Assignees
Milestone

Comments

@RikkiGibson
Copy link
Contributor

RikkiGibson commented Mar 14, 2022

Spec: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-11.0/auto-default-structs.md
Championed proposal: dotnet/csharplang#5737

Compiler

  • add proposal to dotnet/csharplang (Create auto-default-structs.md csharplang#5964)
  • add to compiler test plan
  • -langversion
  • field initialization:
    • when all fields are explicitly assigned
    • when no fields are assigned (use initobj?)
      • implementation initializes each field individually.
    • when no fields
    • with auto-properties with get only; with set; with init
      • SemanticErrorTests.CS0843ERR_UnassignedThisAutoProperty,
      • FlowDiagnosticTests.AutoPropInitialization4
      • StructConstructorTests.FieldInitializers_08
    • with field-like events
    • when all sub-fields of a field are explicitly assigned
    • when some sub-fields of a field are explicitly assigned
    • when field is conditionally assigned
    • when explicitly calling declared constructor : this(...)
    • when explicitly calling default parameterless constructor : this()
    • when assigning this = default;
    • when assigning this = default; conditionally
    • when assigning to backing field of semi-auto property (i.e. using a field initializer) moved to Test plan for "field keyword in properties" #57012
    • when assigning to property of semi-auto property (i.e. in a constructor) moved to Test plan for "field keyword in properties" #57012
    • when reading field before assigning
  • fields assigned where C#10 produces warnings with /warn:5
  • record
    • with explicit fields
    • with explicit auto-properties
  • disabled-by-default diagnostics:
    • when all fields are explicitly assigned
    • when no fields are assigned
    • when diagnostics are elevated to warnings or errors
  • default assigned:
    • to backing fields of auto-properties
    • for field of type parameter type
    • for field of struct type with parameterless constructor
    • for field of empty struct type (no assignment?)
  • field initialization when parameters have !! (which runs first?)
  • nullable analysis treats auto-initialized fields as nullable
  • #pragma warning restore should not enable disabled diagnostics

Productivity

  • Add new error codes to UpgradeProject fixer
    • upgrade from warnings?
  • Debugger: reposition to first sequence point in constructor (init fields?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants