Skip to content

Commit cff6c83

Browse files
domu1deJohannesMeierSE
authored andcommitted
Remove undeclared dependency on langium in typir (#86)
The `typir` package was relying on `assertUnreachable` from the `langium` package without declaring it as a dependency. Since Typir is intended to work as a standalone package, this implicit dependency could lead to issues. This PR replaces the `assertUnreachable` imports with a local implementation to ensure the package remains self-contained and does not rely on undeclared external modules.
1 parent fe51ae1 commit cff6c83

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

packages/typir/src/kinds/class/class-kind.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7-
import { assertUnreachable } from 'langium';
87
import { Type, TypeDetails } from '../../graph/type-node.js';
98
import { TypeInitializer } from '../../initialization/type-initializer.js';
109
import { TypeReference } from '../../initialization/type-reference.js';
@@ -14,7 +13,7 @@ import { ValidationRule } from '../../services/validation.js';
1413
import { TypirServices } from '../../typir.js';
1514
import { InferCurrentTypeRule, RegistrationOptions } from '../../utils/utils-definitions.js';
1615
import { TypeCheckStrategy } from '../../utils/utils-type-comparison.js';
17-
import { assertTrue, assertTypirType, toArray } from '../../utils/utils.js';
16+
import { assertTrue, assertTypirType, assertUnreachable, toArray } from '../../utils/utils.js';
1817
import { FunctionType } from '../function/function-type.js';
1918
import { Kind, isKind } from '../kind.js';
2019
import { ClassTypeInitializer } from './class-initializer.js';

packages/typir/src/services/equality.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7-
import { assertUnreachable } from 'langium';
87
import { Type } from '../graph/type-node.js';
98
import { TypirServices } from '../typir.js';
109
import { isSpecificTypirProblem, TypirProblem } from '../utils/utils-definitions.js';
1110
import { EdgeCachingInformation, TypeRelationshipCaching } from './caching.js';
1211
import { TypeEdge, isTypeEdge } from '../graph/type-edge.js';
12+
import { assertUnreachable } from '../utils/utils.js';
1313

1414
export interface TypeEqualityProblem extends TypirProblem {
1515
$problem: 'TypeEqualityProblem';

packages/typir/src/services/inference.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7-
import { assertUnreachable } from 'langium';
87
import { isType, Type } from '../graph/type-node.js';
98
import { TypirServices } from '../typir.js';
109
import { RuleCollectorListener, RuleOptions, RuleRegistry } from '../utils/rule-registration.js';
1110
import { isSpecificTypirProblem, TypirProblem } from '../utils/utils-definitions.js';
12-
import { removeFromArray, toArray } from '../utils/utils.js';
11+
import { assertUnreachable, removeFromArray, toArray } from '../utils/utils.js';
1312
import { LanguageNodeInferenceCaching } from './caching.js';
1413

1514
export interface InferenceProblem<LanguageType> extends TypirProblem {

packages/typir/src/utils/utils-type-comparison.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7-
import { assertUnreachable } from 'langium';
87
import { isType, Type } from '../graph/type-node.js';
98
import { Kind } from '../kinds/kind.js';
109
import { InferenceProblem } from '../services/inference.js';
1110
import { TypirServices } from '../typir.js';
12-
import { assertTrue } from '../utils/utils.js';
11+
import { assertTrue, assertUnreachable } from '../utils/utils.js';
1312
import { isNameTypePair, isSpecificTypirProblem, NameTypePair, TypirProblem } from './utils-definitions.js';
1413

1514
export type TypeCheckStrategy =

0 commit comments

Comments
 (0)