@shd101wyy/yo 0.1.30 → 0.1.32
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/.github/skills/yo-syntax/syntax-cheatsheet.md +38 -0
- package/out/cjs/index.cjs +800 -633
- package/out/cjs/yo-cli.cjs +1007 -840
- package/out/cjs/yo-lsp.cjs +890 -723
- package/out/esm/index.mjs +804 -637
- package/out/types/src/codegen/index.d.ts +1 -1
- package/out/types/src/compiler-utils.d.ts +1 -1
- package/out/types/src/evaluator/builtins/contracts.d.ts +35 -0
- package/out/types/src/evaluator/memory-safety.d.ts +1 -1
- package/out/types/src/evaluator/types/function.d.ts +2 -0
- package/out/types/src/evaluator/utils/closure.d.ts +2 -1
- package/out/types/src/evaluator/utils.d.ts +3 -0
- package/out/types/src/evaluator/values/impl.d.ts +14 -0
- package/out/types/src/expr.d.ts +6 -0
- package/out/types/src/tests/contracts-comptime-violation.test.d.ts +1 -0
- package/out/types/src/tests/contracts-runtime-violation.test.d.ts +1 -0
- package/out/types/src/tests/thread-safety-codegen.test.d.ts +1 -0
- package/out/types/src/types/creators.d.ts +3 -1
- package/out/types/src/types/definitions.d.ts +2 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/build.yo +5 -2
- package/std/imm/list.yo +1 -1
- package/std/imm/sorted_map.yo +1 -1
- package/std/libc/stdatomic.yo +285 -1
- package/std/prelude.yo +56 -3
- package/std/spec/numeric.yo +30 -0
- package/std/spec/refine.yo +43 -0
- package/std/string/rune.yo +4 -0
- package/std/sync/atomic.yo +557 -0
- package/std/sync/channel.yo +57 -42
- package/std/sync/cond.yo +7 -3
- package/std/sync/mutex.yo +75 -15
- package/std/sync/once.yo +25 -19
- package/std/sync/rwlock.yo +18 -15
- package/std/sync/waitgroup.yo +25 -16
|
@@ -31,7 +31,7 @@ export declare class CodeGenerator {
|
|
|
31
31
|
release?: boolean;
|
|
32
32
|
optimize?: "0" | "1" | "2" | "3";
|
|
33
33
|
allocator?: "mimalloc" | "libc";
|
|
34
|
-
sanitize?: "address" | "leak";
|
|
34
|
+
sanitize?: "address" | "leak" | "thread";
|
|
35
35
|
debugSymbols?: boolean;
|
|
36
36
|
strip?: boolean;
|
|
37
37
|
static?: boolean;
|
|
@@ -8,7 +8,7 @@ export interface CompilerInfo {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function getCompilerInfo(compiler: string): CompilerInfo;
|
|
10
10
|
export interface SanitizerOptions {
|
|
11
|
-
sanitize: "address" | "leak";
|
|
11
|
+
sanitize: "address" | "leak" | "thread";
|
|
12
12
|
compilerInfo: CompilerInfo;
|
|
13
13
|
}
|
|
14
14
|
export interface SanitizerFlags {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Environment } from "../../env";
|
|
2
|
+
import { type Expr, type FnCallExpr } from "../../expr";
|
|
3
|
+
import type { FunctionType } from "../../types/definitions";
|
|
4
|
+
import type { EvaluatorContext } from "../context";
|
|
5
|
+
export declare function evaluateRequires(args: {
|
|
6
|
+
expr: FnCallExpr;
|
|
7
|
+
env: Environment;
|
|
8
|
+
context: EvaluatorContext;
|
|
9
|
+
}): FnCallExpr;
|
|
10
|
+
export declare function evaluateEnsures(args: {
|
|
11
|
+
expr: FnCallExpr;
|
|
12
|
+
env: Environment;
|
|
13
|
+
context: EvaluatorContext;
|
|
14
|
+
}): FnCallExpr;
|
|
15
|
+
export declare function evaluateInvariant(args: {
|
|
16
|
+
expr: FnCallExpr;
|
|
17
|
+
env: Environment;
|
|
18
|
+
context: EvaluatorContext;
|
|
19
|
+
}): FnCallExpr;
|
|
20
|
+
export declare function evaluateGhost(args: {
|
|
21
|
+
expr: FnCallExpr;
|
|
22
|
+
env: Environment;
|
|
23
|
+
context: EvaluatorContext;
|
|
24
|
+
}): FnCallExpr;
|
|
25
|
+
export declare function evaluateGhostFn({ expr, env, context, }: {
|
|
26
|
+
expr: FnCallExpr;
|
|
27
|
+
env: Environment;
|
|
28
|
+
context: EvaluatorContext;
|
|
29
|
+
}): FnCallExpr;
|
|
30
|
+
export declare function evaluateOld({ expr, env, context, }: {
|
|
31
|
+
expr: FnCallExpr;
|
|
32
|
+
env: Environment;
|
|
33
|
+
context: EvaluatorContext;
|
|
34
|
+
}): FnCallExpr;
|
|
35
|
+
export declare function wrapFunctionBodyWithContracts(body: Expr, fnType: FunctionType): Expr;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type PragmaKind = "AllowUnsafe" | "SkipPrelude" | "SkipWasm" | "SkipWasm32Emscripten" | "SkipWasm32Wasi";
|
|
1
|
+
export type PragmaKind = "AllowUnsafe" | "SkipPrelude" | "SkipWasm" | "SkipWasm32Emscripten" | "SkipWasm32Wasi" | "Verify" | "VerifyOrAssert" | "NoContracts";
|
|
2
2
|
export declare function registerFilePragma(modulePath: string, kind: PragmaKind): void;
|
|
3
3
|
export declare function fileHasPragma(modulePath: string | undefined, kind: PragmaKind): boolean;
|
|
4
4
|
export declare function _clearPragmaRegistry(): void;
|
|
@@ -34,6 +34,8 @@ export declare function evaluateFunctionParameters({ parameterExprs, env, contex
|
|
|
34
34
|
forallParameters: FunctionParameter[];
|
|
35
35
|
variadicParameter?: FunctionParameter;
|
|
36
36
|
whereClauseExprs?: Expr[];
|
|
37
|
+
requiresExprs?: Expr[];
|
|
38
|
+
ensuresExprs?: Expr[];
|
|
37
39
|
env: Environment;
|
|
38
40
|
};
|
|
39
41
|
export declare function evaluateFunctionType({ expr, env, context, }: {
|
|
@@ -11,11 +11,12 @@ export declare function consumeCapturedVariables({ capturedVariables, env, closu
|
|
|
11
11
|
closureToken: Token;
|
|
12
12
|
}): Environment;
|
|
13
13
|
export declare function buildPathCollectionFromCapturedVariables(capturedVariables: Map<string, CapturedVariableInfo>): string[][];
|
|
14
|
-
export declare function validateCaptureTraitRequirements({ wrapperType, captureType, env, errorToken, }: {
|
|
14
|
+
export declare function validateCaptureTraitRequirements({ wrapperType, captureType, env, errorToken, capturedVariablesWithValues, }: {
|
|
15
15
|
wrapperType: SomeType;
|
|
16
16
|
captureType: StructType;
|
|
17
17
|
env: Environment;
|
|
18
18
|
errorToken: Token;
|
|
19
|
+
capturedVariablesWithValues?: Map<string, FunctionCapturedVariableInfo>;
|
|
19
20
|
}): void;
|
|
20
21
|
export declare function createCaptureTypeAndValue({ expectedCaptureType, capturedVariablesWithValues, env, closureToken, context, }: {
|
|
21
22
|
expectedCaptureType: StructType | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type Environment, type Variable } from "../env";
|
|
2
2
|
import { type Expr } from "../expr";
|
|
3
|
+
import type { Type } from "../types/definitions";
|
|
4
|
+
export declare function getRootExprOfFieldAccess(expr: Expr): Expr;
|
|
5
|
+
export declare function getAtomicObjectRootType(rootExpr: Expr, env: Environment): Type | undefined;
|
|
3
6
|
export declare function isValidVariableName(expr: Expr): boolean;
|
|
4
7
|
export declare function findRcValueOwnerRelationship(rhs: Expr, env: Environment, _modulePath: string): Variable | undefined;
|
|
@@ -3,6 +3,19 @@ import { type Expr, type FnCallExpr } from "../../expr";
|
|
|
3
3
|
import type { FunctionType, SomeType, TraitField, TraitType, Type } from "../../types/definitions";
|
|
4
4
|
import { type TraitValue, type UnknownValue, type Value } from "../../value";
|
|
5
5
|
import type { EvaluatorContext } from "../context";
|
|
6
|
+
interface NegativeGenericImpl {
|
|
7
|
+
forallParameters: ForallParameter[];
|
|
8
|
+
whereConstraints: {
|
|
9
|
+
someType: SomeType;
|
|
10
|
+
traitType: TraitType;
|
|
11
|
+
traitExpr?: Expr;
|
|
12
|
+
}[];
|
|
13
|
+
receiverTypePattern: Type;
|
|
14
|
+
traitType: TraitType;
|
|
15
|
+
sourceModulePath?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function hasNegativeImpl(typeId: string, traitTypeId: string): boolean;
|
|
18
|
+
export declare function findMatchingNegativeGenericImpl(concreteType: Type, traitType: TraitType, env: Environment): NegativeGenericImpl | undefined;
|
|
6
19
|
export type ForallParameter = {
|
|
7
20
|
kind: "type";
|
|
8
21
|
name: string;
|
|
@@ -90,3 +103,4 @@ export declare function evaluateImplBlock({ expr, env, context, }: {
|
|
|
90
103
|
env: Environment;
|
|
91
104
|
context: EvaluatorContext;
|
|
92
105
|
}): FnCallExpr;
|
|
106
|
+
export {};
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -602,6 +602,12 @@ export declare const BuiltinFunctions: {
|
|
|
602
602
|
__yo_build_doc: string[];
|
|
603
603
|
asm: string[];
|
|
604
604
|
global_asm: string[];
|
|
605
|
+
requires: string[];
|
|
606
|
+
ensures: string[];
|
|
607
|
+
invariant: string[];
|
|
608
|
+
ghost: string[];
|
|
609
|
+
ghost_fn: string[];
|
|
610
|
+
old: string[];
|
|
605
611
|
};
|
|
606
612
|
export declare function exprIsInfixOperatorFunctionCall(expr: Expr): boolean;
|
|
607
613
|
export interface ExprToStringConfig {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -45,11 +45,13 @@ export declare function createSourceNamespaceType(env: Environment): SourceNames
|
|
|
45
45
|
export declare function createTraitType(env: Environment): TraitType;
|
|
46
46
|
export declare function createEnumType(env: Environment): EnumType;
|
|
47
47
|
export declare function createUnionType(env: Environment): UnionType;
|
|
48
|
-
export declare function createFunctionType({ parameters, forallParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, isControl, }: {
|
|
48
|
+
export declare function createFunctionType({ parameters, forallParameters, variadicParameter, whereClauseExprs, requiresExprs, ensuresExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, isControl, }: {
|
|
49
49
|
parameters: FunctionParameter[];
|
|
50
50
|
forallParameters: FunctionForallParameter[];
|
|
51
51
|
variadicParameter: FunctionParameter | undefined;
|
|
52
52
|
whereClauseExprs?: Expr[];
|
|
53
|
+
requiresExprs?: Expr[];
|
|
54
|
+
ensuresExprs?: Expr[];
|
|
53
55
|
return_: FunctionReturn;
|
|
54
56
|
env: Environment;
|
|
55
57
|
parametersFrame: Frame;
|
|
@@ -222,6 +222,8 @@ export interface FunctionType extends Type {
|
|
|
222
222
|
forallParameters: FunctionForallParameter[];
|
|
223
223
|
variadicParameter?: FunctionParameter;
|
|
224
224
|
whereClauseExprs?: Expr[];
|
|
225
|
+
requiresExprs?: Expr[];
|
|
226
|
+
ensuresExprs?: Expr[];
|
|
225
227
|
return: FunctionReturn;
|
|
226
228
|
env: Environment;
|
|
227
229
|
parametersFrame: Frame;
|