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-9001] Code completion assertion failure: (genericParams && "bindExtensionDecl didn't set generic params?"), function validateExtension, file swift/lib/Sema/TypeCheckDecl.cpp #51504

Closed
nathawes opened this issue Oct 15, 2018 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@nathawes
Copy link
Collaborator

Previous ID SR-9001
Radar rdar://problem/45275782
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 9996cd05a38adb1cbadee48515149384

Issue Description:

To reproduce:

$ git clone https://github.com/bignerdranch/Deferred.git
$ cd Deferred
$ git checkout -f c374a6e7072ed88ed0c79299098ca2ba7c27e720
$ open Deferred.xcodeproj

Then in Xcode: # Select the October 3 swift.org dev snapshot toolchain

  1. Navigate to Atomics.swift

  2. On line 32, add a space after “func symbol” (before "<T>") and invoke code completion

Trace:

Thread 4 Crashed:
0   libsystem_kernel.dylib        0x00007fff7443bb86 __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fff744f1c50 pthread_kill + 285
2   libsystem_c.dylib             0x00007fff743a5268 __abort + 144
3   libsystem_c.dylib             0x00007fff743a51d8 abort + 142
4   libsystem_c.dylib             0x00007fff7436d868 __assert_rtn + 320
5   com.apple.SourceKitService.4.2.2018100301_osx0x0000000105dc4026 swift::TypeChecker::validateExtension(swift::ExtensionDecl*) + 1558
6   com.apple.SourceKitService.4.2.2018100301_osx0x0000000105e588d7 swift::typeCheckCompletionDecl(swift::Decl*) + 1191
7   com.apple.SourceKitService.4.2.2018100301_osx0x0000000105605aac (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 2700
8   com.apple.SourceKitService.4.2.2018100301_osx0x0000000105f7309b swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 395
9   com.apple.SourceKitService.4.2.2018100301_osx0x00000001055f5d09 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 841
10  com.apple.SourceKitService.4.2.2018100301_osx0x00000001055f5238 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 616
11  com.apple.SourceKitService.4.2.2018100301_osx0x000000010546389f swiftCodeCompleteImpl(SourceKit::SwiftLangSupport&, llvm::MemoryBuffer*, unsigned int, (anonymous namespace)::SwiftCodeCompletionConsumer&, llvm::ArrayRef<char const*>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 2511
12  com.apple.SourceKitService.4.2.2018100301_osx0x0000000105462e63 SourceKit::SwiftLangSupport::codeComplete(llvm::MemoryBuffer*, unsigned int, SourceKit::CodeCompletionConsumer&, llvm::ArrayRef<char const*>) + 131
13  com.apple.SourceKitService.4.2.2018100301_osx0x00000001054bfc32 handleSemanticRequest(sourcekitd::RequestDict, std::__1::function<void (void*)>, sourcekitd_uid_s*, llvm::Optional<llvm::StringRef>, llvm::Optional<llvm::StringRef>, llvm::ArrayRef<char const*>) + 818
14  com.apple.SourceKitService.4.2.2018100301_osx0x00000001054bf87e void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_4>(void*) + 142
15  libdispatch.dylib             0x00007fff742aedcb _dispatch_client_callout + 8
16  libdispatch.dylib             0x00007fff742b1b68 _dispatch_block_invoke_direct + 260
17  com.apple.SourceKitService.4.2.2018100301_osx0x0000000107f6751f executeBlock(void*) + 15
18  com.apple.SourceKitService.4.2.2018100301_osx0x00000001055825cd ExecuteOnThread_Dispatch(void*) + 13
19  libsystem_pthread.dylib       0x00007fff744ef33d _pthread_body + 126
20  libsystem_pthread.dylib       0x00007fff744f22a7 _pthread_start + 70
21  libsystem_pthread.dylib       0x00007fff744ee425 thread_start + 13 
@nathawes
Copy link
Collaborator Author

@swift-ci create

@rintaro
Copy link
Mannequin

rintaro mannequin commented Oct 16, 2018

$ cat test.swift
#if false
extension Optional {
#^COMPLETE^#
}
#endif
$ ../build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename test.swift 
found code completion token COMPLETE at offset 33
found code completion token COMPLETE at offset 33
Assertion failed: (genericParams && "bindExtensionDecl didn't set generic params?"), function validateExtension, file /Users/rintaro/Repositories/swift-oss/swift/lib/Sema/TypeCheckDecl.cpp, line 4978.
Stack dump:
0.  Program arguments: ../build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename test.swift 
0  swift-ide-test           0x00000001098a8268 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift-ide-test           0x00000001098a7238 llvm::sys::RunSignalHandlers() + 248
2  swift-ide-test           0x00000001098a8882 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff6e3ceb3d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000003e58 _sigtramp + 2445497144
5  libsystem_c.dylib        0x00007fff6e28d1c9 abort + 127
6  libsystem_c.dylib        0x00007fff6e255868 basename_r + 0
7  swift-ide-test           0x0000000106440b76 swift::TypeChecker::validateExtension(swift::ExtensionDecl*) + 1558
8  swift-ide-test           0x00000001064d30f4 swift::typeCheckCompletionDecl(swift::Decl*) + 100
9  swift-ide-test           0x0000000105c6e30b (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 2715
10 swift-ide-test           0x0000000106668cab swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 395
11 swift-ide-test           0x0000000105c5b139 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 841
12 swift-ide-test           0x0000000105c5a668 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 616
13 swift-ide-test           0x0000000105bdd4bb main + 24795
14 libdyld.dylib            0x00007fff6e1e50a5 start + 1
Abort trap: 6

@slavapestov
Copy link
Member

Rintaro fixed this: #20015

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software compiler The Swift compiler in itself labels Dec 12, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
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. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

3 participants