Skip to content

[SR-12428] Can't demangle Self #54867

Open
@krzyzanowskim

Description

@krzyzanowskim
Previous ID SR-12428
Radar rdar://problem/62200992
Original Reporter @krzyzanowskim
Type Bug
Environment

Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.4.0

Additional Detail from JIRA
Votes 1
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 2018afc6624a7ec84ffd38dc809a25d5

Issue Description:

This code crashes in runtime at the line where `Self` is used:

class Foo: NSObject {
  @objc let value: String = "test"
  
  func test() {
    let k1 = \Foo.value  // Ok
    let k2 = \Self.value // Fatal error: could not demangle keypath type from '��: file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/KeyPath.swift, line 2623
  }
}

Foo().test()

https://gist.github.com/krzyzanowskim/2f2dd423ab59ca7a05dfa98a24a730d7

Metadata

Metadata

Assignees

Labels

SILGenArea → compiler: The SIL generation stageSelf in classFeature → types: The 'Self' type in classesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)verifier

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions