Skip to content

Improve the data formatter UX if an array is uninitialized. #9026

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

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

adrian-prantl
Copy link

Global variables in Swift are lazy initialized and often zeroed out before the first access. This can be confusing to users, so this patch modifies the array dataformatter to recognize a null array.

rdar://132736658

Global variables in Swift are lazy initialized and often zeroed out
before the first access. This can be confusing to users, so this patch
modifies the array dataformatter to recognize a null array.

rdar://132736658
@@ -23,7 +23,7 @@ func main() {
var tb = Test() as Array + []

print("second stop") //% self.expect('frame variable -d run -- t', substrs=['t = 0x', 'NSArray = {', 'NSObject = {'])
//% self.expect('frame variable -d run -- ta', substrs=['ta = {', '_buffer = {', '_storage =', 'rawValue = 0x'])
//% self.expect('frame variable -d run -- ta', substrs=['ta = <uninitialized>', '_buffer = {', '_storage =', 'rawValue = 0x'])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this test was basically showing that the formatter didn't work here before either.

@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit d83ae22 into swiftlang:swift/release/6.0 Jul 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants