[#1175] Empty Entity Parsing#1176
Merged
Merged
Conversation
Collaborator
Author
|
Test failure message: test/main.hs:316:13:
1) #1175 empty entity associateLines works
Actual list is not a permutation of expected list!
expected list contains: [LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "Foo" :|
[]} :| [Line {lineIndent = 4, tokens = "name" :| ["String"]},Line {lineIndent = 4, tokens = "age" :| ["I
nt"]}], lwcComments = []}, LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "EmptyEntity" :|
[]} :| [], lwcComments = []}, LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "Bar" :| []} :
| [Line {lineIndent = 4, tokens = "name" :| ["String"]}], lwcComments = []}, LinesWithComments {lwcLines
= Line {lineIndent = 0, tokens = "Baz" :| []} :| [Line {lineIndent = 4, tokens = "a" :| ["Int"]},Line {li
neIndent = 4, tokens = "b" :| ["String"]},Line {lineIndent = 4, tokens = "c" :| ["FooId"]}], lwcComments
= []}]
actual list contains: [LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "Foo" :|
[]} :| [Line {lineIndent = 4, tokens = "name" :| ["String"]},Line {lineIndent = 4, tokens = "age" :| ["I
nt"]}], lwcComments = []}, LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "EmptyEntity" :|
[]} :| [Line {lineIndent = 0, tokens = "Bar" :| []},Line {lineIndent = 4, tokens = "name" :| ["String"]}]
, lwcComments = []}, LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "Baz" :| []} :| [Line {
lineIndent = 4, tokens = "a" :| ["Int"]},Line {lineIndent = 4, tokens = "b" :| ["String"]},Line {lineInde
nt = 4, tokens = "c" :| ["FooId"]}], lwcComments = []}]
the missing elements are: [LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "EmptyEn
tity" :| []} :| [], lwcComments = []}, LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "Bar"
:| []} :| [Line {lineIndent = 4, tokens = "name" :| ["String"]}], lwcComments = []}]
the extra elements are: [LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "EmptyEn
tity" :| []} :| [Line {lineIndent = 0, tokens = "Bar" :| []},Line {lineIndent = 4, tokens = "name" :| ["S
tring"]}], lwcComments = []}]Or, with formatting, expected =
[ LinesWithComments
{lwcLines = Line {lineIndent = 0, tokens = "Foo" :|
[]} :| [Line {lineIndent = 4, tokens = "name" :| ["String"]},Line {lineIndent = 4, tokens = "age" :| ["I
nt"]}], lwcComments = []}, LinesWithComments {lwcLines = Line {lineIndent = 0, tokens = "EmptyEntity" :|
[]} :| [], lwcComments = []}
, LinesWithComments
{lwcLines = Line {lineIndent = 0, tokens = "Bar" :| []} : | [Line {lineIndent = 4, tokens = "name" :| ["String"]}], lwcComments = []}
, LinesWithComments
{ lwcLines =
Line {lineIndent = 0, tokens = "Baz" :| []} :|
[ Line
{ lineIndent = 4
, tokens = "a" :| ["Int"]
}
, Line
{ lineIndent = 4
, tokens = "b" :| ["String"]
}
, Line {lineIndent = 4, tokens = "c" :| ["FooId"]}]
, lwcComments = []
}
]
actual =
[ LinesWithComments
{ lwcLines =
Line { lineIndent = 0 , tokens = "Foo" :| [] } :|
[ Line { lineIndent = 4, tokens = "name" :| ["String"]}
, Line { lineIndent = 4, tokens = "age" :| ["Int"]}
]
, lwcComments = []
}
, LinesWithComments
{ lwcLines =
Line {lineIndent = 0, tokens = "EmptyEntity" :| []} :|
[ Line {lineIndent = 0, tokens = "Bar" :| []}
, Line {lineIndent = 4, tokens = "name" :| ["String"]}
]
, lwcComments = []
}
, LinesWithComments
{ lwcLines = Line {lineIndent = 0, tokens = "Baz" :| []} :|
[ Line { lineIndent = 4, tokens = "a" :| ["Int"]}
, Line {lineIndent = 4, tokens = "b" :| ["String"]}
, Line {lineIndent = 4, tokens = "c" :| ["FooId"]}
]
, lwcComments = []
}
]
missing =
[ LinesWithComments
{ lwcLines = Line {lineIndent = 0, tokens = "EmptyEntity" :| []} :| []
, lwcComments = []
}
, LinesWithComments
{ lwcLines = Line {lineIndent = 0, tokens = "Bar":| []} :| [Line {lineIndent = 4, tokens = "name" :| ["String"]}]
, lwcComments = []
}
]
extra =
[ LinesWithComments
{ lwcLines = Line {lineIndent = 0, tokens = "EmptyEntity" :| []} :|
[ Line {lineIndent = 0, tokens = "Bar" :| []}
, Line {lineIndent = 4, tokens = "name" :| ["String"]}
]
, lwcComments = []
}
]So, what's happening is that the parser is recognizing the syntax and combining |
Collaborator
Author
|
By using associateLines :: [Line' NonEmpty] -> [LinesWithComments]
associateLines lines =
foldr combine [] $
Debug.traceShowId $
foldr toLinesWithComments [] lines
whereSo the problem occurs in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting your PR, check that you've:
@sincedeclarations to the HaddockAfter submitting your PR:
(unreleased)on the ChangelogFixes #1175
Currently just a failing test. I should really get this fixed soon.