-
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
Rename LifetimeAnnotationAttribute
to ScopedRefAttribute
and simplify
#63009
Conversation
@@ -334,7 +334,7 @@ static AttributeDescription() | |||
private static readonly byte[][] s_signaturesOfNullableAttribute = { s_signature_HasThis_Void_Byte, s_signature_HasThis_Void_SzArray_Byte }; | |||
private static readonly byte[][] s_signaturesOfNullableContextAttribute = { s_signature_HasThis_Void_Byte }; | |||
private static readonly byte[][] s_signaturesOfNativeIntegerAttribute = { s_signature_HasThis_Void, s_signature_HasThis_Void_SzArray_Boolean }; | |||
private static readonly byte[][] s_signaturesOfLifetimeAnnotationAttribute = { s_signature_HasThis_Void_Boolean_Boolean }; | |||
private static readonly byte[][] s_signaturesOfScopedRefAttribute = { s_signature_HasThis_Void }; |
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.
} | ||
else | ||
{ | ||
scope = scopeOpt.GetValueOrDefault(); | ||
if (typeWithAnnotations.Type.IsRefLikeType) |
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.
Minor: Consider collapsing to else if
. #Closed
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.
That was intentional, but I don't feel very strongly about it ;-)
Consider removing if not needed. In reply to: 1198403939 Refers to: src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedEmbeddedLifetimeAnnotationAttributeSymbol.cs:9 in 35ff572. [](commit_id = 35ff572, deletion_comment = False) |
}); | ||
} | ||
|
||
[Fact] | ||
public void ExplicitAttribute_MissingConstructor() |
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 parameter = method.Parameters[0]; | ||
Assert.Equal(DeclarationScope.ValueScoped, parameter.Scope); | ||
|
||
method = comp.GetMember<MethodSymbol>("A.F3"); |
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.
Consider renaming files as well:
In reply to: 1198411628 |
I intentionally didn't rename them yet to minimize risk of conflicts. We can do that later In reply to: 1198411628 |
Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E").WithArguments("Program.E").WithLocation(7, 58)); | ||
// (3,10): error CS0592: Attribute 'ScopedRef' is not valid on this declaration type. It is only valid on 'parameter' declarations. | ||
// [module: ScopedRef] | ||
Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "ScopedRef").WithArguments("ScopedRef", "parameter").WithLocation(3, 10), |
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.
Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "ScopedRef").WithArguments("ScopedRef", "parameter").WithLocation(3, 10),
Ideally, this test should use a definition of ScopedRefAttributes
with AttributeTargets.All
rather than AttributeTargets.Parameter
, so we can ensure we're reporting errors for the use in source (when #62124 is fixed) rather than for incorrect target.
It's not blocking though. #Pending
SynthesizedParameterSymbol.Create(m, TypeWithAnnotations.Create(boolType), 1, RefKind.None)), | ||
(f, s, p) => GenerateConstructorBody(f, s, p))); | ||
getParameters: m => ImmutableArray<ParameterSymbol>.Empty, | ||
getConstructorBody: (f, s, p) => { })); |
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.
Nit: discards? #Pending
…and simplify (dotnet#63009)" This reverts commit 7915cb7.
Revert "Rename `LifetimeAnnotationAttribute` to `ScopedRefAttribute` and simplify (#63009)"
Fixes #62838