File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -1325,7 +1325,12 @@ bool ExtensionDecl::isConstrainedExtension() const {
1325
1325
1326
1326
bool ExtensionDecl::isEquivalentToExtendedContext () const {
1327
1327
auto decl = getExtendedNominal ();
1328
- return getParentModule () == decl->getParentModule ()
1328
+ auto extendDeclfromSameModule =
1329
+ getParentModule () == decl->getParentModule () ||
1330
+ // if the extended type was defined in the same module with the extension,
1331
+ // we should consider them as the same module to preserve ABI stability.
1332
+ decl->getAlternateModuleName () == getParentModule ()->getNameStr ();
1333
+ return extendDeclfromSameModule
1329
1334
&& !isConstrainedExtension ()
1330
1335
&& !getDeclaredInterfaceType ()->isExistentialType ();
1331
1336
}
Original file line number Diff line number Diff line change
1
+ // REQUIRES: OS=macosx
2
+ // RUN: %empty-directory(%t)
3
+
4
+ // RUN: %target-swift-frontend -typecheck %s -emit-tbd -emit-tbd-path %t/before_move.tbd -D BEFORE_MOVE -module-name Foo -enable-library-evolution
5
+ // RUN: %FileCheck %s < %t/before_move.tbd
6
+
7
+ // RUN: %target-swift-frontend %s -emit-module -emit-module-path %t/FooCore.swiftmodule -D AFTER_MOVE_FOO_CORE -module-name FooCore -enable-library-evolution
8
+ // RUN: %target-swift-frontend -typecheck %s -emit-tbd -emit-tbd-path %t/after_move.tbd -D AFTER_MOVE_FOO -module-name Foo -I %t -enable-library-evolution
9
+ // RUN: %FileCheck %s < %t/after_move.tbd
10
+
11
+ // CHECK: '_$s3Foo4DateC14getCurrentYearSiyFZ'
12
+ // CHECK: '_$s3Foo9DateValueV4yearACSi_tcfC'
13
+ // CHECK: '_$s3Foo9DateValueV4yearSivg'
14
+ // CHECK: '_$s3Foo9DateValueV4yearSivpMV'
15
+
16
+ #if BEFORE_MOVE
17
+
18
+ public class Date {
19
+ public static func getCurrentYear( ) -> Int { return 2020 }
20
+ }
21
+
22
+ public struct DateValue {
23
+ public init ( year: Int ) { }
24
+ public var year : Int { return 2020 }
25
+ }
26
+
27
+ #endif
28
+
29
+ #if AFTER_MOVE_FOO_CORE
30
+
31
+ @available ( OSX 10 . 7 , * )
32
+ @_originallyDefinedIn ( module: " Foo " , OSX 10 . 9 )
33
+ public class Date { }
34
+
35
+ @available ( OSX 10 . 7 , * )
36
+ @_originallyDefinedIn ( module: " Foo " , OSX 10 . 9 )
37
+ public struct DateValue { }
38
+
39
+ #endif
40
+
41
+ #if AFTER_MOVE_FOO
42
+
43
+ @_exported import FooCore
44
+
45
+ public extension Date {
46
+ public static func getCurrentYear( ) -> Int { return 2020 }
47
+ }
48
+
49
+ public extension DateValue {
50
+ public init ( year: Int ) { }
51
+ public var year : Int { return 2020 }
52
+ }
53
+
54
+ #endif
You can’t perform that action at this time.
0 commit comments