Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ For each minor and major version, there is a corresponding [milestone on GitHub]
- ...


## v0.3.0 (2025-??-??)

### Fixed bugs

- The logic to ensure that types are not created multiple times needs to check that the kind of the types is the same. Otherwise a collision of duplicated identifiers of types needs to be reported.


## v0.2.1 (2025-04-09)

- Export `test-utils.ts` which are using `vitest` via the new namespace `'typir/test'` in order to not pollute production code with vitest dependencies (#68)
Expand Down
3 changes: 3 additions & 0 deletions packages/typir/src/initialization/type-initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export abstract class TypeInitializer<T extends Type, LanguageType> {
}
const existingType = this.services.infrastructure.Graph.getType(key);
if (existingType) {
if (newType.kind !== existingType.kind) {
throw new Error(`A new type with identifier '${key}' and kind '${newType.kind.$name}' (implemented in ${newType.kind.constructor.name}) shall be created, but there is already a type with identifier '${key}' and kind '${existingType.kind.$name}' (implemented in ${existingType.kind.constructor.name}) in the type graph.`);
Comment thread
insafuhrmann marked this conversation as resolved.
Outdated
}
// ensure, that the same type is not duplicated!
this.typeToReturn = existingType as T;
newType.dispose();
Expand Down