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
D69: generic generator functions and generator methods (gen fn f[T], gen fn in impl) #1724
A gen fn with type parameters, or a gen fn declared as a method inside an impl/type/extend block, is not implemented. Before D69 both failed obscurely (generic: "MIR lowering failed for function 'main'"; method: "undefined variable self" / "unknown method"). The D69 lowering (gen-push-impl) makes both a loud compile error naming this issue.
Repro:
gen fn twice[T](x: T) -> T:
yield x
yield x
fn main:
for v in twice(3): print(v)
type W { n: i32 }
impl W:
gen fn upto() -> i32:
var i = 0
while i < self.n:
yield i
i += 1
Expected: both compile; the generator value of a generic gen fn is a specialization of the per-gen-fn state struct (its arguments), each and the producer are specialized with it; a gen method stores its receiver as the first argument.
Activity
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: a generator's views are live for the whole loop over it — the bo…
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: generic generator functions and generator methods (Fixes #1724)
D69: a generator's views are live for the whole loop over it — the bo…
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: generic generator functions and generator methods (Fixes #1724)
D69: a generator's views are live for the whole loop over it — the bo…
2 remaining items
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: generic generator functions and generator methods (Fixes #1724)
D69: a generator's views are live for the whole loop over it — the bo…
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: generic generator functions and generator methods (Fixes #1724)
D69: a generator's views are live for the whole loop over it — the bo…
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — push generators, std.generators pipe…
D69 follow-ups: generic and method gen fn, comprehensions and goto ov…
D69: g.pull() — a generator stepped by next() on its own fiber (#1748)
validate-all: a body's parameter locals are checked against its Sema …
Ownership: D72 liveness byte, D73 assignment-as-read, validator leak/…