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-15171] Assertion failed: (getFromType()->is<TupleType>() && getToType()->is<TupleType>()) #57494

Closed
ahoppen opened this issue Sep 8, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Sep 8, 2021

Previous ID SR-15171
Radar None
Original Reporter @ahoppen
Type Bug
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, FoundByStressTester
Assignee None
Priority Medium

md5: dffb3326e0e0ce01d82ca924deb3ee41

Issue Description:

The following test case fails with an assertion failure:

// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token COMPLETE

struct UserListFormView {
    @ViewBuilder2 var body {
        GorEach(icons().map{ $0#^COMPLETE^# }) { icon in
            GStack {
             Jmage(icon)
            }.sag(icon)
        }
    }
}

protocol View {}
extension View {
  func sag<V>(_ tag: V) -> some View {}
}

enum Category: String {
    case housewares
}

func icons() -> [Category] {
    return  [.housewares]
}

struct GorEach<Data, Content> where Data : RandomAccessCollection {
  init(_ data: Data, @ViewBuilder2 content: @escaping (Data.Element) -> Content) {}
}

struct GStack<Content> : View where Content : View {
  init(@ViewBuilder2 content: () -> Content) {}
}


struct Jmage {
  init(_ name: String) {}
}

@resultBuilder public struct ViewBuilder2 {
  static func buildBlock<Content>(_ content: Content) -> Content where Content : View { fatalError() }
}

Backtrace

Assertion failed: (getFromType()->is<TupleType>() && getToType()->is<TupleType>()), function TupleContextualFailure, file CSDiagnostics.h, line 967.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /Users/alex/swift-src/nbuild/Release+Asserts/bin/swift-ide-test -module-cache-path /Users/alex/swift-src/nbuild/Release+Asserts/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache -completion-cache-path /Users/alex/swift-src/nbuild/Release+Asserts/swift-test-results/x86_64-apple-macosx10.9/completion-cache -swift-version 4 -resource-dir /Users/alex/swift-src/nbuild/Release+Asserts/lib/swift -code-completion -source-filename /Users/alex/swift-src/swift/test/SourceKit/ttt.swift -code-completion-token COMPLETE
1.  While performing new completion
2.  While evaluating request CodeCompletionSecondPassRequest(source_file "/Users/alex/swift-src/swift/test/SourceKit/ttt.swift", )
3.  While evaluating request TypeCheckASTNodeAtLocRequest(0x7fe20f828418 AbstractFunctionDecl name=_ : <<error type>>, )
4.  While evaluating request TypeCheckASTNodeAtLocRequest(0x7fe20f828418 AbstractFunctionDecl name=_ : <<error type>>, )
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           0x000000010935d787 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-ide-test           0x000000010935c648 llvm::sys::RunSignalHandlers() + 248
2  swift-ide-test           0x000000010935ddc6 SignalHandler(int) + 278
3  libsystem_platform.dylib 0x00007ff807dfd06d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603370448826288
5  libsystem_c.dylib        0x00007ff807d39d10 abort + 123
6  libsystem_c.dylib        0x00007ff807d390be err + 0
7  swift-ide-test           0x0000000109833173 swift::constraints::TupleContextualFailure::TupleContextualFailure(swift::constraints::Solution const&, swift::ContextualTypePurpose, swift::Type, swift::Type, llvm::ArrayRef<unsigned int>, swift::constraints::ConstraintLocator*) (.cold.7) + 35
8  swift-ide-test           0x00000001057fb72f swift::constraints::TupleContextualFailure::TupleContextualFailure(swift::constraints::Solution const&, swift::ContextualTypePurpose, swift::Type, swift::Type, llvm::ArrayRef<unsigned int>, swift::constraints::ConstraintLocator*) + 319
9  swift-ide-test           0x00000001057f1bcb swift::constraints::AllowTupleTypeMismatch::coalesceAndDiagnose(swift::constraints::Solution const&, llvm::ArrayRef<swift::constraints::ConstraintFix*>, bool) const + 523
10 swift-ide-test           0x00000001057424a6 swift::constraints::ConstraintSystem::applySolutionFixes(swift::constraints::Solution const&) + 2166
11 swift-ide-test           0x0000000105742d3b swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::constraints::SolutionApplicationTarget) + 75
12 swift-ide-test           0x000000010572db23 swift::TypeChecker::applyResultBuilderBodyTransform(swift::FuncDecl*, swift::Type) + 1523
13 swift-ide-test           0x00000001059d91fd swift::TypeCheckASTNodeAtLocRequest::evaluate(swift::Evaluator&, swift::DeclContext*, swift::SourceLoc) const + 237
14 swift-ide-test           0x0000000105a140d4 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckASTNodeAtLocRequest>(swift::TypeCheckASTNodeAtLocRequest const&) + 244
15 swift-ide-test           0x0000000105a0c854 swift::TypeCheckASTNodeAtLocRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckASTNodeAtLocRequest>(swift::Evaluator&, swift::TypeCheckASTNodeAtLocRequest, swift::TypeCheckASTNodeAtLocRequest::OutputType) + 52
16 swift-ide-test           0x0000000105a0c801 swift::typeCheckASTNodeAtLoc(swift::DeclContext*, swift::SourceLoc) + 65
17 swift-ide-test           0x00000001059d92e9 swift::TypeCheckASTNodeAtLocRequest::evaluate(swift::Evaluator&, swift::DeclContext*, swift::SourceLoc) const + 473
18 swift-ide-test           0x0000000105a140d4 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckASTNodeAtLocRequest>(swift::TypeCheckASTNodeAtLocRequest const&) + 244
19 swift-ide-test           0x0000000105a0c854 swift::TypeCheckASTNodeAtLocRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckASTNodeAtLocRequest>(swift::Evaluator&, swift::TypeCheckASTNodeAtLocRequest, swift::TypeCheckASTNodeAtLocRequest::OutputType) + 52
20 swift-ide-test           0x0000000105a0c801 swift::typeCheckASTNodeAtLoc(swift::DeclContext*, swift::SourceLoc) + 65
21 swift-ide-test           0x0000000104dc04b6 swift::ide::typeCheckContextAt(swift::DeclContext*, swift::SourceLoc) + 774
22 swift-ide-test           0x0000000104d9897e (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 1582
23 swift-ide-test           0x0000000105c8c811 swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 833
24 swift-ide-test           0x0000000105c8c3c4 swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 260
25 swift-ide-test           0x0000000105c96530 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 272
26 swift-ide-test           0x0000000105c8c1a4 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 52
27 swift-ide-test           0x0000000104dbe7c6 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)>) + 582
28 swift-ide-test           0x0000000104dbec3c 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)>) + 668
29 swift-ide-test           0x000000010499f192 doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool) + 1234
30 swift-ide-test           0x00000001049921ed main + 25453
31 dyld                     0x0000000114e384d5 start + 421
32 dyld                     000000000000000000 start + 18446744069064129744
33 swift-ide-test           0x0000000104987000 __dso_handle + 0
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@ahoppen
Copy link
Contributor Author

ahoppen commented Jan 4, 2023

We are no longer seeing this in the stress tester. Most likely fixed by #62734.

@ahoppen ahoppen closed this as completed Jan 4, 2023
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Jan 4, 2023
ahoppen added a commit to ahoppen/swift-source-compat-suite that referenced this issue Jan 4, 2023
- apple/swift#57494 and apple/swift#58317 have been fixed (most likely by apple/swift#62734)
- apple/swift#62840 is a new issue introduced by apple/swift#62768
- apple/swift#62848 is a new issue introduced by apple/swift#62734
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 found by stress tester Flag: An issue 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

2 participants