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
{{ message }}
Repository navigation
c_import: a header name that collides with an imported module's name is an error even when the program never uses it (raylib PI vs std.math PI; even use std.math.TAU) #1221
use c_import("raylib.h")
use std.math.TAU // or: use std.math
fn main:
print(f"{TAU}")
Actual.
error: shadowing is not allowed for 'PI'
--> <c_import raylib.h>:1087:1
1087 | let PI: f32 = 3.14159265358979323846
The program never mentions PI. The diagnostic points into a header the user did not write and cannot change. A selective import (use std.math.TAU) still collides, so it pulls the whole module's names into the check.
Expected. Two imports that both provide a name are not an error by themselves; only a use of the ambiguous name is, and that diagnostic names both providers and the spelling that picks one. A selective import introduces only the name it selects. (Mission: a collision nobody uses leaves no meaning undecided; an ambiguous use leaves two, and the programmer spells the choice there.)
Workaround used. The raylib spiral example uses raylib's own PI and imports nothing from std.math.
Activity
Spec §18.2 (D70): the last import wins; every import is also a namesp…
Sema: the later import shadows the earlier (§18.2, Eric's ruling; Fixes
Sema: two imports that provide one name are an error only where the n…
Sema: the later import shadows the earlier (§18.2, Eric's ruling; Fixes
Sema: two imports that provide one name are an error only where the n…
Sema: the later import shadows the earlier (§18.2, Eric's ruling; Fixes
Sema: two imports that provide one name are an error only where the n…
Sema: the later import shadows the earlier (§18.2, Eric's ruling; Fixes
Sema: two imports that provide one name are an error only where the n…
Sema: the later import shadows the earlier (§18.2, Eric's ruling; Fixes
Sema: two imports that provide one name are an error only where the n…
Sema: the later import shadows the earlier (§18.2, Eric's ruling; Fixes
Sema: a named import introduces only the names it selects (#1744)
Type checker: D74 entry sources and chain moves, field-view bindings (#…
Spec-ruled fixes: Some(place) borrows for Option[&T], module globals …