swift
26f16470 - [TypeChecker] Rework type-checking of `for-in` statements

Commit
3 years ago
[TypeChecker] Rework type-checking of `for-in` statements Change the way how `for-in` statements are type-checked, where a lot of information has to be recorded in a statement in order for SILGen to generate appropriate calls to `makeIterator` and `next` witnesses. Instead of just finding a witness, solver would now: - Synthesize: - Iterator variable with its initializer - `$generator = <sequence>.makeIterator()`; - Call to `$generator.next()` which is called by each loop iteration; - Verify that type of pattern is convertible to type of `next()` Doing so significantly simplifies SILGen, removes the need to carry type information in `ForEachStmt` and enables iterating over existential types. Resolves: rdar://92177656
Author
Committer
Parents
Loading