@@ -59,7 +59,8 @@ ForceOptional *ForceOptional::create(ConstraintSystem &cs,
59
59
}
60
60
61
61
bool UnwrapOptionalBase::diagnose (Expr *root, const Solution &solution) const {
62
- bool resultIsOptional = false ; // FIXME: figure out a way to implement this.
62
+ bool resultIsOptional =
63
+ getKind () == FixKind::UnwrapOptionalBaseWithOptionalResult;
63
64
MemberAccessOnOptionalBaseFailure failure (root, solution, getLocator (),
64
65
MemberName, resultIsOptional);
65
66
return failure.diagnose ();
@@ -68,7 +69,14 @@ bool UnwrapOptionalBase::diagnose(Expr *root, const Solution &solution) const {
68
69
UnwrapOptionalBase *UnwrapOptionalBase::create (ConstraintSystem &cs,
69
70
DeclName member,
70
71
ConstraintLocator *locator) {
71
- return new (cs.getAllocator ()) UnwrapOptionalBase (member, locator);
72
+ return new (cs.getAllocator ())
73
+ UnwrapOptionalBase (FixKind::UnwrapOptionalBase, member, locator);
74
+ }
75
+
76
+ UnwrapOptionalBase *UnwrapOptionalBase::createWithOptionalResult (
77
+ ConstraintSystem &cs, DeclName member, ConstraintLocator *locator) {
78
+ return new (cs.getAllocator ()) UnwrapOptionalBase (
79
+ FixKind::UnwrapOptionalBaseWithOptionalResult, member, locator);
72
80
}
73
81
74
82
bool AddAddressOf::diagnose (Expr *root, const Solution &solution) const {
@@ -118,7 +126,7 @@ RelabelArguments::create(ConstraintSystem &cs,
118
126
119
127
bool MissingConformance::diagnose (Expr *root, const Solution &solution) const {
120
128
MissingConformanceFailure failure (root, solution, getLocator (),
121
- {NonConformingType. getPointer () , Protocol});
129
+ {NonConformingType, Protocol});
122
130
return failure.diagnose ();
123
131
}
124
132
0 commit comments