-
Notifications
You must be signed in to change notification settings - Fork 804
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
Add AddMissingFunKeyword code fix #10646
Add AddMissingFunKeyword code fix #10646
Conversation
|
else | ||
loop (sourceText.GetSubText(TextSpan(pos - 1, 1)).ToString()) (pos - 1) | ||
|
||
loop (sourceText.GetSubText(TextSpan(context.Span.Start - 1, 1)).ToString()) context.Span.Start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that the construction of TextSpan would receive any invalid input? Such as, context.Span.Start - 1
, would that result ever be -1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at this point, no. You can of course write literally ->
as the first set of characters in a script file, but it won't trigger this error when that happens. The compiler thinks it's in the middle of a yield
expression to be precise, which is weird, but unrelated to this or any other code fixer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - it does trigger FS0010, but the span isn't actually ->
, so it never reaches here in the first place
This one was
fun
. Get it? har har har har har har har har har har har har harAnyways, this is what it looks like:
And:
The fact that the error that triggers this is a parse error makes it so that we have to use our nice friend,
Tokenizer.getSymbolAtPosition
. We may want to consider moving that into FCS proper, since it lets you resolve a "symbol" without needing to parse or typecheck something. Very nice when you want the range of that "symbol".