mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Implement uninitialized pattern binding support
This like `let x: Int` or `let (x, y), ...` are now supported by the constraint solver.
This commit is contained in:
@@ -5438,6 +5438,12 @@ SolutionApplicationTarget::forPropertyWrapperInitializer(
|
||||
|
||||
ContextualPattern
|
||||
SolutionApplicationTarget::getContextualPattern() const {
|
||||
if (kind == Kind::uninitializedVar) {
|
||||
assert(patternBinding);
|
||||
return ContextualPattern::forPatternBindingDecl(patternBinding,
|
||||
uninitializedVar.index);
|
||||
}
|
||||
|
||||
assert(kind == Kind::expression);
|
||||
assert(expression.contextualPurpose == CTP_Initialization ||
|
||||
expression.contextualPurpose == CTP_ForEachStmt);
|
||||
@@ -5553,6 +5559,8 @@ void ConstraintSystem::diagnoseFailureFor(SolutionApplicationTarget target) {
|
||||
nominal->diagnose(diag::property_wrapper_declared_here,
|
||||
nominal->getName());
|
||||
}
|
||||
} else if (auto *var = target.getAsUninitializedVar()) {
|
||||
DE.diagnose(target.getLoc(), diag::failed_to_produce_diagnostic);
|
||||
} else {
|
||||
// Emit a poor fallback message.
|
||||
DE.diagnose(target.getAsFunction()->getLoc(),
|
||||
|
||||
Reference in New Issue
Block a user