Skip to content

Test plan for CheckedUserDefinedOperators feature #59458

@AlekseyTs

Description

@AlekseyTs

Feature branch - https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators
Specification - https://github.com/dotnet/csharplang/blob/main/proposals/csharp-11.0/checked-user-defined-operators.md
Proposal: dotnet/csharplang#4665

Compiler

  • LangVer
  • sync with F# team
  • Confirm VB behavior (operators are ignored)
  • Confirm C++/CLI does not crash
  • Build VS

Compiler Public APIs

  • SyntaxNormalizer
  • ClassifyConversion
    • Specified position is a checked context
    • No position specified (should we have an overload for specified whether to treat the conversion as checked?)
  • SymbolDisplay

Syntax

  • checked on
    • concrete conversion operators
    • abstract conversion operators
      • Definitions
      • Explicit implementations
    • implicit conversion operators (error)
    • explicit conversion operators
    • concrete unary operators
    • abstract unary operators
    • concrete binary operators
    • abstract binary operators
  • Misplaced checked
  • checked in cref
  • graceful recovery on unchecked (issue)

Semantics

  • checked expression context calls operator
    • Regular operators
    • Compound assignment operators
  • checked method context calls operator
    • Regular operators
    • Compound assignment operators
  • -checked compiler switch calls operator
    • Regular operators
    • Compound assignment operators
  • Source requires matching unchecked operator
  • Paired operators in metadata can differ by everything but parameter/return type
  • In unchecked contexts, checked operators are ignored during lookup
    • Binary operators
    • Unary operators
    • Conversion operators
  • In checked contexts, unchecked operators (regular operators that have a paired checked operator) are ignored during lookup
    • Binary operators
    • Unary operators
    • Conversion operators
  • In checked contexts, regular operators that are not unchecked are included during lookup
    • Binary operators
    • Unary operators
    • Conversion operators
  • Lifted conversion chooses checked conversions in checked contexts
  • DLR behavior
  • Expression trees contain new operator types
    • Binary operators
    • Unary operators
    • Conversion operators
  • Obsolete
    • Binary operators
    • Unary operators
    • Conversion operators

Productivity

Docs

  • We might need to adjust F1 behavior on checked keyword in declarations, depending on structure of the docs. Right now it goes to a general checked keyword topic.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions