Enable updated escape rules if System.Runtime.CompilerServices.RuntimeFeature.ByRefFields exists#62304
Enable updated escape rules if System.Runtime.CompilerServices.RuntimeFeature.ByRefFields exists#62304cston merged 1 commit intodotnet:mainfrom
Conversation
…eFeature.ByRefFields exists
|
@dotnet/roslyn-compiler, please review. |
| // (10,20): error CS8167: Cannot return by reference a member of parameter 'r' because it is not a ref or out parameter | ||
| // return ref r.F; | ||
| Diagnostic(ErrorCode.ERR_RefReturnParameter2, "r").WithArguments("r").WithLocation(10, 20)); | ||
| Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion10, "ref T").WithArguments("ref fields", "11.0").WithLocation(3, 12)); |
There was a problem hiding this comment.
I think we're missing an error on line 854 below. If you try to use ref fields in a C# 11 compilation but the runtime feature flag doesn't exist, the compiler should complain.
This can be handled in a separate PR, since I understand this PR is meant for whether the updated escape rules kick in.
This is described in the spec:
"This feature [ref fields] requires runtime support and changes to the ECMA spec. As such these will only be enabled when the corresponding feature flag is set in corelib. The issue tracking the exact API is tracked here dotnet/runtime#64165"
jcouv
left a comment
There was a problem hiding this comment.
LGTM Thanks (iteration 1) with follow-up issue for potentially missing runtime feature flag issue.
|
@dotnet/roslyn-compiler, for a second review of small change, thanks. |
…s.RuntimeFeature.ByRefFields exists (dotnet#62304)" This reverts commit 4260c6e.
Fixes #62131