@shd101wyy/yo 0.1.28 → 0.1.30

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.
Files changed (183) hide show
  1. package/.github/skills/yo-async-effects/SKILL.md +15 -15
  2. package/.github/skills/yo-async-effects/async-effects-recipes.md +118 -121
  3. package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +33 -13
  4. package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +1 -1
  5. package/.github/skills/yo-syntax/SKILL.md +2 -2
  6. package/.github/skills/yo-syntax/syntax-cheatsheet.md +108 -96
  7. package/README.md +6 -3
  8. package/out/cjs/index.cjs +812 -706
  9. package/out/cjs/yo-cli.cjs +1023 -907
  10. package/out/cjs/yo-lsp.cjs +836 -730
  11. package/out/esm/index.mjs +757 -651
  12. package/out/types/src/codegen/exprs/async.d.ts +2 -0
  13. package/out/types/src/codegen/exprs/await.d.ts +1 -0
  14. package/out/types/src/codegen/exprs/closures.d.ts +4 -0
  15. package/out/types/src/codegen/functions/context.d.ts +6 -0
  16. package/out/types/src/codegen/functions/declarations.d.ts +1 -1
  17. package/out/types/src/doc/model.d.ts +0 -1
  18. package/out/types/src/env.d.ts +2 -2
  19. package/out/types/src/evaluator/builtins/pragma.d.ts +9 -0
  20. package/out/types/src/evaluator/builtins/unsafe.d.ts +8 -0
  21. package/out/types/src/evaluator/context.d.ts +3 -1
  22. package/out/types/src/evaluator/exprs/{escape.d.ts → unwind.d.ts} +1 -1
  23. package/out/types/src/evaluator/index.d.ts +1 -1
  24. package/out/types/src/evaluator/memory-safety.d.ts +14 -0
  25. package/out/types/src/evaluator/types/flowability.d.ts +6 -0
  26. package/out/types/src/evaluator/types/function.d.ts +1 -2
  27. package/out/types/src/evaluator/utils.d.ts +0 -1
  28. package/out/types/src/expr-traversal.d.ts +1 -0
  29. package/out/types/src/expr.d.ts +9 -7
  30. package/out/types/src/public-safe-report.d.ts +19 -0
  31. package/out/types/src/tests/comptime-ref-gate.test.d.ts +1 -0
  32. package/out/types/src/tests/pragma-validation.test.d.ts +1 -0
  33. package/out/types/src/tests/public-safe-report.test.d.ts +1 -0
  34. package/out/types/src/tests/type-representation-pointer.test.d.ts +1 -0
  35. package/out/types/src/tests/unsafe-gate.test.d.ts +1 -0
  36. package/out/types/src/tests/unsafe-report-classify.test.d.ts +1 -0
  37. package/out/types/src/types/creators.d.ts +4 -6
  38. package/out/types/src/types/definitions.d.ts +9 -16
  39. package/out/types/src/types/guards.d.ts +1 -2
  40. package/out/types/src/types/tags.d.ts +0 -1
  41. package/out/types/src/types/utils.d.ts +5 -0
  42. package/out/types/src/unsafe-report.d.ts +29 -0
  43. package/out/types/src/value.d.ts +1 -0
  44. package/out/types/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +1 -1
  46. package/scripts/add-pragma-for-pointer-decls.ts +134 -0
  47. package/scripts/add-pragma.ts +58 -0
  48. package/scripts/migrate-amp-method-calls.ts +186 -0
  49. package/scripts/migrate-clone-calls.ts +93 -0
  50. package/scripts/migrate-get-unwrap.ts +166 -0
  51. package/scripts/migrate-index-patterns.ts +210 -0
  52. package/scripts/migrate-index-trait.ts +142 -0
  53. package/scripts/migrate-iterator.ts +150 -0
  54. package/scripts/migrate-self-ptr.ts +220 -0
  55. package/scripts/migrate-skip-pragmas.ts +109 -0
  56. package/scripts/migrate-tostring.ts +134 -0
  57. package/scripts/trim-pragma.ts +130 -0
  58. package/scripts/wrap-extern-calls.ts +161 -0
  59. package/std/alg/hash.yo +3 -2
  60. package/std/allocator.yo +6 -5
  61. package/std/async.yo +2 -2
  62. package/std/collections/array_list.yo +59 -40
  63. package/std/collections/btree_map.yo +19 -18
  64. package/std/collections/deque.yo +9 -8
  65. package/std/collections/hash_map.yo +101 -13
  66. package/std/collections/hash_set.yo +5 -4
  67. package/std/collections/linked_list.yo +39 -4
  68. package/std/collections/ordered_map.yo +3 -3
  69. package/std/collections/priority_queue.yo +14 -13
  70. package/std/crypto/md5.yo +2 -1
  71. package/std/crypto/random.yo +21 -20
  72. package/std/crypto/sha256.yo +2 -1
  73. package/std/encoding/base64.yo +18 -18
  74. package/std/encoding/hex.yo +5 -5
  75. package/std/encoding/json.yo +62 -13
  76. package/std/encoding/punycode.yo +24 -23
  77. package/std/encoding/toml.yo +4 -3
  78. package/std/encoding/utf16.yo +3 -3
  79. package/std/env.yo +43 -28
  80. package/std/error.yo +15 -3
  81. package/std/fmt/display.yo +2 -2
  82. package/std/fmt/index.yo +6 -5
  83. package/std/fmt/to_string.yo +39 -38
  84. package/std/fmt/writer.yo +9 -8
  85. package/std/fs/dir.yo +61 -66
  86. package/std/fs/file.yo +121 -126
  87. package/std/fs/metadata.yo +13 -18
  88. package/std/fs/temp.yo +35 -30
  89. package/std/fs/walker.yo +14 -19
  90. package/std/gc.yo +1 -0
  91. package/std/glob.yo +7 -7
  92. package/std/http/client.yo +33 -36
  93. package/std/http/http.yo +6 -6
  94. package/std/http/index.yo +4 -4
  95. package/std/imm/list.yo +33 -0
  96. package/std/imm/map.yo +2 -1
  97. package/std/imm/set.yo +1 -0
  98. package/std/imm/sorted_map.yo +1 -0
  99. package/std/imm/sorted_set.yo +1 -0
  100. package/std/imm/string.yo +27 -23
  101. package/std/imm/vec.yo +18 -2
  102. package/std/io/reader.yo +2 -1
  103. package/std/io/writer.yo +3 -2
  104. package/std/libc/assert.yo +1 -0
  105. package/std/libc/ctype.yo +1 -0
  106. package/std/libc/dirent.yo +1 -0
  107. package/std/libc/errno.yo +1 -0
  108. package/std/libc/fcntl.yo +1 -0
  109. package/std/libc/float.yo +1 -0
  110. package/std/libc/limits.yo +1 -0
  111. package/std/libc/math.yo +1 -0
  112. package/std/libc/signal.yo +1 -0
  113. package/std/libc/stdatomic.yo +1 -0
  114. package/std/libc/stdint.yo +1 -0
  115. package/std/libc/stdio.yo +1 -0
  116. package/std/libc/stdlib.yo +1 -0
  117. package/std/libc/string.yo +1 -0
  118. package/std/libc/sys/stat.yo +1 -0
  119. package/std/libc/time.yo +1 -0
  120. package/std/libc/unistd.yo +1 -0
  121. package/std/libc/wctype.yo +1 -0
  122. package/std/libc/windows.yo +2 -0
  123. package/std/log.yo +7 -6
  124. package/std/net/addr.yo +6 -5
  125. package/std/net/dns.yo +13 -16
  126. package/std/net/errors.yo +9 -9
  127. package/std/net/tcp.yo +71 -74
  128. package/std/net/udp.yo +40 -43
  129. package/std/os/signal.yo +5 -5
  130. package/std/path.yo +1 -0
  131. package/std/prelude.yo +377 -200
  132. package/std/process/command.yo +57 -46
  133. package/std/process/index.yo +2 -1
  134. package/std/regex/compiler.yo +10 -9
  135. package/std/regex/index.yo +41 -41
  136. package/std/regex/match.yo +2 -2
  137. package/std/regex/parser.yo +31 -31
  138. package/std/regex/vm.yo +42 -41
  139. package/std/string/string.yo +95 -40
  140. package/std/string/string_builder.yo +9 -9
  141. package/std/string/unicode.yo +50 -49
  142. package/std/sync/channel.yo +2 -1
  143. package/std/sync/cond.yo +5 -4
  144. package/std/sync/mutex.yo +4 -3
  145. package/std/sys/advise.yo +1 -0
  146. package/std/sys/bufio/buf_reader.yo +27 -26
  147. package/std/sys/bufio/buf_writer.yo +22 -21
  148. package/std/sys/clock.yo +1 -0
  149. package/std/sys/copy.yo +1 -0
  150. package/std/sys/dir.yo +10 -9
  151. package/std/sys/dns.yo +6 -5
  152. package/std/sys/errors.yo +12 -12
  153. package/std/sys/events.yo +1 -0
  154. package/std/sys/externs.yo +38 -37
  155. package/std/sys/file.yo +17 -16
  156. package/std/sys/future.yo +4 -3
  157. package/std/sys/iov.yo +1 -0
  158. package/std/sys/mmap.yo +1 -0
  159. package/std/sys/path.yo +1 -0
  160. package/std/sys/perm.yo +2 -1
  161. package/std/sys/pipe.yo +1 -0
  162. package/std/sys/process.yo +5 -4
  163. package/std/sys/signal.yo +1 -0
  164. package/std/sys/socketpair.yo +1 -0
  165. package/std/sys/sockinfo.yo +1 -0
  166. package/std/sys/statfs.yo +2 -1
  167. package/std/sys/statx.yo +1 -0
  168. package/std/sys/sysinfo.yo +1 -0
  169. package/std/sys/tcp.yo +15 -14
  170. package/std/sys/temp.yo +1 -0
  171. package/std/sys/time.yo +2 -1
  172. package/std/sys/timer.yo +6 -6
  173. package/std/sys/tty.yo +2 -1
  174. package/std/sys/udp.yo +13 -12
  175. package/std/sys/unix.yo +12 -11
  176. package/std/testing/bench.yo +4 -3
  177. package/std/thread.yo +7 -6
  178. package/std/time/datetime.yo +18 -15
  179. package/std/time/duration.yo +11 -10
  180. package/std/time/instant.yo +4 -4
  181. package/std/time/sleep.yo +1 -0
  182. package/std/url/index.yo +5 -5
  183. package/std/worker.yo +4 -3
