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 CheckedUserDefinedOperators feature #59458

Closed
78 tasks done
AlekseyTs opened this issue Feb 10, 2022 · 3 comments
Closed
78 tasks done

Test plan for CheckedUserDefinedOperators feature #59458

AlekseyTs opened this issue Feb 10, 2022 · 3 comments

Comments

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Feb 10, 2022

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.
@333fred
Copy link
Member

333fred commented Mar 17, 2022

I've added more to the test plan. I'll go through and check things off on Monday.

@jcouv jcouv modified the milestones: C# 11.0, 17.3 Apr 4, 2022
@Rekkonnect
Copy link
Contributor

Just tried the feature out, and I think it would be nice to have a more specific error when a user types:

public static int operator unchecked +(int left, int right);
//                         ~~~~~~~~~

Saying that unchecked operators do not require the modifier. Currently, multiple unrelated errors are being shown:
image

@AlekseyTs
Copy link
Contributor Author

@alfasgd This issue is not meant for tracking and discussing different aspects of the feature. If you would like to report a bug or suggestion, please, open a dedicated issue.

@333fred 333fred closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants