134 references to ERR_RefAssignNarrower
Microsoft.CodeAnalysis.CSharp (2)
Binder\Binder_Statements.cs (1)
1572
(_, false) => ErrorCode.
ERR_RefAssignNarrower
,
Errors\ErrorFacts.cs (1)
1883
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)
39260
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M()").WithArguments("j", "i.M()").WithLocation(6, 9),
39263
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i)").WithArguments("j", "E.M(ref i)").WithLocation(12, 9));
39295
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M()").WithArguments("j", "i.M()").WithLocation(6, 9),
39298
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i)").WithArguments("j", "E.M(ref i)").WithLocation(7, 9),
39301
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2()").WithArguments("j", "i.M2()").WithLocation(8, 9));
39333
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M(ref k)").WithArguments("j", "i.M(ref k)").WithLocation(6, 9),
39336
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i, ref k)").WithArguments("j", "E.M(ref i, ref k)").WithLocation(7, 9),
39339
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2(ref k)").WithArguments("j", "i.M2(ref k)").WithLocation(8, 9));
39371
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M(ref k)").WithArguments("j", "i.M(ref k)").WithLocation(6, 9),
39374
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i, ref k)").WithArguments("j", "E.M(ref i, ref k)").WithLocation(7, 9),
39377
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2(ref k)").WithArguments("j", "i.M2(ref k)").WithLocation(8, 9));
Semantics\PrimaryConstructorTests.cs (6)
21785
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "R5 = ref x").WithArguments("R5", "x").WithLocation(38, 9),
21788
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref x").WithArguments("R6", "x").WithLocation(44, 25)
21846
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "R5 = ref x").WithArguments("R5", "x").WithLocation(38, 9),
21849
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref x").WithArguments("R6", "x").WithLocation(44, 34)
21907
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "R5 = ref x").WithArguments("R5", "x").WithLocation(38, 9),
21910
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref x").WithArguments("R6", "x").WithLocation(44, 34)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (107)
Semantics\RefEscapingTests.cs (4)
1495
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "_ = ref y4").WithArguments("_", "y4").WithLocation(25, 9));
7141
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "obj = ref this").WithArguments("obj", "this").WithLocation(7, 9),
7197
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "obj = ref this").WithArguments("obj", "this").WithLocation(7, 9),
9206
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "z = ref x").WithArguments("z", "x").WithLocation(6, 9));
Semantics\RefFieldTests.cs (92)
2660
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r2.F = ref t").WithArguments("F", "t").WithLocation(18, 9)
2673
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r2.F = ref t").WithArguments("F", "t").WithLocation(18, 9)
2762
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.Field = ref i").WithArguments("Field", "i").WithLocation(10, 9)
4457
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.RB = ref r.B").WithArguments("RB", "r.B").WithLocation(17, 9));
5933
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F1 = ref t").WithArguments("F1", "t").WithLocation(10, 9),
5936
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F2 = ref t").WithArguments("F2", "t").WithLocation(11, 9),
5939
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F3 = ref t").WithArguments("F3", "t").WithLocation(12, 9),
5942
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F4 = ref t").WithArguments("F4", "t").WithLocation(13, 9),
5945
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x.F1 = ref t").WithArguments("F1", "t").WithLocation(21, 9),
5948
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x.F2 = ref t").WithArguments("F2", "t").WithLocation(22, 9),
5957
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "y.F1 = ref t").WithArguments("F1", "t").WithLocation(26, 9),
5960
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "y.F2 = ref t").WithArguments("F2", "t").WithLocation(27, 9),
6194
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6197
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6203
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13),
6240
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6243
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6246
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13));
6280
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6283
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6289
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13),
6326
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tValue").WithArguments("F", "tValue").WithLocation(7, 9),
6329
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref tOut").WithArguments("F", "tOut").WithLocation(9, 9),
6332
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F = ref value").WithArguments("F", "value").WithLocation(16, 13));
7181
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tValue").WithArguments("F", "tValue").WithLocation(9, 59),
7187
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tOut").WithArguments("F", "tOut").WithLocation(11, 75),
7193
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tValue").WithArguments("F", "tValue").WithLocation(14, 64),
7199
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tOut").WithArguments("F", "tOut").WithLocation(16, 80),
7205
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tValue").WithArguments("F", "tValue").WithLocation(19, 80),
7208
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tOut").WithArguments("F", "tOut").WithLocation(21, 96),
7304
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tValue").WithArguments("F", "tValue").WithLocation(9, 59),
7310
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s.F = ref tOut").WithArguments("F", "tOut").WithLocation(11, 75),
7316
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tValue").WithArguments("F", "tValue").WithLocation(14, 64),
7322
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sRef.F = ref tOut").WithArguments("F", "tOut").WithLocation(16, 80),
7328
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tValue").WithArguments("F", "tValue").WithLocation(19, 80),
7331
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "sOut.F = ref tOut").WithArguments("F", "tOut").WithLocation(21, 96),
14031
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(9, 13),
14034
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(13, 13));
14071
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(8, 13),
14074
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(12, 13));
14110
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(9, 13),
14113
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(12, 13)
15408
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r1").WithArguments("r0", "r1").WithLocation(8, 13),
15411
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r2").WithArguments("r0", "r2").WithLocation(12, 13),
15414
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r0 = ref r5").WithArguments("r0", "r5").WithLocation(24, 13),
19484
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(29, 9),
19487
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(59, 9)
19562
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(26, 9),
19565
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(52, 9));
19653
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(29, 9),
19665
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(59, 9),
19748
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(26, 9),
19760
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(52, 9),
19871
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t2").WithArguments("F", "t2").WithLocation(18, 9),
19880
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t4").WithArguments("F", "t4").WithLocation(31, 9));
19927
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t2").WithArguments("F", "t2").WithLocation(16, 9),
19936
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t4").WithArguments("F", "t4").WithLocation(27, 9));
20052
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref t").WithArguments("F", "t").WithLocation(12, 13));
22462
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(7, 9)
23224
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(11, 15),
23260
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(11, 16),
23266
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(20, 16));
23550
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(10, 9),
23556
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(18, 9));
23563
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(10, 9),
23572
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(18, 9));
24699
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "_i = ref i3").WithArguments("_i", "i3").WithLocation(16, 9),
28604
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(7, 5),
28607
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(13, 5),
28610
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(19, 5),
28800
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p.refField = ref this.field").WithArguments("refField", "this.field").WithLocation(13, 9),
28941
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p3.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(9, 9));
29203
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc byte[1])").WithArguments("_f1", "F(stackalloc byte[1])").WithLocation(4, 27),
29206
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc byte[1])").WithArguments("_f2", "F(stackalloc byte[1])").WithLocation(5, 36)
29318
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F(stackalloc byte[1])").WithArguments("_f1", "F(stackalloc byte[1])").WithLocation(4, 20),
29324
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F(stackalloc byte[1])").WithArguments("_f2", "F(stackalloc byte[1])").WithLocation(5, 29)
29347
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc int[1])").WithArguments("_s", "F(stackalloc int[1])").WithLocation(4, 33)
29392
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F<byte>(out var b1)").WithArguments("_f1", "F<byte>(out var b1)").WithLocation(4, 20),
29395
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F<byte>(out var b2)").WithArguments("_f2", "F<byte>(out var b2)").WithLocation(5, 29)
29790
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
29793
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(14, 9),
29796
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(20, 9));
29867
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefField = ref value").WithArguments("RefField", "value").WithLocation(7, 9),
29870
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(12, 9),
29873
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(17, 9),
29879
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(27, 9),
29882
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(32, 9),
29888
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(42, 9),
29891
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(47, 9));
30145
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference1(ref s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
30148
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference2(in s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(9, 9),
30154
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),
589
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref s2").WithArguments("s", "s2").WithLocation(8, 9),
595
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref s3").WithArguments("s", "s3").WithLocation(13, 9));
613
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s = ref s2").WithArguments("s", "s2").WithLocation(7, 9));
718
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "rx = ref y").WithArguments("rx", "y").WithLocation(9, 9));
785
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(8, 9),
815
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(7, 9),
818
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref z").WithArguments("x", "z").WithLocation(10, 9));