Relax Restrictions on Placeholder Types Appearing in Interface Types

These restrictions are meant to keep placeholder types from escaping TypeCheckType. But there's really no harm in that happening as long as we diagnose it on the way out in the places it's banned. (We also need to make sure we're only diagnosing things in primaries, but that's a minor issue). The end result is that we lose information because a lot of the AST that has placeholders in it becomes filled with error types instead.

Lift the restriction on placeholders appearing in the interface type, teach the mangler to treat them as unresolved types, and teach serialization to treat them as error types.
This commit is contained in:
Robert Widmann
2021-10-06 16:59:38 -07:00
parent 22ad19f64b
commit 1fe2e4b3e7
5 changed files with 13 additions and 7 deletions

View File

@@ -4289,6 +4289,13 @@ public:
}
void visitPlaceholderType(const PlaceholderType *) {
// If for some reason we have a placeholder type while compiling with
// errors, just serialize an ErrorType and continue.
if (S.getASTContext().LangOpts.AllowModuleWithCompilerErrors) {
visitErrorType(
cast<ErrorType>(ErrorType::get(S.getASTContext()).getPointer()));
return;
}
llvm_unreachable("should not serialize a PlaceholderType");
}