AST: Give all ValueDecls an interface type

Previously, getInterfaceType() would return getType() if no
interface type was set. Instead, always set an interface type
explicitly.

Eventually we want to remove getType() altogether, and this
brings us one step closer to this goal.

Note that ParamDecls are excempt from this treatment, because
they don't have a proper interface type yet. Cleaning this up
requires more effort.
This commit is contained in:
Slava Pestov
2016-11-23 23:42:18 -05:00
parent 530478cebb
commit 6cbb494ad2
22 changed files with 187 additions and 98 deletions

View File

@@ -84,6 +84,7 @@ void BuiltinUnit::LookupCache::lookupValue(
/*genericparams*/nullptr,
const_cast<BuiltinUnit*>(&M));
TAD->computeType();
TAD->setInterfaceType(TAD->getType());
TAD->setAccessibility(Accessibility::Public);
Entry = TAD;
}
@@ -346,6 +347,7 @@ ModuleDecl::ModuleDecl(Identifier name, ASTContext &ctx)
ctx.addDestructorCleanup(*this);
setImplicit();
setType(ModuleType::get(this));
setInterfaceType(ModuleType::get(this));
setAccessibility(Accessibility::Public);
}