Skip to content

Commit 7f9e34a

Browse files
committed
clarify the ref-safe-context for in parameters
The ref safe context for an `in` parameter is different when the `in` argument is passed by reference vs. when a copy is made. Fixes #296
1 parent 06da94b commit 7f9e34a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

standard/variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,8 @@ The conditional operator ([§12.18](expressions.md#1218-conditional-operator)),
11831183
For a variable `c` resulting from a ref-returning function invocation, `ref e1.M(e2, ...)`, its ref-safe-context is the narrowest of the following contexts:
11841184
11851185
- The caller-context.
1186-
- The ref-safe-context of all `ref` and `out` argument expressions (excluding the receiver).
1187-
- For each `in` parameter of the method, if there is a corresponding expression that is a variable, its ref-safe-context, otherwise the nearest enclosing context.
1186+
- The ref-safe-context of all `ref`, `out`, and `in` argument expressions (excluding the receiver).
1187+
- For each `in` parameter, if there is a corresponding expression that is a variable and there exists an identity conversion between the type of the variable and the type of the parameter, the variable's ref-safe-context, otherwise the nearest enclosing context.
11881188
- The context of all argument expressions (including the receiver).
11891189
11901190
> *Example*: the last bullet is necessary to handle code such as

0 commit comments

Comments
 (0)