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-14498] [HAS REPRODUCER] Assertion failure when reusing ASTContext for typecontextinfo #56853

Closed
ahoppen opened this issue Apr 16, 2021 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Apr 16, 2021

Previous ID SR-14498
Radar rdar://problem/76751554
Original Reporter @ahoppen
Type Bug
Status Resolved
Resolution Cannot Reproduce
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug
Assignee @ahoppen
Priority Medium

md5: e944f1b09868f35f37c80650b2745983

Issue Description:

$ cat ~/Desktop/test.swift
public enum Endpoint {
    case popular

    func path() -> String {
        switch self {
        case .popular:
            return "movie/popular"
        }
    }
}
$ ./sourcekitd-test -req=typecontextinfo -offset=88  ~/Desktop/test.swift -- ~/Desktop/test.swift == -req=typecontextinfo -offset=133  ~/Desktop/test.swift -- ~/Desktop/test.swift
{
  key.request: source.request.configuration.global,
  key.optimize_for_ide: 1
}
{
  key.request: source.request.typecontextinfo,
  key.compilerargs: [
    "/Users/alex/Desktop/test.swift"
  ],
  key.offset: 88,
  key.sourcefile: "/Users/alex/Desktop/test.swift"
}
/Users/alex/Desktop/test.swift:6:14: error: extraneous '.' in enum 'case' declaration
        case .popular:
             ^
             
/Users/alex/Desktop/test.swift:6:9: error: 'case' label can only appear inside a 'switch' statement
        case .popular:
        ^
{
  key.results: [
  ]
}
{
  key.request: source.request.typecontextinfo,
  key.compilerargs: [
    "/Users/alex/Desktop/test.swift"
  ],
  key.offset: 133,
  key.sourcefile: "/Users/alex/Desktop/test.swift"
}
Assertion failed: (is<T>() && "Invalid accessor called"), function get, file /Users/alex/swift-src/llvm-project/llvm/include/llvm/ADT/PointerUnion.h, line 188.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  While performing cached completion if possible
1.  While performing cached completion in decl context:
    ---
    0x7fde25029200 Module name=test
      0x7fde250295b8 FileUnit file="/Users/alex/Desktop/test.swift"
        0x7fde25029a08 EnumDecl name=Endpoint
          0x7fde25029c50 AbstractFunctionDecl name=path() : (no type set)
    ---
2.  While evaluating request CodeCompletionSecondPassRequest(source_file "/Users/alex/Desktop/test.swift", )
3.  While evaluating request TypeCheckASTNodeAtLocRequest(0x7fde25029c50 AbstractFunctionDecl name=path() : (no type set), )
4.  While type-checking statement at [/Users/alex/Desktop/test.swift:7:13 - line:7:20] RangeText="return "
@ahoppen
Copy link
Contributor Author

ahoppen commented Apr 16, 2021

@swift-ci Create

@ahoppen
Copy link
Contributor Author

ahoppen commented Apr 20, 2021

I can’t reproduce this in main anymore. Seems to have been fixed in the meantime.

@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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant