瀏覽代碼

Check explicit params exist. (#4875)

If there are no explicit params, then `last_param_node_id` should be
`implicit_params_loc_id`. But there is no use case currently, so for now
we assume explicit params exist and assert if not, so this can be found
and updated then.
Alina Sbirlea 1 年之前
父節點
當前提交
e4e6332ad4
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      toolchain/check/name_component.cpp

+ 3 - 3
toolchain/check/name_component.cpp

@@ -36,9 +36,9 @@ auto PopNameComponent(Context& context, SemIR::InstId return_slot_pattern_id)
         context.node_stack()
             .PopForSoloNodeId<Parse::NodeKind::ImplicitParamListStart>();
     // Only use the end of implicit params if there weren't explicit params.
-    if (last_param_node_id.has_value()) {
-      last_param_node_id = params_loc_id;
-    }
+    CARBON_CHECK(last_param_node_id.has_value(),
+                 "Implicit parameters currently only occur before explicit "
+                 "parameters, update and test when this changes");
   } else {
     implicit_param_patterns_id = SemIR::InstBlockId::None;
   }