Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-1889] Compiler Segmentation Fault with Generic typealias declared in separate module #44498

Closed
rileytestut opened this issue Jun 23, 2016 · 18 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@rileytestut
Copy link

Previous ID SR-1889
Radar None
Original Reporter @rileytestut
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @slavapestov
Priority Medium

md5: 209a915142e6cadfc3c21ed69f25fde4

is duplicated by:

  • SR-2169 When defining a typealias with a generic closure, the compiler segfaults: 11 when the closure is used in a different file as a parameter type.
  • SR-2255 Segmentation fault 11, using generic typealiases in different Files

relates to:

  • SR-2169 When defining a typealias with a generic closure, the compiler segfaults: 11 when the closure is used in a different file as a parameter type.

Issue Description:

I've declared a Result type and a generic typealias for the Result type in one module as such:

public enum Result<T, U: ErrorProtocol>
{
    case success(T)
    case failure(U)
}

public typealias GenericResult<T> = Result<T, NSError>

Then, on attempting to use the GenericResult typealias from a separate module like so:

func testFunction<T>(withCompletion completion: (Result<T, NSError>) -> Void) { }
testFunction { (result: GenericResult<Data>) in }

the compiler will crash with the following stack trace:

0  swift                    0x000000010636434b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x0000000106363636 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x000000010636499f SignalHandler(int) + 287
3  libsystem_platform.dylib 0x00007fff93fb552a _sigtramp + 26
4  libsystem_platform.dylib 0x00007fff5be13760 _sigtramp + 3353731664
5  swift                    0x000000010450bd31 swift::TypeChecker::applyGenericArguments(swift::Type, swift::SourceLoc, swift::DeclContext*, swift::GenericIdentTypeRepr*, bool, swift::GenericTypeResolver*) + 481
6  swift                    0x0000000104511014 resolveTypeDecl(swift::TypeChecker&, swift::TypeDecl*, swift::SourceLoc, swift::DeclContext*, swift::GenericIdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 1380
7  swift                    0x00000001045108d3 resolveTopLevelIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, swift::ComponentIdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 1699
8  swift                    0x000000010450c77f resolveIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, llvm::ArrayRef<swift::ComponentIdentTypeRepr*>, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 383
9  swift                    0x000000010450c4c4 swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 116
10 swift                    0x000000010450d151 (anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>) + 113
11 swift                    0x000000010450d09e swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 174
12 swift                    0x000000010450c40f swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 191
13 swift                    0x00000001044e615e validateParameterType(swift::ParamDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, swift::TypeChecker&) + 94
14 swift                    0x00000001044e6033 swift::TypeChecker::typeCheckParameterList(swift::ParameterList*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 115
15 swift                    0x00000001044a8bce (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 222
16 swift                    0x00000001045726c6 (anonymous namespace)::Traversal::visit(swift::Expr*) + 118
17 swift                    0x0000000104574770 (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 128
18 swift                    0x0000000104572700 (anonymous namespace)::Traversal::visit(swift::Expr*) + 176
19 swift                    0x0000000104571c75 swift::Expr::walk(swift::ASTWalker&) + 53
20 swift                    0x000000010449f571 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 145
21 swift                    0x00000001044a4f9f swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 559
22 swift                    0x0000000104508223 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 451
23 swift                    0x0000000104507ddc swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 140
24 swift                    0x00000001044cfd68 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1224
25 swift                    0x0000000104229555 swift::CompilerInstance::performSema() + 3349
26 swift                    0x0000000103e2192e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 958
27 swift                    0x0000000103e20619 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2873
28 swift                    0x0000000103dee6c4 main + 2852
29 libdyld.dylib            0x00007fff8b0b05ad start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/Riley/Desktop/Swift Crash/Application/main.swift -target x86_64-apple-ios10.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -I /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Products/Debug-iphonesimulator -F /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Products/Debug-iphonesimulator -enable-testing -g -import-underlying-module -module-cache-path /Users/Riley/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Application-generated-files.hmap -Xcc -I/Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Application-own-target-headers.hmap -Xcc -I/Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Application-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Application-project-headers.hmap -Xcc -I/Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/DerivedSources/x86_64 -Xcc -I/Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/Riley/Desktop/Swift Crash -emit-module-doc-path /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Objects-normal/x86_64/main~partial.swiftdoc -Onone -module-name Application -emit-module-path /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Objects-normal/x86_64/main~partial.swiftmodule -serialize-diagnostics-path /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Objects-normal/x86_64/main.dia -emit-dependencies-path /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Objects-normal/x86_64/main.d -emit-reference-dependencies-path /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Objects-normal/x86_64/main.swiftdeps -o /Users/Riley/Library/Developer/Xcode/DerivedData/Swift_Crash-dzowphkavrxgbngnkojnhvsofkar/Build/Intermediates/Swift Crash.build/Debug-iphonesimulator/Application.build/Objects-normal/x86_64/main.o 
1.  While type-checking expression at [/Users/Riley/Desktop/Swift Crash/Application/main.swift:29:1 - line:29:49] RangeText="testFunction { (result: GenericResult<Data>) in }"
2.  While resolving type GenericResult<Data> at [/Users/Riley/Desktop/Swift Crash/Application/main.swift:29:25 - line:29:43] RangeText="GenericResult<Data>"

I've attached a very simple Xcode project to show this issue.

@belkadan
Copy link
Contributor

cc @lattner

@slavapestov
Copy link
Member

I suspect this is one of the classic "validate vs type check" problems that you enjoy fixing so much, @belkadan :-)

@slavapestov
Copy link
Member

This was fixed a while ago:

commit c06fd1a
Author: Slava Pestov <spestov@apple.com>
Date: Thu Jun 23 17:54:17 2016 -0700

Serialization: When deserializing a typealias, build its generic signature

We were forgetting to do this, triggering crashes when using a
generic typealias from another module.

Fixes <https://bugs.swift.org/browse/SR-1889\>.

@belkadan
Copy link
Contributor

I'm not sure about that. There are plenty of generic typealias issues that people have filed based on beta 2 and beta 3.

@slavapestov
Copy link
Member

This specific segfault is fixed, though, in beta 3. Do you have pointers to the other issues that were filed?

@swift-ci
Copy link
Collaborator

Comment by Andy Ibanez (JIRA)

Sorry for butting in, but this specific bug is happening to me in Xcode 8, Beta 3.

@slavapestov
Copy link
Member

Andy, is this with multiple modules or multiple files in one module?

@slavapestov
Copy link
Member

Also I just noticed we still crash with -g. Sorry about that. I'll re-open this bug.

@swift-ci
Copy link
Collaborator

Comment by Andy Ibanez (JIRA)

It happens to me with multiple files in one module.

To be more specific, I'm building a Framework project, and I declared the generic typealias in one file, and attempted to use it in another file as a function parameter.

@swift-ci
Copy link
Collaborator

Comment by Andy Ibanez (JIRA)

I'm the one who opened the duplicate issue that just got closed (SR-2169). I don't know how these two bugs related to each other, but I provided a small sample project on mine that reproduces the issue. Hope that helps.

@slavapestov
Copy link
Member

I have a fix, going to push it now.

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 5, 2016

Comment by Andy Ibanez (JIRA)

Slava, unfortunately, I seem to still have this problem in the version of Swift included in Xcode 8, Beta 4.

I will be happy to submit my entire project if needed and point it what generic typealiases are having the issue.

In the meantime, the following is the stack trace. I'm not entirely sure of how helpful it is though:

0  swift                    0x0000000105979e3d PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x0000000105979886 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fff97ff952a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1744857840
4  swift                    0x000000010321c17d swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2301
5  swift                    0x000000010321c14c swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2252
6  swift                    0x000000010321c79a swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 3866
7  swift                    0x000000010321bc72 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1010
8  swift                    0x000000010321bdc2 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1346
9  swift                    0x000000010321c168 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2280
10 swift                    0x000000010321c79a swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 3866
11 swift                    0x000000010321bc72 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1010
12 swift                    0x000000010321cf66 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 5862
13 swift                    0x000000010321bdd7 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1367
14 swift                    0x0000000103219608 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 38216
15 swift                    0x0000000103224637 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
16 swift                    0x0000000103635d1a swift::NominalTypeDecl::lookupDirect(swift::DeclName, bool) + 138
17 swift                    0x000000010321a681 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 42433
18 swift                    0x000000010321ba40 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 448
19 swift                    0x000000010321c14c swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2252
20 swift                    0x000000010321bc72 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1010
21 swift                    0x000000010321bdc2 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1346
22 swift                    0x000000010321bdd7 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1367
23 swift                    0x0000000103219608 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 38216
24 swift                    0x0000000103224637 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
25 swift                    0x0000000103635d1a swift::NominalTypeDecl::lookupDirect(swift::DeclName, bool) + 138
26 swift                    0x000000010321a681 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 42433
27 swift                    0x000000010321bb75 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 757
28 swift                    0x0000000103213e6a swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 15786
29 swift                    0x000000010323fd5f swift::ModuleFile::getTopLevelDecls(llvm::SmallVectorImpl<swift::Decl*>&) + 2287
30 swift                    0x0000000102f78330 swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1344
31 swift                    0x0000000102f7d0df swift::runSILDiagnosticPasses(swift::SILModule&) + 159
32 swift                    0x0000000102c4e3d7 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 19079
33 swift                    0x0000000102c47679 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 18137
34 swift                    0x0000000102c044a0 main + 10240
35 libdyld.dylib            0x00007fff947025ad start + 1
36 libdyld.dylib            0x000000000000004d start + 1804589729
Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/APIHTTPError~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/APIType~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/LocalSettings~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Anilist~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Notification~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Anilist+API+UserEndpoint~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/SmallStaff~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/APIStatusMessage~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/SmallAnime~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Anilist+String~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Anilist+Authentication~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Anilist+Array~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/User~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/SmallUser~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Activity~partial.swiftmodule /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Functions~partial.swiftmodule -parse-as-library -target x86_64-apple-ios10.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -I /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Products/Debug-iphonesimulator -F /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Products/Debug-iphonesimulator -enable-testing -g -import-underlying-module -module-cache-path /Users/andyibanez/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/ALCKit-generated-files.hmap -Xcc -I/Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/ALCKit-own-target-headers.hmap -Xcc -I/Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/ALCKit-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/ALCKit-project-headers.hmap -Xcc -I/Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/DerivedSources/x86_64 -Xcc -I/Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/andyibanez/Documents/Frameworks/ALCKit -emit-module-doc-path /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/ALCKit.swiftdoc -module-name ALCKit -emit-objc-header-path /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/ALCKit-Swift.h -o /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/ALCKit.swiftmodule 
1.  While reading from /Users/andyibanez/Library/Developer/Xcode/DerivedData/ALCKit-erpdzwdzpcumybbohuttrsvlnsux/Build/Intermediates/ALCKit.build/Debug-iphonesimulator/ALCKit.build/Objects-normal/x86_64/Anilist+API+UserEndpoint~partial.swiftmodule
2.  While deserializing decl #&#8203;49 (EXTENSION_DECL)
3.  While deserializing decl #&#8203;101 (XREF)
4.  Cross-reference to module 'ALCKit'
    ... Anilist
    ... API
    ... UserEndpoint
5.  While loading members for declaration 0x7faeca414e60 at <invalid loc>
6.  While deserializing 'user' (FuncDecl #&#8203;119) 
7.  While deserializing 'APIResponseHandler' (TypeAliasDecl #&#8203;215) 
8.  Cross-reference to module 'ALCKit'
    ... Anilist
    ... API
    ... APIResponseHandler
9.  While loading members for declaration 0x7faeca414f20 at <invalid loc>
10. While deserializing 'performAPITaskGET' (FuncDecl #&#8203;123) 

To add a little bit of context my generic typealias is something like this:

Anilist.swift

public class Anilist {
    public class API {
        public typealias APIResponseHandler<T: APIType> = (item: T?, error: Anilist.API.APIError?) -> Void
    }
}

Anilist+API+UserEndpoint.swift

public extension Anilist.API.UserEndpoint {
    final public func activity(messagesFor id: Int, completionHandler completion: Anilist.API.APIResponseHandler<Activity>) {
        // Code here
    }
}

@slavapestov
Copy link
Member

Hi Andy, sorry but the fix did not make it into beta 4. It will appear in a later Xcode 8 beta, though.

If you want, you can try a recent development snapshot.

@swift-ci
Copy link
Collaborator

Comment by Andy Ibanez (JIRA)

Heya, sorry for bothering you again with this.

I had reported the bug on bugreporter.apple.com as well and I received a notice telling me to see if the bug was fixed on Xcode 8, Beta 6.

I'm not sure if the fix made it to that version, but the bug is still happening to me.

I will happily provide my whole project if you guys need it to debug this.

@slavapestov
Copy link
Member

I can't reproduce this.

What does 'xcrun swiftc -version' report?

$ xcrun swiftc -version
Apple Swift version 3.0 (swiftlang-800.0.43.6 clang-800.0.38)
Target: x86_64-apple-macosx10.9

If you don't mind, can you attach your project to the radar?

@swift-ci
Copy link
Collaborator

Comment by Andy Ibanez (JIRA)

Apple Swift version 3.0 (swiftlang-800.0.43.6 clang-800.0.38)
Target: x86_64-apple-macosx10.9

I will go ahead and attach my project to the radar (27537050)

@swift-ci
Copy link
Collaborator

Comment by Andy Ibanez (JIRA)

Alright, the project has been attached to the radar ID. Please let me know if you need anything else.

@slavapestov
Copy link
Member

Thanks Andy. I was able to reproduce the crash. It does look like a new issue that was uncovered when the others were fixed. I'll have a fix shortly.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

5 participants