mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Warn about module name shadowing in interfaces
There is a known issue with module interfaces where a type with the same name as a module will disrupt references to types in that module. Fully fixing it will require a new language feature (SR-898) which is not yet available. In the meantime, module interfaces support a workaround flag (“-Xfrontend -module-interface-preserve-types-as-written”) which prints an alternate form that usually works. However, you have to know to add this flag, and it’s not obvious because nothing breaks until a compiler tries to consume the affected module interface (or sometimes even one of its clients). This commit emits a warning during module interface emission whenever the module interface either imports a type with the same name as the module being built, or declares a type with the same name as a visible module. This lets the user know that the type may cause problems and they might need to implement a workaround.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
public struct TestStruct {
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public enum module_shadowing {}
|
||||
|
||||
Reference in New Issue
Block a user