mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Merge pull request #574 from github/fix-invalid-slice
Fix invalid slices in split diffs of certain reformatted nodes
This commit is contained in:
commit
f1b4529ad1
@ -104,7 +104,7 @@ alignBranch getRange children ranges = case intersectingChildren of
|
||||
line $ alignBranch getRange (remaining ++ symmetricalChildren ++ nonIntersectingChildren) (modifyJoin (advanceBy (drop 1)) ranges)
|
||||
lineAndRemaining _ Nothing = (identity, [])
|
||||
lineAndRemaining children (Just ranges) = let (intersections, remaining) = alignChildren getRange children ranges in
|
||||
((:) $ (,) <$> ranges `applyToBoth` intersections, remaining)
|
||||
((:) $ (,) <$> ranges `applyToBoth` (sortBy (compare `on` getRange) <$> intersections), remaining)
|
||||
|
||||
-- | Given a list of aligned children, produce lists of their intersecting first lines, and a list of the remaining lines/nonintersecting first lines.
|
||||
alignChildren :: (term -> Range) -> [Join These (term)] -> Join These Range -> (Both [term], [Join These term])
|
||||
|
2
test/crashers/573.A.js
Normal file
2
test/crashers/573.A.js
Normal file
@ -0,0 +1,2 @@
|
||||
if (a &&
|
||||
b) {}
|
1
test/crashers/573.B.js
Normal file
1
test/crashers/573.B.js
Normal file
@ -0,0 +1 @@
|
||||
if (a && b) {}
|
Loading…
Reference in New Issue
Block a user