You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 60785f87f86d26e9c114cf80687ec958
Issue Description:
In Swift 5.2 I am unable to set a default property value that contains a KeyPath. If the same code is written in the initializer it works fine. This code compiles fine on Swift 5.1.3 both MacOS and Linux.
``` swift
struct MyStruct1: I18nBindable {
**let** text: I18nString
**init**() {
**self**.text = **Self**.t(for: \*Self\*.text) // \<– works fine
}
}
struct MyStruct2: I18nBindable {
**let** text: I18nString = **Self**.t(for: \*Self\*.text) // \<– Error: "Key path cannot refer to static member 'text'" – (this worked in Swift 5.1.3, but fails in 5.2)
}
```
Full details in text.swift
Steps to reproduce:
Install Swift 5.2 (Xcode Version 11.4 (11E146)) on MacOS 10.15.4 (19E266)
swift test.swift
Expected result: compiles successfully
Received result:
test.swift:20:46:error:key path cannot refer to static member 'text'
let text: I18nString = Self.t(for: \Self.text) // \<– Error: "Key path cannot refer to static member 'text'" – (this worked in Swift 5.1.3, but fails in 5.2)
The text was updated successfully, but these errors were encountered:
Attachment: Download
Environment
swift --version
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
md5: 60785f87f86d26e9c114cf80687ec958
Issue Description:
In Swift 5.2 I am unable to set a default property value that contains a KeyPath. If the same code is written in the initializer it works fine. This code compiles fine on Swift 5.1.3 both MacOS and Linux.
``` swift
struct MyStruct1: I18nBindable {
}
struct MyStruct2: I18nBindable {
}
```
Full details in text.swift
Steps to reproduce:
Install Swift 5.2 (Xcode Version 11.4 (11E146)) on MacOS 10.15.4 (19E266)
swift test.swift
Expected result: compiles successfully
Received result:
test.swift:20:46: error: key path cannot refer to static member 'text'
The text was updated successfully, but these errors were encountered: