Ensure that we don't end up with interface types that involve type variables.

Swift SVN r10757
This commit is contained in:
Doug Gregor
2013-12-03 22:14:21 +00:00
parent 498a2a96bb
commit 37a68b7f69
2 changed files with 13 additions and 2 deletions

View File

@@ -430,10 +430,21 @@ Type ValueDecl::getInterfaceType() const {
if (!hasType())
return Type();
InterfaceTy = getType();
// If the type involves a type variable, don't cache it.
auto type = getType();
if (type->hasTypeVariable())
return type;
InterfaceTy = type;
return InterfaceTy;
}
void ValueDecl::setInterfaceType(Type type) {
assert((type.isNull() || !type->hasTypeVariable()) &&
"Type variable in interface type");
InterfaceTy = type;
}
Type TypeDecl::getDeclaredType() const {
if (auto TAD = dyn_cast<TypeAliasDecl>(this))
return TAD->getAliasType();