Skip to content

Commit

Permalink
Remove scope variance exceptions from the speclet (#8777)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz authored Jan 6, 2025
1 parent edba5c6 commit ef7cddf
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions proposals/csharp-11.0/low-level-struct-improvements.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,7 @@ The `scoped` modifier and `[UnscopedRef]` attribute (see [below](#rules-unscoped

Any other difference with respect to `scoped` or `[UnscopedRef]` is considered a mismatch.

The compiler will report a diagnostic for _unsafe scoped mismatches_ across overrides, interface implementations, and delegate conversions when:
- The method returns a `ref struct` or returns a `ref` or `ref readonly`, or the method has a `ref` or `out` parameter of `ref struct` type, and
- The method has at least one additional `ref`, `in`, or `out` parameter, or a parameter of `ref struct` type.

The rules above ignore `this` parameters because `ref struct` instance methods cannot be used for overrides, interface implementations, or delegate conversions.

The diagnostic is reported as an _error_ if the mismatched signatures are both using C#11 ref safe context rules; otherwise, the diagnostic is a _warning_.
The mismatch is reported as an _error_ if the mismatched signatures are both using C#11 ref safe context rules; otherwise, the diagnostic is a _warning_.

The scoped mismatch warning may be reported on a module compiled with C#7.2 ref safe context rules where `scoped` is not available. In some such cases, it may be necessary to suppress the warning if the other mismatched signature cannot be modified.

Expand Down

0 comments on commit ef7cddf

Please sign in to comment.