@shd101wyy/yo 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/cjs/index.cjs +340 -336
- package/out/cjs/yo-cli.cjs +341 -337
- package/out/esm/index.mjs +308 -304
- package/out/types/src/evaluator/calls/trait-type.d.ts +8 -1
- package/out/types/src/evaluator/context.d.ts +8 -1
- package/out/types/src/evaluator/values/impl.d.ts +8 -0
- package/out/types/src/types/definitions.d.ts +4 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/collections/array_list.yo +71 -1
- package/std/collections/btree_map.yo +120 -2
- package/std/collections/deque.yo +76 -1
- package/std/collections/hash_map.yo +137 -1
- package/std/collections/hash_set.yo +85 -1
- package/std/collections/linked_list.yo +61 -1
- package/std/collections/priority_queue.yo +70 -1
- package/std/prelude.yo +81 -18
- package/std/string/string.yo +88 -1
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { type Environment } from "../../env";
|
|
2
2
|
import { type Expr } from "../../expr";
|
|
3
3
|
import type { TraitType } from "../../types/definitions";
|
|
4
|
-
import type { EvaluatorContext, TraitTypeCallResult } from "../context";
|
|
4
|
+
import type { EvaluatorContext, TraitSpecializationResult, TraitTypeCallResult } from "../context";
|
|
5
|
+
export declare function tryToSpecializeTraitType({ traitType, argExprs, callerEnv, context, }: {
|
|
6
|
+
traitExpr: Expr;
|
|
7
|
+
traitType: TraitType;
|
|
8
|
+
argExprs: Expr[];
|
|
9
|
+
callerEnv: Environment;
|
|
10
|
+
context: EvaluatorContext;
|
|
11
|
+
}): TraitSpecializationResult;
|
|
5
12
|
export declare function tryToImplementTraitWithArgumentsByTraitType({ traitExpr, traitType, argExprs, callerEnv, context, }: {
|
|
6
13
|
traitExpr: Expr;
|
|
7
14
|
traitType: TraitType;
|
|
@@ -3,7 +3,7 @@ import { YoError } from "../error";
|
|
|
3
3
|
import type { Expr, FnCallExpr, PathCollection } from "../expr";
|
|
4
4
|
import type { FunctionValue } from "../function-value";
|
|
5
5
|
import type { Token } from "../token";
|
|
6
|
-
import type { FunctionType, Type } from "../types/definitions";
|
|
6
|
+
import type { FunctionType, TraitType, Type } from "../types/definitions";
|
|
7
7
|
import type { ArrayValue, ModuleValue, TraitValue, Value } from "../value";
|
|
8
8
|
export interface FunctionEvaluationContext {
|
|
9
9
|
kind: "function-body";
|
|
@@ -112,6 +112,10 @@ export interface TraitTypeCallResult {
|
|
|
112
112
|
traitValue: TraitValue;
|
|
113
113
|
callerEnv: Environment;
|
|
114
114
|
}
|
|
115
|
+
export interface TraitSpecializationResult {
|
|
116
|
+
specializedTraitType: TraitType;
|
|
117
|
+
callerEnv: Environment;
|
|
118
|
+
}
|
|
115
119
|
export interface ArrayCallResult {
|
|
116
120
|
value: Value | undefined;
|
|
117
121
|
index?: number;
|
|
@@ -157,6 +161,9 @@ export interface FunctionToCall {
|
|
|
157
161
|
} | {
|
|
158
162
|
kind: "trait-type";
|
|
159
163
|
result: TraitTypeCallResult;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "trait-specialization";
|
|
166
|
+
result: TraitSpecializationResult;
|
|
160
167
|
} | {
|
|
161
168
|
kind: "array";
|
|
162
169
|
result: ArrayCallResult;
|
|
@@ -44,6 +44,14 @@ export declare function findMethodsFromGenericImpls({ concreteType, methodName,
|
|
|
44
44
|
type: FunctionType;
|
|
45
45
|
value: Value | undefined;
|
|
46
46
|
}[];
|
|
47
|
+
export declare function findAssociatedTypeFromGenericImpls({ concreteType, propertyName, env, }: {
|
|
48
|
+
concreteType: Type;
|
|
49
|
+
propertyName: string;
|
|
50
|
+
env: Environment;
|
|
51
|
+
}): {
|
|
52
|
+
type: Type;
|
|
53
|
+
value: Value;
|
|
54
|
+
} | undefined;
|
|
47
55
|
export declare function findMethodFromGenericImplForTrait({ concreteType, traitType, methodName, env, }: {
|
|
48
56
|
concreteType: Type;
|
|
49
57
|
traitType: TraitType;
|
|
@@ -169,6 +169,10 @@ export interface TraitType extends Type {
|
|
|
169
169
|
concreteType: Type;
|
|
170
170
|
};
|
|
171
171
|
definedInModulePath?: string;
|
|
172
|
+
associatedTypeConstraints?: {
|
|
173
|
+
label: string;
|
|
174
|
+
constraintType: Type;
|
|
175
|
+
}[];
|
|
172
176
|
}
|
|
173
177
|
export type FnTraitType = TraitType & {
|
|
174
178
|
isFn: {
|