You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Tests to verify ref safety bug fix
These tests verify that issue #63852 is fixed. It was very likely fixed
as part of #73081closes#63852
* formatting issue
* Apply suggestions from code review
Co-authored-by: Jan Jones <[email protected]>
---------
Co-authored-by: Jan Jones <[email protected]>
// (16,9): error CS8347: Cannot use a result of 'S1.operator +(S1, S1)' in this context because it may expose variables referenced by parameter 'b' outside of their declaration scope
// (16,22): error CS8352: Cannot use variable 'stackLocal' in this context because it may expose referenced variables outside of their declaration scope
// (16,9): error CS8347: Cannot use a result of 'S1.operator +(S1, S1)' in this context because it may expose variables referenced by parameter 'b' outside of their declaration scope
// (16,22): error CS8352: Cannot use variable 'stackLocal' in this context because it may expose referenced variables outside of their declaration scope
// (50,9): error CS8347: Cannot use a result of 'S3.operator +(in S3, in S3)' in this context because it may expose variables referenced by parameter 'a' outside of their declaration scope
9618
+
// heapLocal += heapLocal; // 2
9619
+
Diagnostic(ErrorCode.ERR_EscapeCall,"heapLocal += heapLocal").WithArguments("S3.operator +(in S3, in S3)","a").WithLocation(50,9),
9620
+
// (51,9): error CS8168: Cannot return local 'heapLocal' by reference because it is not a ref local
// (51,9): error CS8347: Cannot use a result of 'S3.operator +(in S3, in S3)' in this context because it may expose variables referenced by parameter 'a' outside of their declaration scope
9624
+
// heapLocal += stackLocal; // 3
9625
+
Diagnostic(ErrorCode.ERR_EscapeCall,"heapLocal += stackLocal").WithArguments("S3.operator +(in S3, in S3)","a").WithLocation(51,9),
9626
+
// (68,9): error CS8347: Cannot use a result of 'S4.operator +(scoped in S4, scoped in S4)' in this context because it may expose variables referenced by parameter 'b' outside of their declaration scope
9627
+
// heapLocal += stackLocal; // 4
9628
+
Diagnostic(ErrorCode.ERR_EscapeCall,"heapLocal += stackLocal").WithArguments("S4.operator +(scoped in S4, scoped in S4)","b").WithLocation(68,9),
9629
+
// (68,22): error CS8352: Cannot use variable 'stackLocal' in this context because it may expose referenced variables outside of their declaration scope
0 commit comments