@@ -176,12 +176,46 @@ bool ConstraintSystem::isTypeReference(Expr *E) {
176
176
});
177
177
}
178
178
179
+ bool Solution::isTypeReference (Expr *E) const {
180
+ return E->isTypeReference (
181
+ [&](Expr *expr) -> Type { return simplifyType (getType (expr)); },
182
+ [&](Expr *expr) -> Decl * {
183
+ ConstraintLocator *locator = nullptr ;
184
+ if (auto *UDE = dyn_cast<UnresolvedDotExpr>(E)) {
185
+ locator = getConstraintLocator (UDE, {ConstraintLocator::Member});
186
+ }
187
+
188
+ if (auto *UME = dyn_cast<UnresolvedMemberExpr>(E)) {
189
+ locator =
190
+ getConstraintLocator (UME, {ConstraintLocator::UnresolvedMember});
191
+ }
192
+
193
+ if (isa<OverloadSetRefExpr>(E))
194
+ locator = getConstraintLocator (const_cast <Expr *>(E));
195
+
196
+ if (locator) {
197
+ if (auto selectedOverload = getOverloadChoiceIfAvailable (locator)) {
198
+ const auto &choice = selectedOverload->choice ;
199
+ return choice.getDeclOrNull ();
200
+ }
201
+ }
202
+
203
+ return nullptr ;
204
+ });
205
+ }
206
+
179
207
bool ConstraintSystem::isStaticallyDerivedMetatype (Expr *E) {
180
208
return E->isStaticallyDerivedMetatype (
181
209
[&](Expr *E) -> Type { return simplifyType (getType (E)); },
182
210
[&](Expr *E) -> bool { return isTypeReference (E); });
183
211
}
184
212
213
+ bool Solution::isStaticallyDerivedMetatype (Expr *E) const {
214
+ return E->isStaticallyDerivedMetatype (
215
+ [&](Expr *E) -> Type { return simplifyType (getType (E)); },
216
+ [&](Expr *E) -> bool { return isTypeReference (E); });
217
+ }
218
+
185
219
Type ConstraintSystem::getInstanceType (TypeExpr *E) {
186
220
if (!hasType (E))
187
221
return Type ();
0 commit comments