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
swift-ci opened this issue
Sep 26, 2019
· 1 comment
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfkey pathsFeature: key paths (both native and Objective-C)
macOS: Catalina beta 9, but I also had reports of these in mojave Xcode: 11 but I tried 10.3 and it failed as well Swift: only used bundled toolchains on given Xcode's, nothing fancy
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug, KeyPaths
Assignee
None
Priority
Medium
md5: f131fa5fa4bfd8b3a7a76bfb7bceaf57
Issue Description:
So I was debugging this issue my whole day and it's really weird as my current workaround doesn't make sense to me so please bear with me. Finally I was able to recreate a small code sample that breaks both the indexer and compiler❓.
Given the code below (either in another module/package or free floating in a file)
but you are not able to use it in a conditional statement as it will result in an infinite indexing and never-ending build process:
if let compilerCrash =CrashDefaults[\.key]{NSLog("it should just log it but it won't :( \(compilerCrash)")}
Workarounds
Don't use a global variable
E.g. when you specify your local `crashDefaults` variable you will be able to use it in the conditional statement:
letcrashDefaults=SwiftCrashDefaults(keys:SwiftCrashDefaultsKeys(key:.init(bar:"foo")))
if let compilerCrash =crashDefaults[\.key]{NSLog("it should just log it and it will! \(compilerCrash)")}
Add a label to your other subscript
So instead of having this:
public subscript<T: Base>(key:SwiftCrashDefaultsKey<T>)-> T.T{get{return1as!T.T}set{}}
Use this:
public subscript<T: Base>(key key:SwiftCrashDefaultsKey<T>)-> T.T{get{return1as!T.T}set{}}
and it will also build as expected.
The text was updated successfully, but these errors were encountered:
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfkey pathsFeature: key paths (both native and Objective-C)
Environment
macOS: Catalina beta 9, but I also had reports of these in mojave
Xcode: 11 but I tried 10.3 and it failed as well
Swift: only used bundled toolchains on given Xcode's, nothing fancy
Additional Detail from JIRA
md5: f131fa5fa4bfd8b3a7a76bfb7bceaf57
Issue Description:
So I was debugging this issue my whole day and it's really weird as my current workaround doesn't make sense to me so please bear with me. Finally I was able to recreate a small code sample that breaks both the indexer and compiler❓.
Given the code below (either in another module/package or free floating in a file)
you are able to use it and assign it:
but you are not able to use it in a conditional statement as it will result in an infinite indexing and never-ending build process:
Workarounds
Don't use a global variable
E.g. when you specify your local `crashDefaults` variable you will be able to use it in the conditional statement:
Add a label to your other subscript
So instead of having this:
Use this:
and it will also build as expected.
The text was updated successfully, but these errors were encountered: