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-11016] 'try' code completion error #53406

Open
swift-ci opened this issue Jun 25, 2019 · 2 comments
Open

[SR-11016] 'try' code completion error #53406

swift-ci opened this issue Jun 25, 2019 · 2 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

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11016
Radar None
Original Reporter Nevwild (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode Version 10.2.1 (10E1001)

MacOS Version 10.14.4 (18E226)

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

md5: fae355600a275421afb70d2b23cca5d0

Issue Description:

Bug description

With the following delegate declaration:

If I were to call the delegate's function somewhere else without the try prefix I would get the following compiler error:

When I select the "use try" option, it interpolates it in-between the delegate and the function, resulting in the following string.

What we really want is for it to put the try before the delegate call:

Help Me Get Started

This is my first bug report and I would like to solve it as my first contribution. I got set up at try! Swift San Jose, so I'm ready to dive into the code, solve it, and make a PR.

My question for anyone reading this. Where in the language would you recommend I start looking for this? If I had a general direction I would dive into it and see if I can get this fixed!

@hartbit
Copy link
Collaborator

hartbit commented Jun 26, 2019

This blog post entry delves through figuring out how to improve a diagnostic: https://matt.diephouse.com/swift/1/. It should help you figure out where the offending code might be.

@belkadan
Copy link
Contributor

Welcome! David's right that Matt's blog post is a good way to find the problematic code. We call these suggested fixes "fix-its", and so you'll see some part of the compiler that's trying to insert "try" (or possibly "try "). From there, you can figure out where it's trying to insert it, and see why that's not doing the right thing. (I'd expect it to be using the getStartLoc() of the expression.)

Feel free to ask here, on the forums (https://forums.swift.org) in the "Development / Compiler" section, or on a WIP PR on GitHub if you have questions!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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
Projects
None yet
Development

No branches or pull requests

3 participants