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

Better error recovery for unfinished result expressions in pattern matching clauses. #17079

Closed
edgarfgp opened this issue Apr 23, 2024 · 5 comments

Comments

@edgarfgp
Copy link
Contributor

    let normalizeModuleOrNamespace(variant: StringVariant) =
        match variant with
        | Quoted identifier ->
            failwith "
        | Unquoted s -> s
        | TripleQuoted s -> s
        | BacktickQuoted identifier -> identifier
Screenshot 2024-04-23 at 12 13 59 Screenshot 2024-04-23 at 12 14 15 Screenshot 2024-04-23 at 12 14 33 Screenshot 2024-04-23 at 12 16 52

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

Ideally the compiler should be able to recover from this allowing the rest of the file to be analyzed.

@auduchinok
Copy link
Member

@edgarfgp Do you remember how you ended up with only one double quote? I expect that they are added and removed together by an IDE during typing.

Unfortunately, in this particular case it looks like expected behavior: F# strings are always multiline, so everything after an unfinished string is considered a part of it, and this was a design choice in the language itself.

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Apr 23, 2024

@edgarfgp Do you remember how you ended up with only one double quote? I expect that they are added and removed together by an IDE during typing.

@auduchinok . See this GIF
Apr-23-2024 14-24-32

@T-Gro
Copy link
Member

T-Gro commented Apr 29, 2024

In the video, this is how strings work - you get them already doubled by the IDE, and you are expected to type in between them to get good recovery.

I do not see how this particular case could be changed throughout lexing, since strings are a legit part of the language.

Do you have a particular idea in which direction to improve this without breaking strings?
Also, why did you delete the double quote instead of typing in-between them?

@T-Gro T-Gro closed this as completed Apr 29, 2024
@edgarfgp
Copy link
Contributor Author

In the video, this is how strings work - you get them already doubled by the IDE, and you are expected to type in between them to get good recovery.

I do not see how this particular case could be changed throughout lexing, since strings are a legit part of the language.

Do you have a particular idea in which direction to improve this without breaking strings? Also, why did you delete the double quote instead of typing in-between them?

@T-Gro I guess what I would expect is that when I delete a single pair of quotes it removes the other, leaving only the failwith ?

@T-Gro
Copy link
Member

T-Gro commented Apr 29, 2024

I am not sure if this would be the valid thing to do in all cases though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants