Skip to content

Commit ba3b261

Browse files
committed
Shorten diagnostic and refer to bug report instead
diag::warning_module_shadowing_may_break_module_interface was *enormous* but still described the problem too tersely to convey everything that was needed. Instead, reference a bug report that describes the problem and its workarounds in more detail.
1 parent c2f3725 commit ba3b261

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,10 @@ ERROR(error_opening_explicit_module_file,none,
351351
ERROR(error_extracting_flags_from_module_interface,none,
352352
"error extracting flags from module interface", ())
353353
WARNING(warning_module_shadowing_may_break_module_interface,none,
354-
"public %0 %1 shadows module %2, which is permitted by Swift but may "
355-
"stop other compiler versions from importing module %3 or its clients; "
356-
"please work around this language bug (SR-898) by renaming either the "
357-
"%0 %1 or the module %2, or by passing the '-Xfrontend "
358-
"-module-interface-preserve-types-as-written' flags to the Swift "
359-
"compiler",
354+
"public %0 %1 shadows module %2, which may cause failures when "
355+
"importing %3 or its clients in some configurations; please rename "
356+
"either the %0 %1 or the module %2, or see "
357+
"https://bugs.swift.org/browse/SR-14195 for workarounds",
360358
(DescriptiveDeclKind, FullyQualified<Type>,
361359
/*shadowedModule=*/ModuleDecl *, /*interfaceModule*/ModuleDecl *))
362360
REMARK(rebuilding_module_from_interface,none,

test/ModuleInterface/module_shadowing.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424

2525
#if !SELF_SHADOW
2626
import ShadowyHorror
27-
// OTHER-DAG: ShadowyHorror.module_shadowing:{{[0-9]+:[0-9]+}}: warning: public class 'ShadowyHorror.module_shadowing' shadows module 'module_shadowing', which is permitted by Swift but may stop other compiler versions from importing module 'module_shadowing' or its clients; please work around this language bug (SR-898) by renaming either the class 'ShadowyHorror.module_shadowing' or the module 'module_shadowing', or by passing the '-Xfrontend -module-interface-preserve-types-as-written' flags to the Swift compiler{{$}}
27+
// OTHER-DAG: ShadowyHorror.module_shadowing:{{[0-9]+:[0-9]+}}: warning: public class 'ShadowyHorror.module_shadowing' shadows module 'module_shadowing', which may cause failures when importing 'module_shadowing' or its clients in some configurations; please rename either the class 'ShadowyHorror.module_shadowing' or the module 'module_shadowing', or see https://bugs.swift.org/browse/SR-14195 for workarounds{{$}}
2828

2929
@_implementationOnly import TestModule
3030
#endif
3131

3232
public struct ShadowyHorror {
33-
// OTHER-DAG: module_shadowing.swift:[[@LINE-1]]:15: warning: public struct 'module_shadowing.ShadowyHorror' shadows module 'ShadowyHorror', which is permitted by Swift but may stop other compiler versions from importing module 'module_shadowing' or its clients; please work around this language bug (SR-898) by renaming either the struct 'module_shadowing.ShadowyHorror' or the module 'ShadowyHorror', or by passing the '-Xfrontend -module-interface-preserve-types-as-written' flags to the Swift compiler{{$}}
34-
// SELF: module_shadowing.swift:[[@LINE-2]]:15: warning: public struct 'ShadowyHorror.ShadowyHorror' shadows module 'ShadowyHorror', which is permitted by Swift but may stop other compiler versions from importing module 'ShadowyHorror' or its clients; please work around this language bug (SR-898) by renaming either the struct 'ShadowyHorror.ShadowyHorror' or the module 'ShadowyHorror', or by passing the '-Xfrontend -module-interface-preserve-types-as-written' flags to the Swift compiler{{$}}
33+
// OTHER-DAG: module_shadowing.swift:[[@LINE-1]]:15: warning: public struct 'module_shadowing.ShadowyHorror' shadows module 'ShadowyHorror', which may cause failures when importing 'module_shadowing' or its clients in some configurations; please rename either the struct 'module_shadowing.ShadowyHorror' or the module 'ShadowyHorror', or see https://bugs.swift.org/browse/SR-14195 for workarounds{{$}}
34+
// SELF: module_shadowing.swift:[[@LINE-2]]:15: warning: public struct 'ShadowyHorror.ShadowyHorror' shadows module 'ShadowyHorror', which may cause failures when importing 'ShadowyHorror' or its clients in some configurations; please rename either the struct 'ShadowyHorror.ShadowyHorror' or the module 'ShadowyHorror', or see https://bugs.swift.org/browse/SR-14195 for workarounds{{$}}
3535

3636
init() {}
3737
public var property: ShadowyHorror { ShadowyHorror() }

0 commit comments

Comments
 (0)