code: @VisibleForTesting
    static void checkDuplicateHeaderVars(
        ImmutableList<? extends TemplateHeaderVarDefn> params,
        ImmutableList<? extends TemplateHeaderVarDefn> stateVars,
        ErrorReporter errorReporter) {
  
      final Set<String> stateVarNames =
          stateVars.stream().map(TemplateHeaderVarDefn::name).collect(toImmutableSet());
  
      Iterable<? extends TemplateHeaderVarDefn> duplicateVars =
          Iterables.filter(params, param -> stateVarNames.contains(param.name()));
      for (TemplateHeaderVarDefn duplicateVar : duplicateVars) {
        errorReporter.report(duplicateVar.nameLocation(), DUPLICATE_DECLARATION, duplicateVar.name());
      }
    }
docs: Check for duplicate header variable names and append error text for each duplicate to the
  `errorReporter`. For example, this is an error:
  
  <pre>{@code
  {@param s: bool}
  {@state s: bool}
  }</pre>
  
  Note that it is not possible to have duplicate names of the same declaration type. Any
  duplicate {@code @state} or {@code @param} will have been flagged as error during the resolve-
  names pass or in {@link #addParams(Iterable)}.