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
Diagnostic: a method named with the reserved word spawn is reported at the call site ("only available inside scope") instead of at the declaration #1303
Found rewriting `examples/ecs` under #1150 ruling 4 (`World.spawn(name) -> Entity`, the ECS vocabulary).
```
type World { next_id: i32 = 0 }
extend World:
mut fn spawn(name: str) -> i32:
self.next_id += 1
self.next_id
mut fn spawn_player() -> i32:
self.spawn("player")
fn main:
var w = World {}
print(f"{w.spawn_player()}")
```
```
error: spawn() is only available inside scope
--> main.w:108:22
error: return type does not implement Default
```
The built-in `s.spawn(...)` for OS-thread scopes (§14.14) is matched by method name before the receiver's own methods are consulted, so no user type can have a `spawn` method. §18.2's precedence puts current-module declarations above builtins; the builtin should apply only when the receiver is a scope handle (the same class as #1153: builtins need explicit precedence). Installed `with v0.15.2.1-g478b26481`.
The example names the method `spawn_entity` until this lands.
Independent validation: not a builtin-precedence defect — spawn is a reserved word (§29.11 "spawn is reserved"; Token.wTK_KW_SPAWN): fn spawn(...) and let spawn are rejected at the declaration too. The example's spelling is wrong (spawn_entity is right; fixed in #1308). What remains is diagnostic quality: after extend/. the parser accepts fn spawn and Sema reports "only available inside scope" at the call site instead of "reserved keyword" at the declaration. Re-scoped to that.
changed the title [-]A user method named `spawn` is intercepted by the built-in scope spawn(): "spawn() is only available inside scope"[/-][+]Diagnostic: a method named with the reserved word `spawn` is reported at the call site ("only available inside scope") instead of at the declaration[/+]on Sep 22, 2026
Activity
examples: rewritten to the current spec (D55 ruling 4) + examples-tes…
ehartford commentedon Sep 22, 2026
Independent validation: not a builtin-precedence defect —
spawnis a reserved word (§29.11 "spawn is reserved";Token.wTK_KW_SPAWN):fn spawn(...)andlet spawnare rejected at the declaration too. The example's spelling is wrong (spawn_entityis right; fixed in #1308). What remains is diagnostic quality: afterextend/.the parser acceptsfn spawnand Sema reports "only available inside scope" at the call site instead of "reserved keyword" at the declaration. Re-scoped to that.[-]A user method named `spawn` is intercepted by the built-in scope spawn(): "spawn() is only available inside scope"[/-][+]Diagnostic: a method named with the reserved word `spawn` is reported at the call site ("only available inside scope") instead of at the declaration[/+]