-
Notifications
You must be signed in to change notification settings - Fork 177
Fix MultiInfo parser + serialization bug #2265
Fix MultiInfo parser + serialization bug #2265
Conversation
FileInfo compression sorts the outputted entries alphabetically, but this test did not reflect that fact
Looking good. Could you please add the test from #2253 to show that your PR solves the issue? |
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.
LGTM, just minor syntax nits.
@@ -321,4 +321,17 @@ class InfoSpec extends FirrtlFlatSpec with FirrtlMatchers { | |||
for (line <- check) | |||
result should containLine(line) | |||
} | |||
|
|||
"Source Locators" should "not loose information when going through serialization + parsing" in { |
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.
"Source Locators" should "not loose information when going through serialization + parsing" in { | |
"Source Locators" should "not lose information when going through serialization + parsing" in { |
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.
my bad :(
src/main/scala/firrtl/Visitor.scala
Outdated
|
||
// Grab each File.format line:col token from the input string | ||
splitCompressedInfo.findAllIn(escaped).matchData.foreach { info => | ||
{ |
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.
Unnecessary curly braces here
src/main/scala/firrtl/Visitor.scala
Outdated
// If there were no subgroups, the regex matched against a non-conforming source locator | ||
// pattern, so do not process it | ||
case None => out = out :+ ir.FileInfo.fromEscaped(info.toString) | ||
case Some(file) => { |
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.
case Some(file) => { | |
case Some(file) => |
Again, unnecessary curly braces.
src/main/scala/firrtl/Visitor.scala
Outdated
val lineDescriptors = info.group(2) | ||
// Grab each line:col values from the separated (compressed) FileInfo. | ||
splitLineDescriptors.findAllIn(lineDescriptors).matchData.foreach { lineDescriptor => | ||
{ |
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.
Again :)
This PR addresses the issue highlighted in #2253: in particular, the firrtl parser can now reconstruct a
MultiInfo
structure that was previously serialized and compressed by the algorithm in #2212. This only results in a single levelMultiInfo
due to the flattening step of serialization, so it can not recreate aMultiInfo
ofMultiInfo
s or any such recursive source locator object.Contributor Checklist
Type of Improvement
bug fix
API Impact
No change
Backend Code Generation Impact
Should have no impact.
Desired Merge Strategy
Squash and merge
Release Notes
Firrtl parser can now handle parsing a serialized, compressed source locator and return a
MultiInfo
object consisting ofFileInfo
s.Reviewer Checklist (only modified by reviewer)
Please Merge
?