@NotNull
  public static List<@NotNull BitSet> inferWriteAccessMap(final GroovyControlFlow groovyFlow, final GrVariable var) {

    BitSet neutral = new BitSet(groovyFlow.getFlow().length);

    final Semilattice<BitSet> sem = new Semilattice<>() {

      @NotNull
      @Override
      public BitSet join(@NotNull List<? extends BitSet> ins) {
        if (ins.size() == 0) {
          return neutral;
        }
        if (ins.size() == 1) {
          return ins.get(0);
        }
        BitSet result = new BitSet(groovyFlow.getFlow().length);
        for (BitSet set : ins) {
          result.or(set);
        }
        return result;
      }
    };

    DfaInstance<BitSet> dfa = new DfaInstance<>() {
      @Override
      public BitSet fun(@NotNull BitSet bitSet, @NotNull Instruction instruction) {
        if (!(instruction instanceof ReadWriteVariableInstruction)) return bitSet;
        if (!((ReadWriteVariableInstruction)instruction).isWrite()) return bitSet;

        final PsiElement element = instruction.getElement();
        if (element instanceof GrVariable && element != var) return bitSet;
        if (element instanceof GrReferenceExpression ref) {
          if (ref.isQualified() || ref.resolve() != var) {
            return bitSet;
          }
        }
        if (!groovyFlow.getVarIndices()[((ReadWriteVariableInstruction)instruction).getDescriptor()].equals(createDescriptor(var))) {
          return bitSet;
        }
        BitSet newResult = new BitSet(groovyFlow.getFlow().length);
        newResult.set(instruction.num());
        return newResult;
      }
    };

    return ContainerUtil.map(new DFAEngine<>(groovyFlow.getFlow(), dfa, sem).performForceDFA(), set -> set == null ? neutral : set);
  }
@NotNull
  public static List<@NotNull BitSet> inferWriteAccessMap(final GroovyControlFlow groovyFlow, final GrVariable var)