You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Serialization: reword diagnostic about serialization channel mismatch
This diagnostic reports when two compilers that are marked as targetting
different distribution channels try to read swiftmodules produced by the
other one. For a resilient module, this error is usually silently ignored
as the reader compiler picks the swiftinterface over the swiftmodule.
It is visibile to the end user when the module is non-resilient.
For such a case, we here try to improve the diagnostic to be more
meaningful.
The new diagnostics looks like so:
```
import ChannelLib // error: the binary module for 'ChannelLib' was compiled
// for 'restricted-channel', it cannot be imported by the
// current compiler which is aligned with 'other-channel'.
// Binary module loaded from path: .../ChannelLib.swiftmodule
```
Vendors should be mindful to pick meaningful channel names
to guide users in the direction of the actual solution.
Copy file name to clipboardExpand all lines: test/Serialization/restrict-swiftmodule-to-channel.swift
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ public func foo() {}
25
25
26
26
/// 2. Test importing the non-resilient no-channel library from a channel compiler.
27
27
//--- NonResilientClient.swift
28
-
import NonResilientLib // expected-error {{compiled module was created for a different distribution channel '' than the local compiler 'restricted-channel', please ensure 'NonResilientLib' is found from the expected path:}}
28
+
import NonResilientLib // expected-error {{the binary module for 'NonResilientLib' was compiled for '', it cannot be imported by the current compiler which is aligned with 'restricted-channel'. Binary module loaded from path:}}
29
29
foo()
30
30
31
31
/// Building a NonResilientLib client should reject the import for a tagged compiler
@@ -37,7 +37,7 @@ foo()
37
37
38
38
/// 3. Test importing the resilient no-channel library.
39
39
//--- ResilientClient.swift
40
-
import ResilientLib // expected-reject-error {{compiled module was created for a different distribution channel '' than the local compiler 'restricted-channel', please ensure 'ResilientLib' is found from the expected path:}}
40
+
import ResilientLib // expected-reject-error {{the binary module for 'ResilientLib' was compiled for '', it cannot be imported by the current compiler which is aligned with 'restricted-channel'. Binary module loaded from path:}}
41
41
// expected-rebuild-remark @-1 {{rebuilding module 'ResilientLib' from interface}}
42
42
// expected-rebuild-note @-2 {{compiled module is out of date}}
43
43
// expected-rebuild-note @-3 {{compiled for a different distribution channel}}
@@ -80,7 +80,7 @@ foo()
80
80
81
81
/// 4. Test importing the channel restricted library
82
82
//--- ChannelClient.swift
83
-
import ChannelLib // expected-reject-error {{compiled module was created for a different distribution channel 'restricted-channel' than the local compiler 'other-channel', please ensure 'ChannelLib' is found from the expected path}}
83
+
import ChannelLib // expected-reject-error {{the binary module for 'ChannelLib' was compiled for 'restricted-channel', it cannot be imported by the current compiler which is aligned with 'other-channel'. Binary module loaded from path:}}
84
84
foo()
85
85
86
86
/// Importing ChannelLib should succeed with the same channel.
0 commit comments