File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,6 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
207
207
serializationOpts.ModuleLinkName = opts.ModuleLinkName ;
208
208
serializationOpts.UserModuleVersion = opts.UserModuleVersion ;
209
209
serializationOpts.AllowableClients = opts.AllowableClients ;
210
- serializationOpts.SerializeDebugInfoSIL = opts.SerializeDebugInfoSIL ;
211
210
212
211
serializationOpts.PublicDependentLibraries =
213
212
getIRGenOptions ().PublicLinkLibraries ;
@@ -268,6 +267,18 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
268
267
serializationOpts.EmbeddedSwiftModule =
269
268
LangOpts.hasFeature (Feature::Embedded);
270
269
270
+ serializationOpts.SerializeDebugInfoSIL = opts.SerializeDebugInfoSIL ;
271
+
272
+ // Enable serialization of debug info in embedded mode.
273
+ // This is important to get diagnostics for errors which are located in imported modules.
274
+ // Such errors can sometimes only be detected when building the client module, because
275
+ // the error can be in a generic function which is specialized in the client module.
276
+ if (serializationOpts.EmbeddedSwiftModule &&
277
+ // Except for the stdlib core. We don't want to get error locations inside stdlib internals.
278
+ !getParseStdlib ()) {
279
+ serializationOpts.SerializeDebugInfoSIL = true ;
280
+ }
281
+
271
282
serializationOpts.IsOSSA = getSILOptions ().EnableOSSAModules ;
272
283
273
284
serializationOpts.SkipNonExportableDecls =
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %{python} %utils/split_file.py -o %t %s
3
+
4
+ // RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5
+ // RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -verify -o /dev/null
6
+
7
+ // REQUIRES: OS=macosx || OS=linux-gnu
8
+ // REQUIRES: swift_feature_Embedded
9
+
10
+ // BEGIN MyModule.swift
11
+
12
+ public struct MyError : Error {
13
+ }
14
+
15
+ @inline ( never)
16
+ public func foo< T> ( _ t: T ) throws {
17
+ throw MyError ( ) // expected-error {{cannot use a value of protocol type 'any Error' in embedded Swift}}
18
+ }
19
+
20
+ @inline ( never)
21
+ public func callit< T> ( _ t: T ) {
22
+ do {
23
+ try foo ( t)
24
+ } catch {
25
+ }
26
+ }
27
+
28
+ // BEGIN Main.swift
29
+
30
+ import MyModule
31
+
32
+ public func testit( ) {
33
+ callit ( 27 ) // expected-note {{generic specialization called here}}
34
+ }
35
+
You can’t perform that action at this time.
0 commit comments