Error compilation "While deserializing SIL global "UIEdgeInsetsZero"

After migrating to Xcdoe 10 and Swift 4.2, I get a compilation error:



1. While deserializing SIL global "UIEdgeInsetsZero"

error: Abort trap: 6



With stack strace :

*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
result is ambiguous
0  swift                    0x000000010ae42c5a PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010ae42066 SignalHandler(int) + 966
2  libsystem_platform.dylib 0x00007fff7fe6cf5a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000117e1c558 _sigtramp + 2549806616
4  libsystem_c.dylib        0x00007fff7fc0a1ae abort + 127
5  swift                    0x00000001082e899b swift::ModuleFile::fatal(llvm::Error) + 1915
6  swift                    0x00000001083204d2 swift::SILDeserializer::readGlobalVar(llvm::StringRef) + 1890
7  swift                    0x00000001083caf9a swift::SerializedSILLoader::getAllForModule(swift::Identifier, swift::FileUnit*) + 234
8  swift                    0x000000010711ddbe performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 34750
9  swift                    0x000000010711210f swift::performFrontend(llvm::ArrayRef, char const*, void*, swift::FrontendObserver*) + 7839
10 swift                    0x00000001070bbc48 main + 13144
11 libdyld.dylib            0x00007fff7fb5e015 start + 1

I have the exact same problem.

Accepted Answer

I've found a fix here: https://stackoverflow.com/a/50706413/1572847.


if swift(4.2>=)
import UIKit.UIGeometry
extension UIEdgeInsets {
    public static let zero = UIEdgeInsets()
}
#endif

Okay, You can also use UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) instead of UIEdgeInsets.zero.


I found bug on swift tracker : https://bugs.swift.org/browse/SR-7879

Error compilation "While deserializing SIL global "UIEdgeInsetsZero"
 
 
Q