-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Milestone
Description
Proposal:
- [Proposal]: Static abstract members in interfaces csharplang#4436
- https://github.com/dotnet/csharplang/blob/main/proposals/static-abstracts-in-interfaces.md
- Relevant ECMA-335 changes PR - ECMA spec addendum dealing with static interface methods runtime#49558
Feature branch: https://github.com/dotnet/roslyn/tree/features/StaticAbstractMembersInInterfaces
We don't support UnmanagedCallersOnly on instance methods at all, nor do we support taking a pointer to instance methods. We probably shouldn't support them on abstract statics either, or we should make sure that users are forced to apply the attribute to implementations of an abstract static member in a way that matches up.
Features covered during IDE test pass:
- Completion of
staticmodifier in new scenarios, IDE behavior has been adjusted to meet expectations. - Completion of
abstractmodifier in new scenarios, IDE behavior has been adjusted to meet expectations. - Completion of
sealedmodifier in new scenarios, IDE behavior has been adjusted to meet expectations. - Completion of
implicit/explicitkeywords in new scenarios, IDE behavior has been adjusted to meet expectations. - Completion list on ’dot’ after type parameter constrained to an interface with static abstract members. Completion is not offered, tracked by Static abstract members of interfaces are not included into completion list on a type parameter #53930.
- Interface type completion in declaration of an explicit interface implementation for a static member. Completion is not offered, tracked by Interface type is not offered in completion list while typing declaration of an explicit implementation for a static member #54005.
- Implement interface fixer for abstract static members declared in interfaces. The feature doesn’t work properly. Operators do not trigger the fixer on their own, tracked by Implement interface fixer is not offered for an operator declared in an interface #53927. For nonoperators the fixer generates incorrect code, drops the static modifier on implementations, tracked by Implement interface fixer doesn't spit out
staticmodifier implementations of static members #53925. - Member completion on ‘dot’ after an interface type in declaration of an explicit interface implementation. The completion offers static members, but generated code is invalid for conversion operators, tracked by Completion for an explicit implementation of a conversion operator produces invalid code #53924.
- “Extract Interface” refactoring. Doesn't offer to add static members to the interface, tracked by "Extract Interface" refactoring doesn't offer to add static members to the interface #54019.
- "Go To Implementation" on static members. Doesn't work as expected. For non-operators, implicit implementations are not found. For operators, explicit implementations aren't found as well. Tracked by "Go To Implementation" on static members doesn't work as expected #54021.
- “Go To All” works fine for non-operators. Not sure if it can be used for operators.
- “Find All References”.
o Not sure how to trigger for a conversion operator.
o Doesn't work on static member name in declaration of explicit interface implementation for properties and events. Tracked by "Find All References" doesn't work on static member name in declaration of explicit interface implementation for properties and events #54022. Doesn’t work for instance properties/events as well.
o Doesn't work on explicit implementation of conversion operator, tracked by "Find All References" doesn't work on explicit implementation of conversion operator. #54023. - “Go To Definition”. Couldn't find a way to "Go To Definition" from an implicit/explicit implementation of a conversion operator, tracked by Couldn't find a way to "Go To Definition" from an implicit/explicit implementation of a conversion operator #54024.
- "Rename".
o Rename of a static abstract member doesn't rename implementations, produces code with errors, tracked by "Rename" of a static abstract member doesn't rename implementations, produces code with errors #54025.
o Rename of an implicit implementation of a static member doesn't rename corresponding declaration. Produces code with errors. Tracked by "Rename" of an implicit implementation of a static member doesn't rename corresponding declaration. Produces code with errors. #54026.
o Rename of an explicit implementation of a static property/event doesn't rename corresponding declaration. Produces code with errors. Tracked by "Rename" of an explicit implementation of a static property/event doesn't rename corresponding declaration. Produces code with errors. #54027.
o Rename of an explicit implementation of a static method doesn't rename related implicit implementations. Produces code with errors. Tracked by "Rename" of an explicit implementation of a static method doesn't rename related implicit implementations. Produces code with errors. #54028.
o Rename of a static interface member at consumption site doesn't rename related implicit/explicit implementations. Produces code with errors. Tracked by "Rename" of a static interface member at consumption site doesn't rename related implicit/explicit implementations. Produces code with errors. #54029. - “Inheritance Margin” – should be covered by IDE team.
Test plan
General
- LangVersion
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Runtime Version
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Update compiler test plan
- Build VS
Syntax
- Explicit Implementations
- Conversions
- Binary Operators
- Unary Operators
Semantics
- Definition emits correct metadata
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Operator restriction relaxations:
- Restricted operands are allowed to be a type parameter constrained to the containing type
- Conversions
- Binary Operators
- Unary Operators
- Not allowed to be indirectly constrained
- Shift restriction relaxations
- Restricted operands are allowed to be a type parameter constrained to the containing type
- Interface inheritance
- Hide
- Default impl
- Non-interface inheritance
- Abstract class
- Hide
- Implement
- Missing impl
- Concrete class
- Hide
- Implement
- Missing impl
- Abstract class
- Access to member off type parameter constrained to type
- Methods
- Properties
- Events
- Access to member off parameter constrained to type
- Conversions
- Binary Operators
- Unary Operators
- No access to member directly off type
- Methods
- Properties
- Events
- No access to member directly of parameter of type
- Conversions
- Binary Operators
- Unary Operators
- Generic substitution of I for a type parameter
where T : I - Variance safety on members
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Abstract static conversions are considered when processing user-defined conversions
- LINQ-to-Types
- Expression Trees
- Dynamic behavior (via operators)
- Function pointers
- Address of abstract static method
- UnmanagedCallersOnly
- Obsolete honored on abstract statics
- Incorrectly implemented
- Missing
- Non-static
- Wrong return type
- Wrong parameter types
- Not public
- Substitution causing ambiguities in implementation
Metadata
- Metadata is correctly read
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Metadata is correctly emitted
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Constrained T call emitted
- Forwarding methods added for implicit impls from base
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
Public API/IDE
- GetTypeInfo/GetDeclaredSymbol/GetSymbolInfo
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- IOperation
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- CFG
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- LookupSymbols
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Completion
- operator keyword completion in interfaces
- Explicit interface implementation completion
- Member completion
- Conversion completion
- Operator completion
- Implement interface refactoring
- Implicit
- Explicit
- GoToDefinition
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- FindAllRefs
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- EnC
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Formatting of explicit impls
- Conversions
- Binary Operators
- Unary Operators
- Change Signature works as expected
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Extract method extracts to appropriate generic method
- Methods
- Properties
- Events
- Conversions
- Binary Operators
- Unary Operators
- Generate method on Type Parameter
Reactions are currently unavailable