MikePopoloski / slang

SystemVerilog compiler and language services
MIT License
558 stars 122 forks source link

Fix hierarchical paths inside generate arrays #1031

Closed povik closed 1 week ago

povik commented 1 week ago

Take some input with an unnamed generate array, e.g.

module top;
  genvar i;
  for (i = 0; i < 1; i = i + 1) begin
    logic a;
  end
endmodule

make a fix so that the hierpath of the wire is top.genblk1[0].a not top[0].a.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.70%. Comparing base (8637e2e) to head (f43ddd5). Report is 2 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031/graphs/tree.svg?width=650&height=150&src=pr&token=sS5JjK9091&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski)](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski) ```diff @@ Coverage Diff @@ ## master #1031 +/- ## ======================================= Coverage 94.70% 94.70% ======================================= Files 191 191 Lines 47569 47597 +28 ======================================= + Hits 45048 45078 +30 + Misses 2521 2519 -2 ``` | [Files](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski) | Coverage Δ | | |---|---|---| | [source/ast/Symbol.cpp](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031?src=pr&el=tree&filepath=source%2Fast%2FSymbol.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski#diff-c291cmNlL2FzdC9TeW1ib2wuY3Bw) | `96.10% <100.00%> (+0.10%)` | :arrow_up: | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski). Last update [8637e2e...f43ddd5](https://app.codecov.io/gh/MikePopoloski/slang/pull/1031?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Michael+Popoloski).
MikePopoloski commented 1 week ago

Thanks for the PR. Can you add a test that covers this logic so that it doesn't break in the future?

povik commented 1 week ago

@MikePopoloski take a look