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-9090] Unhelpful diagnostic with inout-to-pointer to a nested optional pointer #51587

Closed
hamishknight opened this issue Oct 26, 2018 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-9090
Radar rdar://problem/45643586
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 4.2-dev (LLVM 80f624ef0e, Clang fb15cea7bb, Swift e7700f9497)
Target: x86_64-apple-darwin17.7.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug, TypeChecker
Assignee slazarus (JIRA)
Priority Medium

md5: c52e7a004d6f037077f05c07b1f506d8

Issue Description:

func foo(_ x: UnsafeMutableRawPointer??) {}

var x = 0
foo(&x) // error: '&' can only appear immediately in a call argument list

I would either expect the diagnostic "'&' used with non-inout argument of type 'UnsafeMutableRawPointer??'" or a custom diagnostic explaining that inout-to-pointer only works for non-optional or single-optional pointer types.

@belkadan
Copy link
Contributor

cc @xedin

@xedin
Copy link
Member

xedin commented Oct 29, 2018

@swift-ci create

@belkadan
Copy link
Contributor

slazarus (JIRA User), did you end up working on this one?

@LucianoPAlmeida
Copy link
Collaborator

Hey @hamishknight, I just tested this on Xcode 11.4 beta and this seems to be fixed

@hamishknight
Copy link
Collaborator Author

@LucianoPAlmeida Thanks for checking! I've opened a PR to commit a regression test for this #30493 as well as a follow-up bug SR-12382 for another unhelpful diagnostic around double optional pointer conversions.

@LucianoPAlmeida
Copy link
Collaborator

No problem! 👍

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants