File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,8 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal(
347347 // optimization pipeline.
348348 SerializationOptions SerializationOpts;
349349 std::string OutPathStr = OutPath;
350+ SerializationOpts.EnableNestedTypeLookupTable
351+ = FEOpts.EnableSerializationNestedTypeLookupTable ;
350352 SerializationOpts.OutputPath = OutPathStr.c_str ();
351353 SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName ;
352354 SerializationOpts.AutolinkForceLoad =
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5555// / describe what change you made. The content of this comment isn't important;
5656// / it just ensures a conflict if two people change the module format.
5757// / Don't worry about adhering to the 80-column limit for this line.
58- const uint16_t SWIFTMODULE_VERSION_MINOR = 537 ; // SIL differentiability witnesses
58+ const uint16_t SWIFTMODULE_VERSION_MINOR = 538 ; // swiftmodules from swiftinterfaces have nested types tables
5959
6060// / A standard hash seed used for all string hashes in a serialized module.
6161// /
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %empty-directory(%t/ModuleCache)
3+ // RUN: %empty-directory(%t/Build)
4+ // RUN: %empty-directory(%t/PrebuiltCache)
5+
6+ // 1. Create a module for our nested type
7+ // RUN: echo 'public protocol Nest { associatedtype Egg }' > %t/TestModule.swift
8+
9+ // 2. Create an interface for it
10+ // RUN: %target-swift-frontend -typecheck %t/TestModule.swift -emit-module-interface-path %t/Build/TestModule.swiftinterface -swift-version 5
11+
12+ // 3. Build a .swiftmodule from the .swiftinterface and put it in the module cache
13+ // RUN: %target-swift-frontend -compile-module-from-interface %t/Build/TestModule.swiftinterface -o %t/PrebuiltCache/TestModule.swiftmodule
14+
15+ // 4. Import the module in a different module that extends the nested type.
16+ // RUN: echo 'import TestModule; extension Nest where Egg == Int { public func robin() -> Egg { return 3 } }' > %t/NestModule.swift
17+
18+ // 5. Create an interface for it
19+ // RUN: %target-swift-frontend -typecheck %t/NestModule.swift -I %t/PrebuiltCache -sdk %t -prebuilt-module-cache-path %t/PrebuiltCache -module-cache-path %t/ModuleCache -emit-module-interface-path %t/Build/NestModule.swiftinterface -swift-version 5
20+
21+ // 6. Build a .swiftmodule from the .swiftinterface and put it in the module cache
22+ // RUN: %target-swift-frontend -compile-module-from-interface -I %t/PrebuiltCache -sdk %t %t/Build/NestModule.swiftinterface -o %t/PrebuiltCache/NestModule.swiftmodule
23+
24+ // 7. Ensure we resolve the cross-ref to the nested type properly.
25+ // RUN: %target-swift-frontend -typecheck %s -I %t/PrebuiltCache -sdk %t -prebuilt-module-cache-path %t/PrebuiltCache -module-cache-path %t/ModuleCache -print-stats 2>&1 | %FileCheck %s
26+
27+ import TestModule
28+ import NestModule
29+
30+ // CHECK: Statistics
31+ // CHECK: 1 Serialization - # of nested types resolved without full lookup
32+
33+ func tweet< Location: Nest > ( from place: Location ) where Location. Egg == Int {
34+ _ = place. robin ( )
35+ }
You can’t perform that action at this time.
0 commit comments