Skip to content

Detect circular references in DSL and provide a meaningful error message #292

@gene-pavlovsky

Description

@gene-pavlovsky

Example code:

snapshotModule = new module.SnapshotModule(snapshotDependencies);
snapshotDependencies = new Array<hex.di.mapping.MappingDefinition>(
	mapping({fromType: "Void->Void", toValue: snapshotController.onSnapshotSaved, withName: "onSnapshotSaved"})
);
snapshotController = new adapter.SnapshotController(snapshotModule.takeSnapshot);

As you can see, there is a circular dependency between snapshotModule and snapshotController, but it might be hard to notice in some cases.
Trying to compile the code results in a really long list of errors, none of which are helpful to find the source of the problem.

It would be nice if circular dependencies are detected during building of the dependency graph, and a meaningful error message is produced.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions