TheSnowFox
(The Snow Fox)
1
Hi,
First time on this forum and I'm no sure if this post is in the good category. I was working on my app for macOS, trying to debug a methods when I found this.
I have a Structure on my framework like this :
import Foundation
public struct MyStruct {
public var type: MyTypeEnum
public var item: MyItem
public enum MyTypeEnum {
case a
case b
case utility
}
public init(type: MyTypeEnum, itemType: MyItemTypeEnum, data: Data? = nil) {
self.type = type
self.item = MyItem(type: itemType, data: data)
}
public struct MyItem {
public var type: MyItemTypeEnum
public var data: Data?
}
public enum MyItemTypeEnum {
case itemA
case itemB
case utility
}
}
When I tried to use this struct in my app and pause at breakpoint I get this :
I don't understand why the debugger print myStruct > item > type : itemA (instead of utility)
Result prints "TestOK" so I get into the if....
When I tried the same code in main.swift, I got it right :
import Foundation
import TestFmwk
let myStruct = MyStruct(type: .utility, itemType: .utility)
if myStruct.item.type == MyStruct.MyItemTypeEnum.utility {
print("Test OK")
}
else {
print("Error")
}
That gave me headache for the last few days when trying to debug my app... ;(
If you have any idea....
Thanks
TheSnowFox
(The Snow Fox)
2
I couldn't post this in my first message (limit new user to 1 image)
jrose
(Jordan Rose)
3
Hm. Since the running code does appear to be doing the right thing, I'd say it's an LLDB bug. @Jim_Ingham, does this look familiar, or should TheSnowFox file a new bug?
Jim_Ingham
(Jim Ingham)
4
That does look like lldb's getting the value wrong. If you can make a project available that demonstrates the error, please file a bug at http://bugs.swift.org and we'll take a look.
moiseev
(Max Moiseev)
6