Merge pull request #1568 from antmicro/msrs/fix-comment-following-a-delay

Fix comment following a delay
diff --git a/.github/bin/smoke-test.sh b/.github/bin/smoke-test.sh
index c4f0f8a..1e96d74 100755
--- a/.github/bin/smoke-test.sh
+++ b/.github/bin/smoke-test.sh
@@ -105,7 +105,6 @@
 
 #--- ivtest
 KnownIssue[formatter:$BASE_TEST_DIR/ivtest/ivltests/pr2202846c.v]=1015
-KnownIssue[formatter:$BASE_TEST_DIR/ivtest/ivltests/packed_dims_invalid_class.v]=1146
 
 #--- nontrivial-mips
 KnownIssue[formatter:$BASE_TEST_DIR/nontrivial-mips/src/cpu/decode/decoder.sv]=984
@@ -134,8 +133,8 @@
 ExpectedFailCount[lint:ibex]=14
 ExpectedFailCount[project:ibex]=192
 
-ExpectedFailCount[syntax:opentitan]=36
-ExpectedFailCount[lint:opentitan]=36
+ExpectedFailCount[syntax:opentitan]=35
+ExpectedFailCount[lint:opentitan]=35
 ExpectedFailCount[project:opentitan]=727
 
 ExpectedFailCount[syntax:Cores-VeeR-EH2]=2
@@ -169,7 +168,7 @@
 ExpectedFailCount[formatter:ivtest]=2
 ExpectedFailCount[project:ivtest]=217
 
-ExpectedFailCount[project:ZAP]=30
+ExpectedFailCount[project:ZAP]=29
 
 ExpectedFailCount[syntax:nontrivial-mips]=2
 ExpectedFailCount[lint:nontrivial-mips]=2
@@ -186,9 +185,9 @@
 ExpectedFailCount[formatter:scr1]=2
 ExpectedFailCount[project:scr1]=45
 
-ExpectedFailCount[syntax:basejump_stl]=461
-ExpectedFailCount[lint:basejump_stl]=461
-ExpectedFailCount[project:basejump_stl]=567
+ExpectedFailCount[syntax:basejump_stl]=462
+ExpectedFailCount[lint:basejump_stl]=462
+ExpectedFailCount[project:basejump_stl]=569
 
 # Ideally, we expect all tools to process all files with a zero exit code.
 # However, that is not always the case, so we document the current
diff --git a/README.md b/README.md
index 0f0cb5b..7c08a24 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
 
 
 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
