134 references to ScopedRef
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
106
=> symbol is { RefKind: RefKind.Ref or RefKind.In or RefKind.RefReadOnlyParameter, ScopedKind: ScopedKind.
ScopedRef
}
Microsoft.CodeAnalysis.CSharp (17)
Binder\Binder.ValueChecks.cs (3)
1246
{ EffectiveScope: ScopedKind.
ScopedRef
} => SafeContext.CurrentMethod,
1279
var isRefScoped = parameterSymbol.EffectiveScope == ScopedKind.
ScopedRef
;
3048
return ScopedKind.
ScopedRef
;
Binder\RefSafetyAnalysis.cs (1)
449
refEscapeScope = scopedModifier == ScopedKind.
ScopedRef
?
BoundTree\UnboundLambda.cs (2)
666
scope = ScopedKind.
ScopedRef
;
744
if (((DeclaredScope(i) == ScopedKind.None && parameterScopesBuilder[i] == ScopedKind.
ScopedRef
) ||
SymbolDisplay\SymbolDisplayVisitor.cs (1)
245
if (symbol.ScopedKind == ScopedKind.
ScopedRef
)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
817
if (symbol.ScopedKind == ScopedKind.
ScopedRef
&&
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (1)
324
(ScopedKind.
ScopedRef
, true) => true,
Symbols\FunctionPointers\FunctionPointerParameterSymbol.cs (1)
33
=> ParameterHelpers.IsRefScopedByDefault(this) ? ScopedKind.
ScopedRef
: ScopedKind.None;
Symbols\Metadata\PE\PEParameterSymbol.cs (2)
334
scope = ScopedKind.
ScopedRef
;
347
scope = ScopedKind.
ScopedRef
;
Symbols\SignatureOnlyParameterSymbol.cs (1)
57
=> ParameterHelpers.IsRefScopedByDefault(this) ? ScopedKind.
ScopedRef
: ScopedKind.None;
Symbols\Source\ParameterHelpers.cs (1)
976
scope = (refKind == RefKind.None) ? ScopedKind.ScopedValue : ScopedKind.
ScopedRef
;
Symbols\Source\SourceLocalSymbol.cs (1)
70
? isScoped ? ScopedKind.
ScopedRef
: ScopedKind.None
Symbols\Source\SourceParameterSymbol.cs (1)
243
return ScopedKind.
ScopedRef
;
Symbols\Source\ThisParameterSymbol.cs (1)
180
var scope = _containingType.IsStructType() ? ScopedKind.
ScopedRef
: ScopedKind.None;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
Attributes\AttributeTests_LifetimeAnnotation.cs (2)
273
Assert.Equal(ScopedKind.
ScopedRef
, parameter.EffectiveScope);
278
Assert.Equal(ScopedKind.
ScopedRef
, parameter.EffectiveScope);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (113)
Semantics\RefFieldTests.cs (113)
10924
VerifyParameterSymbol(parameters[1], "scoped ref R y2", RefKind.Ref, ScopedKind.
ScopedRef
);
10928
VerifyParameterSymbol(parameters[1], "scoped in R y3", RefKind.In, ScopedKind.
ScopedRef
);
10931
VerifyParameterSymbol(parameters[0], "out R x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
10932
VerifyParameterSymbol(parameters[1], "out R y4", RefKind.Out, ScopedKind.
ScopedRef
);
10968
VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("A").Constructors.Single(c => !c.IsImplicitlyDeclared).Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.
ScopedRef
);
10969
VerifyParameterSymbol(comp.GetMember<PropertySymbol>("A.this[]").GetMethod.Parameters[0], "scoped in System.Object o", RefKind.In, ScopedKind.
ScopedRef
);
11031
VerifyParameterSymbol(localFunctions[1].Parameters[1], "scoped ref System.Int32 y2", RefKind.Ref, ScopedKind.
ScopedRef
);
11033
VerifyParameterSymbol(localFunctions[2].Parameters[1], "scoped in System.Int32 y3", RefKind.In, ScopedKind.
ScopedRef
);
11034
VerifyParameterSymbol(localFunctions[3].Parameters[0], "out System.Int32 x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
11035
VerifyParameterSymbol(localFunctions[3].Parameters[1], "out System.Int32 y4", RefKind.Out, ScopedKind.
ScopedRef
);
11037
VerifyParameterSymbol(localFunctions[4].Parameters[1], "scoped ref R y5", RefKind.Ref, ScopedKind.
ScopedRef
);
11039
VerifyParameterSymbol(localFunctions[5].Parameters[1], "scoped in R y6", RefKind.In, ScopedKind.
ScopedRef
);
11040
VerifyParameterSymbol(localFunctions[6].Parameters[0], "out R x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
11041
VerifyParameterSymbol(localFunctions[6].Parameters[1], "out R y7", RefKind.Out, ScopedKind.
ScopedRef
);
11104
verifyParameter(delegateTypesAndLambdas[1], 1, "scoped ref System.Int32", "y2", RefKind.Ref, ScopedKind.
ScopedRef
, false, false);
11106
verifyParameter(delegateTypesAndLambdas[2], 1, "scoped in System.Int32", "y3", RefKind.In, ScopedKind.
ScopedRef
, false, false);
11107
verifyParameter(delegateTypesAndLambdas[3], 0, "out System.Int32", "x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.
ScopedRef
: ScopedKind.None, false, false);
11108
verifyParameter(delegateTypesAndLambdas[3], 1, "out System.Int32", "y4", RefKind.Out, ScopedKind.
ScopedRef
, false, false);
11111
verifyParameter(delegateTypesAndLambdas[4], 1, "scoped ref R", "y5", RefKind.Ref, ScopedKind.
ScopedRef
, false, false);
11113
verifyParameter(delegateTypesAndLambdas[5], 1, "scoped in R", "y6", RefKind.In, ScopedKind.
ScopedRef
, false, false);
11114
verifyParameter(delegateTypesAndLambdas[6], 0, "out R", "x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.
ScopedRef
: ScopedKind.None, false, false);
11115
verifyParameter(delegateTypesAndLambdas[6], 1, "out R", "y7", RefKind.Out, ScopedKind.
ScopedRef
, false, false);
11159
VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D2").DelegateInvokeMethod.Parameters[0], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
11247
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.
ScopedRef
);
11248
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F6").Parameters[0], "scoped in R r", RefKind.In, ScopedKind.
ScopedRef
);
11249
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F9").Parameters[0], "out R r", RefKind.Out, ScopedKind.
ScopedRef
);
11358
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "scoped ref scoped s", RefKind.Ref, ScopedKind.
ScopedRef
);
11360
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F7").Parameters[0], "scoped in scoped s", RefKind.In, ScopedKind.
ScopedRef
);
11361
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F8").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.
ScopedRef
);
11362
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.FA").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.
ScopedRef
);
11437
VerifyParameterSymbol(comp.GetMember<PEMethodSymbol>("A.F1").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.
ScopedRef
);
11474
VerifyParameterSymbol(parameters[3], "out R d", RefKind.Out, ScopedKind.
ScopedRef
);
11508
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.ReturnRef").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.
ScopedRef
);
11551
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").ThisParameter, "out S1 this", RefKind.Out, ScopedKind.
ScopedRef
);
11552
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.
ScopedRef
);
11553
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").ThisParameter, "in S1 this", RefKind.In, ScopedKind.
ScopedRef
);
11554
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").ThisParameter, "out R1 this", RefKind.Out, ScopedKind.
ScopedRef
);
11555
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").ThisParameter, "ref R1 this", RefKind.Ref, ScopedKind.
ScopedRef
);
11556
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").ThisParameter, "in R1 this", RefKind.In, ScopedKind.
ScopedRef
);
11557
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").ThisParameter, "out S2 this", RefKind.Out, ScopedKind.
ScopedRef
);
11558
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").ThisParameter, "in S2 this", RefKind.In, ScopedKind.
ScopedRef
);
11559
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.
ScopedRef
);
11560
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").ThisParameter, "out R2 this", RefKind.Out, ScopedKind.
ScopedRef
);
11561
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").ThisParameter, "in R2 this", RefKind.In, ScopedKind.
ScopedRef
);
11562
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").ThisParameter, "in R2 this", RefKind.In, ScopedKind.
ScopedRef
);
11566
VerifyParameterSymbol(thisParameter, "ref S1 this", RefKind.Ref, ScopedKind.
ScopedRef
);
11605
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F3").Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.
ScopedRef
);
11951
VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.
ScopedRef
);
11985
VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.
ScopedRef
);
12065
VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
12066
VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.
ScopedRef
);
12068
VerifyLocalSymbol(locals[4], "scoped ref R r21", RefKind.Ref, ScopedKind.
ScopedRef
);
12069
VerifyLocalSymbol(locals[5], "scoped ref readonly R r51", RefKind.RefReadOnly, ScopedKind.
ScopedRef
);
12202
VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
12203
VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.
ScopedRef
);
13158
VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.
ScopedRef
);
13159
VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.
ScopedRef
);
13213
VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.
ScopedRef
);
13214
VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.
ScopedRef
);
13449
VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.
ScopedRef
);
13513
VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.
ScopedRef
);
14358
VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
14359
VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.
ScopedRef
);
14400
VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
14401
VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.
ScopedRef
);
14532
VerifyLocalSymbol(locals[6], "scoped ref R r41", RefKind.Ref, ScopedKind.
ScopedRef
);
14533
VerifyLocalSymbol(locals[7], "scoped ref R r42", RefKind.Ref, ScopedKind.
ScopedRef
);
14602
VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
14603
VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.
ScopedRef
);
15058
VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.
ScopedRef
);
15059
VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.
ScopedRef
);
15142
VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.
ScopedRef
);
17951
VerifyParameterSymbol(delegateInvokeMethods[1].Parameters[1], "scoped ref System.Int32 arg2", RefKind.Ref, ScopedKind.
ScopedRef
);
23389
VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
23390
VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
23458
VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
23459
VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
23612
VerifyParameterSymbol(parameters[1], "scoped ref R x", RefKind.Ref, ScopedKind.
ScopedRef
);
23676
VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref R<System.Int32> r2", RefKind.Ref, ScopedKind.
ScopedRef
);
23899
VerifyParameterSymbol(parameters[1], "out System.Int32 x", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
23958
VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "out System.Int32 t1", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
23959
VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "out System.Int32 t2", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24024
VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref System.Int32 t2", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24090
VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped in System.Int32 t2", RefKind.In, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24456
VerifyParameterSymbol(lambdas[0].Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24458
VerifyParameterSymbol(lambdas[2].Parameters[0], "out System.Object o1", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24529
VerifyParameterSymbol(lambdas[0].Parameters[0], "scoped ref R<System.Int32> r1", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24531
VerifyParameterSymbol(lambdas[2].Parameters[0], "scoped ref R<System.Object> r1", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24953
VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
24954
VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
25056
VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped ref R x", RefKind.Ref, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
25164
VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped in R x", RefKind.In, ScopedKind.
ScopedRef
, expectedHasUnscopedRefAttribute: false);
25221
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.
ScopedRef
);
25222
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.
ScopedRef
);
25223
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
25264
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.
ScopedRef
);
25265
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.
ScopedRef
);
25266
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
25298
verifyParameter(delegateTypesAndLambdas[0], 0, "out System.Int32", "i1", RefKind.Out, useUpdatedRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
25302
verifyParameter(delegateTypesAndLambdas[4], 0, "out R", "r5", RefKind.Out, useUpdatedRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
25348
VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F1").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) System.Int32", RefKind.Out, useUpdatedRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
25352
VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F5").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) R", RefKind.Out, useUpdatedRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
25417
var scopedRefInCSharp10 = languageVersion == LanguageVersion.CSharp11 ? ScopedKind.None : ScopedKind.
ScopedRef
;
26993
VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, version == 11 ? ScopedKind.
ScopedRef
: ScopedKind.None);
27121
VerifyParameterSymbol(method.Parameters[0], "out T t", RefKind.Out, expectedUseUpdatedEscapeRules ? ScopedKind.
ScopedRef
: ScopedKind.None);
27614
VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
27615
VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.
ScopedRef
);
27704
VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.
ScopedRef
);
27705
VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.
ScopedRef
);
27827
VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.
ScopedRef
);
27828
VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.
ScopedRef
);
27928
VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.
ScopedRef
);
27929
VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.
ScopedRef
);
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
106
=> symbol is { RefKind: RefKind.Ref or RefKind.In or RefKind.RefReadOnlyParameter, ScopedKind: ScopedKind.
ScopedRef
}