Do not type check lazy accessor bodies eagerly.

Start chipping away at cross-file type checker performance issues by
avoiding type checking of lazy property accessor bodies when the type in
question is defined in a different file and the lazy property is a typed
pattern.

We still type check these in the file they are defined in when we go to
type check the types defined within that file.

Resolves rdar://problem/26894118.
This commit is contained in:
Mark Lacey
2016-07-05 20:35:40 -07:00
parent 3c4a93cfc2
commit d80cefc154
2 changed files with 2 additions and 6 deletions

View File

@@ -1625,6 +1625,7 @@ void TypeChecker::completeLazyVarImplementation(VarDecl *VD) {
// Now that we've got the storage squared away, synthesize the getter.
auto *Get = completeLazyPropertyGetter(VD, Storage, *this);
validateDecl(Get);
// The setter just forwards on to storage without materializing the initial
// value.
@@ -1643,12 +1644,6 @@ void TypeChecker::completeLazyVarImplementation(VarDecl *VD) {
Storage->setImplicit();
Storage->setAccessibility(Accessibility::Private);
Storage->setSetterAccessibility(Accessibility::Private);
typeCheckDecl(Get, true);
typeCheckDecl(Get, false);
typeCheckDecl(Set, true);
typeCheckDecl(Set, false);
}