-[![Continuous Integration](https://github.com/chipsalliance/verible/workflows/verible-ci/badge.svg)](https://github.com/chipsalliance/verible/actions/workflows/verible-ci.yml)
+[![Continuous Integration](https://github.com/chipsalliance/verible/workflows/ci/badge.svg)](https://github.com/chipsalliance/verible/actions/workflows/verible-ci.yml)
 [![codecov](https://codecov.io/gh/chipsalliance/verible/branch/master/graph/badge.svg?token=5f656dpmDT)](https://codecov.io/gh/chipsalliance/verible)
 
 <!--*
diff --git a/WORKSPACE b/WORKSPACE
index f7939dd..8cea500 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -6,12 +6,25 @@
 # Bazel platform rules, needed as dependency to absl.
 http_archive(
     name = "platforms",
-    sha256 = "a879ea428c6d56ab0ec18224f976515948822451473a80d06c2e50af0bbe5121",
-    strip_prefix = "platforms-da5541f26b7de1dc8e04c075c99df5351742a4a2",
-    urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"],  # 2022-05-27
+    urls = [
+        "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
+        "https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
+    ],
+    sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
 )
 
 http_archive(
+    name = "bazel_skylib",
+    urls = [
+        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
+        "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
+    ],
+    sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
+)
+load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
+bazel_skylib_workspace()
+
+http_archive(
     name = "com_google_absl",
     # On MSVC's STL implementation, string_view cannot be constructed from
     # a string_view::iterator. This patch forces the use of absl's string_view
diff --git a/verilog/formatting/align.cc b/verilog/formatting/align.cc
index de82da2..c9294c0 100644
--- a/verilog/formatting/align.cc
+++ b/verilog/formatting/align.cc
@@ -733,6 +733,7 @@
         ReserveNewColumn(node, FlushLeft);
         break;
       }
+      case NodeEnum::kNetDeclarationAssignment:
       case NodeEnum::kNetVariable: {
         // at path [2,0] in kNetDeclaration
         // contains the declared id
@@ -823,6 +824,15 @@
     VLOG(2) << __FUNCTION__ << ", node: " << tag << " at "
             << TreePathFormatter(Path());
     switch (tag) {
+      case NodeEnum::kDeclarationDimensions: {
+        if (current_path_ == SyntaxTreePath{1, 0, 0, 3, 0}) {
+          SyntaxTreePath new_path{1, 0, 0, 3};
+          const ValueSaver<SyntaxTreePath> path_saver(&current_path_, new_path);
+          TreeContextPathVisitor::Visit(node);
+          return;
+        }
+        break;
+      }
       case NodeEnum::kDataDeclaration:
       case NodeEnum::kVariableDeclarationAssignment: {
         // Don't wait for the type node, just start the first column right away.
diff --git a/verilog/formatting/formatter_test.cc b/verilog/formatting/formatter_test.cc
index 84ee8a9..411e583 100644
--- a/verilog/formatting/formatter_test.cc
+++ b/verilog/formatting/formatter_test.cc
@@ -3411,6 +3411,20 @@
         "  );\n"
         "endmodule\n",
     },
+    {// Two consecutive EOL comments in kDPIImportItem
+     "import \"DPI-C\" context function void foo(\n"
+     "  input bit first,\n"
+     "  // c3\n"
+     "  // c3+\n"
+     "  input bit second\n"
+     ");\n",
+     "import \"DPI-C\" context\n"
+     "    function void foo(\n"
+     "  input bit first,\n"
+     "  // c3\n"
+     "  // c3+\n"
+     "  input bit second\n"
+     ");\n"},
     {"import \"DPI-C\" context function void func(input bit impl_i,"
      "input bit op_i,"
      "input bit [5:0] mode_i,"
@@ -8121,6 +8135,19 @@
      "  generic_type_name_t third  // c\n"
      ";\n"
      "} type_t;\n"},
+    {"struct {logic test1; // c\n"
+     "logic test2;} test3;\n",
+     "struct {\n"
+     "  logic test1;  // c\n"
+     "  logic test2;\n"
+     "} test3;\n"},
+    {"struct {\n"
+     "  /* t */ logic test1; /* t */\n"
+     "/* t */ logic test2; }test3;\n",
+     "struct {\n"
+     "  /* t */ logic test1;  /* t */\n"
+     "  /* t */ logic test2;\n"
+     "} test3;\n"},
     // Continuation comment alignment
     {"`define BAR 1 // A\n"
      "module foo(); // B\n"
@@ -15254,6 +15281,60 @@
      ";  // c1\n"
      "   // c2\n"
      "   // c3\n"},
+    {"module indent();\n"
+     "   reg     a;\n"
+     "   reg [32:0] b;\n"
+     "   wire    c;\n"
+     "   wire    d = e ? kFoo : kBar;\n"
+     "endmodule\n",
+     "module indent ();\n"
+     "  reg         a;\n"
+     "  reg  [32:0] b;\n"
+     "  wire        c;\n"
+     "  wire        d = e ? kFoo : kBar;\n"
+     "endmodule\n"},
+
+    {"class C; T1 b; logic [$] a; T1 [$] c; endclass\n",
+     "class C;\n"
+     "  T1        b;\n"
+     "  logic [$] a;\n"
+     "  T1    [$] c;\n"
+     "endclass\n"},
+    {"class C;\n"
+     "  T1 b; //test\n"
+     "  logic [$] a; //test\n"
+     "  T1    [$] c; //test\n"
+     "endclass\n",
+     "class C;\n"
+     "  T1        b;  //test\n"
+     "  logic [$] a;  //test\n"
+     "  T1    [$] c;  //test\n"
+     "endclass\n"},
+    {"class C;\n"
+     "  T1\n"
+     "  b;\n"
+     "  logic\n"
+     "  [$]\n"
+     "  a;\n"
+     "  T1\n"
+     "  [$]\n"
+     "  c;\n"
+     "endclass\n",
+     "class C;\n"
+     "  T1        b;\n"
+     "  logic [$] a;\n"
+     "  T1    [$] c;\n"
+     "endclass\n"},
+    {"class C;\n"
+     "  logic/*t*/ [0 : 1] /*t*/\n"
+     "  a;/*t*/\n"
+     "  T1/*t*/[0 : 1]/*t*/\n"
+     "  c;/*t*/\n"
+     "endclass\n",
+     "class C;\n"
+     "  logic/*t*/ [0 : 1]  /*t*/ a;  /*t*/\n"
+     "  T1/*t*/    [0 : 1]  /*t*/ c;  /*t*/\n"
+     "endclass\n"},
 
     // -----------------------------------------------------------------
 };