amplication / amplication/amplication

🐛 Bug Report: @amplication/java-ast duplicates imports when references are used

未关闭
#9,845 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
backend bug
主要语言
TypeScript
星标
16k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

### What happened?

When `References` are used in a `Class` (as happens automatically for annotations etc), the import statement is incorrectly duplicated.

You can see this in the [complex snapshot](https://github.com/amplication/ast-types/blob/cf559c32538c7eb5159868333e8bdc0c586230a0/libs/java-ast/tests/__snapshots__/ComplexExample.spec.ts.snap), which has several duplicated imports.

This is because the references are de-duplicated in a set, but javascript sets use reference equality.

I've got a fix, PR incoming.

### What you expected to happen

Repeat types in imports and references appear only once in the import list.

### How to reproduce

Run the snapshot test.

### Amplication version

@amplication/java-ast@0.0.2

### Environment

Node: v24.11.1
npm: 11.6.2

### Are you willing to submit PR?

Yes I am willing to submit a PR!

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。