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

Range of SynExprAndBang is wrong #12619

Closed
nojaf opened this issue Jan 18, 2022 · 0 comments · Fixed by #12680
Closed

Range of SynExprAndBang is wrong #12619

nojaf opened this issue Jan 18, 2022 · 0 comments · Fixed by #12680
Labels
Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.

Comments

@nojaf
Copy link
Contributor

nojaf commented Jan 18, 2022

The range of SynExprAndBang is wrong.

Repro steps

async {
    let! bar = getBar ()

    and! foo = getFoo ()

    return bar
}

Well, the source code has some TODO's which I'd like to address.

fsharp/src/fsharp/pars.fsy

Lines 3494 to 3509 in 7f7d848

moreBinders:
| AND_BANG headBindingPattern EQUALS typedSequentialExprBlock IN moreBinders %prec expr_let
{ let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 5) (* TODO Pretty sure this is wrong *)
let mEquals = rhs parseState 3
let m = rhs parseState 1 (* TODO Pretty sure this is wrong *)
SynExprAndBang(spBind, $1, true, $2, mEquals, $4, m) :: $6 }
| OAND_BANG headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders %prec expr_let
{ $5 "and!" (rhs parseState 1) // report unterminated error
let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 5) (* TODO Pretty sure this is wrong *)
let mEquals = rhs parseState 3
let m = rhs parseState 1 (* TODO Pretty sure this is wrong *)
SynExprAndBang(spBind, $1, true, $2, mEquals, $4, m) :: $7 }
| %prec prec_no_more_attr_bindings
{ [] }

Currently, the range only takes the and! keyword.

I would expect that it either:

  • starts from and! and ends after the typedSequentialExprBlock
  • starts from the headBindingPattern and ends after typedSequentialExprBlock

@dsyme what should the range be for the debugPoint and the SynExprAndBang node?
I'd like to pick this one up.

@nojaf nojaf added the Bug label Jan 18, 2022
@KevinRansom KevinRansom added the Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants