mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ConstraintSystem] Detect and diagnose missing generic arguments
Introduce a fix to detect and diagnose situations when omitted
generic arguments couldn't be deduced by the solver based on
the enclosing context.
Example:
```swift
struct S<T> {
}
_ = S() // There is not enough context to deduce `T`
```
Resolves: rdar://problem/51203824
This commit is contained in:
@@ -100,13 +100,9 @@ void ConstraintSystem::incrementLeafScopes() {
|
||||
|
||||
bool ConstraintSystem::hasFreeTypeVariables() {
|
||||
// Look for any free type variables.
|
||||
for (auto tv : TypeVariables) {
|
||||
if (!tv->getImpl().hasRepresentativeOrFixed()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return llvm::any_of(TypeVariables, [](const TypeVariableType *typeVar) {
|
||||
return !typeVar->getImpl().hasRepresentativeOrFixed();
|
||||
});
|
||||
}
|
||||
|
||||
void ConstraintSystem::addTypeVariable(TypeVariableType *typeVar) {
|
||||
|
||||
Reference in New Issue
Block a user