[Version 11.0] Feature support for static abstract members in interfaces#1609
Draft
RexJaeschke wants to merge 6 commits intodraft-v11from
Draft
[Version 11.0] Feature support for static abstract members in interfaces#1609RexJaeschke wants to merge 6 commits intodraft-v11from
RexJaeschke wants to merge 6 commits intodraft-v11from
Conversation
RexJaeschke
commented
Mar 17, 2026
| It is a compile-time error if *constant_expression*is `double.NaN`, `float.NaN`, or `null_literal`. | ||
|
|
||
| When the input value has a type for which a suitable built-in binary relational operator is defined, the evaluation of that operator is taken as the meaning of the relational pattern. Otherwise, the input value is converted to the type of `constant_expression` using an explicit nullable or unboxing conversion. It is a compile-time error if no such conversion exists. The pattern is considered to not match if the conversion fails. If the conversion succeeds, the result of the pattern-matching operation is the result of evaluating the expression `e «op» v` where `e` is the converted input, «op» is the relational operator, and `v` is the `constant_expression`. | ||
| When the input value has a type for which a suitable built-in binary relational operator is defined, the evaluation of that operator is taken as the meaning of the relational pattern. Otherwise, the input value is converted to the type of *constant_expression* using an explicit nullable or unboxing conversion. It is a compile-time error if no such conversion exists. It is a compile-time error if the input type is a type parameter constrained to, or a type inheriting, from `System.Numerics.INumberBase<T>` and the input type has no suitable built-in binary relational operator defined. The pattern is considered to not match if the conversion fails. If the conversion succeeds, the result of the pattern-matching operation is the result of evaluating the expression `e «op» v` where `e` is the converted input, «op» is the relational operator, and `v` is the *constant_expression*. |
Contributor
Author
There was a problem hiding this comment.
This is the first mention of the type System.Numerics.INumberBase<T> in the spec. Unless we are going to add all the machinery about that type and how built-in numeric types now have that as a base interface, we'll need some alternative wording here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is Rex's adaptation of the corresponding MS proposal.
Issue
The MS spec contains a section called “Pattern matching.” In there, a change to constant patterns is proposed. However, I cannot find the text below they propose augmenting, anywhere in the spec
Note that the proposed new text refers to
System.Numerics.INumberBase<T>, which I mention elsewhere in the PR as needing attention.