Skip to content

Commit e259def

Browse files
committed
Update global warning stuff
1 parent bacfb5e commit e259def

File tree

2 files changed

+18
-40
lines changed

2 files changed

+18
-40
lines changed

docs/New Features/Compiler Warnings.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,31 @@ end
190190
```
191191

192192
### implicit-global
193-
This is raised when the `global` keyword is enabled and a global was declared without it. See [Explicit Globals](<Explicit Globals>).
193+
This is raised when a global is declared without an explicit prefix, such as the optional `global` keyword:
194194
```pluto showLineNumbers
195195
pluto_use global
196-
197196
a = 1
198197
```
199198
```
200-
file.pluto:3: warning: implicit global creation [implicit-global]
201-
3 | a = 1
202-
| ^^^^^ here: prefix this with 'global' to be explicit
199+
file.pluto:2: warning: implicit global creation [implicit-global]
200+
2 | a = 1
201+
| ^^^^^ here: prefix this with '_G.' or 'global' to be explicit
202+
```
203+
204+
Examples of code that does not raise this warning:
205+
```pluto
206+
pluto_use global
207+
global a = 1
208+
a = 2
209+
```
210+
```pluto
211+
-- @pluto_warnings enable-implicit-global
212+
_G.a = 1
213+
a = 2
203214
```
204215

216+
This warning type is enabled via `pluto_use global` or [compile-time configuration](#compile-time-configuration).
217+
205218
### discarded-return
206219
This is raised when the return value of a function declared `<nodiscard>` was discarded. See [Nodiscard Functions](<Nodiscard Functions>).
207220
```pluto showLineNumbers

docs/New Features/Explicit Globals.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)