Skip to content

Commit

Permalink
feat(bug): Simple fix
Browse files Browse the repository at this point in the history
Signed-off-by: Jaskeerat Singh Saluja <[email protected]>
  • Loading branch information
Jaskeerat Singh Saluja authored and Jaskeerat Singh Saluja committed Sep 7, 2024
1 parent 7b34b87 commit 29b705c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/concerto-core/lib/introspect/modelfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,19 @@ class ModelFile extends Decorated {
// Validate all of the types in this model file.
// Check if names of the declarations are unique.
const uniqueNames = new Set();
this.declarations.forEach(
d => {
const fqn = d.getFullyQualifiedName();
if (!uniqueNames.has(fqn)) {
uniqueNames.add(fqn);
} else {
throw new IllegalModelException(
`Duplicate class name ${fqn}`
);
}
this.declarations.forEach(d => {
const fqn = d.getFullyQualifiedName();
const shortName = ModelUtil.getShortName(fqn);
if (uniqueNames.has(fqn)) {
throw new IllegalModelException(`Duplicate class name: ${fqn}`);
}
);

if (this.importShortNames.has(shortName)) {
throw new IllegalModelException(
`TypeName Conflict: The type '${shortName}' is being redefined, but it already exists as an imported type from '${this.importShortNames.get(shortName)}'. Please rename your local type or avoid importing conflicting types.`
);
}
uniqueNames.add(fqn);
});
// Run validations on class declarations
for(let n=0; n < this.declarations.length; n++) {
let classDeclaration = this.declarations[n];
Expand Down

0 comments on commit 29b705c

Please sign in to comment.