Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12724] LLDB can falsely report that a variable holds nil #4469

Open
swift-ci opened this issue May 3, 2020 · 2 comments
Open

[SR-12724] LLDB can falsely report that a variable holds nil #4469

swift-ci opened this issue May 3, 2020 · 2 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@swift-ci
Copy link

swift-ci commented May 3, 2020

Previous ID SR-12724
Radar rdar://problem/62895094
Original Reporter ThatsJustCheesy (JIRA User)
Type Bug

Attachment: Download

Environment

Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
Target: x86_64-apple-darwin19.4.0

macOS 10.15.4 (19E287)

Additional Detail from JIRA
Votes 4
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: c4a66f09eae9eed18c3196bcb495e01b

Issue Description:

Given the following program:

import AppKit

let panel = NSOpenPanel()
panel.canChooseDirectories = true
guard panel.runModal() == .OK else {
    fatalError()
}
let url = panel.url
// breakpoint #​1: v url
print(String(describing: url))

if let nonOptionalURL: URL = url {
    // breakpoint #​2: v nonOptionalURL
    print(nonOptionalURL)
    
    let optionalURL: URL? = url
    // breakpoint #​3: v optionalURL
    print(String(describing: optionalURL))
}

At breakpoint #1, lldb's frame variable reports that url is nil, even when it is not.

At breakpoint #2, frame variable reports that nonOptionalURL is {}, whatever that even means.

At breakpoint #3, frame variable cannot find optionalURL at all; however, from my testing the problem also remains when using nonOptionalURL as an argument to a function taking a URL?.

Please consult the attached output for specifics.

@beccadax
Copy link

beccadax commented May 5, 2020

@swift-ci create

@phoney
Copy link
Mannequin

phoney mannequin commented May 20, 2020

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

2 participants