Skip to content

Commit 743230e

Browse files
committed
[NFC] applyGenericArguments Returns ErrorType Consistently
1 parent d81f148 commit 743230e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ GenericSignature TypeResolution::getGenericSignature() const {
120120
return dc->getGenericSignatureOfContext();
121121

122122
case TypeResolutionStage::Structural:
123-
return nullptr;
123+
return GenericSignature();
124124
}
125125
llvm_unreachable("unhandled stage");
126126
}
@@ -781,8 +781,9 @@ static Type applyGenericArguments(Type type, TypeResolution resolution,
781781
if (nominal->isOptionalDecl()) {
782782
// Validate the generic argument.
783783
Type objectType = resolution.resolveType(genericArgs[0]);
784-
if (!objectType || objectType->hasError())
785-
return nullptr;
784+
if (!objectType || objectType->hasError()) {
785+
return ErrorType::get(ctx);
786+
}
786787

787788
return BoundGenericType::get(nominal, /*parent*/ Type(), objectType);
788789
}
@@ -3205,7 +3206,9 @@ Type TypeResolver::resolveIdentifierType(IdentTypeRepr *IdType,
32053206
ComponentRange.end());
32063207
Type result = resolveIdentTypeComponent(resolution.withOptions(options),
32073208
Components);
3208-
if (!result) return nullptr;
3209+
if (!result || result->hasError()) {
3210+
return ErrorType::get(Context);
3211+
}
32093212

32103213
if (auto moduleTy = result->getAs<ModuleType>()) {
32113214
// Allow module types only if flag is specified.

0 commit comments

Comments
 (0)