-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
for-in loopsFeature: for-in loopsFeature: for-in loopsgenericsFeature: generic declarations and typesFeature: generic declarations and typespack iterationFeature → statements → for-in: Pack iterationFeature → statements → for-in: Pack iterationparameter packsFeature → generics: Parameter packsFeature → generics: Parameter packstype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Description
func test<each T: Collection>(ts: repeat each T) {
for t in repeat each ts where !t.isEmpty {
// code
}
}
The above code should compile and t
should be a non-empty collection.
Additional information
The problem is that the where
clause is type-checked together with the pattern. We can only get the opened element environment once that's done. Thus, we cannot guarantee that we have it available when the where
clause is type-checked.
Metadata
Metadata
Assignees
Labels
for-in loopsFeature: for-in loopsFeature: for-in loopsgenericsFeature: generic declarations and typesFeature: generic declarations and typespack iterationFeature → statements → for-in: Pack iterationFeature → statements → for-in: Pack iterationparameter packsFeature → generics: Parameter packsFeature → generics: Parameter packstype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis