-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle [UnscopedRef] scoped
in source and metadata
#63134
Conversation
7a01abb
to
5ed9cde
Compare
15071ad
to
66fbae6
Compare
66fbae6
to
939ea72
Compare
} | ||
|
||
[Fact] | ||
public void UnscopedScoped() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var comp = CreateCompilation(new[] { sourceA, UnscopedRefAttributeDefinition }, runtimeFeature: RuntimeFlag.ByRefFields); | ||
comp.VerifyEmitDiagnostics(); | ||
var verifier = CompileAndVerify(comp, verify: Verification.Skipped); | ||
var dump = verifier.Dump(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
throw null; | ||
} | ||
}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
public class A<T> | ||
{ | ||
public ref T F4A([UnscopedRef] scoped ref R<T> r4) // 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -202,7 +202,8 @@ internal sealed override DeclarationScope EffectiveScope | |||
{ | |||
get | |||
{ | |||
var scope = DeclaredScope; | |||
var scope = (RefKind == RefKind.Out && DeclaredScope == DeclarationScope.Unscoped) ? DeclarationScope.RefScoped : DeclaredScope; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it change behavior to move this logic from ParameterHelpers, etc. into this accessor? Or is it just a refactoring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior change is described in ParameterSymbol
. Basically, DeclaredScope
is now just the declared scope, without the implicit scope for various cases. EffectiveScope
is still the combined scope.
dotnet/roslyn-compiler, please review. |
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 5), with one test nit.
Fixes #63070 (metadata scenario)
Fixes #63057 (source scenario)
Relates to test plan #59194