-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
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
-
checkedon- 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 -
checkedin cref - graceful recovery on
unchecked(issue)
Semantics
-
checkedexpression context calls operator- Regular operators
- Compound assignment operators
-
checkedmethod context calls operator- Regular operators
- Compound assignment operators
-
-checkedcompiler 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
uncheckedcontexts,checkedoperators are ignored during lookup- Binary operators
- Unary operators
- Conversion operators
- In
checkedcontexts,uncheckedoperators (regular operators that have a pairedcheckedoperator) are ignored during lookup- Binary operators
- Unary operators
- Conversion operators
- In
checkedcontexts, regular operators that are notuncheckedare included during lookup- Binary operators
- Unary operators
- Conversion operators
- Lifted conversion chooses
checkedconversions incheckedcontexts - DLR behavior
- Expression trees contain new operator types
- Binary operators
- Unary operators
- Conversion operators
- Obsolete
- Binary operators
- Unary operators
- Conversion operators
Productivity
- Declaring checked operators
- Using operators in expressions
- QuickInfo should show whether a checked or regular operator is used
- User-defined operators
- Intrinsic operators
-
checkedkeyword classification - Syntax normalizer for declarations
-
checkedkeyword completion Adjust CheckedKeywordRecommender for checked user-defined operators. #60183 - Go to definition from operator usage and explicit interface implementation
- Find all references for checked operators - doesn't work Find All References doesn't find usages of checked user-defined operators #60216
- Go To Implementation
- Operator completion for explicit implementation - doesn't work Completion list for explicit interface implementation doesn't include
checkedkeyword for checked user-defined operators #60215 - Implement interface fixer - doesn't work Implement interface fixer doesn't spit out
checkedkeyword for checked user-defined operators #60214 - F1 on
checkedkeyword on the declaration goes to the doc page forcheckedkeyword. - Formatter tests Add formatter and smart indentation tests for checked operators #60375
- Signature formatting
- Indentation inside operator
- Navbar - add more miscellaneous tests for checked operators #60727
- Object Browser - add more miscellaneous tests for checked operators #60727
- Metadata as source - add more miscellaneous tests for checked operators #60727
Docs
- We might need to adjust F1 behavior on
checkedkeyword in declarations, depending on structure of the docs. Right now it goes to a generalcheckedkeyword topic.
Reactions are currently unavailable