var c := 0; type t1 = class(IEnumerable, IEnumerator) public function GetEnumerator: IEnumerator := self; function System.Collections.IEnumerable.GetEnumerator: System.Collections.IEnumerator := self; public function MoveNext := false; public property Current: byte read 0; property System.Collections.IEnumerator.Current: object read 0; public procedure Reset := exit; public procedure Dispose := c += 1; end; t2 = class(IEnumerable, IEnumerator) public function GetEnumerator: IEnumerator := self; function System.Collections.IEnumerable.GetEnumerator: System.Collections.IEnumerator := self; public function MoveNext := false; public property Current: byte read 0; property System.Collections.IEnumerator.Current: object read 0; property System.Collections.Generic.IEnumerator.Current: T read default(T); public procedure Reset := exit; public procedure Dispose := c += 1; end; function f1: sequence of byte; begin yield sequence new t1; foreach var x in new t1 do yield x; foreach var x in new t1 do ; end; begin foreach var x in new t1 do ; foreach var x in new t2 do ; //foreach var x in f1 do ; Assert(c = 2); end.