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-14327] Conforming Method List: Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!") #56686

Closed
nathawes opened this issue Mar 11, 2021 · 2 comments
Assignees
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 found by stress tester Flag: Found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@nathawes
Copy link
Collaborator

Previous ID SR-14327
Radar rdar://problem/75299825
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, Crash, FoundByStressTester
Assignee @CodaFi
Priority Medium

md5: bc430b3c7756ac9fd78d7d8ab716e52d

Issue Description:

The completion-like conforming method list request hits an assertion when invoked after module references:

 Swift#^COMPLETE^#
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm-project/llvm/include/llvm/Support/Casting.h, line 269.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: ../build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift-ide-test --conforming-methods --conforming-methods-expected-types=s:SQ -source-filename /tmp/test.swift -code-completion-token=COMPLETE
1.  While performing new completion
2.  While evaluating request CodeCompletionSecondPassRequest(source_file "/tmp/test.swift", )
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-ide-test           0x0000000114f3a7ad llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 61
1  swift-ide-test           0x0000000114f3acdb PrintStackTraceSignalHandler(void*) + 27
2  swift-ide-test           0x0000000114f38b5b llvm::sys::RunSignalHandlers() + 123
3  swift-ide-test           0x0000000114f3c8fd SignalHandler(int) + 205
4  libsystem_platform.dylib 0x00007fff203a4d7d _sigtramp + 29
5  libdyld.dylib            0x00007fff2037a473 dyldGlobalLockRelease() + 0
6  libsystem_c.dylib        0x00007fff202b3720 abort + 120
7  libsystem_c.dylib        0x00007fff202b29d6 err + 0
8  swift-ide-test           0x00000001093614c2 llvm::cast_retty<swift::AnyFunctionType, swift::TypeBase*>::ret_type llvm::cast<swift::AnyFunctionType, swift::TypeBase>(swift::TypeBase*) + 98
9  swift-ide-test           0x0000000109378e3d swift::AnyFunctionType* swift::TypeBase::castTo<swift::AnyFunctionType>() + 29
10 swift-ide-test           0x0000000109f793c0 (anonymous namespace)::ConformingMethodListCallbacks::getMatchingMethods(swift::Type, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&, llvm::SmallVectorImpl<swift::ValueDecl*>&)::LocalConsumer::isMatchingMethod(swift::ValueDecl*) + 304
11 swift-ide-test           0x0000000109f79257 (anonymous namespace)::ConformingMethodListCallbacks::getMatchingMethods(swift::Type, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&, llvm::SmallVectorImpl<swift::ValueDecl*>&)::LocalConsumer::foundDecl(swift::ValueDecl*, swift::DeclVisibilityKind, swift::DynamicLookupInfo) + 39
12 swift-ide-test           0x000000010bb7d6ea (anonymous namespace)::OverrideFilteringConsumer::filterDecls(swift::VisibleDeclConsumer&) + 2634
13 swift-ide-test           0x000000010bb7c8af lookupVisibleMemberDecls(swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::GenericSignatureBuilder*) + 367
14 swift-ide-test           0x000000010bb7c673 swift::lookupVisibleMemberDecls(swift::VisibleDeclConsumer&, swift::Type, swift::DeclContext const*, bool, bool, bool, swift::GenericSignatureBuilder*) + 243
15 swift-ide-test           0x0000000109f78d49 (anonymous namespace)::ConformingMethodListCallbacks::getMatchingMethods(swift::Type, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&, llvm::SmallVectorImpl<swift::ValueDecl*>&) + 217
16 swift-ide-test           0x0000000109f7860e (anonymous namespace)::ConformingMethodListCallbacks::doneParsing() + 798
17 swift-ide-test           0x000000010c8e30c0 swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 1264
18 swift-ide-test           0x000000010c8e28b8 swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 376
19 swift-ide-test           0x000000010c91d679 bool swift::SimpleRequest<swift::CodeCompletionSecondPassRequest, bool (swift::SourceFile*, swift::CodeCompletionCallbacksFactory*), (swift::RequestFlags)9>::callDerived<0ul, 1ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>) const + 89
20 swift-ide-test           0x000000010c91d560 swift::SimpleRequest<swift::CodeCompletionSecondPassRequest, bool (swift::SourceFile*, swift::CodeCompletionCallbacksFactory*), (swift::RequestFlags)9>::evaluateRequest(swift::CodeCompletionSecondPassRequest const&, swift::Evaluator&) + 32
21 swift-ide-test           0x000000010c8fd13d llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 317
22 swift-ide-test           0x000000010c8fcf7b llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::operator()<swift::CodeCompletionSecondPassRequest, (void*)0>(swift::CodeCompletionSecondPassRequest const&) + 43
23 swift-ide-test           0x000000010c8e2639 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 57
24 swift-ide-test           0x000000010c8e25f0 swift::performCodeCompletionSecondPass(swift::SourceFile&, swift::CodeCompletionCallbacksFactory&) + 96
25 swift-ide-test           0x000000010912e61d doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool)::$_0::operator()(swift::CompilerInstance&, bool) const + 141
26 swift-ide-test           0x000000010912e57c void llvm::function_ref<void (swift::CompilerInstance&, bool)>::callback_fn<doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool)::$_0>(long, swift::CompilerInstance&, bool) + 76
27 swift-ide-test           0x0000000109f6c908 llvm::function_ref<void (swift::CompilerInstance&, bool)>::operator()(swift::CompilerInstance&, bool) const + 88
28 swift-ide-test           0x0000000109f6cbef swift::ide::CompletionInstance::performNewOperation(llvm::Optional<llvm::hash_code>, swift::CompilerInvocation&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 623
29 swift-ide-test           0x0000000109f6d60e swift::ide::CompletionInstance::performOperation(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 670
30 swift-ide-test           0x000000010912e2d2 doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool) + 1090
31 swift-ide-test           0x0000000109103b61 doConformingMethodList(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >) + 545
32 swift-ide-test           0x00000001090fed83 main + 8435
33 libdyld.dylib            0x00007fff2037b621 start + 1
34 libdyld.dylib            0x0000000000000006 start + 18446603339975641574
Abort trap: 6
 
@nathawes
Copy link
Collaborator Author

@swift-ci create

@CodaFi
Copy link
Member

CodaFi commented Mar 11, 2021

#36406

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Dec 13, 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 found by stress tester Flag: Found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

3 participants