@@ -1,6 +1,8 @@
1
1
  import { type FnCallExpr } from "../../expr";
2
+ import type { FutureTraitType } from "../../types/definitions";
2
3
  import type { FunctionGenerationContext } from "../functions/context";
3
4
  export declare function generateAsyncBlock(expr: FnCallExpr, indent: string, context: FunctionGenerationContext): string;
5
+ export declare function findBundleFieldName(futureTraitType: FutureTraitType, stateMachineVariables: Map<string, import("../../evaluator/async/await-analysis-types").CapturedVariable> | undefined, stateMachineFieldAliases?: Map<string, string>): string | undefined;
4
6
  export declare function generateDeferredAsyncBlocks(context: FunctionGenerationContext): void;
5
7
  export declare function preRegisterAsyncBlockTypes(context: FunctionGenerationContext): void;
6
8
  export declare function generateIoAsyncSyncCall(expr: FnCallExpr, indent: string, context: FunctionGenerationContext): string;
@@ -3,3 +3,4 @@ import { type CodeGenContext } from "../utils";
3
3
  export declare function generateAwait(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
4
4
  export declare function generateState(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
5
5
  export declare function generateJoinHandleAwait(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
6
+ export declare function emitIoSpawnEffectInjection(expr: FnCallExpr, futureVar: string, indent: string, context: CodeGenContext): void;
@@ -1,6 +1,10 @@
1
1
  import { type Environment } from "../../env";
2
2
  import { type FnCallExpr } from "../../expr";
3
+ import type { Type } from "../../types/definitions";
4
+ export declare function resolveSomeTypeToConcrete(t: Type): Type;
5
+ import type { FunctionGenerationContext } from "../functions/context";
3
6
  import { type CodeGenContext } from "../utils";
4
7
  export declare function checkVariableIsClosureCaptured(variableName: string, env: Environment, closureCaptureFrameLevel: number): boolean;
5
8
  export declare function isClosureConstruction(expr: FnCallExpr): boolean;
9
+ export declare function registerImplClosureCallMappings(context: FunctionGenerationContext): void;
6
10
  export declare function generateClosureConstruction(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
@@ -51,6 +51,12 @@ export interface FunctionGenerationContext extends CodeGenContext {
51
51
  resultTypeCName: string;
52
52
  captureType: StructType | undefined;
53
53
  analysis: AwaitAnalysisResult;
54
+ closureParamSlots?: {
55
+ fieldName: string;
56
+ cType: string;
57
+ paramName: string;
58
+ paramType: Type;
59
+ }[];
54
60
  }>;
55
61
  asyncCondBranchInfo?: Map<number, {
56
62
  branches: Array<{
@@ -10,7 +10,7 @@ export interface EvidenceParameter {
10
10
  fieldFunctionType: FunctionType;
11
11
  cParamName: string;
12
12
  }
13
- export declare function getEvidenceParameters(functionType: FunctionType): EvidenceParameter[];
13
+ export declare function getEvidenceParameters(_functionType: FunctionType): EvidenceParameter[];
14
14
  export declare function generateFunctionPrototype(functionType: FunctionType, cFunctionName: string, context: CodeGenContext, overrideReturnType?: string, originalFunctionType?: FunctionType): string;
15
15
  export declare function generateFunctionDeclaration(functionType: FunctionType, cFunctionName: string, isExtern: boolean, context: CodeGenContext, functionBody?: Expr, originalFunctionType?: FunctionType): void;
16
16
  export declare function generateObjectConstructorDeclarations(context: FunctionGenerationContext): void;
@@ -3,7 +3,6 @@ export interface DocParam {
3
3
  name: string;
4
4
  type: string;
5
5
  isComptime: boolean;
6
- isImplicit: boolean;
7
6
  defaultValue?: string;
8
7
  doc?: string;
9
8
  }
@@ -11,13 +11,14 @@ export interface Variable {
11
11
  isOwningTheRcValue: boolean;
12
12
  isOwningTheSameRcValueAs?: Variable;
13
13
  isReassignable?: boolean;
14
+ isRef?: boolean;
15
+ isParameter?: boolean;
14
16
  initializedAtToken: Token | undefined;
15
17
  consumedAtToken: Token | undefined;
16
18
  frameLevel: number;
17
19
  token: Token;
18
20
  isCreatedFromDestructuringAtomVariable?: boolean;
19
21
  parameterAlias?: string;
20
- isImplicit?: boolean;
21
22
  isFromEffectSpread?: boolean;
22
23
  isEffectParam?: boolean;
23
24
  isModuleLevel?: boolean;
@@ -129,7 +130,6 @@ export declare function getReceiverMethodsByNameFromEnv({ env, context, methodNa
129
130
  value: Value | undefined;
130
131
  needsPointerConversion?: boolean;
131
132
  }[];
132
- export declare function stripImplicitVariablesFromEnv(env: Environment): Environment;
133
133
  export declare function keepTopLevelFrameAndComptimeVariablesFromEnv(env: Environment): Environment;
134
134
  export declare function getVariablesNeedingDrop(env: Environment): Variable[];
135
135
  export declare function findNearestBeginBlockFrameLevel(env: Environment): number;
@@ -0,0 +1,9 @@
1
+ import type { Environment } from "../../env";
2
+ import { type Expr, type FnCallExpr } from "../../expr";
3
+ import type { EvaluatorContext } from "../context";
4
+ export declare function evaluatePragma({ expr, env, context, }: {
5
+ expr: FnCallExpr;
6
+ env: Environment;
7
+ context: EvaluatorContext;
8
+ }): FnCallExpr;
9
+ export declare function preScanForSkipPrelude(program: Expr[], modulePath: string): boolean;
@@ -0,0 +1,8 @@
1
+ import type { Environment } from "../../env";
2
+ import { type FnCallExpr } from "../../expr";
3
+ import type { EvaluatorContext } from "../context";
4
+ export declare function evaluateUnsafe({ expr, env, context, }: {
5
+ expr: FnCallExpr;
6
+ env: Environment;
7
+ context: EvaluatorContext;
8
+ }): FnCallExpr;
@@ -54,6 +54,8 @@ export interface EvaluatorContext {
54
54
  stdPath: string;
55
55
  currentModulePath?: string;
56
56
  isUnsafeFunctionType?: boolean;
57
+ unsafeContext?: boolean;
58
+ isControlFunctionType?: boolean;
57
59
  enclosingFunctionReturnType?: Type;
58
60
  hasControlFunctionImplicitParams?: boolean;
59
61
  isInsideWhereClause?: boolean;
@@ -64,10 +66,10 @@ export interface EvaluatorContext {
64
66
  token: Token;
65
67
  }>;
66
68
  forceCompileTimeBindings?: boolean;
69
+ deferGenericFnTypeCheckToAssignment?: boolean;
67
70
  isAnalyzingCtfeCapability?: boolean;
68
71
  isInFunctionCallCheckingPhase?: boolean;
69
72
  isInsideIoAsyncCall?: boolean;
70
- isInsideGivenHandler?: boolean;
71
73
  isEvaluatingGenericImplSpecialization?: boolean;
72
74
  currentlySpecializingFunction?: {
73
75
  originalFuncId: string;
@@ -1,7 +1,7 @@
1
1
  import { type Environment } from "../../env";
2
2
  import { type Expr, type FnCallExpr } from "../../expr";
3
3
  import type { EvaluatorContext } from "../context";
4
- export declare function evaluateEscape({ expr, env, context, }: {
4
+ export declare function evaluateUnwind({ expr, env, context, }: {
5
5
  expr: FnCallExpr;
6
6
  env: Environment;
7
7
  context: EvaluatorContext;
@@ -1,6 +1,6 @@
1
1
  import { type Environment } from "../env";
2
2
  import type { Expr } from "../expr";
3
- import { type Token } from "../token";
3
+ import type { Token } from "../token";
4
4
  import type { StructValue } from "../value";
5
5
  import type { LoadModuleFn } from "./context";
6
6
  import { clearAllGlobalImplState, clearGenericImplsFromModule, clearImplsFromModule } from "./values/impl";
@@ -0,0 +1,14 @@
1
+ export type PragmaKind = "AllowUnsafe" | "SkipPrelude" | "SkipWasm" | "SkipWasm32Emscripten" | "SkipWasm32Wasi";
2
+ export declare function registerFilePragma(modulePath: string, kind: PragmaKind): void;
3
+ export declare function fileHasPragma(modulePath: string | undefined, kind: PragmaKind): boolean;
4
+ export declare function _clearPragmaRegistry(): void;
5
+ export declare function _clearPragmaForModule(modulePath: string): void;
6
+ export declare function isImplicitlyUnsafeCapableFile(modulePath: string | undefined): boolean;
7
+ export declare function isAutoGeneratedExpansion(modulePath: string | undefined): boolean;
8
+ type ExternCallSiteRecord = {
9
+ modulePath: string;
10
+ characterOffset: number;
11
+ calleeName: string;
12
+ };
13
+ export declare function recordExternCallSite(record: ExternCallSiteRecord): void;
14
+ export {};
@@ -0,0 +1,6 @@
1
+ import { type Expr } from "../../expr";
2
+ export declare function isFlowableExpr(expr: Expr, options?: {
3
+ allowSameFrameLocal?: boolean;
4
+ allowParameterSource?: boolean;
5
+ allowComptimeSource?: boolean;
6
+ }): boolean;
@@ -1,6 +1,6 @@
1
1
  import { type Environment } from "../../env";
2
2
  import { type Expr, type FnCallExpr } from "../../expr";
3
- import type { FunctionImplicitParameter, FunctionParameter, FunctionType, Type } from "../../types/definitions";
3
+ import type { FunctionParameter, FunctionType, Type } from "../../types/definitions";
4
4
  import type { EvaluatorContext } from "../context";
5
5
  export declare function evaluateFunctionParameter({ expr, env, context, isParameterComptimeByDefault, allowVariableShadowing, }: {
6
6
  expr: Expr;
@@ -32,7 +32,6 @@ export declare function evaluateFunctionParameters({ parameterExprs, env, contex
32
32
  }): {
33
33
  parameters: FunctionParameter[];
34
34
  forallParameters: FunctionParameter[];
35
- implicitParameters: FunctionImplicitParameter[];
36
35
  variadicParameter?: FunctionParameter;
37
36
  whereClauseExprs?: Expr[];
38
37
  env: Environment;
@@ -2,4 +2,3 @@ import { type Environment, type Variable } from "../env";
2
2
  import { type Expr } from "../expr";
3
3
  export declare function isValidVariableName(expr: Expr): boolean;
4
4
  export declare function findRcValueOwnerRelationship(rhs: Expr, env: Environment, _modulePath: string): Variable | undefined;
5
- export declare function throwExprIsImplicitVariableError(rhs: Expr): void;
@@ -1,4 +1,5 @@
1
1
  import { type Expr } from "./expr";
2
+ export declare function allPathsUnwind(expr: Expr): boolean;
2
3
  export declare function evaluatedBodyContainsEscape(expr: Expr): boolean;
3
4
  export declare function exprTreeContainsReturn(expr: Expr): boolean;
4
5
  export declare function exprContainsAwait(expr: Expr): boolean;
@@ -39,12 +39,12 @@ export interface RuntimeDestructuring {
39
39
  }
40
40
  export type ControlFlowFlags = {
41
41
  return?: boolean;
42
- escape?: boolean;
42
+ unwind?: boolean;
43
43
  break?: boolean;
44
44
  continue?: boolean;
45
45
  };
46
- export declare function controlFlowOf(kind: "return" | "escape" | "break" | "continue"): ControlFlowFlags;
47
- export declare function hasControlFlow(cf: ControlFlowFlags | undefined, kind: "return" | "escape" | "break" | "continue"): boolean;
46
+ export declare function controlFlowOf(kind: "return" | "unwind" | "break" | "continue"): ControlFlowFlags;
47
+ export declare function hasControlFlow(cf: ControlFlowFlags | undefined, kind: "return" | "unwind" | "break" | "continue"): boolean;
48
48
  export declare function hasAnyControlFlow(cf: ControlFlowFlags | undefined): boolean;
49
49
  export declare function mergeControlFlows(flows: ControlFlowFlags[]): ControlFlowFlags;
50
50
  export declare function controlFlowToString(cf: ControlFlowFlags): string;
@@ -86,6 +86,7 @@ export interface EvaluatedExprData {
86
86
  indexMethodType?: FunctionType;
87
87
  indexMethodValue?: Value;
88
88
  isIndexTraitAddressOf?: boolean;
89
+ isReturnSlot?: boolean;
89
90
  isCompileTimeOnlyAssignment?: boolean;
90
91
  isAnonymousFunctionDefinition?: boolean;
91
92
  comptimeUnrolledBodies?: Expr[];
@@ -118,8 +119,6 @@ export declare const BuiltinKeywords: {
118
119
  runtime: string[];
119
120
  ref: string[];
120
121
  forall: string[];
121
- using: string[];
122
- given: string[];
123
122
  where: string[];
124
123
  quote: string[];
125
124
  unquote: string[];
@@ -128,7 +127,8 @@ export declare const BuiltinKeywords: {
128
127
  recur: string[];
129
128
  fn: string[];
130
129
  unsafe_fn: string[];
131
- escape: string[];
130
+ ctl: string[];
131
+ unwind: string[];
132
132
  extern: string[];
133
133
  cond: string[];
134
134
  type: string[];
@@ -191,6 +191,8 @@ export declare const BuiltinFunctions: {
191
191
  typeid: string[];
192
192
  downcast: string[];
193
193
  consume: string[];
194
+ unsafe: string[];
195
+ pragma: string[];
194
196
  macro_expand: string[];
195
197
  as: string[];
196
198
  the: string[];
@@ -610,7 +612,7 @@ export interface ExprToStringConfig {
610
612
  }
611
613
  export declare function exprToString(expr: Expr, config?: ExprToStringConfig): string;
612
614
  export declare function consumeCaseBodyTempVar(evaluatedBody: Expr, env: Environment): Environment;
613
- export declare function attachTempVariableToExpr(expr: Expr, isOwningTheRcValue: boolean, isOwningTheSameRcValueAs?: Variable): void;
615
+ export declare function attachTempVariableToExpr(expr: Expr, isOwningTheRcValue: boolean, isOwningTheSameRcValueAs?: Variable, isRef?: boolean): void;
614
616
  export declare function mergeAndCheckEnvs(env: Environment, bodies: Expr[]): Environment;
615
617
  export declare function replaceFuncCallExprWithFuncCallExpr(funcExpr: FnCallExpr, newFuncExpr: FnCallExpr): void;
616
618
  export declare function replaceFuncCallExprWithAtomExpr(funcExpr: FnCallExpr, newAtomExpr: AtomExpr): void;
@@ -0,0 +1,19 @@
1
+ export interface PublicSafeFinding {
2
+ file: string;
3
+ line: number;
4
+ column: number;
5
+ declName: string;
6
+ slot: "parameter" | "return";
7
+ pointerType: string;
8
+ snippet: string;
9
+ }
10
+ export interface PublicSafeReport {
11
+ findings: PublicSafeFinding[];
12
+ totals: {
13
+ filesScanned: number;
14
+ publicDeclsScanned: number;
15
+ findings: number;
16
+ };
17
+ }
18
+ export declare function generatePublicSafeReport(rootPath: string): PublicSafeReport;
19
+ export declare function formatPublicSafeReport(report: PublicSafeReport): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,7 @@ import type { EvaluatorContext } from "../evaluator/context";
3
3
  import type { Expr } from "../expr";
4
4
  import type { FunctionValue } from "../function-value";
5
5
  import { type Value } from "../value";
6
- import type { ArrayType, ComptimeListType, DynType, EffectsRowType, EnumType, FnTraitType, FunctionForallParameter, FunctionImplicitParameter, FunctionParameter, FunctionParameterExprs, FunctionReturn, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, SliceType, SomeType, StructType, TraitType, TupleType, Type, TypeApplicationType, TypeField, TypeHierarchyType, UnionType, VoidType } from "./definitions";
6
+ import type { ArrayType, ComptimeListType, DynType, EnumType, FnTraitType, FunctionForallParameter, FunctionParameter, FunctionParameterExprs, FutureEffect, FunctionReturn, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, SliceType, SomeType, StructType, TraitType, TupleType, Type, TypeApplicationType, TypeField, TypeHierarchyType, UnionType, VoidType } from "./definitions";
7
7
  export declare function createComptimeIntType(): Type;
8
8
  export declare function createComptimeFloatType(): Type;
9
9
  export declare function createComptimeStringType(): Type;
@@ -45,10 +45,9 @@ 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, implicitParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, }: {
48
+ export declare function createFunctionType({ parameters, forallParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, isControl, }: {
49
49
  parameters: FunctionParameter[];
50
50
  forallParameters: FunctionForallParameter[];
51
- implicitParameters?: FunctionImplicitParameter[];
52
51
  variadicParameter: FunctionParameter | undefined;
53
52
  whereClauseExprs?: Expr[];
54
53
  return_: FunctionReturn;
@@ -57,6 +56,7 @@ export declare function createFunctionType({ parameters, forallParameters, impli
57
56
  SelfType?: Type;
58
57
  SelfTraitType?: Type;
59
58
  isClosure?: boolean;
59
+ isControl?: boolean;
60
60
  }): FunctionType;
61
61
  export declare function createPtrType(childType: Type): PtrType;
62
62
  export declare function createIsoType(childType: Type, env: Environment): IsoType;
@@ -71,8 +71,6 @@ export declare function createSomeType(type: TypeHierarchyType, variableName: st
71
71
  env: Environment;
72
72
  context: EvaluatorContext;
73
73
  }): SomeType;
74
- export declare function createEffectsRowSomeType(variableName: string, env: Environment): SomeType;
75
- export declare function createEffectsRowType(implicitParameters: FunctionImplicitParameter[]): EffectsRowType;
76
74
  export declare function createTypeHierarchy(level: number, baseType?: Type): TypeHierarchyType;
77
75
  export declare function getFunctionParameterExprs({ expr, labelExpr, typeExpr, defaultValueExpr, assignedValueExpr, }: {
78
76
  expr: Expr;
@@ -82,7 +80,7 @@ export declare function getFunctionParameterExprs({ expr, labelExpr, typeExpr, d
82
80
  assignedValueExpr: Expr | undefined;
83
81
  }): FunctionParameterExprs;
84
82
  export declare function createFnTraitType(fnType: FunctionType, env: Environment): FnTraitType;
85
- export declare function createFutureTraitType(outputType: Type, env: Environment, effects?: FunctionImplicitParameter[]): FutureTraitType;
83
+ export declare function createFutureTraitType(outputType: Type, env: Environment, effect?: FutureEffect): FutureTraitType;
86
84
  export declare function createDynType({ requiredTraits, env, negativeTraits, }: {
87
85
  requiredTraits: TraitType[];
88
86
  env: Environment;
@@ -53,14 +53,8 @@ export interface SomeType extends Type {
53
53
  functionValue: FunctionValue;
54
54
  argValues: Value[];
55
55
  };
56
- isEffectsRow?: boolean;
57
56
  kindFunctionType?: FunctionType;
58
57
  }
59
- export interface EffectsRowType extends Type {
60
- tag: TypeTag.EffectsRow;
61
- implicitParameters: FunctionImplicitParameter[];
62
- trait: TraitType;
63
- }
64
58
  export interface TypeApplicationType extends Type {
65
59
  tag: TypeTag.TypeApplication;
66
60
  constructor: SomeType;
@@ -119,18 +113,12 @@ export interface FunctionParameter {
119
113
  isCompileTimeOnly: boolean;
120
114
  isQuote: boolean;
121
115
  isOwningTheRcValue: boolean;
122
- isImplicit: boolean;
123
- isEffectRowSpread?: boolean;
116
+ isRef?: boolean;
124
117
  exprs: FunctionParameterExprs;
125
118
  assignedValue?: Value;
126
119
  }
127
120
  export type FunctionForallParameter = FunctionParameter & {
128
121
  isCompileTimeOnly: true;
129
- isImplicit: false;
130
- };
131
- export type FunctionImplicitParameter = FunctionParameter & {
132
- isCompileTimeOnly: true;
133
- isImplicit: true;
134
122
  };
135
123
  export interface StructType extends Type {
136
124
  tag: TypeTag.Struct;
@@ -164,7 +152,7 @@ export interface TraitType extends Type {
164
152
  };
165
153
  isFuture?: {
166
154
  outputType: Type;
167
- effects: FunctionImplicitParameter[];
155
+ effect?: FutureEffect;
168
156
  };
169
157
  isConcrete?: {
170
158
  concreteType: Type;
@@ -181,10 +169,14 @@ export type FnTraitType = TraitType & {
181
169
  callType: FunctionType;
182
170
  };
183
171
  };
172
+ export interface FutureEffect {
173
+ label: string;
174
+ type: Type;
175
+ }
184
176
  export type FutureTraitType = TraitType & {
185
177
  isFuture: {
186
178
  outputType: Type;
187
- effects: FunctionImplicitParameter[];
179
+ effect?: FutureEffect;
188
180
  };
189
181
  };
190
182
  export type ConcreteTraitType = TraitType & {
@@ -222,12 +214,12 @@ export interface FunctionReturn {
222
214
  isCompileTimeOnly: boolean;
223
215
  isUnquote: boolean;
224
216
  label: string;
217
+ isRef?: boolean;
225
218
  }
226
219
  export interface FunctionType extends Type {
227
220
  tag: TypeTag.Function;
228
221
  parameters: FunctionParameter[];
229
222
  forallParameters: FunctionForallParameter[];
230
- implicitParameters: FunctionImplicitParameter[];
231
223
  variadicParameter?: FunctionParameter;
232
224
  whereClauseExprs?: Expr[];
233
225
  return: FunctionReturn;
@@ -237,6 +229,7 @@ export interface FunctionType extends Type {
237
229
  SelfTraitType?: Type;
238
230
  trait: TraitType;
239
231
  isClosure?: boolean;
232
+ isControl?: boolean;
240
233
  }
241
234
  export interface PtrType extends Type {
242
235
  tag: TypeTag.Ptr;
@@ -1,5 +1,5 @@
1
1
  import { FunctionValue } from "../function-value";
2
- import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType, EffectsRowType, EnumType, FnTraitType, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, SliceType, SomeType, StructType, TraitType, TupleType, Type, TypeApplicationType, TypeHierarchyType, UnionType, VoidType } from "./definitions";
2
+ import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType, EnumType, FnTraitType, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, SliceType, SomeType, StructType, TraitType, TupleType, Type, TypeApplicationType, TypeHierarchyType, UnionType, VoidType } from "./definitions";
3
3
  export declare function isPrimitiveType(type: Type): boolean;
4
4
  export declare function isUnitType(type?: Type): boolean;
5
5
  export declare function isComptimeIntType(type?: Type): boolean;
@@ -77,4 +77,3 @@ export declare function isBoxedType(type: Type): type is StructType & {
77
77
  isReferenceSemantics: true;
78
78
  __isBoxed: true;
79
79
  };
80
- export declare function isEffectsRowType(type?: Type): type is EffectsRowType;
@@ -42,6 +42,5 @@ export declare enum TypeTag {
42
42
  Dyn = "Dyn",
43
43
  Expr = "Expr",
44
44
  ComptimeList = "ComptimeList",
45
- EffectsRow = "EffectsRow",
46
45
  TypeApplication = "TypeApplication"
47
46
  }
@@ -7,7 +7,12 @@ export declare function typeProhibitsComptimeModifier(type: Type | undefined, en
7
7
  export declare function isComptimeOnlyType(type: Type, env: Environment): boolean;
8
8
  export declare function isRuntimeOnlyType(type: Type, env: Environment): boolean;
9
9
  export declare function typeContainsRcType(type?: Type, checkedTypes?: Type[]): boolean;
10
+ export declare function typeIsControlBound(type?: Type, checkedTypes?: Type[]): boolean;
11
+ export declare function typeRepresentationContainsRawPtr(type?: Type, checkedTypes?: Type[]): boolean;
12
+ export declare function typeMayProvideSliceSource(type?: Type, checkedTypes?: Type[]): boolean;
10
13
  export declare function typeContainsSomeType(type?: Type, checkedTypes?: Type[]): boolean;
14
+ export declare function typeContainsUnboundSomeType(type?: Type, boundNames?: Set<string>, checkedTypes?: Type[]): boolean;
15
+ export declare function typeContainsSomeTypeForCodegenParam(type?: Type, checkedTypes?: Type[]): boolean;
11
16
  export declare function typeContainsUnknownValue(type: Type, visited?: Set<string>): boolean;
12
17
  export declare function getAllSomeTypes(type: Type): Set<SomeType>;
13
18
  export declare function typeRequiresInference(type?: Type): boolean;
@@ -0,0 +1,29 @@
1
+ export type UnsafeSubKind = "extern-call" | "deref" | "arith" | "addr-of" | "other";
2
+ export interface UnsafeFinding {
3
+ file: string;
4
+ line: number;
5
+ column: number;
6
+ kind: "unsafe" | "asm" | "extern" | "pragma";
7
+ subKind?: UnsafeSubKind;
8
+ calleeName?: string;
9
+ snippet: string;
10
+ safetyComment?: string;
11
+ }
12
+ export interface UnsafeReport {
13
+ privilegedFiles: string[];
14
+ findings: UnsafeFinding[];
15
+ totals: {
16
+ filesScanned: number;
17
+ privileged: number;
18
+ unsafeSites: number;
19
+ unsafeBySubKind: Record<UnsafeSubKind, number>;
20
+ asmSites: number;
21
+ externSites: number;
22
+ };
23
+ topExternCallees: Array<{
24
+ callee: string;
25
+ count: number;
26
+ }>;
27
+ }
28
+ export declare function generateUnsafeReport(rootPath: string): UnsafeReport;
29
+ export declare function formatUnsafeReport(report: UnsafeReport): string;
@@ -71,6 +71,7 @@ export type UnknownValue = {
71
71
  type: Type;
72
72
  variableName?: string;
73
73
  isRuntimeOnly?: boolean;
74
+ resolvedFuncValueId?: string;
74
75
  };
75
76
  export type PtrValue = {
76
77
  tag: ValueTag.Ptr;