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: ref readonly #68056

Closed
26 of 67 tasks
jaredpar opened this issue May 2, 2023 · 0 comments · Fixed by #69474
Closed
26 of 67 tasks

Test Plan: ref readonly #68056

jaredpar opened this issue May 2, 2023 · 0 comments · Fixed by #69474

Comments

@jaredpar
Copy link
Member

jaredpar commented May 2, 2023

Proposal: dotnet/csharplang#6010
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/ref-readonly-parameters.md

Compiler

  • Spec
    • Call out indexers
    • Operators (disallow, made sense for in but not for ref readonly)
    • disallow ref readonly in dynamic invocation
  • Parse ref readonly
    • permutations and combinations (RefReadonlyTests parsing tests)
    • allowed on parameters
    • in cref
  • Bind, emit and roundtrip parameter declarations
    • Methods, lambdas, local functions, delegates, constructors, primary constructor, function pointers, indexers
    • operators (post-merge)
    • LangVer check on parameter modifiers
    • modreq, attributes
    • Emit RequiresLocation
    • Disallow ref readonly in combination with various attributes
      • [IsReadOnly] (generally disallowed in source, see ManuallyAppliedAttributes_IsReadOnly)
      • [In], [Out] (see ManuallyAppliedAttributes_InOut)
      • [RequiresLocation] (disallow in source, see ManuallyAppliedAttribute; hide on symbols)
    • Disallow in expression trees (post-merge)
    • decoding from metadata
      • misplaced [RequiresLocation] (see ReturnParameter)
      • priority order decoding
    • Default parameter values (warn)
    • extension this parameter (see RefReadonlyWithThis_*)
    • dynamic binding (blocked)
  • Argument matching
    • LangVer-conditional for ref argument on in parameter
    • method group conversion
    • function type inference (see MethodGroupComparer_*)
    • OHI (warn on overriding/hiding/implementing with different ref-ness)
    • partial methods (must match strictly, see PartialMembers_*)
    • interceptors
  • Bind and emit
    • invocations, indexer access (see Invocation_*, RefReadonlyParameter_Indexer_*)
    • operator
    • LangVer check (behave like old compiler, ie. treat as ref)
    • Check argument value kind during argument coercion (ok for lvalue but warn for rvalue)
    • Warn for no modifier (except on this parameter for extension methods)
  • Enforce readonliness
    • Mutable struct with a readonly and a non-readonly member - call the readonly member (no silent copy) and vice versa
  • Public API:
    • new RefKind
    • IOperation
    • symbol display
    • check GetSymbolInfo and RefKind on symbol
    • SyntaxNormalizer
    • cref
  • Synthesized usages of ref parameters? Maybe in interpolated strings?
  • (readonly) refs, ref structs, readonly structs, readonly members
  • scoped, UnscopedRef

General

  • add to compiler test plan
  • compile runtime
  • compile VS
  • Add RequiresLocationAttribute to BCL (tracked by [API Proposal]: RequiresLocationAttribute (supporting ref readonly parameters) runtime#85910)
  • VB should be able to consume by-ref, except for virtual (since those involve modreq). See what we did for in. Override in VB should be disallowed
  • Let F# know
  • Notify managed C++ team for new modopt, but should be fine (they should tolerate/ignore) (Jared)
  • go over usages of RefKind.In and check if RefKind.RefReadonlyParameter needs to be handled there as well
  • document any compat breaks
  • update feature status

IDE

  • colorization and formatting
  • QuickInfo
  • scoped, readonly completion
  • F1/Help
  • interface implementation and override generation
  • cref
  • EE/EnC (manual smoketest)
@jaredpar jaredpar added this to the C# 12.0 milestone May 2, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label May 2, 2023
@jcouv jcouv self-assigned this May 2, 2023
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label May 2, 2023
@jjonescz jjonescz added the New Feature - Ref Readonly Parameters `ref readonly` parameters label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants