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

Mangling doesn't handle local archetypes #78690

Open
hamishknight opened this issue Jan 16, 2025 · 1 comment
Open

Mangling doesn't handle local archetypes #78690

hamishknight opened this issue Jan 16, 2025 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software generics Feature: generic declarations and types mangling Area → compiler: Mangling pack iteration Feature → statements → for-in: Pack iteration parameter packs Feature → generics: Parameter packs Swift 6.2-dev

Comments

@hamishknight
Copy link
Contributor

The following test case crashes SourceKit:

func foo<each T>(_ xs: repeat each T) {
  for x in repeat each xs {
    // RUN: %sourcekitd-test -req=cursor -pos=%(line-1):7 %s -- %s
  }
}
{
  key.request: source.request.cursorinfo,
  key.offset: 2767,
  key.sourcefile: "/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift",
  key.primary_file: "/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift",
  key.compilerargs: [
    "/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift"
  ]
}
Cannot mangle free-standing archetype: (element_archetype_type address=0x11ea0baa0 conforms_to="Swift.(file).Copyable" conforms_to="Swift.(file).Escapable" opened_element_id="7F7D30B0-D452-11EF-BBBD-4A10B34A40AC")
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      While evaluating request USRGenerationRequest(main.(file).foo(_:).x@/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift:168:7)
fish: Job 1, './sourcekitd-test -req=cursor -…' terminated by signal SIGABRT (Abort)
Swift version 6.2-dev (LLVM bb5a46203470a96, Swift 192bb334093ddfa)
Target: arm64-apple-darwin24.2.0
@hamishknight hamishknight added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software generics Feature: generic declarations and types SourceKit Area → source tooling: SourceKit labels Jan 16, 2025
@hamishknight hamishknight self-assigned this Jan 16, 2025
@hamishknight
Copy link
Contributor Author

This also affects regular compilation for cases like:

func foo<each T>(_ xs: repeat each T) {
  for x in repeat each xs {
    lazy var y = x
  }
}

@hamishknight hamishknight changed the title USR mangling doesn't handle local archetypes Mangling doesn't handle local archetypes Jan 17, 2025
@AnthonyLatsis AnthonyLatsis added mangling Area → compiler: Mangling parameter packs Feature → generics: Parameter packs pack iteration Feature → statements → for-in: Pack iteration Swift 6.2-dev compiler The Swift compiler itself and removed SourceKit Area → source tooling: SourceKit labels Jan 17, 2025
@hamishknight hamishknight removed their assignment Jan 17, 2025
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. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software generics Feature: generic declarations and types mangling Area → compiler: Mangling pack iteration Feature → statements → for-in: Pack iteration parameter packs Feature → generics: Parameter packs Swift 6.2-dev
Projects
None yet
Development

No branches or pull requests

2 participants