Skip to content

[SR-4888] Crash: Tuple KeyPaths #47465

@stephencelis

Description

@stephencelis
Previous ID SR-4888
Radar rdar://problem/34186458
Original Reporter @stephencelis
Type Bug
Status Reopened
Resolution
Environment

Swift Development Snapshot 2017-05-12 (a)
Xcode 8.3.2
macOS 10.12.5 Beta (16F71b)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @jckarter
Priority Medium

md5: e43e68b9511248f280cf77762db2a6d0

Issue Description:

Right now, tuple KeyPaths crash the compiler.

Assertion failed: (isDecl() && "Not a declaration"), function getDecl, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/Sema/OverloadChoice.h, line 251.
0  swift                    0x000000010efc8b18 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010efc7ae6 llvm::sys::RunSignalHandlers() + 86
2  swift                    0x000000010efc90d9 SignalHandler(int) + 361
3  libsystem_platform.dylib 0x00007fffb72cbb3a _sigtramp + 26
4  libsystem_platform.dylib 0x00007fff53e6fbb8 _sigtramp + 2629451928
5  libsystem_c.dylib        0x00007fffb7150420 abort + 129
6  libsystem_c.dylib        0x00007fffb7117893 basename_r + 0
7  swift                    0x000000010cba0f20 swift::constraints::ConstraintSystem::simplifyKeyPathConstraint(swift::Type, swift::Type, swift::Type, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 2064

Basic case:

struct User {
  let names: (first: String, last: String)

  func test() {
    _ = \User.names.0
    _ = \User.names.first
  }
}

Ideally the KeyPath works in a read-only fashion! Less ideally we get a compiler error.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions