File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ use crate::semantic_index::UseId;
8181// ### Loop-carried definitions (`finish_loop_defs()`)
8282//
8383// ```r
84- // x <- 0
84+ // x <- 0 # def A
8585// while (cond) {
8686// print(x) # should see def A (pre-loop) AND def B (previous iteration)
8787// x <- 1 # def B
@@ -97,6 +97,12 @@ use crate::semantic_index::UseId;
9797//
9898// ### Deferred definitions (`record_deferred_definition()`)
9999//
100+ // `<<-` modifies a symbol that should already be bound in an ancestor scope (if
101+ // there is no existing definition, R stores in the global environment, but
102+ // we'll lint about it). For this reason, `<<-` _adds_ to the set of potential
103+ // definitions reaching uses of that symbols, it doesn't overwrite like `<-`
104+ // would.
105+ //
100106// ```r
101107// x <- 0 # def A
102108// print(x) # should see def A AND def B
@@ -105,7 +111,7 @@ use crate::semantic_index::UseId;
105111// }
106112// ```
107113//
108- // The `<<-` creates a definition in the file scope, but it's encountered
114+ // Here the `<<-` creates a definition in the file scope, but it's encountered
109115// during the function body walk, after `print(x)` was already recorded.
110116// `record_deferred_definition()` adds it to the live state (so future uses
111117// see it) and also stashes it. At finalization, `finish_deferred_defs()`
You can’t perform that action at this time.
0 commit comments