Skip to content

Commit 00d8908

Browse files
author
Harlan Haskins
committed
Address review comments
1 parent ba5564a commit 00d8908

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ void PrintOptions::clearSynthesizedExtension() {
6565
}
6666

6767
static bool contributesToParentTypeStorage(const AbstractStorageDecl *ASD) {
68-
return ASD->getDeclContext()->isTypeContext() && ASD->hasStorage() &&
69-
!ASD->isStatic();
68+
auto *DC = ASD->getDeclContext()->getAsDecl();
69+
if (!DC) return false;
70+
auto *ND = dyn_cast<NominalTypeDecl>(DC);
71+
if (!ND) return false;
72+
return !ND->isResilient() && ASD->hasStorage() && !ASD->isStatic();
7073
}
7174

7275
PrintOptions PrintOptions::printTextualInterfaceFile() {

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -945,16 +945,8 @@ static void checkRedeclaration(TypeChecker &tc, ValueDecl *current) {
945945

946946
/// Does the context allow pattern bindings that don't bind any variables?
947947
static bool contextAllowsPatternBindingWithoutVariables(DeclContext *dc) {
948-
949-
// Property decls in type context must bind variables unless in a module
950-
// interface, where private members don't bind variables but contribute
951-
// to storage.
952-
if (dc->isTypeContext()) {
953-
if (auto SF = dc->getParentSourceFile())
954-
if (SF->Kind == SourceFileKind::Interface)
955-
return true;
948+
if (dc->isTypeContext())
956949
return false;
957-
}
958950

959951
// Global variable decls must bind variables, except in scripts.
960952
if (dc->isModuleScopeContext()) {

test/ModuleInterface/private-stored-members.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
2-
// R UN: %target-swift-frontend -emit-module -o %t/Test~partial.swiftmodule -module-name Test -primary-file %s
3-
// R UN: %target-swift-frontend -merge-modules -emit-module -o %t/Test.swiftmodule %t/Test~partial.swiftmodule
4-
// R UN: %target-swift-ide-test -print-module -module-to-print=Test -source-filename=x -I %t | %FileCheck %s
2+
// RUN: %target-swift-frontend -emit-module -o %t/Test~partial.swiftmodule -module-name Test -primary-file %s
3+
// RUN: %target-swift-frontend -merge-modules -emit-module -o %t/Test.swiftmodule %t/Test~partial.swiftmodule
4+
// RUN: %target-swift-ide-test -print-module -module-to-print=Test -source-filename=x -I %t | %FileCheck %s
55

66
// RUN: %target-swift-frontend -emit-interface-path %t.swiftinterface -enable-resilience -emit-module -o /dev/null %s
77
// RUN: %FileCheck %s < %t.swiftinterface

0 commit comments

Comments
 (0)