mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Assert in getInterfaceType() if no interface type is set
All decls except for ParamDecls must now have an interface type.
This commit is contained in:
@@ -1675,19 +1675,11 @@ Type ValueDecl::getInterfaceType() const {
|
||||
if (!hasType())
|
||||
return Type();
|
||||
|
||||
assert(!isa<AbstractFunctionDecl>(this) &&
|
||||
"functions should have an interface type");
|
||||
// FIXME: ParamDecls are funky and don't always have an interface type
|
||||
if (isa<ParamDecl>(this))
|
||||
return getType();
|
||||
|
||||
// If the type involves a type variable, don't cache it.
|
||||
auto type = getType();
|
||||
assert((type.isNull() || !type->is<PolymorphicFunctionType>())
|
||||
&& "decl has polymorphic function type but no interface type");
|
||||
|
||||
if (type->hasTypeVariable())
|
||||
return type;
|
||||
|
||||
InterfaceTy = type;
|
||||
return InterfaceTy;
|
||||
llvm_unreachable("decl has context type but no interface type");
|
||||
}
|
||||
|
||||
void ValueDecl::setInterfaceType(Type type) {
|
||||
|
||||
Reference in New Issue
Block a user