134 references to ERR_RefAssignNarrower
Microsoft.CodeAnalysis.CSharp (2)
Binder\Binder_Statements.cs (1)
1578
(_, false) => ErrorCode.
ERR_RefAssignNarrower
,
Errors\ErrorFacts.cs (1)
1890
or ErrorCode.
ERR_RefAssignNarrower
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (25)
RefStructInterfacesTests.cs (8)
2486
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
2489
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(14, 9));
2550
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(7, 9),
2553
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(12, 9),
2556
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(17, 9),
2559
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(22, 9),
2562
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(27, 9),
2565
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(32, 9)
Semantics\ExtensionTests.cs (11)
45553
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M()").WithArguments("j", "i.M()").WithLocation(6, 9),
45556
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i)").WithArguments("j", "E.M(ref i)").WithLocation(12, 9));
45588
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M()").WithArguments("j", "i.M()").WithLocation(6, 9),
45591
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i)").WithArguments("j", "E.M(ref i)").WithLocation(7, 9),
45594
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2()").WithArguments("j", "i.M2()").WithLocation(8, 9));
45626
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M(ref k)").WithArguments("j", "i.M(ref k)").WithLocation(6, 9),
45629
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i, ref k)").WithArguments("j", "E.M(ref i, ref k)").WithLocation(7, 9),
45632
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2(ref k)").WithArguments("j", "i.M2(ref k)").WithLocation(8, 9));
45664
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M(ref k)").WithArguments("j", "i.M(ref k)").WithLocation(6, 9),
45667
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i, ref k)").WithArguments("j", "E.M(ref i, ref k)").WithLocation(7, 9),
45670
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2(ref k)").WithArguments("j", "i.M2(ref k)").WithLocation(8, 9));
Semantics\PrimaryConstructorTests.cs (6)
21925
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "R5 = ref x").WithArguments("R5", "x").WithLocation(38, 9),
21928
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref x").WithArguments("R6", "x").WithLocation(44, 25)
21986
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "R5 = ref x").WithArguments("R5", "x").WithLocation(38, 9),
21989
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref x").WithArguments("R6", "x").WithLocation(44, 34)
22047
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "R5 = ref x").WithArguments("R5", "x").WithLocation(38, 9),
22050
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref x").WithArguments("R6", "x").WithLocation(44, 34)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (107)
Semantics\RefEscapingTests.cs (4)
1497
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "_ = ref y4").WithArguments("_", "y4").WithLocation(25, 9));
10303
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "obj = ref this").WithArguments("obj", "this").WithLocation(7, 9),
10359
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "obj = ref this").WithArguments("obj", "this").WithLocation(7, 9),
12368
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "z = ref x").WithArguments("z", "x").WithLocation(6, 9));
Semantics\RefFieldTests.cs (92)
2732
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r2.F = ref t").WithArguments("F", "t").WithLocation(18, 9)
2745
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r2.F = ref t").WithArguments("F", "t").WithLocation(18, 9)
2834
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.Field = ref i").WithArguments("Field", "i").WithLocation(10, 9)
4529
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.RB = ref r.B").WithArguments("RB", "r.B").WithLocation(17, 9));
6005
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F1 = ref t").WithArguments("F1", "t").WithLocation(10, 9),
6008
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F2 = ref t").WithArguments("F2", "t").WithLocation(11, 9),
6011
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F3 = ref t").WithArguments("F3", "t").WithLocation(12, 9),
6014
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F4 = ref t").WithArguments("F4", "t").WithLocation(13, 9),
6017
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x.F1 = ref t").WithArguments("F1", "t").WithLocation(21, 9),
6020
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x.F2 = ref t").WithArguments("F2", "t").WithLocation(22, 9),
6029
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "y.F1 = ref t").WithArguments("F1", "t").WithLocation(26, 9),
6032
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "y.F2 = ref t").WithArguments("F2", "t").WithLocation(27, 9),
6266
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6269
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6275
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13),
6312
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6315
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6318
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13));
6352
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6355
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6361
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13),
6398
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6401
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6404
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13));
7253
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tValue").WithArguments("F", "tValue").WithLocation(9, 59),
7259
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tOut").WithArguments("F", "tOut").WithLocation(11, 75),
7265
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tValue").WithArguments("F", "tValue").WithLocation(14, 64),
7271
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tOut").WithArguments("F", "tOut").WithLocation(16, 80),
7277
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tValue").WithArguments("F", "tValue").WithLocation(19, 80),
7280
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tOut").WithArguments("F", "tOut").WithLocation(21, 96),
7376
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tValue").WithArguments("F", "tValue").WithLocation(9, 59),
7382
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tOut").WithArguments("F", "tOut").WithLocation(11, 75),
7388
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tValue").WithArguments("F", "tValue").WithLocation(14, 64),
7394
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tOut").WithArguments("F", "tOut").WithLocation(16, 80),
7400
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tValue").WithArguments("F", "tValue").WithLocation(19, 80),
7403
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tOut").WithArguments("F", "tOut").WithLocation(21, 96),
14066
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(9, 13),
14069
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(13, 13));
14106
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(8, 13),
14109
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(12, 13));
14145
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(9, 13),
14148
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(12, 13)
15443
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(8, 13),
15446
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(12, 13),
15449
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r5").WithArguments("r0", "r5").WithLocation(24, 13),
19518
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(29, 9),
19521
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(59, 9)
19596
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(26, 9),
19599
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(52, 9));
19687
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(29, 9),
19699
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(59, 9),
19782
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(26, 9),
19794
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(52, 9),
19905
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t2").WithArguments("F", "t2").WithLocation(18, 9),
19914
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t4").WithArguments("F", "t4").WithLocation(31, 9));
19961
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t2").WithArguments("F", "t2").WithLocation(16, 9),
19970
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t4").WithArguments("F", "t4").WithLocation(27, 9));
20086
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref t").WithArguments("F", "t").WithLocation(12, 13));
22440
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(7, 9)
23202
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(11, 15),
23238
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(11, 16),
23244
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(20, 16));
23528
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(10, 9),
23534
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(18, 9));
23541
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(10, 9),
23550
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(18, 9));
24677
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "_i = ref i3").WithArguments("_i", "i3").WithLocation(16, 9),
28591
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(7, 5),
28594
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(13, 5),
28597
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(19, 5),
28787
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p.refField = ref this.field").WithArguments("refField", "this.field").WithLocation(13, 9),
28928
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p3.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(9, 9));
29190
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc byte[1])").WithArguments("_f1", "F(stackalloc byte[1])").WithLocation(4, 27),
29193
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc byte[1])").WithArguments("_f2", "F(stackalloc byte[1])").WithLocation(5, 36)
29305
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F(stackalloc byte[1])").WithArguments("_f1", "F(stackalloc byte[1])").WithLocation(4, 20),
29311
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F(stackalloc byte[1])").WithArguments("_f2", "F(stackalloc byte[1])").WithLocation(5, 29)
29334
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc int[1])").WithArguments("_s", "F(stackalloc int[1])").WithLocation(4, 33)
29379
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F<byte>(out var b1)").WithArguments("_f1", "F<byte>(out var b1)").WithLocation(4, 20),
29382
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F<byte>(out var b2)").WithArguments("_f2", "F<byte>(out var b2)").WithLocation(5, 29)
29777
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
29780
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(14, 9),
29783
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(20, 9));
29854
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefField = ref value").WithArguments("RefField", "value").WithLocation(7, 9),
29857
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(12, 9),
29860
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(17, 9),
29866
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(27, 9),
29869
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(32, 9),
29875
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(42, 9),
29878
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(47, 9));
30132
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference1(ref s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
30135
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference2(in s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(9, 9),
30141
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference3(out s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(10, 9),
Semantics\RefLocalsAndReturnsTests.cs (11)
64
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r1 = ref rx").WithArguments("r1", "rx").WithLocation(8, 30),
67
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r1 = ref rx").WithArguments("r1", "rx").WithLocation(11, 33));
140
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "rd = ref rd.Length").WithArguments("rd", "rd.Length").WithLocation(7, 9));
177
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref this").WithArguments("s", "this").WithLocation(6, 9),
586
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref s2").WithArguments("s", "s2").WithLocation(8, 9),
592
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref s3").WithArguments("s", "s3").WithLocation(13, 9));
610
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref s2").WithArguments("s", "s2").WithLocation(7, 9));
715
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "rx = ref y").WithArguments("rx", "y").WithLocation(9, 9));
782
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(8, 9),
812
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(7, 9),
815
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref z").WithArguments("x", "z").WithLocation(10, 9));