@@ -3747,24 +3747,43 @@ toIfReport source context if_ startRow startCol =
37473747 )
37483748
37493749 IfIndentElse row col ->
3750- let
3751- surroundings = A. Region ( A. Position startRow startCol) ( A. Position row col)
3752- region = toRegion row col
3753- in
3754- Report. Report " UNFINISHED IF " region [] $
3755- Code. toSnippet source surroundings ( Just region)
3756- (
3757- D. reflow $
3758- " I was expecting to see an `else` branch after this: "
3759- ,
3760- D. stack
3761- [ D. fillSep
3762- [ " I " , " know " , " what " , " to " , " do " , " when " , " the " , " condition " , " is " , " True, "
3763- , " but " ," what " , " happens " ," when " ," it " ," is " ," False? "
3764- ," Add " ," an " , D. cyan " else " ," branch " ," to " ," handle " , " that " , " scenario! "
3750+ case Code. nextLineStartsWithKeyword " else " source row of
3751+ Just (elseRow, elseCol) ->
3752+ let
3753+ surroundings = A. Region ( A. Position startRow startCol) ( A. Position elseRow elseCol)
3754+ region = toWiderRegion elseRow elseCol 4
3755+ in
3756+ Report. Report " WEIRD ELSE BRANCH " region [] $
3757+ Code. toSnippet source surroundings ( Just region)
3758+ (
3759+ D. reflow $
3760+ " I was partway through an `if` expression when I got stuck here: "
3761+ ,
3762+ D. fillSep $
3763+ [ " I " , " think " ," this " , D. cyan " else " ," keyword " ," needs " ," to " ," be " , " indented " , " more. "
3764+ ," Try " ," adding " , " some " ," spaces " ," before " ," it. "
37653765 ]
3766- ]
3767- )
3766+ )
3767+
3768+ Nothing ->
3769+ let
3770+ surroundings = A. Region (A. Position startRow startCol) (A. Position row col)
3771+ region = toRegion row col
3772+ in
3773+ Report. Report " UNFINISHED IF" region [] $
3774+ Code. toSnippet source surroundings (Just region)
3775+ (
3776+ D. reflow $
3777+ " I was expecting to see an `else` branch after this:"
3778+ ,
3779+ D. stack
3780+ [ D. fillSep
3781+ [" I" ," know" ," what" ," to" ," do" ," when" ," the" ," condition" ," is" ," True,"
3782+ ," but" ," what" ," happens" ," when" ," it" ," is" ," False?"
3783+ ," Add" ," an" ,D. cyan " else" ," branch" ," to" ," handle" ," that" ," scenario!"
3784+ ]
3785+ ]
3786+ )
37683787
37693788
37703789
0 commit comments