134 references to ERR_RefAssignNarrower
Microsoft.CodeAnalysis.CSharp (2)
Binder\Binder_Statements.cs (1)
1577
(_, 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)
45224
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M()").WithArguments("j", "i.M()").WithLocation(6, 9),
45227
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i)").WithArguments("j", "E.M(ref i)").WithLocation(12, 9));
45259
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M()").WithArguments("j", "i.M()").WithLocation(6, 9),
45262
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i)").WithArguments("j", "E.M(ref i)").WithLocation(7, 9),
45265
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2()").WithArguments("j", "i.M2()").WithLocation(8, 9));
45297
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M(ref k)").WithArguments("j", "i.M(ref k)").WithLocation(6, 9),
45300
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i, ref k)").WithArguments("j", "E.M(ref i, ref k)").WithLocation(7, 9),
45303
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M2(ref k)").WithArguments("j", "i.M2(ref k)").WithLocation(8, 9));
45335
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref i.M(ref k)").WithArguments("j", "i.M(ref k)").WithLocation(6, 9),
45338
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "j = ref E.M(ref i, ref k)").WithArguments("j", "E.M(ref i, ref k)").WithLocation(7, 9),
45341
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)
1495
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "_ = ref y4").WithArguments("_", "y4").WithLocation(25, 9));
7722
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "obj = ref this").WithArguments("obj", "this").WithLocation(7, 9),
7778
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "obj = ref this").WithArguments("obj", "this").WithLocation(7, 9),
9787
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),
19483
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(29, 9),
19486
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(59, 9)
19561
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(26, 9),
19564
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(52, 9));
19652
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(29, 9),
19664
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(59, 9),
19747
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r3.F = ref t").WithArguments("F", "t").WithLocation(26, 9),
19759
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r7.F = ref t").WithArguments("F", "t").WithLocation(52, 9),
19870
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t2").WithArguments("F", "t2").WithLocation(18, 9),
19879
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t4").WithArguments("F", "t4").WithLocation(31, 9));
19926
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t2").WithArguments("F", "t2").WithLocation(16, 9),
19935
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "this.F = ref t4").WithArguments("F", "t4").WithLocation(27, 9));
20051
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref t").WithArguments("F", "t").WithLocation(12, 13));
22451
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "x = ref y").WithArguments("x", "y").WithLocation(7, 9)
23213
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(11, 15),
23249
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(11, 16),
23255
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "value.F = ref this").WithArguments("F", "this").WithLocation(20, 16));
23539
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(10, 9),
23545
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(18, 9));
23552
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(10, 9),
23561
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "r.F = ref this").WithArguments("F", "this").WithLocation(18, 9));
24688
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "_i = ref i3").WithArguments("_i", "i3").WithLocation(16, 9),
28593
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(7, 5),
28596
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(13, 5),
28599
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p2.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(19, 5),
28789
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p.refField = ref this.field").WithArguments("refField", "this.field").WithLocation(13, 9),
28930
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "p3.refField = ref p1.field").WithArguments("refField", "p1.field").WithLocation(9, 9));
29192
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc byte[1])").WithArguments("_f1", "F(stackalloc byte[1])").WithLocation(4, 27),
29195
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc byte[1])").WithArguments("_f2", "F(stackalloc byte[1])").WithLocation(5, 36)
29307
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F(stackalloc byte[1])").WithArguments("_f1", "F(stackalloc byte[1])").WithLocation(4, 20),
29313
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "F(stackalloc byte[1])").WithArguments("_f2", "F(stackalloc byte[1])").WithLocation(5, 29)
29336
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F(stackalloc int[1])").WithArguments("_s", "F(stackalloc int[1])").WithLocation(4, 33)
29381
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F<byte>(out var b1)").WithArguments("_f1", "F<byte>(out var b1)").WithLocation(4, 20),
29384
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "ref F<byte>(out var b2)").WithArguments("_f2", "F<byte>(out var b2)").WithLocation(5, 29)
29779
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
29782
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(14, 9),
29785
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(20, 9));
29856
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefField = ref value").WithArguments("RefField", "value").WithLocation(7, 9),
29859
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(12, 9),
29862
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(17, 9),
29868
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(27, 9),
29871
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(32, 9),
29877
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefProperty.RefField = ref value").WithArguments("RefField", "value").WithLocation(42, 9),
29880
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "s1.RefMethod().RefField = ref value").WithArguments("RefField", "value").WithLocation(47, 9));
30134
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference1(ref s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(8, 9),
30137
Diagnostic(ErrorCode.
ERR_RefAssignNarrower
, "GetReference2(in s1).RefField = ref value").WithArguments("RefField", "value").WithLocation(9, 9),
30143
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));