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-14683] Assertion failure (Walker && "Not walking!") when converting function to async #57033

Closed
ahoppen opened this issue Jun 1, 2021 · 1 comment

Comments

@ahoppen
Copy link
Collaborator

@ahoppen ahoppen commented Jun 1, 2021

Previous ID SR-14683
Radar rdar://78781781
Original Reporter @ahoppen
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, FoundByStressTester
Assignee None
Priority Medium

md5: 6020c14519887f961931b45bec8d4ed8

Issue Description:

The following new test case hits an assertion.

struct MovieContextMenu {
  // RUN: %refactor --convert-to-async -dump-rewritten -source-filename %s -pos=%(line + 1):10
  func onAddToWishlist(isIn: Bool, dispatch: (RemoveFromWishlist) -> Void) {
    if true {
      dispatch(RemoveFromWishlist())
    } else {
      dispatch(RemoveFromWishlist())
    }
  }
}

struct RemoveFromWishlist {}

Stack trace:

Assertion failed: (Walker && "Not walking!"), function getWalker, file /Users/alex/swift-src/swift/include/swift/IDE/SourceEntityWalker.h, line 183.
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-refactor --convert-to-async -dump-rewritten -source-filename /Users/alex/swift-src/swift/test/refactoring/test.swift -pos=3:10
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-refactor           0x000000010f6e5dc7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-refactor           0x000000010f6e4be8 llvm::sys::RunSignalHandlers() + 248
2  swift-refactor           0x000000010f6e63f6 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff20365d7d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603339975729824
5  libsystem_c.dylib        0x00007fff20275411 abort + 120
6  libsystem_c.dylib        0x00007fff202747e8 err + 0
7  swift-refactor           0x000000010f739ca3 std::__1::__function::__func<(anonymous namespace)::asyncrefactorings::AsyncConverter::walkToExprPre(swift::Expr*)::'lambda1'(), std::__1::allocator<(anonymous namespace)::asyncrefactorings::AsyncConverter::walkToExprPre(swift::Expr*)::'lambda1'()>, void ()>::operator()() (.cold.1) + 35
8  swift-refactor           0x000000010ad910d7 std::__1::__function::__func<(anonymous namespace)::asyncrefactorings::AsyncConverter::walkToExprPre(swift::Expr*)::'lambda1'(), std::__1::allocator<(anonymous namespace)::asyncrefactorings::AsyncConverter::walkToExprPre(swift::Expr*)::'lambda1'()>, void ()>::operator()() + 471
9  swift-refactor           0x000000010ad8ddd6 (anonymous namespace)::asyncrefactorings::AsyncConverter::walkToExprPre(swift::Expr*) + 1334
10 swift-refactor           0x000000010adb2a18 (anonymous namespace)::SemaAnnotator::walkToExprPre(swift::Expr*) + 232
11 swift-refactor           0x000000010bc8d939 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) + 169
12 swift-refactor           0x000000010bc8e2df swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) + 2639
13 swift-refactor           0x000000010bc8d9ff swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) + 367
14 swift-refactor           0x000000010bc8ac47 swift::Stmt::walk(swift::ASTWalker&) + 87
15 swift-refactor           0x000000010adb21e6 swift::SourceEntityWalker::walk(swift::Stmt*) + 278
16 swift-refactor           0x000000010ad914be (anonymous namespace)::asyncrefactorings::AsyncConverter::convertNode(swift::ASTNode, swift::SourceLoc, bool) + 206
17 swift-refactor           0x000000010ad8cd72 (anonymous namespace)::asyncrefactorings::AsyncConverter::convert() + 130
18 swift-refactor           0x000000010ad7c7a8 (anonymous namespace)::RefactoringActionConvertToAsync::performChange() + 120
19 swift-refactor           0x000000010ad77130 swift::ide::refactorSwiftModule(swift::ModuleDecl*, swift::ide::RefactoringOptions, swift::ide::SourceEditConsumer&, swift::DiagnosticConsumer&) + 2672
20 swift-refactor           0x000000010ad0df81 main + 3649
21 libdyld.dylib            0x00007fff2033bf3d start + 1
/Users/alex/swift-src/nbuild/Release+Asserts/tools/swift/test-macosx-x86_64/refactoring/Output/test.swift.script: line 1: 35757 Abort trap: 6           /Users/alex/swift-src/nbuild/Release+Asserts/bin/swift-refactor --convert-to-async -dump-rewritten -source-filename /Users/alex/swift-src/swift/test/refactoring/test.swift -pos=3:10
@ahoppen
Copy link
Collaborator Author

@ahoppen ahoppen commented Jun 8, 2021

Fixed in #37715

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant