swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.51k stars 10.35k forks source link

[SR-4737] Assertion failed: (!constraint.source->isDerivedRequirement() && "Must not be derived"), function checkSameTypeConstraints #47314

Closed dabrahams closed 7 years ago

dabrahams commented 7 years ago
Previous ID SR-4737
Radar rdar://problem/31905232
Original Reporter @dabrahams
Type Bug
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, CompilerCrash, TypeChecker | |Assignee | None | |Priority | Medium | md5: 56b05ec34d3fcaaf16d57c22b0ead02e

Issue Description:

Against 8ecc3e31cf7 from github/master, build the attached for this assertion

Assertion failed: (!constraint.source->isDerivedRequirement() && "Must not be derived"), function checkSameTypeConstraints, file /Users/Shared/dabrahams/s/swift/lib/AST/GenericSignatureBuilder.cpp, line 4584.
0  swift                    0x00000001124f5ab8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001124f6166 SignalHandler(int) + 454
2  libsystem_platform.dylib 0x00007fffc8943b3a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000400000000 _sigtramp + 929809632
4  libsystem_c.dylib        0x00007fffc87c8420 abort + 129
5  libsystem_c.dylib        0x00007fffc878f893 basename_r + 0
6  swift                    0x000000011016f667 swift::GenericSignatureBuilder::checkSameTypeConstraints(llvm::ArrayRef<swift::GenericTypeParamType*>, swift::GenericSignatureBuilder::PotentialArchetype*) + 4663
7  swift                    0x000000011016b274 swift::GenericSignatureBuilder::finalize(swift::SourceLoc, llvm::ArrayRef<swift::GenericTypeParamType*>, bool) + 1124
8  swift                    0x0000000110024018 swift::TypeChecker::checkGenericEnvironment(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, bool, llvm::function_ref<void (swift::GenericSignatureBuilder&)>) + 664
9  swift                    0x0000000110024442 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 162
10 swift                    0x000000010fff86c9 swift::TypeChecker::validateDecl(swift::ValueDecl*) + 1801
11 swift                    0x000000010ffa0312 swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 594
12 swift                    0x000000010ffa03cb swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 779
13 swift                    0x000000010ffa03cb swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 779
14 swift                    0x000000010fff2352 swift::TypeChecker::validateDeclForNameLookup(swift::ValueDecl*) + 482
15 swift                    0x0000000110070182 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)>*) + 98
16 swift                    0x000000011006fd87 resolveTopLevelIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, swift::ComponentIdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 1719
17 swift                    0x000000011006a67f resolveIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, llvm::ArrayRef<swift::ComponentIdentTypeRepr*>, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 495
18 swift                    0x000000011006a142 swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 146
19 swift                    0x000000011006b0a3 (anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>) + 195
20 swift                    0x000000011006afad swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 173
21 swift                    0x00000001100699c3 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 355
22 swift                    0x0000000110076a56 bindExtensionDecl(swift::ExtensionDecl*, swift::TypeChecker&) + 102
23 swift                    0x000000011007badb void llvm::function_ref<void (std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>::callback_fn<swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int)::$_2>(long, std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>) + 123
24 swift                    0x00000001100a108b bool llvm::function_ref<bool (std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>::callback_fn<swift::FileUnit::forAllVisibleModules(llvm::function_ref<void (std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>)::'lambda'(std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>(long, std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>) + 59
25 swift                    0x000000011018d19f swift::ModuleDecl::forAllVisibleModules(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, bool, llvm::function_ref<bool (std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>) + 527
26 swift                    0x000000011018d323 swift::FileUnit::forAllVisibleModules(llvm::function_ref<bool (std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>) + 83
27 swift                    0x0000000110078081 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1457
28 swift                    0x000000010fbe6090 swift::CompilerInstance::performSema() + 3616
29 swift                    0x000000010f151d77 performCompile(std::__1::unique_ptr<swift::CompilerInstance, std::__1::default_delete<swift::CompilerInstance> >&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 2279
30 swift                    0x000000010f1503c4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3204
31 swift                    0x000000010f10cbb0 main + 3312
32 libdyld.dylib            0x00007fffc8734235 start + 1
Stack dump:
0.  Program arguments: /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file /Users/Shared/dabrahams/s/swift/test/Prototypes/UnicodeDecoders.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../Developer/Library/Frameworks -g -module-cache-path /var/folders/8v/9769m3ps7ds7h9pg23lzcls00000gn/T/swift-testsuite-clang-module-cacheaJ2T3N -swift-version 4 -emit-module-doc-path /var/folders/8v/9769m3ps7ds7h9pg23lzcls00000gn/T/lit_tmp_kdvr1v/UnicodeDecoders-dcba22.swiftdoc -Onone -module-name UnicodeDecoders -emit-module-path /var/folders/8v/9769m3ps7ds7h9pg23lzcls00000gn/T/lit_tmp_kdvr1v/UnicodeDecoders-dcba22.swiftmodule -o /var/folders/8v/9769m3ps7ds7h9pg23lzcls00000gn/T/lit_tmp_kdvr1v/UnicodeDecoders-dcba22.o 
1.  While resolving type _UTF8Decoder at [/Users/Shared/dabrahams/s/swift/test/Prototypes/UnicodeDecoders.swift:579:11 - line:579:11] RangeText="_"
2.  While validating '_UTFDecoder' at /Users/Shared/dabrahams/s/swift/test/Prototypes/UnicodeDecoders.swift:524:8
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)

Other hashes

clang                              e6d55005e6 Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
cmark                              d875488 Merge pull request #&#8203;4 from llvm-beanz/generate-cmark-exports
compiler-rt                        3acb58590 Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
llbuild                            7853943 Merge pull request #&#8203;143 from neonichu/better-diagnostics-for-dependency-cycles
lldb                               6deeb29d5 Merge branch 'swift-4.0-branch' into stable
llvm                               8758fc3e9cc Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
Traceback (most recent call last):
dabrahams commented 7 years ago

@swift-ci create

DougGregor commented 7 years ago

Fixed by https://github.com/apple/swift/commit/35776422beb17c501f58c0b59ae405a38873458c