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(
207207 serializationOpts.ModuleLinkName = opts.ModuleLinkName ;
208208 serializationOpts.UserModuleVersion = opts.UserModuleVersion ;
209209 serializationOpts.AllowableClients = opts.AllowableClients ;
210- serializationOpts.SerializeDebugInfoSIL = opts.SerializeDebugInfoSIL ;
211210
212211 serializationOpts.PublicDependentLibraries =
213212 getIRGenOptions ().PublicLinkLibraries ;
@@ -268,6 +267,18 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
268267 serializationOpts.EmbeddedSwiftModule =
269268 LangOpts.hasFeature (Feature::Embedded);
270269
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+
271282 serializationOpts.IsOSSA = getSILOptions ().EnableOSSAModules ;
272283
273284 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