From f3d2ab277029d28a3124e455d01f196c9a0ede36 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Mon, 24 Aug 2026 06:54:01 +0100 Subject: [PATCH] refactor: semantically port TS to AffineScript --- .../affinescript-deno-test/cli.affine | 16 +-- .../example/smoke_driver.affine | 6 +- .../affinescript-deno-test/lib/compile.affine | 26 ++-- .../lib/discover.affine | 16 +-- .../affinescript-deno-test/lib/runner.affine | 67 +++++----- .../affinescript-deno-test/mod.affine | 20 ++- .../editors/vscode/src/extension.affine | 58 +++++---- .../packages/affine-js/types.d.affine | 78 ++++++------ .../packages/affine-ts/types.d.affine | 44 +++---- cadre-router/mod.affine | 8 +- cadre-router/tea-router-pkg/mod.affine | 8 +- .../bindings/redis/tests/redis_test.affine | 36 +++--- .../src/syntax/sample-highlighting.affine | 22 ++-- .../@rescript/darwin-arm64/bin.d.affine | 12 +- .../@rescript/darwin-x64/bin.d.affine | 12 +- .../@rescript/linux-arm64/bin.d.affine | 12 +- .../packages/@rescript/linux-x64/bin.d.affine | 12 +- .../packages/@rescript/win32-x64/bin.d.affine | 12 +- .../src/StdlibNoShims.gen.affine | 114 +++++++++--------- .../stdlib-no-shims/src/index.affine | 18 ++- .../typescript-react-example/src/App.affine | 12 +- .../src/AutoAnnotate.gen.affine | 18 ++- .../src/BucklescriptAnnotations.gen.affine | 10 +- .../src/Comments.gen.affine | 18 ++- .../src/Core.gen.affine | 68 +++++------ .../src/CoreTS.affine | 10 +- .../src/Derivings.gen.affine | 14 +-- .../src/Docstrings.gen.affine | 46 ++++--- .../src/EmitModuleIfNoConversion.gen.affine | 18 ++- .../src/EscapedNames.gen.affine | 18 ++- .../src/ExportWithRename.gen.affine | 10 +- .../src/FirstClassModules.gen.affine | 22 ++-- .../src/FirstClassModulesInterface.gen.affine | 10 +- .../src/GADT.gen.affine | 10 +- .../src/Hooks.gen.affine | 112 +++++++++-------- .../src/IgnoreInterface.gen.affine | 8 +- .../src/ImportHookDefault.gen.affine | 30 ++--- .../src/ImportHooks.gen.affine | 28 ++--- .../src/ImportIndex.gen.affine | 14 +-- .../src/ImportJsValue.gen.affine | 74 ++++++------ .../src/Inherits.gen.affine | 12 +- .../src/InnerModuleSignature.gen.affine | 12 +- .../src/JSXV4.gen.affine | 34 +++--- .../src/LabeledFun.gen.affine | 8 +- .../src/LetPrivate.gen.affine | 8 +- .../src/Lib.gen.affine | 8 +- .../src/Machine.gen.affine | 10 +- .../src/ModuleAliases.gen.affine | 26 ++-- .../src/ModuleAliases2.gen.affine | 18 ++- .../src/ModuleResolution1.gen.affine | 8 +- .../src/ModuleResolution2.gen.affine | 8 +- .../src/MoreVariants.gen.affine | 14 +-- .../src/MyInput.affine | 10 +- .../src/MyInput.gen.affine | 16 +-- .../src/MyMath.affine | 34 +++--- .../src/MyModule.gen.affine | 10 +- .../src/NestedModules.gen.affine | 32 +++-- .../src/NestedModulesInSignature.gen.affine | 10 +- .../src/NestedVariants.gen.affine | 58 +++++---- .../src/NonrecursiveTypes.gen.affine | 16 +-- .../src/NumericPolyVar.gen.affine | 8 +- .../src/Object.gen.affine | 10 +- .../src/OnClick2.gen.affine | 10 +- .../src/Opaque.gen.affine | 14 +-- .../src/Records.gen.affine | 72 ++++++----- .../src/References.gen.affine | 28 ++--- .../src/Shadow.gen.affine | 8 +- .../src/TestEmitInnerModules.gen.affine | 16 +-- .../src/TestFirstClassModules.gen.affine | 16 +-- .../src/TestImmutableArray.gen.affine | 8 +- .../src/TestModuleAliases.gen.affine | 30 ++--- .../src/TestPromise.gen.affine | 16 +-- .../src/TransitiveType1.gen.affine | 10 +- .../src/TransitiveType2.gen.affine | 10 +- .../src/TransitiveType3.gen.affine | 10 +- .../src/TypeNameSanitize.gen.affine | 12 +- .../src/TypeParams1.gen.affine | 8 +- .../src/TypeParams2.gen.affine | 12 +- .../src/TypeParams3.gen.affine | 10 +- .../src/Unboxed.gen.affine | 28 ++--- .../src/Uncurried.gen.affine | 42 +++---- .../src/Usage.gen.affine | 8 +- .../src/UseImportJsValue.gen.affine | 10 +- .../src/Variants.gen.affine | 70 +++++------ .../src/VariantsWithPayload.gen.affine | 38 +++--- .../src/Warnings.gen.affine | 8 +- .../src/Wrapper.gen.affine | 12 +- .../src/counter.gen.affine | 8 +- .../src/hookExample.affine | 22 ++-- .../typescript-react-example/src/index.affine | 36 +++--- .../src/location/location.gen.affine | 8 +- .../src/nested/Tuples.gen.affine | 32 +++-- .../src/nested/Types.gen.affine | 108 ++++++++--------- .../src/react-app-env.d.affine | 6 +- .../src/shims/Belt.shim.affine | 8 +- .../src/shims/Js.shim.affine | 12 +- .../src/shims/Jsx.shim.affine | 8 +- .../src/shims/JsxEvent.shim.affine | 38 +++--- .../src/shims/RescriptPervasives.shim.affine | 20 ++- .../src/strange_file_names/404.gen.affine | 8 +- .../AppModal.web.gen.affine | 8 +- .../src/strange_file_names/_under.gen.affine | 8 +- .../with_underscore.gen.affine | 8 +- .../src/testReferences.affine | 10 +- .../tests/src/variantsMatching.gen.affine | 22 ++-- .../core/runtime-tools/bin/rrt.affine | 84 ++++++------- .../runtime-tools/tests/detect_test.affine | 18 ++- .../tests/safe_dom_high_assurance.test.affine | 20 ++- .../tests/safe_dom_high_assurance.test.affine | 20 ++- .../src/syntax/sample-highlighting.affine | 22 ++-- .../@rescript/darwin-arm64/bin.d.affine | 12 +- .../@rescript/darwin-x64/bin.d.affine | 12 +- .../@rescript/linux-arm64/bin.d.affine | 12 +- .../packages/@rescript/linux-x64/bin.d.affine | 12 +- .../packages/@rescript/win32-x64/bin.d.affine | 12 +- .../src/StdlibNoShims.gen.affine | 114 +++++++++--------- .../stdlib-no-shims/src/index.affine | 18 ++- .../typescript-react-example/src/App.affine | 12 +- .../src/AutoAnnotate.gen.affine | 18 ++- .../src/BucklescriptAnnotations.gen.affine | 10 +- .../src/Comments.gen.affine | 18 ++- .../src/Core.gen.affine | 68 +++++------ .../src/CoreTS.affine | 10 +- .../src/Derivings.gen.affine | 14 +-- .../src/Docstrings.gen.affine | 46 ++++--- .../src/EmitModuleIfNoConversion.gen.affine | 18 ++- .../src/EscapedNames.gen.affine | 18 ++- .../src/ExportWithRename.gen.affine | 10 +- .../src/FirstClassModules.gen.affine | 22 ++-- .../src/FirstClassModulesInterface.gen.affine | 10 +- .../src/GADT.gen.affine | 10 +- .../src/Hooks.gen.affine | 112 +++++++++-------- .../src/IgnoreInterface.gen.affine | 8 +- .../src/ImportHookDefault.gen.affine | 30 ++--- .../src/ImportHooks.gen.affine | 28 ++--- .../src/ImportIndex.gen.affine | 14 +-- .../src/ImportJsValue.gen.affine | 74 ++++++------ .../src/Inherits.gen.affine | 12 +- .../src/InnerModuleSignature.gen.affine | 12 +- .../src/JSXV4.gen.affine | 34 +++--- .../src/LabeledFun.gen.affine | 8 +- .../src/LetPrivate.gen.affine | 8 +- .../src/Lib.gen.affine | 8 +- .../src/Machine.gen.affine | 10 +- .../src/ModuleAliases.gen.affine | 26 ++-- .../src/ModuleAliases2.gen.affine | 18 ++- .../src/ModuleResolution1.gen.affine | 8 +- .../src/ModuleResolution2.gen.affine | 8 +- .../src/MoreVariants.gen.affine | 14 +-- .../src/MyInput.affine | 10 +- .../src/MyInput.gen.affine | 16 +-- .../src/MyMath.affine | 34 +++--- .../src/MyModule.gen.affine | 10 +- .../src/NestedModules.gen.affine | 32 +++-- .../src/NestedModulesInSignature.gen.affine | 10 +- .../src/NestedVariants.gen.affine | 58 +++++---- .../src/NonrecursiveTypes.gen.affine | 16 +-- .../src/NumericPolyVar.gen.affine | 8 +- .../src/Object.gen.affine | 10 +- .../src/OnClick2.gen.affine | 10 +- .../src/Opaque.gen.affine | 14 +-- .../src/Records.gen.affine | 72 ++++++----- .../src/References.gen.affine | 28 ++--- .../src/Shadow.gen.affine | 8 +- .../src/TestEmitInnerModules.gen.affine | 16 +-- .../src/TestFirstClassModules.gen.affine | 16 +-- .../src/TestImmutableArray.gen.affine | 8 +- .../src/TestModuleAliases.gen.affine | 30 ++--- .../src/TestPromise.gen.affine | 16 +-- .../src/TransitiveType1.gen.affine | 10 +- .../src/TransitiveType2.gen.affine | 10 +- .../src/TransitiveType3.gen.affine | 10 +- .../src/TypeNameSanitize.gen.affine | 12 +- .../src/TypeParams1.gen.affine | 8 +- .../src/TypeParams2.gen.affine | 12 +- .../src/TypeParams3.gen.affine | 10 +- .../src/Unboxed.gen.affine | 28 ++--- .../src/Uncurried.gen.affine | 42 +++---- .../src/Usage.gen.affine | 8 +- .../src/UseImportJsValue.gen.affine | 10 +- .../src/Variants.gen.affine | 70 +++++------ .../src/VariantsWithPayload.gen.affine | 38 +++--- .../src/Warnings.gen.affine | 8 +- .../src/Wrapper.gen.affine | 12 +- .../src/counter.gen.affine | 8 +- .../src/hookExample.affine | 22 ++-- .../typescript-react-example/src/index.affine | 36 +++--- .../src/location/location.gen.affine | 8 +- .../src/nested/Tuples.gen.affine | 32 +++-- .../src/nested/Types.gen.affine | 108 ++++++++--------- .../src/react-app-env.d.affine | 6 +- .../src/shims/Belt.shim.affine | 8 +- .../src/shims/Js.shim.affine | 12 +- .../src/shims/Jsx.shim.affine | 8 +- .../src/shims/JsxEvent.shim.affine | 38 +++--- .../src/shims/RescriptPervasives.shim.affine | 20 ++- .../src/strange_file_names/404.gen.affine | 8 +- .../AppModal.web.gen.affine | 8 +- .../src/strange_file_names/_under.gen.affine | 8 +- .../with_underscore.gen.affine | 8 +- .../src/testReferences.affine | 10 +- .../tests/src/variantsMatching.gen.affine | 22 ++-- .../deno-fresh/well_known_middleware.affine | 22 ++-- .../deno-fresh/well_known_plugin.affine | 16 +-- 204 files changed, 1883 insertions(+), 2700 deletions(-) diff --git a/affinescript-ecosystem/affinescript-deno-test/cli.affine b/affinescript-ecosystem/affinescript-deno-test/cli.affine index ed5f7802..66cdf49a 100644 --- a/affinescript-ecosystem/affinescript-deno-test/cli.affine +++ b/affinescript-ecosystem/affinescript-deno-test/cli.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module cli; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -27,7 +24,7 @@ module cli; import { compileToWasm } from "./lib/compile.ts"; import { discoverTestFiles } from "./lib/discover.ts"; -function usage(): never { +fn usage(): never { console.error( "Usage: deno run --allow-read --allow-run --allow-env cli.ts \n" + "\n" + @@ -39,10 +36,10 @@ function usage(): never { } if (import.meta.main) { - const root = Deno.args[0]; + let root = Deno.args[0]; if (!root) usage(); - const sources = await discoverTestFiles(root); + let sources = await discoverTestFiles(root); if (sources.length === 0) { console.error(`No *_test.affine files found under ${root}`); Deno.exit(1); @@ -51,14 +48,13 @@ if (import.meta.main) { console.log(`Discovered ${sources.length} test file(s):`); for (const source of sources) { try { - const wasm = await compileToWasm(source); + let wasm = await compileToWasm(source); console.log(` ✓ ${source} → ${wasm}`); } catch (error) { - const message = error instanceof Error ? error.message : String(error); + let message = error instanceof Error ? error.message : String(error); console.error(` ✗ ${source}\n ${message}`); Deno.exit(1); } } } -==================================== */ diff --git a/affinescript-ecosystem/affinescript-deno-test/example/smoke_driver.affine b/affinescript-ecosystem/affinescript-deno-test/example/smoke_driver.affine index 04be5c0c..a872dbba 100644 --- a/affinescript-ecosystem/affinescript-deno-test/example/smoke_driver.affine +++ b/affinescript-ecosystem/affinescript-deno-test/example/smoke_driver.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module smoke_driver; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -21,4 +18,3 @@ import { runAll } from "../mod.ts"; await runAll(new URL("./", import.meta.url).pathname); -==================================== */ diff --git a/affinescript-ecosystem/affinescript-deno-test/lib/compile.affine b/affinescript-ecosystem/affinescript-deno-test/lib/compile.affine index 5d580df6..c5388073 100644 --- a/affinescript-ecosystem/affinescript-deno-test/lib/compile.affine +++ b/affinescript-ecosystem/affinescript-deno-test/lib/compile.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module compile; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -14,16 +11,16 @@ module compile; // Wraps the `affinescript compile` CLI. Given a `.affine` source file, // produces a sibling `.wasm` file and returns its absolute path. // -// The `AFFINESCRIPT_BIN` env var overrides the default path to the compiler. +// The `AFFINESCRIPT_BIN` env let overrides the default path to the compiler. // Default is the local dev-build at developer-ecosystem/nextgen-languages/ // affinescript/_build/install/default/bin/affinescript (useful while the // compiler is not on $PATH). -const DEFAULT_BIN = +let DEFAULT_BIN = "/var/mnt/eclipse/repos/developer-ecosystem/nextgen-languages/affinescript/_build/install/default/bin/affinescript"; /** Absolute path to the `affinescript` compiler binary. */ -export function resolveCompilerPath(): string { +fn resolveCompilerPath(): string { return Deno.env.get("AFFINESCRIPT_BIN") ?? DEFAULT_BIN; } @@ -32,20 +29,20 @@ export function resolveCompilerPath(): string { * path to the emitted `.wasm`. Throws with compiler stderr if compilation * fails. */ -export async function compileToWasm(sourcePath: string): Promise { - const absolute = sourcePath.startsWith("/") +async fn compileToWasm(sourcePath: string): string { + let absolute = sourcePath.startsWith("/") ? sourcePath : `${Deno.cwd()}/${sourcePath}`; - const wasmPath = absolute.replace(/\.(affine|afs|rattle|pyaff|jsaff)$/, ".wasm"); + let wasmPath = absolute.replace(/\.(affine|afs|rattle|pyaff|jsaff)$/, ".wasm"); if (wasmPath === absolute) { throw new Error( `compileToWasm: source file must end in .affine / .afs / .rattle / .pyaff / .jsaff — got ${sourcePath}`, ); } - const bin = resolveCompilerPath(); - const cmd = new Deno.Command(bin, { + let bin = resolveCompilerPath(); + let cmd = new Deno.Command(bin, { args: ["compile", absolute, "-o", wasmPath], stdout: "piped", stderr: "piped", @@ -53,8 +50,8 @@ export async function compileToWasm(sourcePath: string): Promise { const { code, stdout, stderr } = await cmd.output(); if (code !== 0) { - const out = new TextDecoder().decode(stdout); - const err = new TextDecoder().decode(stderr); + let out = new TextDecoder().decode(stdout); + let err = new TextDecoder().decode(stderr); throw new Error( `affinescript compile failed (exit ${code}) for ${sourcePath}\n` + `STDOUT:\n${out}\nSTDERR:\n${err}`, @@ -64,4 +61,3 @@ export async function compileToWasm(sourcePath: string): Promise { return wasmPath; } -==================================== */ diff --git a/affinescript-ecosystem/affinescript-deno-test/lib/discover.affine b/affinescript-ecosystem/affinescript-deno-test/lib/discover.affine index 40025422..0542c9cc 100644 --- a/affinescript-ecosystem/affinescript-deno-test/lib/discover.affine +++ b/affinescript-ecosystem/affinescript-deno-test/lib/discover.affine @@ -1,33 +1,30 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module discover; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // // affinescript-deno-test: discover.ts // // Glob-based discovery of AffineScript test files. -// Default convention: any file matching `*_test.affine` or `*.test.affine`. +// Default convention: unknown file matching `*_test.affine` or `*.test.affine`. import { walk } from "jsr:@std/fs@1/walk"; /** Default regex for matching AffineScript test files by filename. */ -export const DEFAULT_TEST_PATTERN = /(?:_test|\.test)\.(?:affine|afs|rattle|pyaff|jsaff)$/; +let DEFAULT_TEST_PATTERN = /(?:_test|\.test)\.(?:affine|afs|rattle|pyaff|jsaff)$/; /** * Recursively walk `root` and return absolute paths of files matching * `pattern` (default: `*_test.affine` or `*.test.affine`). */ -export async function discoverTestFiles( +async fn discoverTestFiles( root: string, pattern: RegExp = DEFAULT_TEST_PATTERN, -): Promise { - const absoluteRoot = root.startsWith("/") ? root : `${Deno.cwd()}/${root}`; +): string[] { + let absoluteRoot = root.startsWith("/") ? root : `${Deno.cwd()}/${root}`; const matches: string[] = []; for await (const entry of walk(absoluteRoot, { includeDirs: false, match: [pattern] })) { @@ -38,4 +35,3 @@ export async function discoverTestFiles( return matches; } -==================================== */ diff --git a/affinescript-ecosystem/affinescript-deno-test/lib/runner.affine b/affinescript-ecosystem/affinescript-deno-test/lib/runner.affine index e5d035ea..53a00e20 100644 --- a/affinescript-ecosystem/affinescript-deno-test/lib/runner.affine +++ b/affinescript-ecosystem/affinescript-deno-test/lib/runner.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module runner; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -13,13 +10,12 @@ module runner; // // Loads a compiled AffineScript WASM module and wraps every exported function // whose name starts with `test_` as a Deno.test() case. A test passes when -// the function returns `true`, fails when it returns `false`. +// the fn returns `true`, fails when it returns `false`. // // Convention (v0.2.0): each `.affine` file may define multiple tests via -// the `pub fn test_() -> Bool` syntax. Every `pub fn test_*` export -// becomes a separate Deno.test() case. Non-`pub` helpers stay internal to +// the `pub fn test_() -> Bool` syntax. Every `pub fn test_*` // becomes a separate Deno.test() case. Non-`pub` helpers stay internal to // the module. This relies on the AffineScript compiler honouring `fd_vis` -// in its WASM-export decision (commit ce324fa, both codegen.ml and +// in its WASM-decision (commit ce324fa, both codegen.ml and // codegen_gc.ml). // // Uses the existing @hyperpolymath/affine-js bridge for WASM loading and @@ -29,23 +25,23 @@ module runner; import { AffineModule } from "@hyperpolymath/affine-js"; /** Convention: every `pub fn` whose name begins with this prefix is a test. */ -export const TEST_PREFIX = "test_"; +let TEST_PREFIX = "test_"; /** Result shape returned by AffineScript Bool exports (via affine-js). */ -interface BoolValue { +struct BoolValue { kind: "bool"; value: boolean; } /** - * Derive the Deno.test() case name from the file basename + export name. - * For a wasm at `/path/to/math_test.wasm` with export `test_add`, yields + * Derive the Deno.test() case name from the file basename + name. + * For a wasm at `/path/to/math_test.wasm` with `test_add`, yields * `math / add`. */ -function caseName(wasmPath: string, exportName: string): string { - const base = wasmPath.split("/").pop() ?? wasmPath; - const fileStem = base.replace(/\.wasm$/, "").replace(/(_test|\.test)$/, ""); - const caseStem = exportName.replace(/^test_/, ""); +fn caseName(wasmPath: string, exportName: string): string { + let base = wasmPath.split("/").pop() ?? wasmPath; + let fileStem = base.replace(/\.wasm$/, "").replace(/(_test|\.test)$/, ""); + let caseStem = exportName.replace(/^test_/, ""); return `${fileStem} / ${caseStem}`; } @@ -55,7 +51,7 @@ function caseName(wasmPath: string, exportName: string): string { * do not use IO. For test modules that only return Bool, we can satisfy this * with a no-op that reports `0` bytes written on every call. */ -function makeWasiStub(): WebAssembly.ModuleImports { +fn makeWasiStub(): WebAssembly.ModuleImports { return { fd_write: ( _fd: number, @@ -71,22 +67,22 @@ function makeWasiStub(): WebAssembly.ModuleImports { } /** - * Register a Deno.test() case for every `test_*` export in the WASM module + * Register a Deno.test() case for every `test_*` in the WASM module * at `wasmPath`. Path should be absolute; relative paths resolve against CWD. * * Returns the number of tests registered. Throws if no `test_*` exports * are found (indicating a misconfigured file — at least one `pub fn test_*` * is expected). */ -export async function registerTestsFromWasm(wasmPath: string): Promise { - const absolute = wasmPath.startsWith("/") +async fn registerTestsFromWasm(wasmPath: string): number { + let absolute = wasmPath.startsWith("/") ? wasmPath : `${Deno.cwd()}/${wasmPath}`; - const bytes = await Deno.readFile(absolute); - const wasmMod = await WebAssembly.compile(bytes); - const neededImports = WebAssembly.Module.imports(wasmMod); - const needsWasi = neededImports.some((i) => i.module === "wasi_snapshot_preview1"); + let bytes = await Deno.readFile(absolute); + let wasmMod = await WebAssembly.compile(bytes); + let neededImports = WebAssembly.Module.imports(wasmMod); + let needsWasi = neededImports.some((i) => i.module === "wasi_snapshot_preview1"); // AffineModule.fromBytes only supplies imports under the "env" module key, // so when WASI is required we must take the alternative path: raw @@ -95,8 +91,8 @@ export async function registerTestsFromWasm(wasmPath: string): Promise { return await registerTestsWithWasi(bytes, wasmPath); } - const mod = await AffineModule.fromBytes(bytes); - const testExports = mod.functionExports.filter((name: string) => + let mod = await AffineModule.fromBytes(bytes); + let testExports = mod.functionExports.filter((name: string) => name.startsWith(TEST_PREFIX) ); @@ -110,7 +106,7 @@ export async function registerTestsFromWasm(wasmPath: string): Promise { for (const exportName of testExports) { Deno.test(caseName(wasmPath, exportName), () => { - const result = mod.call(exportName, { returnType: "bool" }) as BoolValue; + let result = mod.call(exportName, { returnType: "bool" }) as BoolValue; if (result.kind !== "bool") { throw new Error( `test '${exportName}' returned non-bool value: ${JSON.stringify(result)}`, @@ -129,39 +125,39 @@ export async function registerTestsFromWasm(wasmPath: string): Promise { * wasi_snapshot_preview1. Bypasses AffineModule because its constructor * only accepts imports under the "env" module key. */ -async function registerTestsWithWasi( +async fn registerTestsWithWasi( bytes: Uint8Array, wasmPath: string, -): Promise { +): number { // Copy into a fresh ArrayBuffer-backed Uint8Array so the TS BufferSource // overload matches (Deno's Uint8Array default-types to ArrayBufferLike, // which the WebAssembly.instantiate overload rejects). - const buf = new Uint8Array(bytes.byteLength); + let buf = new Uint8Array(bytes.byteLength); buf.set(bytes); const { instance } = await WebAssembly.instantiate(buf.buffer, { env: {}, wasi_snapshot_preview1: makeWasiStub(), }); - const testExports = Object.keys(instance.exports).filter( + let testExports = Object.keys(instance.exports).filter( (name) => typeof instance.exports[name] === "function" && name.startsWith(TEST_PREFIX), ); if (testExports.length === 0) { - const available = Object.keys(instance.exports).join(", "); + let available = Object.keys(instance.exports).join(", "); throw new Error( - `affinescript-deno-test: no '${TEST_PREFIX}*' function exports found in ${wasmPath}. ` + + `affinescript-deno-test: no '${TEST_PREFIX}*' fn exports found in ${wasmPath}. ` + `Available: [${available}]. ` + `Each test must be declared as 'pub fn test_() -> Bool'.`, ); } for (const exportName of testExports) { - const fn = instance.exports[exportName] as () => number; + let fn = instance.exports[exportName] as () => number; Deno.test(caseName(wasmPath, exportName), () => { - const raw = fn(); + let raw = fn(); // AffineScript compiles Bool to i32 (0 = false, 1 = true). if (raw !== 0 && raw !== 1) { throw new Error( @@ -177,4 +173,3 @@ async function registerTestsWithWasi( return testExports.length; } -==================================== */ diff --git a/affinescript-ecosystem/affinescript-deno-test/mod.affine b/affinescript-ecosystem/affinescript-deno-test/mod.affine index a27b438b..6ccea351 100644 --- a/affinescript-ecosystem/affinescript-deno-test/mod.affine +++ b/affinescript-ecosystem/affinescript-deno-test/mod.affine @@ -1,18 +1,15 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module mod; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // // affinescript-deno-test: mod.ts (public API) // // High-level entry point. Compiles matching AffineScript test files under a -// given root, then registers every `test_*` WASM export as a Deno.test() case. +// given root, then registers every `test_*` WASM as a Deno.test() case. // // Usage (library mode, from a harness script): // @@ -28,9 +25,9 @@ import { compileToWasm } from "./lib/compile.ts"; import { discoverTestFiles } from "./lib/discover.ts"; import { registerTestsFromWasm } from "./lib/runner.ts"; -export { compileToWasm, resolveCompilerPath } from "./lib/compile.ts"; -export { DEFAULT_TEST_PATTERN, discoverTestFiles } from "./lib/discover.ts"; -export { TEST_PREFIX, registerTestsFromWasm } from "./lib/runner.ts"; +{ compileToWasm, resolveCompilerPath } from "./lib/compile.ts"; +{ DEFAULT_TEST_PATTERN, discoverTestFiles } from "./lib/discover.ts"; +{ TEST_PREFIX, registerTestsFromWasm } from "./lib/runner.ts"; /** * Discover, compile, and register every AffineScript test file under `root`. @@ -38,8 +35,8 @@ export { TEST_PREFIX, registerTestsFromWasm } from "./lib/runner.ts"; * Returns the total number of test cases registered across all files. * Deno's test framework reports pass/fail per case when `deno test` runs. */ -export async function runAll(root: string): Promise { - const sources = await discoverTestFiles(root); +async fn runAll(root: string): number { + let sources = await discoverTestFiles(root); if (sources.length === 0) { throw new Error( `affinescript-deno-test: no test files found under ${root} ` + @@ -49,10 +46,9 @@ export async function runAll(root: string): Promise { let total = 0; for (const source of sources) { - const wasm = await compileToWasm(source); + let wasm = await compileToWasm(source); total += await registerTestsFromWasm(wasm); } return total; } -==================================== */ diff --git a/affinescript-ecosystem/rattlescript/affinescript/editors/vscode/src/extension.affine b/affinescript-ecosystem/rattlescript/affinescript/editors/vscode/src/extension.affine index a36286d0..ab3881ef 100644 --- a/affinescript-ecosystem/rattlescript/affinescript/editors/vscode/src/extension.affine +++ b/affinescript-ecosystem/rattlescript/affinescript/editors/vscode/src/extension.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module extension; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MIT OR AGPL-3.0-or-later // AffineScript VSCode Extension @@ -20,11 +17,11 @@ import { Executable } from 'vscode-languageclient/node'; -const execAsync = promisify(exec); +let execAsync = promisify(exec); let client: LanguageClient | undefined; -export function activate(context: vscode.ExtensionContext) { +fn activate(context: vscode.ExtensionContext) { console.log('AffineScript extension activated'); // Register commands @@ -37,22 +34,22 @@ export function activate(context: vscode.ExtensionContext) { ); // Start LSP if enabled - const config = vscode.workspace.getConfiguration('affinescript'); + let config = vscode.workspace.getConfiguration('affinescript'); if (config.get('lsp.enabled')) { startLsp(context); } } -export function deactivate(): Thenable | undefined { +fn deactivate(): Thenable | undefined { if (!client) { return undefined; } return client.stop(); } -async function startLsp(context: vscode.ExtensionContext) { - const config = vscode.workspace.getConfiguration('affinescript'); - const serverPath = config.get('lsp.serverPath') || 'affinescript-lsp'; +async fn startLsp(context: vscode.ExtensionContext) { + let config = vscode.workspace.getConfiguration('affinescript'); + let serverPath = config.get('lsp.serverPath') || 'affinescript-lsp'; // Check if LSP server exists try { @@ -87,74 +84,73 @@ async function startLsp(context: vscode.ExtensionContext) { vscode.window.showInformationMessage('AffineScript LSP started'); } -async function restartLsp() { +async fn restartLsp() { if (client) { await client.stop(); vscode.window.showInformationMessage('AffineScript LSP stopped'); } - const context = (global as any).extensionContext; + let context = (global as unknown).extensionContext; if (context) { await startLsp(context); } } -async function checkCurrentFile() { - const editor = vscode.window.activeTextEditor; +async fn checkCurrentFile() { + let editor = vscode.window.activeTextEditor; if (!editor || editor.document.languageId !== 'affinescript') { vscode.window.showErrorMessage('No AffineScript file open'); return; } - const filePath = editor.document.uri.fsPath; - const terminal = vscode.window.createTerminal('AffineScript Check'); + let filePath = editor.document.uri.fsPath; + let terminal = vscode.window.createTerminal('AffineScript Check'); terminal.show(); terminal.sendText(`affinescript check "${filePath}"`); } -async function evalCurrentFile() { - const editor = vscode.window.activeTextEditor; +async fn evalCurrentFile() { + let editor = vscode.window.activeTextEditor; if (!editor || editor.document.languageId !== 'affinescript') { vscode.window.showErrorMessage('No AffineScript file open'); return; } - const filePath = editor.document.uri.fsPath; - const terminal = vscode.window.createTerminal('AffineScript Eval'); + let filePath = editor.document.uri.fsPath; + let terminal = vscode.window.createTerminal('AffineScript Eval'); terminal.show(); terminal.sendText(`affinescript eval "${filePath}"`); } -async function compileCurrentFile() { - const editor = vscode.window.activeTextEditor; +async fn compileCurrentFile() { + let editor = vscode.window.activeTextEditor; if (!editor || editor.document.languageId !== 'affinescript') { vscode.window.showErrorMessage('No AffineScript file open'); return; } - const filePath = editor.document.uri.fsPath; - const outputPath = filePath.replace(/\.affine$/, '.wasm'); + let filePath = editor.document.uri.fsPath; + let outputPath = filePath.replace(/\.affine$/, '.wasm'); - const terminal = vscode.window.createTerminal('AffineScript Compile'); + let terminal = vscode.window.createTerminal('AffineScript Compile'); terminal.show(); terminal.sendText(`affinescript compile "${filePath}" -o "${outputPath}"`); } -async function formatCurrentFile() { - const editor = vscode.window.activeTextEditor; +async fn formatCurrentFile() { + let editor = vscode.window.activeTextEditor; if (!editor || editor.document.languageId !== 'affinescript') { vscode.window.showErrorMessage('No AffineScript file open'); return; } - const filePath = editor.document.uri.fsPath; + let filePath = editor.document.uri.fsPath; try { const { stdout } = await execAsync(`affinescript fmt "${filePath}"`); vscode.window.showInformationMessage('File formatted successfully'); - } catch (error: any) { + } catch (error: unknown) { vscode.window.showErrorMessage(`Formatting failed: ${error.message}`); } } -==================================== */ diff --git a/affinescript-ecosystem/rattlescript/affinescript/packages/affine-js/types.d.affine b/affinescript-ecosystem/rattlescript/affinescript/packages/affine-js/types.d.affine index b5b3da69..f065363d 100644 --- a/affinescript-ecosystem/rattlescript/affinescript/packages/affine-js/types.d.affine +++ b/affinescript-ecosystem/rattlescript/affinescript/packages/affine-js/types.d.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module types.d; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -20,19 +17,19 @@ module types.d; // ── AffineValue discriminated union ────────────────────────────────────────── -export type AffineInt = { kind: "int"; value: number }; -export type AffineFloat = { kind: "float"; value: number }; -export type AffineBool = { kind: "bool"; value: boolean }; -export type AffineUnit = { kind: "unit" }; -export type AffineString = { kind: "string"; value: string }; -export type AffineSome = { kind: "some"; value: AffineValue }; -export type AffineNone = { kind: "none" }; -export type AffineOk = { kind: "ok"; value: AffineValue }; -export type AffineErr = { kind: "err"; value: AffineValue }; -export type AffineArray = { kind: "array"; elements: AffineValue[] }; -export type AffineRecord = { kind: "record"; fields: Record }; - -export type AffineValue = +struct AffineInt { { kind: "int"; value: number }; +struct AffineFloat { { kind: "float"; value: number }; +struct AffineBool { { kind: "bool"; value: boolean }; +struct AffineUnit { { kind: "unit" }; +struct AffineString { { kind: "string"; value: string }; +struct AffineSome { { kind: "some"; value: AffineValue }; +struct AffineNone { { kind: "none" }; +struct AffineOk { { kind: "ok"; value: AffineValue }; +struct AffineErr { { kind: "err"; value: AffineValue }; +struct AffineArray { { kind: "array"; elements: AffineValue[] }; +struct AffineRecord { { kind: "record"; fields: Record }; + +struct AffineValue { | AffineInt | AffineFloat | AffineBool @@ -47,7 +44,7 @@ export type AffineValue = // ── Return type hint ────────────────────────────────────────────────────────── -export type AffineValueType = +struct AffineValueType { | "int" | "float" | "bool" @@ -60,7 +57,7 @@ export type AffineValueType = // ── LoadOptions ─────────────────────────────────────────────────────────────── -export interface LoadOptions { +struct LoadOptions { /** * Extra host imports merged with the default AffineScript runtime. * @@ -76,7 +73,7 @@ export interface LoadOptions { // ── CallOptions ─────────────────────────────────────────────────────────────── -export interface CallOptions extends LoadOptions { +struct CallOptions extends LoadOptions { /** * Type hint for the return value unmarshaler. * @@ -89,19 +86,19 @@ export interface CallOptions extends LoadOptions { // ── AffineModule ────────────────────────────────────────────────────────────── -export declare class AffineModule { +declare struct AffineModule { /** * Load a compiled AffineScript `.wasm` file from the local filesystem. */ - static fromFile(path: string | URL, options?: LoadOptions): Promise; + static fromFile(path: string | URL, options?: LoadOptions): AffineModule; /** * Load a compiled AffineScript module from raw WASM bytes. */ - static fromBytes(bytes: Uint8Array | ArrayBuffer, options?: LoadOptions): Promise; + static fromBytes(bytes: Uint8Array | ArrayBuffer, options?: LoadOptions): AffineModule; /** - * Call a named export by name. + * Call a named by name. */ call(name: string, options?: CallOptions, ...args: AffineValue[]): AffineValue; @@ -123,17 +120,17 @@ export declare class AffineModule { // ── Top-level functions ─────────────────────────────────────────────────────── /** Load and run a compiled AffineScript program in one call. */ -export declare function run(path: string | URL, options?: LoadOptions): Promise; +declare fn run(path: string | URL, options?: LoadOptions): AffineValue; /** Marshal an AffineValue to a raw WASM operand. */ -export declare function marshal( +declare fn marshal( value: AffineValue, memory: WebAssembly.Memory, alloc: (n: number) => number, ): number; /** Unmarshal a raw WASM operand to an AffineValue. */ -export declare function unmarshal( +declare fn unmarshal( raw: number, valueType: AffineValueType, memory: WebAssembly.Memory, @@ -141,21 +138,20 @@ export declare function unmarshal( // ── AffineValue constructors ────────────────────────────────────────────────── -export declare function int(value: number): AffineInt; -export declare function float(value: number): AffineFloat; -export declare function bool(value: boolean): AffineBool; -export declare function unit(): AffineUnit; -export declare function string(value: string): AffineString; -export declare function some(value: AffineValue): AffineSome; -export declare function none(): AffineNone; -export declare function ok(value: AffineValue): AffineOk; -export declare function err(value: AffineValue): AffineErr; -export declare function array(elements: AffineValue[]): AffineArray; -export declare function record(fields: Record): AffineRecord; +declare fn int(value: number): AffineInt; +declare fn float(value: number): AffineFloat; +declare fn bool(value: boolean): AffineBool; +declare fn unit(): AffineUnit; +declare fn string(value: string): AffineString; +declare fn some(value: AffineValue): AffineSome; +declare fn none(): AffineNone; +declare fn ok(value: AffineValue): AffineOk; +declare fn err(value: AffineValue): AffineErr; +declare fn array(elements: AffineValue[]): AffineArray; +declare fn record(fields: Record): AffineRecord; // ── Runtime constants ───────────────────────────────────────────────────────── -export declare const AFFINE_TAG: Readonly<{ NONE: 0; SOME: 1; OK: 2; ERR: 3 }>; -export declare const AFFINE_SIZE: Readonly<{ INT: 4; FLOAT: 8; PTR: 4; TAG: 4; LEN: 4 }>; +declare const AFFINE_TAG: Readonly<{ NONE: 0; SOME: 1; OK: 2; ERR: 3 }>; +declare const AFFINE_SIZE: Readonly<{ INT: 4; FLOAT: 8; PTR: 4; TAG: 4; LEN: 4 }>; -==================================== */ diff --git a/affinescript-ecosystem/rattlescript/affinescript/packages/affine-ts/types.d.affine b/affinescript-ecosystem/rattlescript/affinescript/packages/affine-ts/types.d.affine index 5c4acd1e..2590718b 100644 --- a/affinescript-ecosystem/rattlescript/affinescript/packages/affine-ts/types.d.affine +++ b/affinescript-ecosystem/rattlescript/affinescript/packages/affine-ts/types.d.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module types.d; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -13,7 +10,7 @@ module types.d; // // Re-exports everything from affine-js and adds affine-ts typed helpers. -export * from "@hyperpolymath/affine-js"; +* from "@hyperpolymath/affine-js"; import type { AffineModule, @@ -30,42 +27,41 @@ import type { // ── Typed call helpers ──────────────────────────────────────────────────────── -/** Call an export and coerce the return value to Int. */ -export declare function callInt(mod: AffineModule, name: string, ...args: AffineValue[]): AffineInt; +/** Call an and coerce the return value to Int. */ +declare fn callInt(mod: AffineModule, name: string, ...args: AffineValue[]): AffineInt; -/** Call an export and coerce the return value to Float. */ -export declare function callFloat(mod: AffineModule, name: string, ...args: AffineValue[]): AffineFloat; +/** Call an and coerce the return value to Float. */ +declare fn callFloat(mod: AffineModule, name: string, ...args: AffineValue[]): AffineFloat; -/** Call an export and coerce the return value to Bool. */ -export declare function callBool(mod: AffineModule, name: string, ...args: AffineValue[]): AffineBool; +/** Call an and coerce the return value to Bool. */ +declare fn callBool(mod: AffineModule, name: string, ...args: AffineValue[]): AffineBool; -/** Call an export and coerce the return value to String. */ -export declare function callString(mod: AffineModule, name: string, ...args: AffineValue[]): AffineString; +/** Call an and coerce the return value to String. */ +declare fn callString(mod: AffineModule, name: string, ...args: AffineValue[]): AffineString; -/** Call an export and coerce the return value to Option. */ -export declare function callOption(mod: AffineModule, name: string, ...args: AffineValue[]): AffineSome | AffineNone; +/** Call an and coerce the return value to Option. */ +declare fn callOption(mod: AffineModule, name: string, ...args: AffineValue[]): AffineSome | AffineNone; -/** Call an export and coerce the return value to Result. */ -export declare function callResult(mod: AffineModule, name: string, ...args: AffineValue[]): AffineOk | AffineErr; +/** Call an and coerce the return value to Result. */ +declare fn callResult(mod: AffineModule, name: string, ...args: AffineValue[]): AffineOk | AffineErr; // ── Narrowing helpers ───────────────────────────────────────────────────────── /** Assert Some and extract payload; throws on None. */ -export declare function expectSome(value: AffineValue): AffineValue; +declare fn expectSome(value: AffineValue): AffineValue; /** Assert Ok and extract payload; throws on Err with message. */ -export declare function expectOk(value: AffineValue): AffineValue; +declare fn expectOk(value: AffineValue): AffineValue; /** Type-narrowing predicate: is this value None? */ -export declare function isNone(value: AffineValue): value is AffineNone; +declare fn isNone(value: AffineValue): value is AffineNone; /** Type-narrowing predicate: is this value Some? */ -export declare function isSome(value: AffineValue): value is AffineSome; +declare fn isSome(value: AffineValue): value is AffineSome; /** Type-narrowing predicate: is this value Ok? */ -export declare function isOk(value: AffineValue): value is AffineOk; +declare fn isOk(value: AffineValue): value is AffineOk; /** Type-narrowing predicate: is this value Err? */ -export declare function isErr(value: AffineValue): value is AffineErr; +declare fn isErr(value: AffineValue): value is AffineErr; -==================================== */ diff --git a/cadre-router/mod.affine b/cadre-router/mod.affine index eed901c9..95d18791 100644 --- a/cadre-router/mod.affine +++ b/cadre-router/mod.affine @@ -1,17 +1,13 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module mod; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // mod.ts — Deno module entry point for cadre-router // // This file enables publishing to deno.land/x // Usage: import { Url, Parser, Navigation } from "https://deno.land/x/cadre_router/mod.ts" -export * from "./src/client/CadreRouter.js"; +* from "./src/client/CadreRouter.js"; -==================================== */ diff --git a/cadre-router/tea-router-pkg/mod.affine b/cadre-router/tea-router-pkg/mod.affine index 3056048b..58efc7ba 100644 --- a/cadre-router/tea-router-pkg/mod.affine +++ b/cadre-router/tea-router-pkg/mod.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module mod; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // mod.ts — Deno module entry point for cadre-tea-router // // Usage: import { TeaRouter } from "https://deno.land/x/cadre_tea_router/mod.ts" -export * from "./src/TeaRouter.js"; +* from "./src/TeaRouter.js"; -==================================== */ diff --git a/rescript-ecosystem/packages/bindings/redis/tests/redis_test.affine b/rescript-ecosystem/packages/bindings/redis/tests/redis_test.affine index 0048333e..eddc5b33 100644 --- a/rescript-ecosystem/packages/bindings/redis/tests/redis_test.affine +++ b/rescript-ecosystem/packages/bindings/redis/tests/redis_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module redis_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // SPDX-FileCopyrightText: 2025 Hyperpolymath @@ -29,8 +26,8 @@ Deno.test({ name: "Redis connection - placeholder", ignore: true, // Enable when Redis.res.js is compiled async fn() { - // const redis = await Redis.make() - // const pong = await Redis.ping(redis) + // let redis = await Redis.make() + // let pong = await Redis.ping(redis) // assertEquals(pong, "PONG") // await Redis.quit(redis) }, @@ -40,9 +37,9 @@ Deno.test({ name: "String operations - placeholder", ignore: true, async fn() { - // const redis = await Redis.make() + // let redis = await Redis.make() // await Redis.set(redis, "test:key", "hello") - // const value = await Redis.get(redis, "test:key") + // let value = await Redis.get(redis, "test:key") // assertEquals(value, "hello") // await Redis.delOne(redis, "test:key") // await Redis.quit(redis) @@ -53,9 +50,9 @@ Deno.test({ name: "Hash operations - placeholder", ignore: true, async fn() { - // const redis = await Redis.make() + // let redis = await Redis.make() // await Redis.hset(redis, "test:hash", "field1", "value1") - // const value = await Redis.hget(redis, "test:hash", "field1") + // let value = await Redis.hget(redis, "test:hash", "field1") // assertEquals(value, "value1") // await Redis.delOne(redis, "test:hash") // await Redis.quit(redis) @@ -66,9 +63,9 @@ Deno.test({ name: "List operations - placeholder", ignore: true, async fn() { - // const redis = await Redis.make() + // let redis = await Redis.make() // await Redis.rpush(redis, "test:list", ["a", "b", "c"]) - // const items = await Redis.lrange(redis, "test:list", 0, -1) + // let items = await Redis.lrange(redis, "test:list", 0, -1) // assertEquals(items, ["a", "b", "c"]) // await Redis.delOne(redis, "test:list") // await Redis.quit(redis) @@ -79,9 +76,9 @@ Deno.test({ name: "Set operations - placeholder", ignore: true, async fn() { - // const redis = await Redis.make() + // let redis = await Redis.make() // await Redis.sadd(redis, "test:set", ["a", "b", "c"]) - // const members = await Redis.smembers(redis, "test:set") + // let members = await Redis.smembers(redis, "test:set") // assertEquals(members.sort(), ["a", "b", "c"]) // await Redis.delOne(redis, "test:set") // await Redis.quit(redis) @@ -92,10 +89,10 @@ Deno.test({ name: "Sorted set operations - placeholder", ignore: true, async fn() { - // const redis = await Redis.make() + // let redis = await Redis.make() // await Redis.zadd(redis, "test:zset", 1.0, "a") // await Redis.zadd(redis, "test:zset", 2.0, "b") - // const members = await Redis.zrange(redis, "test:zset", 0, -1) + // let members = await Redis.zrange(redis, "test:zset", 0, -1) // assertEquals(members, ["a", "b"]) // await Redis.delOne(redis, "test:zset") // await Redis.quit(redis) @@ -106,10 +103,10 @@ Deno.test({ name: "JSON helpers - placeholder", ignore: true, async fn() { - // const redis = await Redis.make() - // const data = { name: "test", value: 42 } + // let redis = await Redis.make() + // let data = { name: "test", value: 42 } // await Redis.setJson(redis, "test:json", data) - // const retrieved = await Redis.getJson(redis, "test:json") + // let retrieved = await Redis.getJson(redis, "test:json") // assertEquals(retrieved, data) // await Redis.delOne(redis, "test:json") // await Redis.quit(redis) @@ -126,4 +123,3 @@ Deno.test({ }, }) -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/analysis/examples/example-project/src/syntax/sample-highlighting.affine b/rescript-ecosystem/packages/core/compiler-source/analysis/examples/example-project/src/syntax/sample-highlighting.affine index 68fbfc74..df78b53f 100644 --- a/rescript-ecosystem/packages/core/compiler-source/analysis/examples/example-project/src/syntax/sample-highlighting.affine +++ b/rescript-ecosystem/packages/core/compiler-source/analysis/examples/example-project/src/syntax/sample-highlighting.affine @@ -1,15 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module sample-highlighting; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // Bindings let numberBinding = 123; -const SomeComp = { +let SomeComp = { Nested: () => null, }; @@ -49,7 +46,7 @@ let destructuring = () => { }; namespace SomeModule { - export enum t { + enum t { Some, Value, Here, @@ -57,9 +54,9 @@ namespace SomeModule { } // Decorators and classes -function someDecorator() { +fn someDecorator() { return function ( - target: any, + target: unknown, propertyKey: string, descriptor: PropertyDescriptor ) { @@ -67,7 +64,7 @@ function someDecorator() { }; } -class SomeClass { +struct SomeClass { @someDecorator() doStuff() { return 123; } @@ -77,12 +74,12 @@ class SomeClass { let interpolated = `${numberBinding} ${"123"}`; // JSX -interface Props { +struct Props { someProp: number; otherProp: string; thirdProp: SomeModule.t; } -const SomeComponent = ({ someProp, otherProp, thirdProp }: Props) => { +let SomeComponent = ({ someProp, otherProp, thirdProp }: Props) => { return null; }; @@ -97,8 +94,7 @@ let jsx = ( {"Hello"} ); -function Property() { +fn Property() { throw new Error("Function not implemented."); } -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-arm64/bin.d.affine b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-arm64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-arm64/bin.d.affine +++ b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-arm64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-x64/bin.d.affine b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-x64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-x64/bin.d.affine +++ b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/darwin-x64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-arm64/bin.d.affine b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-arm64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-arm64/bin.d.affine +++ b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-arm64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-x64/bin.d.affine b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-x64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-x64/bin.d.affine +++ b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/linux-x64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/win32-x64/bin.d.affine b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/win32-x64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/win32-x64/bin.d.affine +++ b/rescript-ecosystem/packages/core/compiler-source/packages/@rescript/win32-x64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine index e267b8dc..7224953a 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module StdlibNoShims.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from StdlibNoShims.res by genType. */ /* eslint-disable */ @@ -13,116 +10,115 @@ module StdlibNoShims.gen; import * as StdlibNoShimsJS from './StdlibNoShims.res.js'; -export const idInt: (x:number) => number = StdlibNoShimsJS.idInt as any; +const idInt: (x:number) => number = StdlibNoShimsJS.idInt as unknown; -export const idFloat: (x:number) => number = StdlibNoShimsJS.idFloat as any; +const idFloat: (x:number) => number = StdlibNoShimsJS.idFloat as unknown; -export const idBool: (x:boolean) => boolean = StdlibNoShimsJS.idBool as any; +const idBool: (x:boolean) => boolean = StdlibNoShimsJS.idBool as unknown; -export const idString: (x:string) => string = StdlibNoShimsJS.idString as any; +const idString: (x:string) => string = StdlibNoShimsJS.idString as unknown; -export const idBigInt: (x:bigint) => bigint = StdlibNoShimsJS.idBigInt as any; +const idBigInt: (x:bigint) => bigint = StdlibNoShimsJS.idBigInt as unknown; -export const idDate: (x:Date) => Date = StdlibNoShimsJS.idDate as any; +const idDate: (x:Date) => Date = StdlibNoShimsJS.idDate as unknown; -export const idRegExp: (x:RegExp) => RegExp = StdlibNoShimsJS.idRegExp as any; +const idRegExp: (x:RegExp) => RegExp = StdlibNoShimsJS.idRegExp as unknown; -export const idPromise: (x:Promise) => Promise = StdlibNoShimsJS.idPromise as any; +const idPromise: (x:string) => string = StdlibNoShimsJS.idPromise as unknown; -export const idDict: (x:{[id: string]: number}) => {[id: string]: number} = StdlibNoShimsJS.idDict as any; +const idDict: (x:{[id: string]: number}) => {[id: string]: number} = StdlibNoShimsJS.idDict as unknown; -export const idMap: (x:Map) => Map = StdlibNoShimsJS.idMap as any; +const idMap: (x:Map) => Map = StdlibNoShimsJS.idMap as unknown; -export const idWeakMap: (x:WeakMap) => WeakMap = StdlibNoShimsJS.idWeakMap as any; +const idWeakMap: (x:WeakMap) => WeakMap = StdlibNoShimsJS.idWeakMap as unknown; -export const idSet: (x:Set) => Set = StdlibNoShimsJS.idSet as any; +const idSet: (x:Set) => Set = StdlibNoShimsJS.idSet as unknown; -export const idWeakSet: (x:WeakSet) => WeakSet = StdlibNoShimsJS.idWeakSet as any; +const idWeakSet: (x:WeakSet) => WeakSet = StdlibNoShimsJS.idWeakSet as unknown; -export const idArray: (x:number[]) => number[] = StdlibNoShimsJS.idArray as any; +const idArray: (x:number[]) => number[] = StdlibNoShimsJS.idArray as unknown; -export const idUndefined: (x:(undefined | number)) => (undefined | number) = StdlibNoShimsJS.idUndefined as any; +const idUndefined: (x:(undefined | number)) => (undefined | number) = StdlibNoShimsJS.idUndefined as unknown; -export const idNull: (x:(null | number)) => (null | number) = StdlibNoShimsJS.idNull as any; +const idNull: (x:(null | number)) => (null | number) = StdlibNoShimsJS.idNull as unknown; -export const idNullable: (x:(null | undefined | number)) => (null | undefined | number) = StdlibNoShimsJS.idNullable as any; +const idNullable: (x:(null | undefined | number)) => (null | undefined | number) = StdlibNoShimsJS.idNullable as unknown; -export const idOption: (x:(undefined | string)) => (undefined | string) = StdlibNoShimsJS.idOption as any; +const idOption: (x:(undefined | string)) => (undefined | string) = StdlibNoShimsJS.idOption as unknown; -export const idJSON: (x:unknown) => unknown = StdlibNoShimsJS.idJSON as any; +const idJSON: (x:unknown) => unknown = StdlibNoShimsJS.idJSON as unknown; -export const idResult: (x: +const idResult: (x: { TAG: "Ok"; _0: number } | { TAG: "Error"; _0: string }) => { TAG: "Ok"; _0: number } - | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResult as any; + | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResult as unknown; -export const idResultAlias: (x: +const idResultAlias: (x: { TAG: "Ok"; _0: number } | { TAG: "Error"; _0: string }) => { TAG: "Ok"; _0: number } - | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResultAlias as any; + | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResultAlias as unknown; -export const idRef: (x:{ contents: number }) => { contents: number } = StdlibNoShimsJS.idRef as any; +const idRef: (x:{ contents: number }) => { contents: number } = StdlibNoShimsJS.idRef as unknown; -export const returnsUnit: () => void = StdlibNoShimsJS.returnsUnit as any; +const returnsUnit: () => void = StdlibNoShimsJS.returnsUnit as unknown; -export const idTuple: (x:[number, string, number]) => [number, string, number] = StdlibNoShimsJS.idTuple as any; +const idTuple: (x:[number, string, number]) => [number, string, number] = StdlibNoShimsJS.idTuple as unknown; -export const idArrayBuffer: (x:ArrayBuffer) => ArrayBuffer = StdlibNoShimsJS.idArrayBuffer as any; +const idArrayBuffer: (x:ArrayBuffer) => ArrayBuffer = StdlibNoShimsJS.idArrayBuffer as unknown; -export const idDataView: (x:DataView) => DataView = StdlibNoShimsJS.idDataView as any; +const idDataView: (x:DataView) => DataView = StdlibNoShimsJS.idDataView as unknown; -export const idInt8Array: (x:Int8Array) => Int8Array = StdlibNoShimsJS.idInt8Array as any; +const idInt8Array: (x:Int8Array) => Int8Array = StdlibNoShimsJS.idInt8Array as unknown; -export const idUint8Array: (x:Uint8Array) => Uint8Array = StdlibNoShimsJS.idUint8Array as any; +const idUint8Array: (x:Uint8Array) => Uint8Array = StdlibNoShimsJS.idUint8Array as unknown; -export const idUint8ClampedArray: (x:Uint8ClampedArray) => Uint8ClampedArray = StdlibNoShimsJS.idUint8ClampedArray as any; +const idUint8ClampedArray: (x:Uint8ClampedArray) => Uint8ClampedArray = StdlibNoShimsJS.idUint8ClampedArray as unknown; -export const idInt16Array: (x:Int16Array) => Int16Array = StdlibNoShimsJS.idInt16Array as any; +const idInt16Array: (x:Int16Array) => Int16Array = StdlibNoShimsJS.idInt16Array as unknown; -export const idUint16Array: (x:Uint16Array) => Uint16Array = StdlibNoShimsJS.idUint16Array as any; +const idUint16Array: (x:Uint16Array) => Uint16Array = StdlibNoShimsJS.idUint16Array as unknown; -export const idInt32Array: (x:Int32Array) => Int32Array = StdlibNoShimsJS.idInt32Array as any; +const idInt32Array: (x:Int32Array) => Int32Array = StdlibNoShimsJS.idInt32Array as unknown; -export const idUint32Array: (x:Uint32Array) => Uint32Array = StdlibNoShimsJS.idUint32Array as any; +const idUint32Array: (x:Uint32Array) => Uint32Array = StdlibNoShimsJS.idUint32Array as unknown; -export const idFloat32Array: (x:Float32Array) => Float32Array = StdlibNoShimsJS.idFloat32Array as any; +const idFloat32Array: (x:Float32Array) => Float32Array = StdlibNoShimsJS.idFloat32Array as unknown; -export const idFloat64Array: (x:Float64Array) => Float64Array = StdlibNoShimsJS.idFloat64Array as any; +const idFloat64Array: (x:Float64Array) => Float64Array = StdlibNoShimsJS.idFloat64Array as unknown; -export const idBigInt64Array: (x:BigInt64Array) => BigInt64Array = StdlibNoShimsJS.idBigInt64Array as any; +const idBigInt64Array: (x:BigInt64Array) => BigInt64Array = StdlibNoShimsJS.idBigInt64Array as unknown; -export const idBigUint64Array: (x:BigUint64Array) => BigUint64Array = StdlibNoShimsJS.idBigUint64Array as any; +const idBigUint64Array: (x:BigUint64Array) => BigUint64Array = StdlibNoShimsJS.idBigUint64Array as unknown; -export const idSymbol: (x:symbol) => symbol = StdlibNoShimsJS.idSymbol as any; +const idSymbol: (x:symbol) => symbol = StdlibNoShimsJS.idSymbol as unknown; -export const idIterator: (x:Iterator) => Iterator = StdlibNoShimsJS.idIterator as any; +const idIterator: (x:Iterator) => Iterator = StdlibNoShimsJS.idIterator as unknown; -export const idAsyncIterator: (x:AsyncIterator) => AsyncIterator = StdlibNoShimsJS.idAsyncIterator as any; +const idAsyncIterator: (x:AsyncIterator) => AsyncIterator = StdlibNoShimsJS.idAsyncIterator as unknown; -export const idOrdering: (x:number) => number = StdlibNoShimsJS.idOrdering as any; +const idOrdering: (x:number) => number = StdlibNoShimsJS.idOrdering as unknown; -export const idIntlCollator: (x:Intl.Collator) => Intl.Collator = StdlibNoShimsJS.idIntlCollator as any; +const idIntlCollator: (x:Intl.Collator) => Intl.Collator = StdlibNoShimsJS.idIntlCollator as unknown; -export const idIntlDateTimeFormat: (x:Intl.DateTimeFormat) => Intl.DateTimeFormat = StdlibNoShimsJS.idIntlDateTimeFormat as any; +const idIntlDateTimeFormat: (x:Intl.DateTimeFormat) => Intl.DateTimeFormat = StdlibNoShimsJS.idIntlDateTimeFormat as unknown; -export const idIntlListFormat: (x:Intl.ListFormat) => Intl.ListFormat = StdlibNoShimsJS.idIntlListFormat as any; +const idIntlListFormat: (x:Intl.ListFormat) => Intl.ListFormat = StdlibNoShimsJS.idIntlListFormat as unknown; -export const idIntlLocale: (x:Intl.Locale) => Intl.Locale = StdlibNoShimsJS.idIntlLocale as any; +const idIntlLocale: (x:Intl.Locale) => Intl.Locale = StdlibNoShimsJS.idIntlLocale as unknown; -export const idIntlNumberFormat: (x:Intl.NumberFormat) => Intl.NumberFormat = StdlibNoShimsJS.idIntlNumberFormat as any; +const idIntlNumberFormat: (x:Intl.NumberFormat) => Intl.NumberFormat = StdlibNoShimsJS.idIntlNumberFormat as unknown; -export const idIntlPluralRules: (x:Intl.PluralRules) => Intl.PluralRules = StdlibNoShimsJS.idIntlPluralRules as any; +const idIntlPluralRules: (x:Intl.PluralRules) => Intl.PluralRules = StdlibNoShimsJS.idIntlPluralRules as unknown; -export const idIntlRelativeTimeFormat: (x:Intl.RelativeTimeFormat) => Intl.RelativeTimeFormat = StdlibNoShimsJS.idIntlRelativeTimeFormat as any; +const idIntlRelativeTimeFormat: (x:Intl.RelativeTimeFormat) => Intl.RelativeTimeFormat = StdlibNoShimsJS.idIntlRelativeTimeFormat as unknown; -export const idIntlSegmenter: (x:Intl.Segmenter) => Intl.Segmenter = StdlibNoShimsJS.idIntlSegmenter as any; +const idIntlSegmenter: (x:Intl.Segmenter) => Intl.Segmenter = StdlibNoShimsJS.idIntlSegmenter as unknown; -export const idIntlSegments: (x:Intl.Segments) => Intl.Segments = StdlibNoShimsJS.idIntlSegments as any; +const idIntlSegments: (x:Intl.Segments) => Intl.Segments = StdlibNoShimsJS.idIntlSegments as unknown; -export const idJsError: (x:Error) => Error = StdlibNoShimsJS.idJsError as any; +const idJsError: (x:Error) => Error = StdlibNoShimsJS.idJsError as unknown; -export const idObj: (x:{}) => {} = StdlibNoShimsJS.idObj as any; +const idObj: (x:{}) => {} = StdlibNoShimsJS.idObj as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/index.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/index.affine index 01bbf898..b5748bf9 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/index.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/stdlib-no-shims/src/index.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module index; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // Import the generated bindings to force TS to resolve types without shims import * as S from "./StdlibNoShims.gen"; @@ -27,7 +24,7 @@ const d: Date = S.idDate(new Date()); const re: RegExp = S.idRegExp(/a/); // Promise -const p: Promise = S.idPromise(Promise.resolve("ok")); +const p: string = S.idPromise(Promise.resolve("ok")); // Dict const dict: { [id: string]: number } = S.idDict({ a: 1, b: 2 }); @@ -56,12 +53,12 @@ const j: unknown = S.idJSON({}); // Result const ok: { TAG: "Ok"; _0: number } = { TAG: "Ok", _0: 1 }; const err: { TAG: "Error"; _0: string } = { TAG: "Error", _0: "e" }; -const r1 = S.idResult(ok); -const r2 = S.idResult(err); +let r1 = S.idResult(ok); +let r2 = S.idResult(err); // result alias -const r3 = S.idResultAlias(ok); -const r4 = S.idResultAlias(err); +let r3 = S.idResultAlias(ok); +let r4 = S.idResultAlias(err); // array const arr: number[] = S.idArray([1, 2, 3]); @@ -95,7 +92,7 @@ const sym: symbol = S.idSymbol(Symbol("x")); // Iterator / AsyncIterator / Ordering const it: Iterator = S.idIterator([1, 2, 3].values()); const ait: AsyncIterator = S.idAsyncIterator({ - next(): Promise> { + next(): IteratorResult { return Promise.resolve({ done: true, value: undefined }); }, }); @@ -127,4 +124,3 @@ const _obj: {} = S.idObj({ a: 1, b: "x" }); // Tuple const _tup: [number, string, number] = S.idTuple([1, "x", 1.5]); -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/App.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/App.affine index 8976833f..e3104a6a 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/App.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/App.affine @@ -1,25 +1,21 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module App; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import * as React from "react"; import "./App.css"; -export interface Props { +struct Props { name: string; count?: number; } -class App extends React.PureComponent { +struct App extends React.PureComponent { public render() { return
; } } -export default App; +default App; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine index 9fadb4d0..dc38e90f 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine @@ -1,28 +1,24 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module AutoAnnotate.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from AutoAnnotate.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type variant = { TAG: "R"; _0: number }; +struct variant { { TAG: "R"; _0: number }; -export type record = { readonly variant: variant }; +struct record { { readonly variant: variant }; -export type r2 = { readonly r2: number }; +struct r2 { { readonly r2: number }; -export type r3 = { readonly r3: number }; +struct r3 { { readonly r3: number }; -export type r4 = { readonly r4: number }; +struct r4 { { readonly r4: number }; -export type annotatedVariant = +struct annotatedVariant { { TAG: "R2"; _0: r2; _1: r3 } | { TAG: "R4"; _0: r4 }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine index 7bc09242..ff6f3743 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine @@ -1,28 +1,24 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module BucklescriptAnnotations.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from BucklescriptAnnotations.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type someMutableFields = { +struct someMutableFields { { mutable0: string; readonly immutable: number; mutable1: string; mutable2: string }; -export type someMethods = { +struct someMethods { { readonly send: (_1:string) => void; readonly on: (_1:string, _2:((_1:number) => void)) => void; readonly threeargs: (_1:number, _2:string, _3:number) => string; readonly twoArgs: (_1:number, _2:string) => number }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine index 4dcf48e1..e4d4fe0b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Comments.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Comments.res by genType. */ /* eslint-disable */ @@ -13,15 +10,15 @@ module Comments.gen; import * as CommentsJS from './Comments.res.js'; -export type DecideSubject_payload = { +struct DecideSubject_payload { { /** A hint to use as a guide when thinking of your poem. */ readonly hint: string }; /** The input used to generate the prompt and system prompt. */ -export abstract class DecideSubject_input { protected opaque!: any }; /* simulate opaque types */ +abstract struct DecideSubject_input { protected opaque!: unknown }; /* simulate opaque types */ /** The output from evaluating the llm prompt */ -export type DecideSubject_output = { +struct DecideSubject_output { { /** The text of the poem. */ readonly text: string; /** The prompt used to generate the poem. */ @@ -31,10 +28,9 @@ export type DecideSubject_output = { }; /** Decide on a subject matter for a poem. */ -export const DecideSubject__placeholder: (run:string, times:number) => void = CommentsJS.DecideSubject._placeholder as any; +const DecideSubject__placeholder: (run:string, times:number) => void = CommentsJS.DecideSubject._placeholder as unknown; -export const DecideSubject: { +const DecideSubject: { /** Decide on a subject matter for a poem. */ -_placeholder: (run:string, times:number) => void } = CommentsJS.DecideSubject as any; +_placeholder: (run:string, times:number) => void } = CommentsJS.DecideSubject as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Core.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Core.gen.affine index 7bc7fa5a..7effc099 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Core.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Core.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Core.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Core.res by genType. */ /* eslint-disable */ @@ -16,69 +13,68 @@ import {someFunWithNullThenOptionalArgs as someFunWithNullThenOptionalArgsNotChe import {someFunWithNullUndefinedArg as someFunWithNullUndefinedArgNotChecked} from './CoreTS'; // In case of type error, check the type of 'someFunWithNullThenOptionalArgs' in 'Core.res' and './CoreTS'. -export const someFunWithNullThenOptionalArgsTypeChecked: (_1:(null | string), _2:(undefined | string)) => string = someFunWithNullThenOptionalArgsNotChecked as any; +const someFunWithNullThenOptionalArgsTypeChecked: (_1:(null | string), _2:(undefined | string)) => string = someFunWithNullThenOptionalArgsNotChecked as unknown; // Export 'someFunWithNullThenOptionalArgs' early to allow circular import from the '.bs.js' file. -export const someFunWithNullThenOptionalArgs: unknown = someFunWithNullThenOptionalArgsTypeChecked as (_1:(null | string), _2:(undefined | string)) => string as any; +const someFunWithNullThenOptionalArgs: unknown = someFunWithNullThenOptionalArgsTypeChecked as (_1:(null | string), _2:(undefined | string)) => string as unknown; // In case of type error, check the type of 'someFunWithNullUndefinedArg' in 'Core.res' and './CoreTS'. -export const someFunWithNullUndefinedArgTypeChecked: (_1:(null | undefined | string), _2:number) => string = someFunWithNullUndefinedArgNotChecked as any; +const someFunWithNullUndefinedArgTypeChecked: (_1:(null | undefined | string), _2:number) => string = someFunWithNullUndefinedArgNotChecked as unknown; // Export 'someFunWithNullUndefinedArg' early to allow circular import from the '.bs.js' file. -export const someFunWithNullUndefinedArg: unknown = someFunWithNullUndefinedArgTypeChecked as (_1:(null | undefined | string), _2:number) => string as any; +const someFunWithNullUndefinedArg: unknown = someFunWithNullUndefinedArgTypeChecked as (_1:(null | undefined | string), _2:number) => string as unknown; -const CoreJS = require('./Core.res.js'); +let CoreJS = require('./Core.res.js'); -export type variant = "A" | { TAG: "B"; _0: string }; +struct variant { "A" | { TAG: "B"; _0: string }; -export type t1 = { readonly x?: string }; +struct t1 { { readonly x?: string }; -export type t2 = { readonly x: (undefined | string) }; +struct t2 { { readonly x: (undefined | string) }; -export const null0: (x:(null | number)) => (null | number) = CoreJS.null0 as any; +const null0: (x:(null | number)) => (null | number) = CoreJS.null0 as unknown; -export const null1: (x:(null | number)) => (null | number) = CoreJS.null1 as any; +const null1: (x:(null | number)) => (null | number) = CoreJS.null1 as unknown; -export const nullable0: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable0 as any; +const nullable0: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable0 as unknown; -export const nullable1: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable1 as any; +const nullable1: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable1 as unknown; -export const undefined0: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined0 as any; +const undefined0: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined0 as unknown; -export const undefined1: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined1 as any; +const undefined1: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined1 as unknown; -export const dict0: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict0 as any; +const dict0: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict0 as unknown; -export const dict1: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict1 as any; +const dict1: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict1 as unknown; -export const promise0: (x:Promise) => Promise = CoreJS.promise0 as any; +const promise0: (x:string) => string = CoreJS.promise0 as unknown; -export const promise1: (x:Promise) => Promise = CoreJS.promise1 as any; +const promise1: (x:string) => string = CoreJS.promise1 as unknown; -export const date0: (x:Date) => Date = CoreJS.date0 as any; +const date0: (x:Date) => Date = CoreJS.date0 as unknown; -export const date1: (x:Date) => Date = CoreJS.date1 as any; +const date1: (x:Date) => Date = CoreJS.date1 as unknown; -export const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as any; +const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as unknown; -export const regexp0: (x:RegExp) => RegExp = CoreJS.regexp0 as any; +const regexp0: (x:RegExp) => RegExp = CoreJS.regexp0 as unknown; -export const regexp1: (x:RegExp) => RegExp = CoreJS.regexp1 as any; +const regexp1: (x:RegExp) => RegExp = CoreJS.regexp1 as unknown; -export const map1: (x:Map) => Map = CoreJS.map1 as any; +const map1: (x:Map) => Map = CoreJS.map1 as unknown; -export const weakmap1: (x:WeakMap) => WeakMap = CoreJS.weakmap1 as any; +const weakmap1: (x:WeakMap) => WeakMap = CoreJS.weakmap1 as unknown; -export const set1: (x:Set) => Set = CoreJS.set1 as any; +const set1: (x:Set) => Set = CoreJS.set1 as unknown; -export const weakset1: (x:WeakSet) => WeakSet = CoreJS.weakset1 as any; +const weakset1: (x:WeakSet) => WeakSet = CoreJS.weakset1 as unknown; -export const option0: (x:(undefined | string)) => (undefined | string) = CoreJS.option0 as any; +const option0: (x:(undefined | string)) => (undefined | string) = CoreJS.option0 as unknown; -export const option1: (x:(undefined | variant)) => (undefined | variant) = CoreJS.option1 as any; +const option1: (x:(undefined | variant)) => (undefined | variant) = CoreJS.option1 as unknown; -export const jsonEncodeString1: unknown = CoreJS.jsonEncodeString1 as any; +const jsonEncodeString1: unknown = CoreJS.jsonEncodeString1 as unknown; -export const jsonEncodeString2: unknown = CoreJS.jsonEncodeString2 as any; +const jsonEncodeString2: unknown = CoreJS.jsonEncodeString2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/CoreTS.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/CoreTS.affine index e3c52d68..3bf9b670 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/CoreTS.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/CoreTS.affine @@ -1,19 +1,15 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module CoreTS; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === -export declare function someFunWithNullThenOptionalArgs( +declare fn someFunWithNullThenOptionalArgs( nullable: null | string, app?: string, ): string; -export declare function someFunWithNullUndefinedArg( +declare fn someFunWithNullUndefinedArg( nullUndefined: null | undefined | string, other: number, ): string; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine index 1d8c83a9..828b3eb4 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Derivings.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Derivings.res by genType. */ /* eslint-disable */ @@ -13,15 +10,14 @@ module Derivings.gen; import * as DerivingsJS from './Derivings.res.js'; -export type action = +struct action { "Click" | "Cancel" | { TAG: "Submit"; _0: string }; -export const click: action = DerivingsJS.click as any; +const click: action = DerivingsJS.click as unknown; -export const submit: (_1:string) => action = DerivingsJS.submit as any; +const submit: (_1:string) => action = DerivingsJS.submit as unknown; -export const cancel: action = DerivingsJS.cancel as any; +const cancel: action = DerivingsJS.cancel as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine index aee694f6..e8ba0010 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Docstrings.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Docstrings.res by genType. */ /* eslint-disable */ @@ -13,50 +10,49 @@ module Docstrings.gen; import * as DocstringsJS from './Docstrings.res.js'; -export type t = "A" | "B"; +struct t { "A" | "B"; /** hello */ -export const flat: number = DocstringsJS.flat as any; +const flat: number = DocstringsJS.flat as unknown; /** * Sign a message with a key. * * @param message - A message to be signed * @param key - The key with which to sign the message * @returns A signed message */ -export const signMessage: (message:string, key:number) => string = DocstringsJS.signMessage as any; +const signMessage: (message:string, key:number) => string = DocstringsJS.signMessage as unknown; -export const one: (a:number) => number = DocstringsJS.one as any; +const one: (a:number) => number = DocstringsJS.one as unknown; -export const two: (a:number, b:number) => number = DocstringsJS.two as any; +const two: (a:number, b:number) => number = DocstringsJS.two as unknown; -export const tree: (a:number, b:number, c:number) => number = DocstringsJS.tree as any; +const tree: (a:number, b:number, c:number) => number = DocstringsJS.tree as unknown; -export const oneU: (a:number) => number = DocstringsJS.oneU as any; +const oneU: (a:number) => number = DocstringsJS.oneU as unknown; -export const twoU: (a:number, b:number) => number = DocstringsJS.twoU as any; +const twoU: (a:number, b:number) => number = DocstringsJS.twoU as unknown; -export const treeU: (a:number, b:number, c:number) => number = DocstringsJS.treeU as any; +const treeU: (a:number, b:number, c:number) => number = DocstringsJS.treeU as unknown; -export const useParam: (param:number) => number = DocstringsJS.useParam as any; +const useParam: (param:number) => number = DocstringsJS.useParam as unknown; -export const useParamU: (param:number) => number = DocstringsJS.useParamU as any; +const useParamU: (param:number) => number = DocstringsJS.useParamU as unknown; -export const unnamed1: (param:number) => number = DocstringsJS.unnamed1 as any; +const unnamed1: (param:number) => number = DocstringsJS.unnamed1 as unknown; -export const unnamed1U: (param:number) => number = DocstringsJS.unnamed1U as any; +const unnamed1U: (param:number) => number = DocstringsJS.unnamed1U as unknown; -export const unnamed2: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2 as any; +const unnamed2: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2 as unknown; -export const unnamed2U: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2U as any; +const unnamed2U: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2U as unknown; -export const grouped: (x:number, y:number, a:number, b:number, c:number, z:number) => number = DocstringsJS.grouped as any; +const grouped: (x:number, y:number, a:number, b:number, c:number, z:number) => number = DocstringsJS.grouped as unknown; -export const unitArgWithoutConversion: () => string = DocstringsJS.unitArgWithoutConversion as any; +const unitArgWithoutConversion: () => string = DocstringsJS.unitArgWithoutConversion as unknown; -export const unitArgWithoutConversionU: () => string = DocstringsJS.unitArgWithoutConversionU as any; +const unitArgWithoutConversionU: () => string = DocstringsJS.unitArgWithoutConversionU as unknown; -export const unitArgWithConversion: () => t = DocstringsJS.unitArgWithConversion as any; +const unitArgWithConversion: () => t = DocstringsJS.unitArgWithConversion as unknown; -export const unitArgWithConversionU: () => t = DocstringsJS.unitArgWithConversionU as any; +const unitArgWithConversionU: () => t = DocstringsJS.unitArgWithConversionU as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine index e3595e1c..68048931 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module EmitModuleIfNoConversion.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from EmitModuleIfNoConversion.res by genType. */ /* eslint-disable */ @@ -13,16 +10,15 @@ module EmitModuleIfNoConversion.gen; import * as EmitModuleIfNoConversionJS from './EmitModuleIfNoConversion.res.js'; -export type t = "A" | { TAG: "B"; readonly name: string }; +struct t { "A" | { TAG: "B"; readonly name: string }; -export const X_foo: (t:t) => void = EmitModuleIfNoConversionJS.X.foo as any; +const X_foo: (t:t) => void = EmitModuleIfNoConversionJS.X.foo as unknown; -export const X_x: number = EmitModuleIfNoConversionJS.X.x as any; +const X_x: number = EmitModuleIfNoConversionJS.X.x as unknown; -export const Y_x: string = EmitModuleIfNoConversionJS.Y.x as any; +const Y_x: string = EmitModuleIfNoConversionJS.Y.x as unknown; -export const Y: { x: string } = EmitModuleIfNoConversionJS.Y as any; +const Y: { x: string } = EmitModuleIfNoConversionJS.Y as unknown; -export const X: { x: number; foo: (t:t) => void } = EmitModuleIfNoConversionJS.X as any; +const X: { x: number; foo: (t:t) => void } = EmitModuleIfNoConversionJS.X as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine index e9d6ff07..bf6556e8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module EscapedNames.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from EscapedNames.res by genType. */ /* eslint-disable */ @@ -13,21 +10,20 @@ module EscapedNames.gen; import * as EscapedNamesJS from './EscapedNames.res.js'; -export type variant = "Illegal\"Name"; +struct variant { "Illegal\"Name"; -export type UppercaseVariant = "Illegal\"Name"; +struct UppercaseVariant { "Illegal\"Name"; -export type polymorphicVariant = "Illegal\"Name"; +struct polymorphicVariant { "Illegal\"Name"; -export type object_ = { readonly normalField: number; readonly "escape\"me": number }; +struct object_ { { readonly normalField: number; readonly "escape\"me": number }; -export type record = { +struct record { { readonly normalField: variant; readonly "Renamed'Field": number; readonly "Illegal-field name": number; readonly UPPERCASE: number }; -export const myRecord: record = EscapedNamesJS.myRecord as any; +const myRecord: record = EscapedNamesJS.myRecord as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine index 7c1a9fec..05d96965 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ExportWithRename.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ExportWithRename.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module ExportWithRename.gen; import * as ExportWithRenameJS from './ExportWithRename.res.js'; -export type props = { readonly s: s }; +type props = { readonly s: s }; -export const Renamed: React.ComponentType<{ readonly s: string }> = ExportWithRenameJS.make as any; +const Renamed: React.ComponentType<{ readonly s: string }> = ExportWithRenameJS.make as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine index 9a521f2e..9e904bc7 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module FirstClassModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from FirstClassModules.res by genType. */ /* eslint-disable */ @@ -13,11 +10,11 @@ module FirstClassModules.gen; import * as FirstClassModulesJS from './FirstClassModules.res.js'; -export type MT_t = number; +struct MT_t { number; -export type MT_InnerModule3_inner = number; +struct MT_InnerModule3_inner { number; -export type firstClassModule = { +struct firstClassModule { { readonly x: number; readonly EmptyInnerModule: { }; @@ -31,9 +28,9 @@ export type firstClassModule = { readonly y: string }; -export const firstClassModule: firstClassModule = FirstClassModulesJS.firstClassModule as any; +const firstClassModule: firstClassModule = FirstClassModulesJS.firstClassModule as unknown; -export const testConvert: (m:{ +const testConvert: (m:{ readonly x: number; readonly EmptyInnerModule: { }; @@ -57,9 +54,9 @@ export const testConvert: (m:{ }; readonly Z: unknown; readonly y: string -} = FirstClassModulesJS.testConvert as any; +} = FirstClassModulesJS.testConvert as unknown; -export const someFunctorAsFunction: (x:{ +const someFunctorAsFunction: (x:{ readonly x: number; readonly EmptyInnerModule: { }; @@ -71,6 +68,5 @@ export const someFunctorAsFunction: (x:{ }; readonly Z: unknown; readonly y: string -}) => { readonly ww: string } = FirstClassModulesJS.someFunctorAsFunction as any; +}) => { readonly ww: string } = FirstClassModulesJS.someFunctorAsFunction as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine index 55b03717..e46c0f62 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module FirstClassModulesInterface.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from FirstClassModulesInterface.resi by genType. */ /* eslint-disable */ /* tslint:disable */ -export type record = { readonly x: number; readonly y: string }; +struct record { { readonly x: number; readonly y: string }; -export type firstClassModule = { readonly x: number }; +struct firstClassModule { { readonly x: number }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine index 4a0aec2a..51d673f8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module GADT.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from GADT.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export abstract class t { protected opaque!: any }; /* simulate opaque types */ +abstract struct t { protected opaque!: unknown }; /* simulate opaque types */ -export abstract class tt { protected opaque!: any }; /* simulate opaque types */ +abstract struct tt { protected opaque!: unknown }; /* simulate opaque types */ -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine index ac6aa0b9..e3e186c9 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Hooks.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Hooks.res by genType. */ /* eslint-disable */ @@ -15,95 +12,95 @@ import * as HooksJS from './Hooks.res.js'; import type {TypedArray2_Uint8Array_t as Js_TypedArray2_Uint8Array_t} from '../src/shims/Js.shim'; -export type vehicle = { readonly name: string }; +struct vehicle { { readonly name: string }; -export type props = { readonly vehicle: vehicle }; +type props = { readonly vehicle: vehicle }; -export type Another_props = { readonly vehicle: vehicle; readonly callback: callback }; +type Another_props = { readonly vehicle: vehicle; readonly callback: callback }; -export type Inner_props = { readonly vehicle: vehicle }; +type Inner_props = { readonly vehicle: vehicle }; -export type Inner_Another_props = { readonly vehicle: vehicle }; +type Inner_Another_props = { readonly vehicle: vehicle }; -export type Inner_Inner2_props = { readonly vehicle: vehicle }; +type Inner_Inner2_props = { readonly vehicle: vehicle }; -export type Inner_Inner2_Another_props = { readonly vehicle: vehicle }; +type Inner_Inner2_Another_props = { readonly vehicle: vehicle }; -export type NoProps_props = {}; +struct NoProps_props { {}; -export type cb = (_to:vehicle) => void; +struct cb { (_to:vehicle) => void; -export type WithRename_props = { +type WithRename_props = { readonly _to: T_to; readonly _Type: T_Type; readonly cb: cb }; -export type WithRef_props = { readonly vehicle: vehicle; readonly ref?: ref }; +type WithRef_props = { readonly vehicle: vehicle; readonly ref?: ref }; -export type r = { readonly x: string }; +struct r { { readonly x: string }; -export type callback = (_1:input) => output; +type callback = (_1:input) => output; -export type testReactContext = React.Context; +struct testReactContext { React.Context; -export type testReactRef = { current: (null | number) }; +struct testReactRef { { current: (null | number) }; -export type testDomRef = React.Ref; +struct testDomRef { React.Ref; -export type testDomRef2 = React.Ref; +struct testDomRef2 { React.Ref; -export type Poly_props

= { readonly p: p }; +type Poly_props

= { readonly p: p }; -export type Fun_props = { readonly name: name }; +type Fun_props = { readonly name: name }; -export type RenderPropRequiresConversion_props = { readonly renderVehicle: renderVehicle }; +type RenderPropRequiresConversion_props = { readonly renderVehicle: renderVehicle }; -export type WithChildren_props = { readonly vehicle: vehicle; readonly children: children }; +type WithChildren_props = { readonly vehicle: vehicle; readonly children: children }; -export type DD_props = { readonly array: array; readonly name: name }; +type DD_props = { readonly array: array; readonly name: name }; -export const $$default: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.default as any; +const $$default: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.default as unknown; -export default $$default; +default $$default; -export const Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> = HooksJS.Another.anotherComponent as any; +const Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> = HooksJS.Another.anotherComponent as unknown; -export const Inner_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.make as any; +const Inner_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.make as unknown; -export const Inner_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Another.anotherComponent as any; +const Inner_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Another.anotherComponent as unknown; -export const Inner_Inner2_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.make as any; +const Inner_Inner2_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.make as unknown; -export const Inner_Inner2_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.Another.anotherComponent as any; +const Inner_Inner2_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.Another.anotherComponent as unknown; -export const NoProps_make: React.ComponentType<{}> = HooksJS.NoProps.make as any; +const NoProps_make: React.ComponentType<{}> = HooksJS.NoProps.make as unknown; -export const functionWithRenamedArgs: (_to:vehicle, _Type:vehicle, cb:cb) => string = HooksJS.functionWithRenamedArgs as any; +const functionWithRenamedArgs: (_to:vehicle, _Type:vehicle, cb:cb) => string = HooksJS.functionWithRenamedArgs as unknown; -export const WithRename_componentWithRenamedArgs: React.ComponentType<{ +const WithRename_componentWithRenamedArgs: React.ComponentType<{ readonly _to: vehicle; readonly _Type: vehicle; readonly cb: cb -}> = HooksJS.WithRename.componentWithRenamedArgs as any; +}> = HooksJS.WithRename.componentWithRenamedArgs as unknown; -export const WithRef_make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: any }> = HooksJS.WithRef.make as any; +const WithRef_make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: unknown }> = HooksJS.WithRef.make as unknown; -export const ForwardRef_input: (_1:r) => JSX.Element = HooksJS.ForwardRef.input as any; +const ForwardRef_input: (_1:r) => JSX.Element = HooksJS.ForwardRef.input as unknown; -export const Poly_polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, any] }> = HooksJS.Poly.polymorphicComponent as any; +const Poly_polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, unknown] }> = HooksJS.Poly.polymorphicComponent as unknown; -export const Fun_functionReturningReactElement: React.ComponentType<{ readonly name: string }> = HooksJS.Fun.functionReturningReactElement as any; +const Fun_functionReturningReactElement: React.ComponentType<{ readonly name: string }> = HooksJS.Fun.functionReturningReactElement as unknown; -export const RenderPropRequiresConversion_make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> = HooksJS.RenderPropRequiresConversion.make as any; +const RenderPropRequiresConversion_make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> = HooksJS.RenderPropRequiresConversion.make as unknown; -export const WithChildren_aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> = HooksJS.WithChildren.aComponentWithChildren as any; +const WithChildren_aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> = HooksJS.WithChildren.aComponentWithChildren as unknown; -export const DD_make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> = HooksJS.DD.make as any; +const DD_make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> = HooksJS.DD.make as unknown; -export const NoProps: { make: React.ComponentType<{}> } = HooksJS.NoProps as any; +const NoProps: { make: React.ComponentType<{}> } = HooksJS.NoProps as unknown; -export const Inner: { +const Inner: { Inner2: { Another: { anotherComponent: React.ComponentType<{ @@ -122,28 +119,27 @@ export const Inner: { make: React.ComponentType<{ readonly vehicle: vehicle }> -} = HooksJS.Inner as any; +} = HooksJS.Inner as unknown; -export const RenderPropRequiresConversion: { make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> } = HooksJS.RenderPropRequiresConversion as any; +const RenderPropRequiresConversion: { make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> } = HooksJS.RenderPropRequiresConversion as unknown; -export const WithRename: { componentWithRenamedArgs: React.ComponentType<{ +const WithRename: { componentWithRenamedArgs: React.ComponentType<{ readonly _to: vehicle; readonly _Type: vehicle; readonly cb: cb -}> } = HooksJS.WithRename as any; +}> } = HooksJS.WithRename as unknown; -export const ForwardRef: { input: (_1:r) => JSX.Element } = HooksJS.ForwardRef as any; +const ForwardRef: { input: (_1:r) => JSX.Element } = HooksJS.ForwardRef as unknown; -export const Fun: { functionReturningReactElement: React.ComponentType<{ readonly name: string }> } = HooksJS.Fun as any; +const Fun: { functionReturningReactElement: React.ComponentType<{ readonly name: string }> } = HooksJS.Fun as unknown; -export const WithRef: { make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: any }> } = HooksJS.WithRef as any; +const WithRef: { make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: unknown }> } = HooksJS.WithRef as unknown; -export const WithChildren: { aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> } = HooksJS.WithChildren as any; +const WithChildren: { aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> } = HooksJS.WithChildren as unknown; -export const DD: { make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> } = HooksJS.DD as any; +const DD: { make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> } = HooksJS.DD as unknown; -export const Another: { anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> } = HooksJS.Another as any; +const Another: { anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> } = HooksJS.Another as unknown; -export const Poly: { polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, any] }> } = HooksJS.Poly as any; +const Poly: { polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, unknown] }> } = HooksJS.Poly as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine index c491e92e..29f5f17f 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module IgnoreInterface.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from IgnoreInterface.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = number; +struct t { number; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine index e90a5c19..edfc9a07 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportHookDefault.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportHookDefault.res by genType. */ /* eslint-disable */ @@ -16,49 +13,48 @@ import {default as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; // In case of type error, check the type of 'make' in 'ImportHookDefault.res' and './hookExample'. -export const makeTypeChecked: React.ComponentType<{ +const makeTypeChecked: React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> = makeNotChecked as any; +}> = makeNotChecked as unknown; // Export 'make' early to allow circular import from the '.bs.js' file. -export const make: unknown = makeTypeChecked as React.ComponentType<{ +const make: unknown = makeTypeChecked as React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> as any; +}> as unknown; // In case of type error, check the type of 'default' in 'ImportHookDefault.res' and './hookExample'. -export const defaultTypeChecked: React.ComponentType<{ +const defaultTypeChecked: React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> = defaultNotChecked as any; +}> = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ +const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> as any; +}> as unknown; import type {renderMe as ImportHooks_renderMe} from './ImportHooks.gen'; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type props = { +type props = { readonly person: person; readonly children: children; readonly renderMe: renderMe }; -export type MM_props = { +type MM_props = { readonly person: person; readonly children: children; readonly renderMe: renderMe }; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine index 1a4cc330..183414dd 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportHooks.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportHooks.res by genType. */ /* eslint-disable */ @@ -16,36 +13,35 @@ import {makeRenamed as makeRenamedNotChecked} from './hookExample'; import {foo as fooNotChecked} from './hookExample'; // In case of type error, check the type of 'makeRenamed' in 'ImportHooks.res' and './hookExample'. -export const makeRenamedTypeChecked: React.ComponentType<{ +const makeRenamedTypeChecked: React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> = makeRenamedNotChecked as any; + readonly renderMe: renderMe +}> = makeRenamedNotChecked as unknown; // Export 'makeRenamed' early to allow circular import from the '.bs.js' file. -export const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentType<{ +const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> as any; + readonly renderMe: renderMe +}> as unknown; // In case of type error, check the type of 'foo' in 'ImportHooks.res' and './hookExample'. -export const fooTypeChecked: (person:person) => string = fooNotChecked as any; +const fooTypeChecked: (person:person) => string = fooNotChecked as unknown; // Export 'foo' early to allow circular import from the '.bs.js' file. -export const foo: unknown = fooTypeChecked as (person:person) => string as any; +const foo: unknown = fooTypeChecked as (person:person) => string as unknown; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type renderMe = React.ComponentType<{ readonly randomString: string; readonly poly: a }>; +type renderMe = React.ComponentType<{ readonly randomString: string; readonly poly: a }>; -export type props = { +type props = { readonly actions?: actions; readonly person: person; readonly children: children; readonly renderMe: renderMe }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine index 1911e969..7d5bc73b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportIndex.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportIndex.res by genType. */ /* eslint-disable */ @@ -14,13 +11,12 @@ module ImportIndex.gen; import {default as defaultNotChecked} from './'; // In case of type error, check the type of 'default' in 'ImportIndex.res' and './'. -export const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked as any; +const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly method?: "push" | "replace" }> as any; +const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly method?: "push" | "replace" }> as unknown; -export type props = { readonly method?: method }; +type props = { readonly method?: method }; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine index 01c6d146..a6ecb73b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportJsValue.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportJsValue.res by genType. */ /* eslint-disable */ @@ -30,60 +27,60 @@ import {polymorphic as polymorphicNotChecked} from './MyMath'; import {default as defaultNotChecked} from './MyMath'; // In case of type error, check the type of 'round' in 'ImportJsValue.res' and './MyMath'. -export const roundTypeChecked: (_1:number) => number = roundNotChecked as any; +const roundTypeChecked: (_1:number) => number = roundNotChecked as unknown; // Export 'round' early to allow circular import from the '.bs.js' file. -export const round: unknown = roundTypeChecked as (_1:number) => number as any; +const round: unknown = roundTypeChecked as (_1:number) => number as unknown; // In case of type error, check the type of 'round2' in 'ImportJsValue.res' and './MyMath'. -export const round2TypeChecked: (_1:number) => number = round2NotChecked as any; +const round2TypeChecked: (_1:number) => number = round2NotChecked as unknown; // Export 'round2' early to allow circular import from the '.bs.js' file. -export const round2: unknown = round2TypeChecked as (_1:number) => number as any; +const round2: unknown = round2TypeChecked as (_1:number) => number as unknown; // In case of type error, check the type of 'area' in 'ImportJsValue.res' and './MyMath'. -export const areaTypeChecked: (_1:point) => number = areaNotChecked as any; +const areaTypeChecked: (_1:point) => number = areaNotChecked as unknown; // Export 'area' early to allow circular import from the '.bs.js' file. -export const area: unknown = areaTypeChecked as (_1:point) => number as any; +const area: unknown = areaTypeChecked as (_1:point) => number as unknown; // In case of type error, check the type of 'returnMixedArray' in 'ImportJsValue.res' and './MyMath'. -export const returnMixedArrayTypeChecked: () => numberOrString[] = returnMixedArrayNotChecked as any; +const returnMixedArrayTypeChecked: () => numberOrString[] = returnMixedArrayNotChecked as unknown; // Export 'returnMixedArray' early to allow circular import from the '.bs.js' file. -export const returnMixedArray: unknown = returnMixedArrayTypeChecked as () => numberOrString[] as any; +const returnMixedArray: unknown = returnMixedArrayTypeChecked as () => numberOrString[] as unknown; // In case of type error, check the type of 'useColor' in 'ImportJsValue.res' and './MyMath'. -export const useColorTypeChecked: (_1:color) => number = useColorNotChecked as any; +const useColorTypeChecked: (_1:color) => number = useColorNotChecked as unknown; // Export 'useColor' early to allow circular import from the '.bs.js' file. -export const useColor: unknown = useColorTypeChecked as (_1:color) => number as any; +const useColor: unknown = useColorTypeChecked as (_1:color) => number as unknown; // In case of type error, check the type of 'higherOrder' in 'ImportJsValue.res' and './MyMath'. -export const higherOrderTypeChecked: (_1:((_1:number, _2:number) => number)) => number = higherOrderNotChecked as any; +const higherOrderTypeChecked: (_1:((_1:number, _2:number) => number)) => number = higherOrderNotChecked as unknown; // Export 'higherOrder' early to allow circular import from the '.bs.js' file. -export const higherOrder: unknown = higherOrderTypeChecked as (_1:((_1:number, _2:number) => number)) => number as any; +const higherOrder: unknown = higherOrderTypeChecked as (_1:((_1:number, _2:number) => number)) => number as unknown; // In case of type error, check the type of 'convertVariant' in 'ImportJsValue.res' and './MyMath'. -export const convertVariantTypeChecked: (_1:variant) => variant = convertVariantNotChecked as any; +const convertVariantTypeChecked: (_1:variant) => variant = convertVariantNotChecked as unknown; // Export 'convertVariant' early to allow circular import from the '.bs.js' file. -export const convertVariant: unknown = convertVariantTypeChecked as (_1:variant) => variant as any; +const convertVariant: unknown = convertVariantTypeChecked as (_1:variant) => variant as unknown; // In case of type error, check the type of 'polymorphic' in 'ImportJsValue.res' and './MyMath'. -export const polymorphicTypeChecked: (_1:a) => a = polymorphicNotChecked as any; +const polymorphicTypeChecked: (_1:a) => a = polymorphicNotChecked as unknown; // Export 'polymorphic' early to allow circular import from the '.bs.js' file. -export const polymorphic: unknown = polymorphicTypeChecked as (_1:a) => a as any; +const polymorphic: unknown = polymorphicTypeChecked as (_1:a) => a as unknown; // In case of type error, check the type of 'default' in 'ImportJsValue.res' and './MyMath'. -export const defaultTypeChecked: number = defaultNotChecked as any; +const defaultTypeChecked: number = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as number as any; +const $$default: unknown = defaultTypeChecked as number as unknown; -const ImportJsValueJS = require('./ImportJsValue.res.js'); +let ImportJsValueJS = require('./ImportJsValue.res.js'); import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; @@ -97,36 +94,35 @@ import type {polyType as $$polyType} from './MyMath'; import type {stringFunction as $$stringFunction} from './MyMath'; -export type point = { readonly x: number; readonly y: (undefined | number) }; +struct point { { readonly x: number; readonly y: (undefined | number) }; -export type numberOrString = $$numberOrString; +struct numberOrString { $$numberOrString; -export type AbsoluteValue_t = $$AbsoluteValue_t; +struct AbsoluteValue_t { $$AbsoluteValue_t; -export type stringFunction = $$stringFunction; +struct stringFunction { $$stringFunction; -export type color = "tomato" | "gray"; +struct color { "tomato" | "gray"; -export type variant = +struct variant { { TAG: "I"; _0: number } | { TAG: "S"; _0: string }; -export type num = $$num; +struct num { $$num; -export type myNum = $$myNum; +struct myNum { $$myNum; -export type polyType = $$polyType; +type polyType = $$polyType; -export const roundedNumber: number = ImportJsValueJS.roundedNumber as any; +const roundedNumber: number = ImportJsValueJS.roundedNumber as unknown; -export const areaValue: number = ImportJsValueJS.areaValue as any; +const areaValue: number = ImportJsValueJS.areaValue as unknown; -export const useGetProp: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetProp as any; +const useGetProp: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetProp as unknown; -export const useGetAbs: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetAbs as any; +const useGetAbs: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetAbs as unknown; -export const returnedFromHigherOrder: number = ImportJsValueJS.returnedFromHigherOrder as any; +const returnedFromHigherOrder: number = ImportJsValueJS.returnedFromHigherOrder as unknown; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine index 8e64d313..7137ba72 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Inherits.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Inherits.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type red = "Ruby" | "Redwood" | "Rust"; +struct red { "Ruby" | "Redwood" | "Rust"; -export type blue = "Sapphire" | "Neon" | "Navy"; +struct blue { "Sapphire" | "Neon" | "Navy"; -export type color = red | blue; +struct color { red | blue; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine index 35d4034d..9e1c2c57 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module InnerModuleSignature.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from InnerModuleSignature.res by genType. */ /* eslint-disable */ @@ -13,10 +10,9 @@ module InnerModuleSignature.gen; import * as InnerModuleSignatureJS from './InnerModuleSignature.res.js'; -export type InnerModule_t = string; +struct InnerModule_t { string; -export const InnerModule_make: (_1:InnerModule_t) => string = InnerModuleSignatureJS.InnerModule.make as any; +const InnerModule_make: (_1:InnerModule_t) => string = InnerModuleSignatureJS.InnerModule.make as unknown; -export const InnerModule: { make: (_1:InnerModule_t) => string } = InnerModuleSignatureJS.InnerModule as any; +const InnerModule: { make: (_1:InnerModule_t) => string } = InnerModuleSignatureJS.InnerModule as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine index c623bc4b..1b40eb1d 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module JSXV4.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from JSXV4.res by genType. */ /* eslint-disable */ @@ -14,40 +11,39 @@ module JSXV4.gen; import {make as makeNotChecked} from './hookExample'; // In case of type error, check the type of 'make' in 'JSXV4.res' and './hookExample'. -export const makeTypeChecked: React.ComponentType<{ +const makeTypeChecked: React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> = makeNotChecked as any; + readonly renderMe: renderMe +}> = makeNotChecked as unknown; // Export 'make' early to allow circular import from the '.bs.js' file. -export const make: unknown = makeTypeChecked as React.ComponentType<{ +const make: unknown = makeTypeChecked as React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> as any; + readonly renderMe: renderMe +}> as unknown; -const JSXV4JS = require('./JSXV4.res.js'); +let JSXV4JS = require('./JSXV4.res.js'); -export type CompV4_props = { readonly x: x; readonly y: y }; +type CompV4_props = { readonly x: x; readonly y: y }; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type props2 = { readonly randomString: string; readonly poly: a }; +type props2 = { readonly randomString: string; readonly poly: a }; -export type renderMe = (_1:props2) => JSX.Element; +type renderMe = (_1:props2) => JSX.Element; -export type props = { +type props = { readonly actions?: actions; readonly person: person; readonly children: children; readonly renderMe: renderMe }; -export const CompV4_make: React.ComponentType<{ readonly x: string; readonly y: string }> = JSXV4JS.CompV4.make as any; +const CompV4_make: React.ComponentType<{ readonly x: string; readonly y: string }> = JSXV4JS.CompV4.make as unknown; -export const CompV4: { make: React.ComponentType<{ readonly x: string; readonly y: string }> } = JSXV4JS.CompV4 as any; +const CompV4: { make: React.ComponentType<{ readonly x: string; readonly y: string }> } = JSXV4JS.CompV4 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine index 433eaa6b..9aa918d0 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module LabeledFun.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from LabeledFun.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module LabeledFun.gen; import * as LabeledFunJS from './LabeledFun.res.js'; -export const labelled: (a:number, b:(undefined | number), c:number, _4:number, e:number, f:number) => number = LabeledFunJS.labelled as any; +const labelled: (a:number, b:(undefined | number), c:number, _4:number, e:number, f:number) => number = LabeledFunJS.labelled as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine index c00f5d1c..213f1a86 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module LetPrivate.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from LetPrivate.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module LetPrivate.gen; import * as LetPrivateJS from './LetPrivate.res.js'; -export const y: number = LetPrivateJS.y as any; +const y: number = LetPrivateJS.y as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine index 0e48ee0c..82a66fa9 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Lib.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Lib.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type action = +struct action { { action: "A"; _0: string } | { action: "B"; _0: string }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine index 6e710715..b663023a 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Machine.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Machine.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module Machine.gen; import * as MachineJS from './Machine.res.js'; -export type aa = { TAG: "A"; _0: number }; +struct aa { { TAG: "A"; _0: number }; -export const a: aa = MachineJS.a as any; +const a: aa = MachineJS.a as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine index f12957a0..3187c3c4 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleAliases.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleAliases.res by genType. */ /* eslint-disable */ @@ -13,24 +10,23 @@ module ModuleAliases.gen; import * as ModuleAliasesJS from './ModuleAliases.res.js'; -export type Outer_Inner_innerT = { readonly inner: string }; +struct Outer_Inner_innerT { { readonly inner: string }; -export type Outer2_Inner2_InnerNested_t = { readonly nested: number }; +struct Outer2_Inner2_InnerNested_t { { readonly nested: number }; -export type Outer2_OuterInnerAlias_innerT = Outer_Inner_innerT; +struct Outer2_OuterInnerAlias_innerT { Outer_Inner_innerT; -export type Outer2_Inner2_OuterInnerAlias2_innerT = Outer2_OuterInnerAlias_innerT; +struct Outer2_Inner2_OuterInnerAlias2_innerT { Outer2_OuterInnerAlias_innerT; -export type Outer2Alias_OuterInnerAlias_innerT = Outer2_OuterInnerAlias_innerT; +struct Outer2Alias_OuterInnerAlias_innerT { Outer2_OuterInnerAlias_innerT; -export type Outer2Alias_Inner2_OuterInnerAlias2_innerT = Outer2_Inner2_OuterInnerAlias2_innerT; +struct Outer2Alias_Inner2_OuterInnerAlias2_innerT { Outer2_Inner2_OuterInnerAlias2_innerT; -export type InnerNestedAlias_t = Outer2_Inner2_InnerNested_t; +struct InnerNestedAlias_t { Outer2_Inner2_InnerNested_t; -export const testNested: (x:InnerNestedAlias_t) => InnerNestedAlias_t = ModuleAliasesJS.testNested as any; +const testNested: (x:InnerNestedAlias_t) => InnerNestedAlias_t = ModuleAliasesJS.testNested as unknown; -export const testInner: (x:Outer2Alias_OuterInnerAlias_innerT) => Outer2Alias_OuterInnerAlias_innerT = ModuleAliasesJS.testInner as any; +const testInner: (x:Outer2Alias_OuterInnerAlias_innerT) => Outer2Alias_OuterInnerAlias_innerT = ModuleAliasesJS.testInner as unknown; -export const testInner2: (x:Outer2Alias_Inner2_OuterInnerAlias2_innerT) => Outer2Alias_Inner2_OuterInnerAlias2_innerT = ModuleAliasesJS.testInner2 as any; +const testInner2: (x:Outer2Alias_Inner2_OuterInnerAlias2_innerT) => Outer2Alias_Inner2_OuterInnerAlias2_innerT = ModuleAliasesJS.testInner2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine index b45d4fd7..000d0269 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine @@ -1,26 +1,22 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleAliases2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleAliases2.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type record = { readonly x: number; readonly y: string }; +struct record { { readonly x: number; readonly y: string }; -export type Outer_outer = { readonly outer: string }; +struct Outer_outer { { readonly outer: string }; -export type Outer_Inner_inner = { readonly inner: string }; +struct Outer_Inner_inner { { readonly inner: string }; -export type OuterAlias_outer = Outer_outer; +struct OuterAlias_outer { Outer_outer; -export type OuterAlias_Inner_inner = Outer_Inner_inner; +struct OuterAlias_Inner_inner { Outer_Inner_inner; -export type InnerAlias_inner = OuterAlias_Inner_inner; +struct InnerAlias_inner { OuterAlias_Inner_inner; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine index 0dfeabc0..e3b5e06d 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleResolution1.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleResolution1.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t1 = { readonly foo: string; readonly bar: number }; +struct t1 { { readonly foo: string; readonly bar: number }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine index 245fa1e7..9efd07e1 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleResolution2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleResolution2.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module ModuleResolution2.gen; import type {t1 as ModuleResolution1_t1} from './ModuleResolution1.gen'; -export type t2 = { readonly dependency: ModuleResolution1_t1 }; +struct t2 { { readonly dependency: ModuleResolution1_t1 }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine index efafad75..c65022b3 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MoreVariants.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from MoreVariants.res by genType. */ /* eslint-disable */ @@ -13,12 +10,11 @@ module MoreVariants.gen; import * as MoreVariantsJS from './MoreVariants.res.js'; -export type withRenaming = "type_" | "b"; +struct withRenaming { "type_" | "b"; -export type withoutRenaming = "type_" | "b"; +struct withoutRenaming { "type_" | "b"; -export const testWithRenaming: (x:withRenaming) => withRenaming = MoreVariantsJS.testWithRenaming as any; +const testWithRenaming: (x:withRenaming) => withRenaming = MoreVariantsJS.testWithRenaming as unknown; -export const testWithoutRenaming: (x:withoutRenaming) => withoutRenaming = MoreVariantsJS.testWithoutRenaming as any; +const testWithoutRenaming: (x:withoutRenaming) => withoutRenaming = MoreVariantsJS.testWithoutRenaming as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.affine index 93f304cb..5c3313aa 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.affine @@ -1,17 +1,13 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyInput; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type * as React from "react"; -type Props = React.InputHTMLAttributes; +struct Props { React.InputHTMLAttributes; const MyInput: React.FC = props => ; -export default MyInput; +default MyInput; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine index b294fd49..f950fe33 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyInput.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from MyInput.res by genType. */ /* eslint-disable */ @@ -14,17 +11,16 @@ module MyInput.gen; import {default as defaultNotChecked} from './MyInput'; // In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'. -export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as any; +const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any; +const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as unknown; import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; -export type inputFocusEvent = $$inputFocusEvent; +struct inputFocusEvent { $$inputFocusEvent; -export type props = { readonly onFocus?: onFocus }; +type props = { readonly onFocus?: onFocus }; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyMath.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyMath.affine index 29522c4b..86a33f12 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyMath.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyMath.affine @@ -1,23 +1,20 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyMath; -// TODO: Complete semantic implementation +const round: (_: number) => number = Math.round; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const round: (_: number) => number = Math.round; +let round2 = round; -export const round2 = round; - -export const area = (point: { x: number; y?: number }): number => +let area = (point: { x: number; y?: number }): number => point.x * (point.y === undefined ? 1 : point.y); -export type numberOrString = number | string; +struct numberOrString { number | string; -export const returnMixedArray = (): Array => [1, 2]; +let returnMixedArray = (): Array => [1, 2]; -export class AbsoluteValue { +struct AbsoluteValue { public prop!: number; public getProp(): number { return this.prop; @@ -27,22 +24,21 @@ export class AbsoluteValue { } } -export type stringFunction = (_: string) => string; +struct stringFunction { (_: string) => string; -export const useColor = (_x: "tomato" | "gray"): number => 0; +let useColor = (_x: "tomato" | "gray"): number => 0; -export const higherOrder = (foo: (_1: number, _2: number) => number) => +let higherOrder = (foo: (_1: number, _2: number) => number) => foo(3, 4); // biome-ignore lint/suspicious/noExplicitAny: intended use -export const convertVariant = (x: any) => x; +let convertVariant = (x: unknown) => x; -export const polymorphic = (x: T): T => x; +let polymorphic = (x: T): T => x; -export type num = number; +struct num { number; -export type polyType = { x: T }; +type polyType = { x: T }; -export default 34; +default 34; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine index a7936f06..0638327f 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyModule.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from MyModule.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module MyModule.gen; import * as MyModuleJS from './MyModule.res.js'; -export type t = number; +struct t { number; -export const add: (a:t, b:t) => t = MyModuleJS.add as any; +const add: (a:t, b:t) => t = MyModuleJS.add as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine index 3076d079..c26451d4 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NestedModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NestedModules.res by genType. */ /* eslint-disable */ @@ -13,29 +10,29 @@ module NestedModules.gen; import * as NestedModulesJS from './NestedModules.res.js'; -export type Universe_nestedType = string[]; +struct Universe_nestedType { string[]; -export type Universe_Nested2_nested2Type = Array; +struct Universe_Nested2_nested2Type { Array; -export type Universe_Nested2_Nested3_nested3Type = Array>; +struct Universe_Nested2_Nested3_nested3Type { Array>; -export type Universe_variant = "A" | { TAG: "B"; _0: string }; +struct Universe_variant { "A" | { TAG: "B"; _0: string }; -export const notNested: number = NestedModulesJS.notNested as any; +const notNested: number = NestedModulesJS.notNested as unknown; -export const Universe_theAnswer: number = NestedModulesJS.Universe.theAnswer as any; +const Universe_theAnswer: number = NestedModulesJS.Universe.theAnswer as unknown; -export const Universe_Nested2_nested2Value: number = NestedModulesJS.Universe.Nested2.nested2Value as any; +const Universe_Nested2_nested2Value: number = NestedModulesJS.Universe.Nested2.nested2Value as unknown; -export const Universe_Nested2_Nested3_nested3Value: string = NestedModulesJS.Universe.Nested2.Nested3.nested3Value as any; +const Universe_Nested2_Nested3_nested3Value: string = NestedModulesJS.Universe.Nested2.Nested3.nested3Value as unknown; -export const Universe_Nested2_Nested3_nested3Function: (x:Universe_Nested2_nested2Type) => Universe_Nested2_nested2Type = NestedModulesJS.Universe.Nested2.Nested3.nested3Function as any; +const Universe_Nested2_Nested3_nested3Function: (x:Universe_Nested2_nested2Type) => Universe_Nested2_nested2Type = NestedModulesJS.Universe.Nested2.Nested3.nested3Function as unknown; -export const Universe_Nested2_nested2Function: (x:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type = NestedModulesJS.Universe.Nested2.nested2Function as any; +const Universe_Nested2_nested2Function: (x:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type = NestedModulesJS.Universe.Nested2.nested2Function as unknown; -export const Universe_someString: string = NestedModulesJS.Universe.someString as any; +const Universe_someString: string = NestedModulesJS.Universe.someString as unknown; -export const Universe: { +const Universe: { theAnswer: number; Nested2: { nested2Function: (x:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type; @@ -46,6 +43,5 @@ export const Universe: { } }; someString: string -} = NestedModulesJS.Universe as any; +} = NestedModulesJS.Universe as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine index f3991234..6657b71b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NestedModulesInSignature.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NestedModulesInSignature.resi by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module NestedModulesInSignature.gen; import * as NestedModulesInSignatureJS from './NestedModulesInSignature.res.js'; -export const Universe_theAnswer: number = NestedModulesInSignatureJS.Universe.theAnswer as any; +const Universe_theAnswer: number = NestedModulesInSignatureJS.Universe.theAnswer as unknown; -export const Universe: { theAnswer: number } = NestedModulesInSignatureJS.Universe as any; +const Universe: { theAnswer: number } = NestedModulesInSignatureJS.Universe as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine index d21824ed..677cf3cb 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NestedVariants.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NestedVariants.res by genType. */ /* eslint-disable */ @@ -13,69 +10,68 @@ module NestedVariants.gen; import * as NestedVariantsJS from './NestedVariants.res.js'; -export type typeL = +struct typeL { { TAG: "NonUnary"; _0: number; _1: number }; -export type typeC = +struct typeC { { TAG: "C"; _0: string } | { TAG: "D"; _0: string }; -export type typeB = { readonly c: typeC }; +struct typeB { { readonly c: typeC }; -export type typeD = { TAG: "Int"; _0: number }; +struct typeD { { TAG: "Int"; _0: number }; -export type typeE = number; +struct typeE { number; -export type typeA = +type typeA = { TAG: "A"; _0: a; _1: number } | { TAG: "B"; _0: a; _1: number }; -export type typeF = { TAG: "F"; _0: a } | { TAG: "G"; _0: a }; +type typeF = { TAG: "F"; _0: a } | { TAG: "G"; _0: a }; -export type typeH = +struct typeH { { TAG: "H"; _0: typeD; _1: number } | { TAG: "I"; _0: typeD; _1: number }; -export type typeJ = { TAG: "J"; _0: typeD; _1: typeD }; +struct typeJ { { TAG: "J"; _0: typeD; _1: typeD }; -export type typeK = { TAG: "K"; _0: typeD; _1: typeD }; +struct typeK { { TAG: "K"; _0: typeD; _1: typeD }; -export type boxedBinary = +struct boxedBinary { { TAG: "BB"; _0: typeD; _1: number } | { TAG: "Z"; _0: number }; -export type unboxedBinary = { TAG: "UB"; _0: typeD; _1: number }; +struct unboxedBinary { { TAG: "UB"; _0: typeD; _1: number }; -export type inline = +struct inline { { TAG: "I"; readonly i: number; readonly j: number } | { TAG: "J"; readonly i: number; readonly j: number } | { TAG: "K"; _0: number; _1: number } | { TAG: "L"; _0: { readonly j: number; readonly i: number } }; -export const makeVariant: () => typeL = NestedVariantsJS.makeVariant as any; +const makeVariant: () => typeL = NestedVariantsJS.makeVariant as unknown; -export const makeABC: () => typeA = NestedVariantsJS.makeABC as any; +const makeABC: () => typeA = NestedVariantsJS.makeABC as unknown; -export const makeBC: () => typeB = NestedVariantsJS.makeBC as any; +const makeBC: () => typeB = NestedVariantsJS.makeBC as unknown; -export const makeAC: () => typeA = NestedVariantsJS.makeAC as any; +const makeAC: () => typeA = NestedVariantsJS.makeAC as unknown; -export const makeAD: () => typeA = NestedVariantsJS.makeAD as any; +const makeAD: () => typeA = NestedVariantsJS.makeAD as unknown; -export const makeAE: () => typeA = NestedVariantsJS.makeAE as any; +const makeAE: () => typeA = NestedVariantsJS.makeAE as unknown; -export const makeFD: () => typeF = NestedVariantsJS.makeFD as any; +const makeFD: () => typeF = NestedVariantsJS.makeFD as unknown; -export const makeHD: () => typeH = NestedVariantsJS.makeHD as any; +const makeHD: () => typeH = NestedVariantsJS.makeHD as unknown; -export const makeJ: () => typeJ = NestedVariantsJS.makeJ as any; +const makeJ: () => typeJ = NestedVariantsJS.makeJ as unknown; -export const makeK: () => typeK = NestedVariantsJS.makeK as any; +const makeK: () => typeK = NestedVariantsJS.makeK as unknown; -export const testBoxedBinary: (param:boxedBinary) => number = NestedVariantsJS.testBoxedBinary as any; +const testBoxedBinary: (param:boxedBinary) => number = NestedVariantsJS.testBoxedBinary as unknown; -export const testUnboxedBinary: (param:unboxedBinary) => number = NestedVariantsJS.testUnboxedBinary as any; +const testUnboxedBinary: (param:unboxedBinary) => number = NestedVariantsJS.testUnboxedBinary as unknown; -export const testInline: (x:inline) => inline = NestedVariantsJS.testInline as any; +const testInline: (x:inline) => inline = NestedVariantsJS.testInline as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine index 0347e6a1..ed06dbe2 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine @@ -1,24 +1,20 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NonrecursiveTypes.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NonrecursiveTypes.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type notRecursive = number; +struct notRecursive { number; -export type M_notRecursive = notRecursive[]; +struct M_notRecursive { notRecursive[]; -export type M_recursive = { readonly self: M_recursive }; +struct M_recursive { { readonly self: M_recursive }; -export type M_mutualRecursive = { readonly a: M_a }; +struct M_mutualRecursive { { readonly a: M_a }; -export type M_a = { readonly self: M_mutualRecursive }; +struct M_a { { readonly self: M_mutualRecursive }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine index 17a46a5e..72b3ecbd 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NumericPolyVar.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NumericPolyVar.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = 12 | 0 | "b"; +struct t { 12 | 0 | "b"; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Object.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Object.gen.affine index e279b412..d5835cb7 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Object.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Object.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Object.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Object.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type someType = { readonly crop?: string; readonly "fp-z"?: string }; +struct someType { { readonly crop?: string; readonly "fp-z"?: string }; -export type someType2 = { readonly crop: (undefined | string); readonly "fp-z": (undefined | string) }; +struct someType2 { { readonly crop: (undefined | string); readonly "fp-z": (undefined | string) }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine index cc37a9dd..941ed876 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module OnClick2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from OnClick2.res by genType. */ /* eslint-disable */ @@ -15,8 +12,7 @@ import * as OnClick2JS from './OnClick2.res.js'; import type {Mouse_t as JsxEvent_Mouse_t} from '../src/shims/JsxEvent.shim'; -export type props = { readonly onClick: onClick }; +type props = { readonly onClick: onClick }; -export const make: React.ComponentType<{ readonly onClick: (_1:JsxEvent_Mouse_t) => void }> = OnClick2JS.make as any; +const make: React.ComponentType<{ readonly onClick: (_1:JsxEvent_Mouse_t) => void }> = OnClick2JS.make as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine index b4931ddd..646abd9e 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Opaque.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Opaque.res by genType. */ /* eslint-disable */ @@ -15,12 +12,11 @@ import * as OpaqueJS from './Opaque.res.js'; import type {business as Records_business} from './Records.gen'; -export abstract class opaqueFromRecords { protected opaque!: any }; /* simulate opaque types */ +abstract struct opaqueFromRecords { protected opaque!: unknown }; /* simulate opaque types */ -export type pair = [opaqueFromRecords, opaqueFromRecords]; +struct pair { [opaqueFromRecords, opaqueFromRecords]; -export const noConversion: (x:opaqueFromRecords) => opaqueFromRecords = OpaqueJS.noConversion as any; +const noConversion: (x:opaqueFromRecords) => opaqueFromRecords = OpaqueJS.noConversion as unknown; -export const testConvertNestedRecordFromOtherFile: (x:Records_business) => Records_business = OpaqueJS.testConvertNestedRecordFromOtherFile as any; +const testConvertNestedRecordFromOtherFile: (x:Records_business) => Records_business = OpaqueJS.testConvertNestedRecordFromOtherFile as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Records.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Records.gen.affine index 03b9c4e4..5a0d289a 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Records.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Records.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Records.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Records.res by genType. */ /* eslint-disable */ @@ -15,35 +12,35 @@ import * as RecordsJS from './Records.res.js'; import type {list} from '../src/shims/RescriptPervasives.shim'; -export type coord = { +struct coord { { readonly x: number; readonly y: number; readonly z: (undefined | number) }; -export type person = { +struct person { { readonly name: string; readonly age: number; readonly address: (undefined | string) }; -export type business = { +struct business { { readonly name: string; readonly owner: (undefined | person); readonly address: (undefined | string) }; -export type payload = { readonly num: number; readonly payload: a }; +type payload = { readonly num: number; readonly payload: a }; -export type record = { readonly v: number; readonly w: number }; +struct record { { readonly v: number; readonly w: number }; -export type business2 = { +struct business2 { { readonly name: string; readonly owner: (null | undefined | person); readonly address2: (null | undefined | string) }; -export type mix = { +struct mix { { readonly a: number; readonly b: number; readonly c?: { @@ -52,11 +49,11 @@ export type mix = { } }; -export type myRec = { readonly type: string }; +struct myRec { { readonly type: string }; -export type myObj = { readonly type_: string }; +struct myObj { { readonly type_: string }; -export type myRecBsAs = { +struct myRecBsAs { { readonly jsValid0: string; readonly type: string; readonly "the-key": string; @@ -65,54 +62,53 @@ export type myRecBsAs = { readonly "1number": string }; -export const origin: coord = RecordsJS.origin as any; +const origin: coord = RecordsJS.origin as unknown; -export const computeArea: (param:coord) => number = RecordsJS.computeArea as any; +const computeArea: (param:coord) => number = RecordsJS.computeArea as unknown; -export const coord2d: (x:number, y:number) => coord = RecordsJS.coord2d as any; +const coord2d: (x:number, y:number) => coord = RecordsJS.coord2d as unknown; -export const findAddress: (business:business) => list = RecordsJS.findAddress as any; +const findAddress: (business:business) => list = RecordsJS.findAddress as unknown; -export const someBusiness: business = RecordsJS.someBusiness as any; +const someBusiness: business = RecordsJS.someBusiness as unknown; -export const findAllAddresses: (businesses:business[]) => string[] = RecordsJS.findAllAddresses as any; +const findAllAddresses: (businesses:business[]) => string[] = RecordsJS.findAllAddresses as unknown; -export const getPayload: (param:payload) => T1 = RecordsJS.getPayload as any; +const getPayload: (param:payload) => T1 = RecordsJS.getPayload as unknown; -export const getPayloadRecord: (param:payload) => record = RecordsJS.getPayloadRecord as any; +const getPayloadRecord: (param:payload) => record = RecordsJS.getPayloadRecord as unknown; -export const recordValue: record = RecordsJS.recordValue as any; +const recordValue: record = RecordsJS.recordValue as unknown; -export const payloadValue: payload = RecordsJS.payloadValue as any; +const payloadValue: payload = RecordsJS.payloadValue as unknown; -export const getPayloadRecordPlusOne: (param:payload) => record = RecordsJS.getPayloadRecordPlusOne as any; +const getPayloadRecordPlusOne: (param:payload) => record = RecordsJS.getPayloadRecordPlusOne as unknown; -export const findAddress2: (business:business2) => list = RecordsJS.findAddress2 as any; +const findAddress2: (business:business2) => list = RecordsJS.findAddress2 as unknown; -export const someBusiness2: business2 = RecordsJS.someBusiness2 as any; +const someBusiness2: business2 = RecordsJS.someBusiness2 as unknown; -export const computeArea3: (o:{ +const computeArea3: (o:{ readonly x: number; readonly y: number; readonly z: (null | undefined | number) -}) => number = RecordsJS.computeArea3 as any; +}) => number = RecordsJS.computeArea3 as unknown; -export const computeArea4: (o:{ +const computeArea4: (o:{ readonly x: number; readonly y: number; readonly z?: number -}) => number = RecordsJS.computeArea4 as any; +}) => number = RecordsJS.computeArea4 as unknown; -export const testMyRec: (x:myRec) => string = RecordsJS.testMyRec as any; +const testMyRec: (x:myRec) => string = RecordsJS.testMyRec as unknown; -export const testMyRec2: (x:myRec) => myRec = RecordsJS.testMyRec2 as any; +const testMyRec2: (x:myRec) => myRec = RecordsJS.testMyRec2 as unknown; -export const testMyObj: (x:myObj) => string = RecordsJS.testMyObj as any; +const testMyObj: (x:myObj) => string = RecordsJS.testMyObj as unknown; -export const testMyObj2: (x:myObj) => myObj = RecordsJS.testMyObj2 as any; +const testMyObj2: (x:myObj) => myObj = RecordsJS.testMyObj2 as unknown; -export const testMyRecBsAs: (x:myRecBsAs) => string[] = RecordsJS.testMyRecBsAs as any; +const testMyRecBsAs: (x:myRecBsAs) => string[] = RecordsJS.testMyRecBsAs as unknown; -export const testMyRecBsAs2: (x:myRecBsAs) => myRecBsAs = RecordsJS.testMyRecBsAs2 as any; +const testMyRecBsAs2: (x:myRecBsAs) => myRecBsAs = RecordsJS.testMyRecBsAs2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/References.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/References.gen.affine index 62602655..48f50fe4 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/References.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/References.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module References.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from References.res by genType. */ /* eslint-disable */ @@ -13,26 +10,25 @@ module References.gen; import * as ReferencesJS from './References.res.js'; -export abstract class R_t { protected opaque!: a }; /* simulate opaque types */ +abstract struct R_t { protected opaque!: a }; /* simulate opaque types */ -export type t = R_t; +type t = R_t; -export type requiresConversion = { readonly x: number }; +struct requiresConversion { { readonly x: number }; -export const create: (x:number) => { contents: number } = ReferencesJS.create as any; +const create: (x:number) => { contents: number } = ReferencesJS.create as unknown; -export const access: (r:{ contents: number }) => number = ReferencesJS.access as any; +const access: (r:{ contents: number }) => number = ReferencesJS.access as unknown; -export const update: (r:{ contents: number }) => void = ReferencesJS.update as any; +const update: (r:{ contents: number }) => void = ReferencesJS.update as unknown; -export const get: (_1:R_t) => T1 = ReferencesJS.get as any; +const get: (_1:R_t) => T1 = ReferencesJS.get as unknown; -export const make: (_1:T1) => R_t = ReferencesJS.make as any; +const make: (_1:T1) => R_t = ReferencesJS.make as unknown; -export const set: (_1:R_t, _2:T1) => void = ReferencesJS.set as any; +const set: (_1:R_t, _2:T1) => void = ReferencesJS.set as unknown; -export const destroysRefIdentity: (x:{ contents: requiresConversion }) => { contents: requiresConversion } = ReferencesJS.destroysRefIdentity as any; +const destroysRefIdentity: (x:{ contents: requiresConversion }) => { contents: requiresConversion } = ReferencesJS.destroysRefIdentity as unknown; -export const preserveRefIdentity: (x:R_t) => R_t = ReferencesJS.preserveRefIdentity as any; +const preserveRefIdentity: (x:R_t) => R_t = ReferencesJS.preserveRefIdentity as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine index 56f3d330..d6d08b4d 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Shadow.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Shadow.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module Shadow.gen; import * as ShadowJS from './Shadow.res.js'; -export const test: () => string = ShadowJS.test as any; +const test: () => string = ShadowJS.test as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine index 4079183a..da35124b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestEmitInnerModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestEmitInnerModules.res by genType. */ /* eslint-disable */ @@ -13,14 +10,13 @@ module TestEmitInnerModules.gen; import * as TestEmitInnerModulesJS from './TestEmitInnerModules.res.js'; -export const Inner_x: number = TestEmitInnerModulesJS.Inner.x as any; +const Inner_x: number = TestEmitInnerModulesJS.Inner.x as unknown; -export const Inner_y: string = TestEmitInnerModulesJS.Inner.y as any; +const Inner_y: string = TestEmitInnerModulesJS.Inner.y as unknown; -export const Outer_Medium_Inner_y: number = TestEmitInnerModulesJS.Outer.Medium.Inner.y as any; +const Outer_Medium_Inner_y: number = TestEmitInnerModulesJS.Outer.Medium.Inner.y as unknown; -export const Inner: { x: number; y: string } = TestEmitInnerModulesJS.Inner as any; +const Inner: { x: number; y: string } = TestEmitInnerModulesJS.Inner as unknown; -export const Outer: { Medium: { Inner: { y: number } } } = TestEmitInnerModulesJS.Outer as any; +const Outer: { Medium: { Inner: { y: number } } } = TestEmitInnerModulesJS.Outer as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine index 5464f792..2f345142 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestFirstClassModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestFirstClassModules.res by genType. */ /* eslint-disable */ @@ -19,14 +16,13 @@ import type {firstClassModule as FirstClassModules_firstClassModule} from './Fir import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; -export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; +type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; -export const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as any; +const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as unknown; -export const convertInterface: (x:FirstClassModulesInterface_firstClassModule) => FirstClassModulesInterface_firstClassModule = TestFirstClassModulesJS.convertInterface as any; +const convertInterface: (x:FirstClassModulesInterface_firstClassModule) => FirstClassModulesInterface_firstClassModule = TestFirstClassModulesJS.convertInterface as unknown; -export const convertRecord: (x:FirstClassModulesInterface_record) => FirstClassModulesInterface_record = TestFirstClassModulesJS.convertRecord as any; +const convertRecord: (x:FirstClassModulesInterface_record) => FirstClassModulesInterface_record = TestFirstClassModulesJS.convertRecord as unknown; -export const convertFirstClassModuleWithTypeEquations: (x:{ readonly out: ((_1:T1) => T1); readonly Inner: { readonly inn: ((_1:T2) => T2) } }) => { readonly out: (_1:T1) => T1; readonly Inner: { readonly inn: (_1:T2) => T2 } } = TestFirstClassModulesJS.convertFirstClassModuleWithTypeEquations as any; +const convertFirstClassModuleWithTypeEquations: (x:{ readonly out: ((_1:T1) => T1); readonly Inner: { readonly inn: ((_1:T2) => T2) } }) => { readonly out: (_1:T1) => T1; readonly Inner: { readonly inn: (_1:T2) => T2 } } = TestFirstClassModulesJS.convertFirstClassModuleWithTypeEquations as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine index e38afb1f..7029c22b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestImmutableArray.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestImmutableArray.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module TestImmutableArray.gen; import * as TestImmutableArrayJS from './TestImmutableArray.res.js'; -export const testImmutableArrayGet: (arr:ReadonlyArray) => (undefined | T1) = TestImmutableArrayJS.testImmutableArrayGet as any; +const testImmutableArrayGet: (arr:ReadonlyArray) => (undefined | T1) = TestImmutableArrayJS.testImmutableArrayGet as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine index c19d7f8b..e43795ea 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestModuleAliases.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestModuleAliases.res by genType. */ /* eslint-disable */ @@ -21,28 +18,27 @@ import type {Outer_outer as ModuleAliases2_Outer_outer} from './ModuleAliases2.g import type {record as ModuleAliases2_record} from './ModuleAliases2.gen'; -export type OtherFile_record = { readonly x: number; readonly y: string }; +struct OtherFile_record { { readonly x: number; readonly y: string }; -export type record = ModuleAliases2_record; +struct record { ModuleAliases2_record; -export type record2 = ModuleAliases2_record; +struct record2 { ModuleAliases2_record; -export type outer = ModuleAliases2_Outer_outer; +struct outer { ModuleAliases2_Outer_outer; -export type outer2 = ModuleAliases2_Outer_outer; +struct outer2 { ModuleAliases2_Outer_outer; -export type my2 = ModuleAliases2_Outer_Inner_inner; +struct my2 { ModuleAliases2_Outer_Inner_inner; -export type inner1 = ModuleAliases2_InnerAlias_inner; +struct inner1 { ModuleAliases2_InnerAlias_inner; -export type inner2 = ModuleAliases2_Outer_Inner_inner; +struct inner2 { ModuleAliases2_Outer_Inner_inner; -export const testInner1: (x:inner1) => inner1 = TestModuleAliasesJS.testInner1 as any; +const testInner1: (x:inner1) => inner1 = TestModuleAliasesJS.testInner1 as unknown; -export const testInner1Expanded: (x:ModuleAliases2_InnerAlias_inner) => ModuleAliases2_InnerAlias_inner = TestModuleAliasesJS.testInner1Expanded as any; +const testInner1Expanded: (x:ModuleAliases2_InnerAlias_inner) => ModuleAliases2_InnerAlias_inner = TestModuleAliasesJS.testInner1Expanded as unknown; -export const testInner2: (x:inner2) => inner2 = TestModuleAliasesJS.testInner2 as any; +const testInner2: (x:inner2) => inner2 = TestModuleAliasesJS.testInner2 as unknown; -export const testInner2Expanded: (x:ModuleAliases2_Outer_Inner_inner) => ModuleAliases2_Outer_Inner_inner = TestModuleAliasesJS.testInner2Expanded as any; +const testInner2Expanded: (x:ModuleAliases2_Outer_Inner_inner) => ModuleAliases2_Outer_Inner_inner = TestModuleAliasesJS.testInner2Expanded as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine index 0dbc2ec5..beba73d1 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestPromise.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestPromise.res by genType. */ /* eslint-disable */ @@ -13,14 +10,13 @@ module TestPromise.gen; import * as TestPromiseJS from './TestPromise.res.js'; -export type promise = Promise; +type promise = a; -export type fromPayload = { readonly x: number; readonly s: string }; +struct fromPayload { { readonly x: number; readonly s: string }; -export type toPayload = { readonly result: string }; +struct toPayload { { readonly result: string }; -export const convert: (p:Promise) => Promise = TestPromiseJS.convert as any; +const convert: (p:fromPayload) => toPayload = TestPromiseJS.convert as unknown; -export const barx: (x:(undefined | Promise<(undefined | string)>), _2:void) => boolean = TestPromiseJS.barx as any; +const barx: (x:(undefined | (undefined | string)), _2:void) => boolean = TestPromiseJS.barx as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine index 723c18ef..3e127bdc 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TransitiveType1.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TransitiveType1.res by genType. */ /* eslint-disable */ @@ -17,8 +14,7 @@ import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; -export const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as any; +const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as unknown; -export const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as any; +const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine index 3a2028b3..0f6c1590 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TransitiveType2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TransitiveType2.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module TransitiveType2.gen; import type {t3 as TransitiveType3_t3} from './TransitiveType3.gen'; -export type t2 = (undefined | TransitiveType3_t3); +struct t2 { (undefined | TransitiveType3_t3); -export type t2Alias = t2; +struct t2Alias { t2; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine index be1d3747..33144148 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TransitiveType3.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TransitiveType3.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module TransitiveType3.gen; import * as TransitiveType3JS from './TransitiveType3.res.js'; -export type t3 = { readonly i: number; readonly s: string }; +struct t3 { { readonly i: number; readonly s: string }; -export const convertT3: (x:t3) => t3 = TransitiveType3JS.convertT3 as any; +const convertT3: (x:t3) => t3 = TransitiveType3JS.convertT3 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine index 53921776..94391b0f 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeNameSanitize.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeNameSanitize.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t_ = number; +struct t_ { number; -export type M_t__ = number; +struct M_t__ { number; -export type pair = [t_, M_t__]; +struct pair { [t_, M_t__]; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine index eafda865..e0cc7635 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeParams1.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeParams1.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type ocaml_array = a[]; +type ocaml_array = a[]; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine index dfcd0afa..c69126e2 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeParams2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeParams2.res by genType. */ /* eslint-disable */ @@ -13,10 +10,9 @@ module TypeParams2.gen; import type {ocaml_array as TypeParams1_ocaml_array} from './TypeParams1.gen'; -export type item = { readonly id: number }; +struct item { { readonly id: number }; -export type items = TypeParams1_ocaml_array; +struct items { TypeParams1_ocaml_array; -export type items2 = item[]; +struct items2 { item[]; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine index 5a32f93a..d34a3af0 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeParams3.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeParams3.res by genType. */ /* eslint-disable */ @@ -17,8 +14,7 @@ import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; import type {items as TypeParams2_items} from './TypeParams2.gen'; -export const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as any; +const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as unknown; -export const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as any; +const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine index 13d45c6a..66310b6c 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Unboxed.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Unboxed.res by genType. */ /* eslint-disable */ @@ -13,26 +10,25 @@ module Unboxed.gen; import * as UnboxedJS from './Unboxed.res.js'; -export type v1 = number; +struct v1 { number; -export type v2 = number; +struct v2 { number; -export type r1 = number; +struct r1 { number; -export type r2 = string; +struct r2 { string; -export type t = number[] | number | ((_1:number) => number); +struct t { number[] | number | ((_1:number) => number); -export type tabIndex = "0" | "1" | 0; +struct tabIndex { "0" | "1" | 0; -export const testV1: (x:v1) => v1 = UnboxedJS.testV1 as any; +const testV1: (x:v1) => v1 = UnboxedJS.testV1 as unknown; -export const r2Test: (x:r2) => r2 = UnboxedJS.r2Test as any; +const r2Test: (x:r2) => r2 = UnboxedJS.r2Test as unknown; -export const a: tabIndex = UnboxedJS.a as any; +const a: tabIndex = UnboxedJS.a as unknown; -export const b: tabIndex = UnboxedJS.b as any; +const b: tabIndex = UnboxedJS.b as unknown; -export const zero: 0 = UnboxedJS.zero as any; +const zero: 0 = UnboxedJS.zero as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine index d31531ff..93c34038 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Uncurried.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Uncurried.res by genType. */ /* eslint-disable */ @@ -13,40 +10,39 @@ module Uncurried.gen; import * as UncurriedJS from './Uncurried.res.js'; -export type u0 = () => string; +struct u0 { () => string; -export type u1 = (_1:number) => string; +struct u1 { (_1:number) => string; -export type u2 = (_1:number, _2:string) => string; +struct u2 { (_1:number, _2:string) => string; -export type u3 = (_1:number, _2:string, _3:number) => string; +struct u3 { (_1:number, _2:string, _3:number) => string; -export type auth = { readonly login: () => string }; +struct auth { { readonly login: () => string }; -export type authU = { readonly loginU: () => string }; +struct authU { { readonly loginU: () => string }; -export const uncurried0: () => string = UncurriedJS.uncurried0 as any; +const uncurried0: () => string = UncurriedJS.uncurried0 as unknown; -export const uncurried1: (x:number) => string = UncurriedJS.uncurried1 as any; +const uncurried1: (x:number) => string = UncurriedJS.uncurried1 as unknown; -export const uncurried2: (x:number, y:string) => string = UncurriedJS.uncurried2 as any; +const uncurried2: (x:number, y:string) => string = UncurriedJS.uncurried2 as unknown; -export const uncurried3: (x:number, y:string, z:number) => string = UncurriedJS.uncurried3 as any; +const uncurried3: (x:number, y:string, z:number) => string = UncurriedJS.uncurried3 as unknown; -export const curried3: (x:number, y:string, z:number) => string = UncurriedJS.curried3 as any; +const curried3: (x:number, y:string, z:number) => string = UncurriedJS.curried3 as unknown; -export const callback: (cb:(() => number)) => string = UncurriedJS.callback as any; +const callback: (cb:(() => number)) => string = UncurriedJS.callback as unknown; -export const callback2: (auth:auth) => string = UncurriedJS.callback2 as any; +const callback2: (auth:auth) => string = UncurriedJS.callback2 as unknown; -export const callback2U: (auth:authU) => string = UncurriedJS.callback2U as any; +const callback2U: (auth:authU) => string = UncurriedJS.callback2U as unknown; -export const sumU: (n:number, m:number) => void = UncurriedJS.sumU as any; +const sumU: (n:number, m:number) => void = UncurriedJS.sumU as unknown; -export const sumU2: (n:number) => (_1:number) => void = UncurriedJS.sumU2 as any; +const sumU2: (n:number) => (_1:number) => void = UncurriedJS.sumU2 as unknown; -export const sumCurried: (n:number) => (_1:number) => void = UncurriedJS.sumCurried as any; +const sumCurried: (n:number) => (_1:number) => void = UncurriedJS.sumCurried as unknown; -export const sumLblCurried: (s:string, n:number) => (m:number) => void = UncurriedJS.sumLblCurried as any; +const sumLblCurried: (s:string, n:number) => (m:number) => void = UncurriedJS.sumLblCurried as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine index 52ea9695..41030c07 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Usage.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Usage.res by genType. */ /* eslint-disable */ @@ -15,6 +12,5 @@ import * as UsageJS from './Usage.res.js'; import type {MyModuleAlias_t as Wrapper_MyModuleAlias_t} from './Wrapper.gen'; -export const b: Wrapper_MyModuleAlias_t = UsageJS.b as any; +const b: Wrapper_MyModuleAlias_t = UsageJS.b as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine index 3e220029..763703fe 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module UseImportJsValue.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from UseImportJsValue.res by genType. */ /* eslint-disable */ @@ -17,8 +14,7 @@ import type {AbsoluteValue_t as ImportJsValue_AbsoluteValue_t} from './ImportJsV import type {stringFunction as ImportJsValue_stringFunction} from './ImportJsValue.gen'; -export const useGetProp: (x:ImportJsValue_AbsoluteValue_t) => number = UseImportJsValueJS.useGetProp as any; +const useGetProp: (x:ImportJsValue_AbsoluteValue_t) => number = UseImportJsValueJS.useGetProp as unknown; -export const useTypeImportedInOtherModule: (x:ImportJsValue_stringFunction) => ImportJsValue_stringFunction = UseImportJsValueJS.useTypeImportedInOtherModule as any; +const useTypeImportedInOtherModule: (x:ImportJsValue_stringFunction) => ImportJsValue_stringFunction = UseImportJsValueJS.useTypeImportedInOtherModule as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine index a92b8a46..2428fe4c 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Variants.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Variants.res by genType. */ /* eslint-disable */ @@ -15,7 +12,7 @@ import * as VariantsJS from './Variants.res.js'; import type {list} from '../src/shims/RescriptPervasives.shim'; -export type weekday = +struct weekday { "monday" | "tuesday" | "wednesday" @@ -24,71 +21,70 @@ export type weekday = | "saturday" | "sunday"; -export type testGenTypeAs = "type_" | "module_" | "fortytwo"; +struct testGenTypeAs { "type_" | "module_" | "fortytwo"; -export type testGenTypeAs2 = "type_" | "module" | 42; +struct testGenTypeAs2 { "type_" | "module" | 42; -export type testGenTypeAs3 = "type_" | "module" | 42; +struct testGenTypeAs3 { "type_" | "module" | 42; -export type x1 = "x" | "x1"; +struct x1 { "x" | "x1"; -export type x2 = "x" | "x2"; +struct x2 { "x" | "x2"; -export type type_ = "Type"; -export type type = type_; +struct type_ { "Type"; +struct type { type_; -export type myList = "E" | { TAG: "C"; _0: number; _1: myList }; +struct myList { "E" | { TAG: "C"; _0: number; _1: myList }; -export type builtinList = list; +struct builtinList { list; -export type result1 = +type result1 = { TAG: "Ok"; _0: a } | { TAG: "Error"; _0: b }; -export type result2 = +type result2 = { TAG: "Ok"; _0: a } | { TAG: "Error"; _0: b }; -export type result3 = +type result3 = { TAG: "Ok"; _0: a } | { TAG: "Error"; _0: b }; -export const isWeekend: (x:weekday) => boolean = VariantsJS.isWeekend as any; +const isWeekend: (x:weekday) => boolean = VariantsJS.isWeekend as unknown; -export const monday: "monday" = VariantsJS.monday as any; +const monday: "monday" = VariantsJS.monday as unknown; -export const saturday: "saturday" = VariantsJS.saturday as any; +const saturday: "saturday" = VariantsJS.saturday as unknown; -export const sunday: "sunday" = VariantsJS.sunday as any; +const sunday: "sunday" = VariantsJS.sunday as unknown; -export const onlySunday: (param:"sunday") => void = VariantsJS.onlySunday as any; +const onlySunday: (param:"sunday") => void = VariantsJS.onlySunday as unknown; -export const swap: (x:"saturday" | "sunday") => "saturday" | "sunday" = VariantsJS.swap as any; +const swap: (x:"saturday" | "sunday") => "saturday" | "sunday" = VariantsJS.swap as unknown; -export const testConvert: (x:testGenTypeAs) => testGenTypeAs = VariantsJS.testConvert as any; +const testConvert: (x:testGenTypeAs) => testGenTypeAs = VariantsJS.testConvert as unknown; -export const fortytwoOK: testGenTypeAs = VariantsJS.fortytwoOK as any; +const fortytwoOK: testGenTypeAs = VariantsJS.fortytwoOK as unknown; -export const fortytwoBAD: "fortytwo" = VariantsJS.fortytwoBAD as any; +const fortytwoBAD: "fortytwo" = VariantsJS.fortytwoBAD as unknown; -export const testConvert2: (x:testGenTypeAs2) => testGenTypeAs2 = VariantsJS.testConvert2 as any; +const testConvert2: (x:testGenTypeAs2) => testGenTypeAs2 = VariantsJS.testConvert2 as unknown; -export const testConvert3: (x:testGenTypeAs3) => testGenTypeAs3 = VariantsJS.testConvert3 as any; +const testConvert3: (x:testGenTypeAs3) => testGenTypeAs3 = VariantsJS.testConvert3 as unknown; -export const testConvert2to3: (x:testGenTypeAs2) => testGenTypeAs3 = VariantsJS.testConvert2to3 as any; +const testConvert2to3: (x:testGenTypeAs2) => testGenTypeAs3 = VariantsJS.testConvert2to3 as unknown; -export const id1: (x:x1) => x1 = VariantsJS.id1 as any; +const id1: (x:x1) => x1 = VariantsJS.id1 as unknown; -export const id2: (x:x2) => x2 = VariantsJS.id2 as any; +const id2: (x:x2) => x2 = VariantsJS.id2 as unknown; -export const polyWithOpt: (foo:string) => (undefined | ( +const polyWithOpt: (foo:string) => (undefined | ( { NAME: "One"; VAL: string } - | { NAME: "Two"; VAL: number })) = VariantsJS.polyWithOpt as any; + | { NAME: "Two"; VAL: number })) = VariantsJS.polyWithOpt as unknown; -export const restResult1: (x:result1) => result1 = VariantsJS.restResult1 as any; +const restResult1: (x:result1) => result1 = VariantsJS.restResult1 as unknown; -export const restResult2: (x:result2) => result2 = VariantsJS.restResult2 as any; +const restResult2: (x:result2) => result2 = VariantsJS.restResult2 as unknown; -export const restResult3: (x:result3) => result3 = VariantsJS.restResult3 as any; +const restResult3: (x:result3) => result3 = VariantsJS.restResult3 as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine index 843346b0..af469d1b 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module VariantsWithPayload.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from VariantsWithPayload.res by genType. */ /* eslint-disable */ @@ -13,9 +10,9 @@ module VariantsWithPayload.gen; import * as VariantsWithPayloadJS from './VariantsWithPayload.res.js'; -export type payload = { readonly x: number; readonly y?: string }; +struct payload { { readonly x: number; readonly y?: string }; -export type withPayload = +struct withPayload { "a" | "b" | "True" @@ -23,40 +20,39 @@ export type withPayload = | "Half" | { NAME: "c"; VAL: payload }; -export type manyPayloads = +struct manyPayloads { { NAME: "one"; VAL: number } | { NAME: "two"; VAL: [string, string] } | { NAME: "three"; VAL: payload }; -export type simpleVariant = "A" | "B" | "C"; +struct simpleVariant { "A" | "B" | "C"; -export type variantWithPayloads = +struct variantWithPayloads { "A" | { TAG: "B"; _0: number } | { TAG: "C"; _0: number; _1: number } | { TAG: "D"; _0: number; _1: number } | { TAG: "E"; _0: number; _1: string; _2: number }; -export type variant1Int = { TAG: "R"; _0: number }; +struct variant1Int { { TAG: "R"; _0: number }; -export type variant1Object = { TAG: "R"; _0: payload }; +struct variant1Object { { TAG: "R"; _0: payload }; -export const testWithPayload: (x:withPayload) => withPayload = VariantsWithPayloadJS.testWithPayload as any; +const testWithPayload: (x:withPayload) => withPayload = VariantsWithPayloadJS.testWithPayload as unknown; -export const printVariantWithPayload: (x:withPayload) => void = VariantsWithPayloadJS.printVariantWithPayload as any; +const printVariantWithPayload: (x:withPayload) => void = VariantsWithPayloadJS.printVariantWithPayload as unknown; -export const testManyPayloads: (x:manyPayloads) => manyPayloads = VariantsWithPayloadJS.testManyPayloads as any; +const testManyPayloads: (x:manyPayloads) => manyPayloads = VariantsWithPayloadJS.testManyPayloads as unknown; -export const printManyPayloads: (x:manyPayloads) => void = VariantsWithPayloadJS.printManyPayloads as any; +const printManyPayloads: (x:manyPayloads) => void = VariantsWithPayloadJS.printManyPayloads as unknown; -export const testSimpleVariant: (x:simpleVariant) => simpleVariant = VariantsWithPayloadJS.testSimpleVariant as any; +const testSimpleVariant: (x:simpleVariant) => simpleVariant = VariantsWithPayloadJS.testSimpleVariant as unknown; -export const testVariantWithPayloads: (x:variantWithPayloads) => variantWithPayloads = VariantsWithPayloadJS.testVariantWithPayloads as any; +const testVariantWithPayloads: (x:variantWithPayloads) => variantWithPayloads = VariantsWithPayloadJS.testVariantWithPayloads as unknown; -export const printVariantWithPayloads: (x:variantWithPayloads) => void = VariantsWithPayloadJS.printVariantWithPayloads as any; +const printVariantWithPayloads: (x:variantWithPayloads) => void = VariantsWithPayloadJS.printVariantWithPayloads as unknown; -export const testVariant1Int: (x:variant1Int) => variant1Int = VariantsWithPayloadJS.testVariant1Int as any; +const testVariant1Int: (x:variant1Int) => variant1Int = VariantsWithPayloadJS.testVariant1Int as unknown; -export const testVariant1Object: (x:variant1Object) => variant1Object = VariantsWithPayloadJS.testVariant1Object as any; +const testVariant1Object: (x:variant1Object) => variant1Object = VariantsWithPayloadJS.testVariant1Object as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine index af1bbcaa..de13f094 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Warnings.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Warnings.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module Warnings.gen; import * as WarningsJS from './Warnings.res.js'; -export const ddd: number = WarningsJS.x as any; +const ddd: number = WarningsJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine index d3d6f3b6..554a91ab 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Wrapper.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Wrapper.res by genType. */ /* eslint-disable */ @@ -13,10 +10,9 @@ module Wrapper.gen; import * as WrapperJS from './Wrapper.res.js'; -export type MyModuleAlias_t = number; +struct MyModuleAlias_t { number; -export const MyModuleAlias_add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t = WrapperJS.MyModuleAlias.add as any; +const MyModuleAlias_add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t = WrapperJS.MyModuleAlias.add as unknown; -export const MyModuleAlias: { add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t } = WrapperJS.MyModuleAlias as any; +const MyModuleAlias: { add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t } = WrapperJS.MyModuleAlias as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/counter.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/counter.gen.affine index 7b5c8f13..057fb381 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/counter.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/counter.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module counter.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from counter.res by genType. */ /* eslint-disable */ @@ -15,6 +12,5 @@ import * as counterJS from './counter.res.js'; import type {aa as Machine_aa} from './Machine.gen'; -export const b: Machine_aa = counterJS.b as any; +const b: Machine_aa = counterJS.b as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/hookExample.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/hookExample.affine index a4d1c80c..db689cef 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/hookExample.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/hookExample.affine @@ -1,17 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module hookExample; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import * as React from "react"; -export const foo = (person: { readonly name: string; readonly age: number }) => +let foo = (person: { readonly name: string; readonly age: number }) => person.name; -type Props = { +struct Props { { readonly person: { readonly name: string; readonly age: number }; readonly children: React.ReactNode; readonly renderMe: React.ComponentType<{ @@ -20,8 +17,8 @@ type Props = { }>; }; -export const make: React.FC = (x: Props) => { - const RenderMe = x.renderMe; +const make: React.FC = (x: Props) => { + let RenderMe = x.renderMe; return (

{" "} @@ -31,9 +28,9 @@ export const make: React.FC = (x: Props) => { ); }; -class AsClassComponent extends React.PureComponent { +struct AsClassComponent extends React.PureComponent { public render() { - const RenderMe = this.props.renderMe; + let RenderMe = this.props.renderMe; return (
{" "} @@ -44,8 +41,7 @@ class AsClassComponent extends React.PureComponent { } } -export const makeRenamed = AsClassComponent; +let makeRenamed = AsClassComponent; -export default make; +default make; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/index.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/index.affine index 47e0e2a5..f5929491 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/index.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/index.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module index; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type * as React from "react"; import * as ReactDOM from "react-dom"; import App from "./App.tsx"; @@ -29,11 +26,11 @@ import { } from "./VariantsWithPayload.gen.tsx"; import * as Types from "./nested/Types.gen.tsx"; -const consoleLog = console.log; +let consoleLog = console.log; -const intList = Types.map(Types.someIntList, x => x + 1); +let intList = Types.map(Types.someIntList, x => x + 1); -const businesses = [ +let businesses = [ { address: "Poison road", name: "AcmeLTD", @@ -41,7 +38,7 @@ const businesses = [ }, ]; -const addresses = Records.findAllAddresses(businesses); +let addresses = Records.findAllAddresses(businesses); consoleLog("indList", intList); consoleLog("addresses", addresses); @@ -78,10 +75,10 @@ ReactDOM.render( document.getElementById("root") as HTMLElement, ); -const x1 = Records.getPayload(Records.payloadValue).v; -const x2 = Records.getPayloadRecord(Records.payloadValue).v; -const x3 = Records.payloadValue.payload.v; -const x4 = Records.getPayloadRecordPlusOne(Records.payloadValue).v; +let x1 = Records.getPayload(Records.payloadValue).v; +let x2 = Records.getPayloadRecord(Records.payloadValue).v; +let x3 = Records.payloadValue.payload.v; +let x4 = Records.getPayloadRecordPlusOne(Records.payloadValue).v; consoleLog("x1,x2,x3,x4 are", x1, x2, x3, x4); consoleLog( @@ -98,12 +95,12 @@ consoleLog( ); consoleLog("Variants: testConvert3to2(42) =", Variants.testConvert2to3(42)); -const absoluteValueInstance = new MyMath.AbsoluteValue(); +let absoluteValueInstance = new MyMath.AbsoluteValue(); absoluteValueInstance.prop = -3; consoleLog("absoluteValueInstance", absoluteValueInstance); -const propValue = ImportJsValue.useGetProp(absoluteValueInstance); -const absValue = ImportJsValue.useGetAbs(absoluteValueInstance); +let propValue = ImportJsValue.useGetProp(absoluteValueInstance); +let absValue = ImportJsValue.useGetAbs(absoluteValueInstance); consoleLog("ImportJsValue: getProp() =", propValue); consoleLog("ImportJsValue: getAbs() =", absValue); @@ -130,17 +127,16 @@ TestPromise.convert(Promise.resolve({ x: 3, s: "hello" })).then(x => consoleLog("TestPromise result:", x.result), ); -type Props = { +struct Props { { readonly method?: "push" | "replace"; }; -export const make: React.FC = (_x: Props) => { +const make: React.FC = (_x: Props) => { return
; }; -const signedMessage = DocStrings.signMessage("hello", 42); +let signedMessage = DocStrings.signMessage("hello", 42); consoleLog("signedMessage:", signedMessage); -export default make; +default make; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine index 0bb22292..b44a12d3 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module location.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from location.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = { readonly id: string; readonly name: string }; +struct t { { readonly id: string; readonly name: string }; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine index 02a85ffb..a4893283 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Tuples.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Tuples.res by genType. */ /* eslint-disable */ @@ -13,30 +10,29 @@ module Tuples.gen; import * as TuplesJS from './Tuples.res.js'; -export type coord = [number, number, (undefined | number)]; +struct coord { [number, number, (undefined | number)]; -export type coord2 = [number, number, (null | undefined | number)]; +struct coord2 { [number, number, (null | undefined | number)]; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type couple = [person, person]; +struct couple { [person, person]; -export const testTuple: (param:[number, number]) => number = TuplesJS.testTuple as any; +const testTuple: (param:[number, number]) => number = TuplesJS.testTuple as unknown; -export const origin: [number, number, (undefined | number)] = TuplesJS.origin as any; +const origin: [number, number, (undefined | number)] = TuplesJS.origin as unknown; -export const computeArea: (param:[number, number, (undefined | number)]) => number = TuplesJS.computeArea as any; +const computeArea: (param:[number, number, (undefined | number)]) => number = TuplesJS.computeArea as unknown; -export const computeAreaWithIdent: (param:coord) => number = TuplesJS.computeAreaWithIdent as any; +const computeAreaWithIdent: (param:coord) => number = TuplesJS.computeAreaWithIdent as unknown; -export const computeAreaNoConverters: (param:[number, number]) => number = TuplesJS.computeAreaNoConverters as any; +const computeAreaNoConverters: (param:[number, number]) => number = TuplesJS.computeAreaNoConverters as unknown; -export const coord2d: (x:T1, y:T2) => [T1, T2, (undefined | T3)] = TuplesJS.coord2d as any; +const coord2d: (x:T1, y:T2) => [T1, T2, (undefined | T3)] = TuplesJS.coord2d as unknown; -export const getFirstName: (param:couple) => string = TuplesJS.getFirstName as any; +const getFirstName: (param:couple) => string = TuplesJS.getFirstName as unknown; -export const marry: (first:person, second:person) => couple = TuplesJS.marry as any; +const marry: (first:person, second:person) => couple = TuplesJS.marry as unknown; -export const changeSecondAge: (param:couple) => couple = TuplesJS.changeSecondAge as any; +const changeSecondAge: (param:couple) => couple = TuplesJS.changeSecondAge as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine index 1651f191..5d720e14 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Types.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Types.res by genType. */ /* eslint-disable */ @@ -25,61 +22,61 @@ import type {t_ as TypeNameSanitize_t_} from '../../src/TypeNameSanitize.gen'; import type {t as Location_t} from '../../src/location/location.gen'; -export type t = number; +struct t { number; -export type typeWithVars = +type typeWithVars = { TAG: "A"; _0: x; _1: y } | { TAG: "B"; _0: z }; -export type tree = { +struct tree { { readonly label: string; readonly left?: tree; readonly right?: tree }; -export type selfRecursive = { readonly self: selfRecursive }; +struct selfRecursive { { readonly self: selfRecursive }; -export type mutuallyRecursiveA = { readonly b: mutuallyRecursiveB }; +struct mutuallyRecursiveA { { readonly b: mutuallyRecursiveB }; -export type mutuallyRecursiveB = { readonly a: mutuallyRecursiveA }; +struct mutuallyRecursiveB { { readonly a: mutuallyRecursiveA }; -export abstract class opaqueVariant { protected opaque!: any }; /* simulate opaque types */ +abstract struct opaqueVariant { protected opaque!: unknown }; /* simulate opaque types */ -export type twice = [a, a]; +type twice = [a, a]; -export type genTypeMispelled = number; +struct genTypeMispelled { number; -export type dictString = {[id: string]: string}; +struct dictString { {[id: string]: string}; -export type nullOrString = (null | string); +struct nullOrString { (null | string); -export type nullOrString2 = (null | string); +struct nullOrString2 { (null | string); -export type nullOrString3 = (null | string); +struct nullOrString3 { (null | string); -export type nullOrString4 = (null | string); +struct nullOrString4 { (null | string); -export type nullableOrString = (null | undefined | string); +struct nullableOrString { (null | undefined | string); -export type nullableOrString2 = (null | undefined | string); +struct nullableOrString2 { (null | undefined | string); -export type nullableOrString3 = (null | undefined | string); +struct nullableOrString3 { (null | undefined | string); -export type nullableOrString4 = (null | undefined | string); +struct nullableOrString4 { (null | undefined | string); -export type undefinedOrString = (undefined | string); +struct undefinedOrString { (undefined | string); -export type undefinedOrString2 = (undefined | string); +struct undefinedOrString2 { (undefined | string); -export type undefinedOrString3 = (undefined | string); +struct undefinedOrString3 { (undefined | string); -export type undefinedOrString4 = (undefined | string); +struct undefinedOrString4 { (undefined | string); -export type record = { readonly i: number; readonly s: string }; +struct record { { readonly i: number; readonly s: string }; -export type decorator = (_1:a) => b; +type decorator = (_1:a) => b; -export type marshalFields = { +struct marshalFields { { readonly _rec: string; readonly _switch: string; readonly switch: string; @@ -91,55 +88,54 @@ export type marshalFields = { readonly _Uppercase__: string }; -export type marshalMutableField = { _match: number }; +struct marshalMutableField { { _match: number }; -export type ocaml_array = a[]; +type ocaml_array = a[]; -export type someRecord = { readonly id: number }; +struct someRecord { { readonly id: number }; -export type instantiateTypeParameter = ocaml_array; +struct instantiateTypeParameter { ocaml_array; -export type vector = [a, a]; -export type Vector = vector; +type vector = [a, a]; +type Vector = vector; -export type date = Date; +struct date { Date; -export type ObjectId_t = number; +struct ObjectId_t { number; -export type tPrimed = [TypeNameSanitize_t_, TypeNameSanitize_M_t__]; +struct tPrimed { [TypeNameSanitize_t_, TypeNameSanitize_M_t__]; -export const someIntList: list = TypesJS.someIntList as any; +const someIntList: list = TypesJS.someIntList as unknown; -export const map: (_1:Belt_List_t, _2:((_1:T1) => T2)) => Belt_List_t = TypesJS.map as any; +const map: (_1:Belt_List_t, _2:((_1:T1) => T2)) => Belt_List_t = TypesJS.map as unknown; -export const swap: (tree:tree) => tree = TypesJS.swap as any; +const swap: (tree:tree) => tree = TypesJS.swap as unknown; -export const selfRecursiveConverter: (param:selfRecursive) => selfRecursive = TypesJS.selfRecursiveConverter as any; +const selfRecursiveConverter: (param:selfRecursive) => selfRecursive = TypesJS.selfRecursiveConverter as unknown; -export const mutuallyRecursiveConverter: (param:mutuallyRecursiveA) => mutuallyRecursiveB = TypesJS.mutuallyRecursiveConverter as any; +const mutuallyRecursiveConverter: (param:mutuallyRecursiveA) => mutuallyRecursiveB = TypesJS.mutuallyRecursiveConverter as unknown; -export const testFunctionOnOptionsAsArgument: (a:(undefined | a), foo:((_1:(undefined | a)) => T1)) => T1 = TypesJS.testFunctionOnOptionsAsArgument as any; +const testFunctionOnOptionsAsArgument: (a:(undefined | a), foo:((_1:(undefined | a)) => T1)) => T1 = TypesJS.testFunctionOnOptionsAsArgument as unknown; -export const stringT: string = TypesJS.stringT as any; +const stringT: string = TypesJS.stringT as unknown; -export const jsStringT: string = TypesJS.jsStringT as any; +const jsStringT: string = TypesJS.jsStringT as unknown; -export const jsString2T: string = TypesJS.jsString2T as any; +const jsString2T: string = TypesJS.jsString2T as unknown; -export const jsonStringify: (_1:Js_Json_t) => string = TypesJS.jsonStringify as any; +const jsonStringify: (_1:Js_Json_t) => string = TypesJS.jsonStringify as unknown; -export const testConvertNull: (x:(null | record)) => (null | record) = TypesJS.testConvertNull as any; +const testConvertNull: (x:(null | record)) => (null | record) = TypesJS.testConvertNull as unknown; -export const testConvertLocation: (x:Location_t) => Location_t = TypesJS.testConvertLocation as any; +const testConvertLocation: (x:Location_t) => Location_t = TypesJS.testConvertLocation as unknown; -export const testMarshalFields: marshalFields = TypesJS.testMarshalFields as any; +const testMarshalFields: marshalFields = TypesJS.testMarshalFields as unknown; -export const setMatch: (x:marshalMutableField) => void = TypesJS.setMatch as any; +const setMatch: (x:marshalMutableField) => void = TypesJS.setMatch as unknown; -export const testInstantiateTypeParameter: (x:instantiateTypeParameter) => instantiateTypeParameter = TypesJS.testInstantiateTypeParameter as any; +const testInstantiateTypeParameter: (x:instantiateTypeParameter) => instantiateTypeParameter = TypesJS.testInstantiateTypeParameter as unknown; -export const currentTime: Date = TypesJS.currentTime as any; +const currentTime: Date = TypesJS.currentTime as unknown; -export const optFunction: (undefined | (() => number)) = TypesJS.optFunction as any; +const optFunction: (undefined | (() => number)) = TypesJS.optFunction as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine index 887016c7..ca17d105 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine @@ -1,11 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module react-app-env.d; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /// -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine index 9f73ace8..a27f48bf 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine @@ -1,13 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Belt.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type { list } from "./RescriptPervasives.shim"; -export type List_t = list; +type List_t = list; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine index ea775677..92bdc3dd 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine @@ -1,15 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Js.shim; -// TODO: Complete semantic implementation +struct Json_t { unknown; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export type Json_t = unknown; +struct t { unknown; -export type t = unknown; +struct TypedArray2_Uint8Array_t { Uint8Array; -export type TypedArray2_Uint8Array_t = Uint8Array; - -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine index f6d07079..229c9a65 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine @@ -1,13 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Jsx.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type { ReactElement } from "react"; -export type element = ReactElement; +struct element { ReactElement; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine index b7c85262..459d1d4c 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine @@ -1,71 +1,67 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module JsxEvent.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === -export abstract class Animation_t { +abstract struct Animation_t { protected opaque: unknown; } -export abstract class Clipboard_t { +abstract struct Clipboard_t { protected opaque: unknown; } -export abstract class Composition_t { +abstract struct Composition_t { protected opaque: unknown; } -export abstract class Focus_t { +abstract struct Focus_t { protected opaque: unknown; } -export abstract class Form_t { +abstract struct Form_t { protected opaque: unknown; } -export abstract class Keyboard_t { +abstract struct Keyboard_t { protected opaque: unknown; } -export abstract class Image_t { +abstract struct Image_t { protected opaque: unknown; } -export abstract class Media_t { +abstract struct Media_t { protected opaque: unknown; } -export abstract class Selection_t { +abstract struct Selection_t { protected opaque: unknown; } -export abstract class Synthetic_t { +abstract struct Synthetic_t { protected opaque: unknown; } -export abstract class Touch_t { +abstract struct Touch_t { protected opaque: unknown; } -export abstract class Transition_t { +abstract struct Transition_t { protected opaque: unknown; } -export abstract class UI_t { +abstract struct UI_t { protected opaque: unknown; } -export abstract class Wheel_t { +abstract struct Wheel_t { protected opaque: unknown; } -export type inputFocusEvent = React.FocusEvent; +struct inputFocusEvent { React.FocusEvent; -export abstract class Mouse_t { +abstract struct Mouse_t { protected opaque: unknown; } -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine index d9e69a19..dc9a35a8 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine @@ -1,31 +1,27 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module RescriptPervasives.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === const $$Array = require("bs-platform/lib/js/array"); -export abstract class EmptyList { +abstract struct EmptyList { protected opaque: unknown; } -export abstract class Cons { +abstract struct Cons { protected opaque!: T; } -export type list = Cons | EmptyList; +type list = Cons | EmptyList; -export function cons(itm: T, lst: list): list { +fn cons(itm: T, lst: list): list { // biome-ignore lint/suspicious/noExplicitAny: intended use - return /* :: */ [itm, lst] as any; + return /* :: */ [itm, lst] as unknown; } // biome-ignore lint/suspicious/noExplicitAny: intended use -export const emptyList: EmptyList = /* [] */ 0 as any; +const emptyList: EmptyList = /* [] */ 0 as unknown; -export const fromArray = $$Array.to_list; +let fromArray = $$Array.to_list; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine index b7c79e53..16ba62b1 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module 404.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from 404.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module 404.gen; import * as _404JS from './404.res.js'; -export const x: number = _404JS.x as any; +const x: number = _404JS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine index 74e9cb30..8fd735b6 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module AppModal.web.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from AppModal.web.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module AppModal.web.gen; import * as AppModal_webJS from './AppModal.web.res.js'; -export const x: number = AppModal_webJS.x as any; +const x: number = AppModal_webJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine index d11f3d79..b59390f1 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module _under.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from _under.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module _under.gen; import * as _underJS from './_under.res.js'; -export const x: number = _underJS.x as any; +const x: number = _underJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine index 171b0ac8..455d84f3 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module with_underscore.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from with_underscore.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module with_underscore.gen; import * as with_underscoreJS from './with_underscore.res.js'; -export const x: number = with_underscoreJS.x as any; +const x: number = with_underscoreJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/testReferences.affine b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/testReferences.affine index 2e5b11a2..ccc647a7 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/testReferences.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/gentype_tests/typescript-react-example/src/testReferences.affine @@ -1,23 +1,19 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module testReferences; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import * as References from "./References.gen"; const r: { contents: number } = { contents: 34 }; r.contents = 42; -export const n: number = References.access(r); +const n: number = References.access(r); const ar: References.t = References.make(34); References.set(ar, 42); -export const an: number = References.get(ar); +const an: number = References.get(ar); -==================================== */ diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/tests/src/variantsMatching.gen.affine b/rescript-ecosystem/packages/core/compiler-source/tests/tests/src/variantsMatching.gen.affine index f4984c3a..58d3bec6 100644 --- a/rescript-ecosystem/packages/core/compiler-source/tests/tests/src/variantsMatching.gen.affine +++ b/rescript-ecosystem/packages/core/compiler-source/tests/tests/src/variantsMatching.gen.affine @@ -1,30 +1,26 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module variantsMatching.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from variantsMatching.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = "thisIsA" | 42 | null | "D" | 3.14; +struct t { "thisIsA" | 42 | null | "D" | 3.14; -export type tNU = null | undefined; +struct tNU { null | undefined; -export type MyUndefined_t = undefined | a; +type MyUndefined_t = undefined | a; -export type MyNull_t = null | a; +type MyNull_t = null | a; -export type MyNullable_t = null | undefined | a; +type MyNullable_t = null | undefined | a; -export type MyNullableExtended_t = null | undefined | "WhyNotAnotherOne" | a; +type MyNullableExtended_t = null | undefined | "WhyNotAnotherOne" | a; -export type UntaggedWithBool_t = string | number | boolean | string; +struct UntaggedWithBool_t { string | number | boolean | string; -export type UntaggedWithTuple_t = string | [number, number, string]; +struct UntaggedWithTuple_t { string | [number, number, string]; -==================================== */ diff --git a/rescript-ecosystem/packages/core/runtime-tools/bin/rrt.affine b/rescript-ecosystem/packages/core/runtime-tools/bin/rrt.affine index 44eaa9d8..04a17783 100644 --- a/rescript-ecosystem/packages/core/runtime-tools/bin/rrt.affine +++ b/rescript-ecosystem/packages/core/runtime-tools/bin/rrt.affine @@ -1,25 +1,22 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module rrt; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === #!/usr/bin/env -S deno run --allow-read --allow-write --allow-run --allow-net --allow-env // SPDX-License-Identifier: MPL-2.0 // rrt - ReScript Runtime Tools CLI // Works on both Deno and Bun -const VERSION = "0.1.0"; +let VERSION = "0.1.0"; // Detect runtime -const isDeno = typeof (globalThis as any).Deno !== "undefined"; -const isBun = typeof (globalThis as any).Bun !== "undefined"; -const runtime = isDeno ? "deno" : isBun ? "bun" : "unknown"; +let isDeno = typeof (globalThis as unknown).Deno !== "undefined"; +let isBun = typeof (globalThis as unknown).Bun !== "undefined"; +let runtime = isDeno ? "deno" : isBun ? "bun" : "unknown"; // Colors for terminal output -const colors = { +let colors = { reset: "\x1b[0m", bold: "\x1b[1m", dim: "\x1b[2m", @@ -30,11 +27,11 @@ const colors = { cyan: "\x1b[36m", }; -const c = (color: keyof typeof colors, text: string) => +let c = (color: keyof typeof colors, text: string) => `${colors[color]}${text}${colors.reset}`; // Help text -const HELP = ` +let HELP = ` ${c("bold", "rrt")} - ReScript Runtime Tools v${VERSION} ${c("dim", `Running on ${runtime}`)} @@ -67,15 +64,15 @@ ${c("yellow", "EXAMPLES:")} `; // Parse command line args -function parseArgs(args: string[]): { +fn parseArgs(args: string[]): { command: string; options: Record; } { - const command = args[0] || "help"; + let command = args[0] || "help"; const options: Record = {}; for (let i = 1; i < args.length; i++) { - const arg = args[i]; + let arg = args[i]; if (arg === "--help" || arg === "-h") { options.help = true; } else if (arg === "--version" || arg === "-v") { @@ -95,21 +92,21 @@ function parseArgs(args: string[]): { } // Run shell command -async function run(cmd: string, args: string[]): Promise { +async fn run(cmd: string, args: string[]): boolean { if (isDeno) { - const command = new (globalThis as any).Deno.Command(cmd, { args }); + let command = new (globalThis as unknown).Deno.Command(cmd, { args }); const { success } = await command.output(); return success; } else if (isBun) { - const proc = (globalThis as any).Bun.spawn([cmd, ...args]); - const code = await proc.exited; + let proc = (globalThis as unknown).Bun.spawn([cmd, ...args]); + let code = await proc.exited; return code === 0; } return false; } // Run rescript via Deno's npm: specifier (no npm install needed) -async function runRescript(args: string[]): Promise { +async fn runRescript(args: string[]): boolean { if (isDeno) { return run("deno", ["run", "-A", "npm:rescript", ...args]); } else if (isBun) { @@ -120,9 +117,9 @@ async function runRescript(args: string[]): Promise { } // Commands -async function cmdDev(options: Record) { - const port = options.port || "8000"; - const host = options.host || "127.0.0.1"; +async fn cmdDev(options: Record) { + let port = options.port || "8000"; + let host = options.host || "127.0.0.1"; console.log(c("cyan", `\n🚀 Starting dev server on ${runtime}...`)); console.log(c("dim", ` http://${host}:${port}\n`)); @@ -132,7 +129,7 @@ async function cmdDev(options: Record) { if (isDeno) { // Deno: use npm: specifier directly - no node_modules - const rescriptCmd = new (globalThis as any).Deno.Command("deno", { + let rescriptCmd = new (globalThis as unknown).Deno.Command("deno", { args: ["run", "-A", "npm:rescript", "build", "-w"], stdout: "inherit", stderr: "inherit", @@ -140,7 +137,7 @@ async function cmdDev(options: Record) { rescriptCmd.spawn(); } else if (isBun) { // Bun: use bunx for npm packages - (globalThis as any).Bun.spawn(["bunx", "rescript", "build", "-w"], { + (globalThis as unknown).Bun.spawn(["bunx", "rescript", "build", "-w"], { stdout: "inherit", stderr: "inherit", }); @@ -164,8 +161,8 @@ async function cmdDev(options: Record) { } } -async function cmdBuild(options: Record) { - const isProd = options.prod === true; +async fn cmdBuild(options: Record) { + let isProd = options.prod === true; console.log( c("cyan", `\n🔨 Building for ${isProd ? "production" : "development"}...`) ); @@ -176,20 +173,20 @@ async function cmdBuild(options: Record) { } // Build ReScript (no npm install needed) - const success = await runRescript(["build"]); + let success = await runRescript(["build"]); if (!success) { console.error(c("red", "❌ ReScript build failed")); - if (isDeno) (globalThis as any).Deno.exit(1); + if (isDeno) (globalThis as unknown).Deno.exit(1); if (isBun) process.exit(1); } console.log(c("green", "✅ Build complete\n")); } -async function cmdTest(options: Record) { +async fn cmdTest(options: Record) { console.log(c("cyan", `\n🧪 Running tests on ${runtime}...\n`)); - const watchFlag = options.watch ? ["--watch"] : []; + let watchFlag = options.watch ? ["--watch"] : []; if (isDeno) { await run("deno", [ @@ -203,7 +200,7 @@ async function cmdTest(options: Record) { } } -async function cmdBench(_options: Record) { +async fn cmdBench(_options: Record) { console.log(c("cyan", `\n⚡ Running benchmarks on ${runtime}...\n`)); if (isDeno) { @@ -214,31 +211,31 @@ async function cmdBench(_options: Record) { } } -async function cmdFmt(_options: Record) { +async fn cmdFmt(_options: Record) { console.log(c("cyan", "\n✨ Formatting...\n")); await runRescript(["format", "-all"]); console.log(c("green", "✅ Format complete\n")); } -async function cmdClean(_options: Record) { +async fn cmdClean(_options: Record) { console.log(c("cyan", "\n🧹 Cleaning...\n")); await runRescript(["clean"]); console.log(c("green", "✅ Clean complete\n")); } -function cmdInfo() { - const info = { +fn cmdInfo() { + let info = { runtime, version: isDeno - ? (globalThis as any).Deno.version.deno + ? (globalThis as unknown).Deno.version.deno : isBun - ? (globalThis as any).Bun.version + ? (globalThis as unknown).Bun.version : "unknown", platform: isDeno - ? (globalThis as any).Deno.build.os + ? (globalThis as unknown).Deno.build.os : process?.platform || "unknown", arch: isDeno - ? (globalThis as any).Deno.build.arch + ? (globalThis as unknown).Deno.build.arch : process?.arch || "unknown", }; @@ -250,9 +247,9 @@ function cmdInfo() { } // Main -async function main() { - const args = isDeno - ? (globalThis as any).Deno.args +async fn main() { + let args = isDeno + ? (globalThis as unknown).Deno.args : isBun ? process.argv.slice(2) : []; @@ -295,11 +292,10 @@ async function main() { default: console.error(c("red", `Unknown command: ${command}`)); console.log(c("dim", "Run 'rrt --help' for usage")); - if (isDeno) (globalThis as any).Deno.exit(1); + if (isDeno) (globalThis as unknown).Deno.exit(1); if (isBun) process.exit(1); } } main(); -==================================== */ diff --git a/rescript-ecosystem/packages/core/runtime-tools/tests/detect_test.affine b/rescript-ecosystem/packages/core/runtime-tools/tests/detect_test.affine index e3ea230f..9198ff5e 100644 --- a/rescript-ecosystem/packages/core/runtime-tools/tests/detect_test.affine +++ b/rescript-ecosystem/packages/core/runtime-tools/tests/detect_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module detect_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Tests for runtime detection @@ -15,33 +12,32 @@ import { assertEquals, assertExists } from "@std/assert"; // For now, test the detection logic directly Deno.test("runtime detection - identifies Deno", () => { - const isDeno = typeof (globalThis as any).Deno !== "undefined"; + let isDeno = typeof (globalThis as unknown).Deno !== "undefined"; assertEquals(isDeno, true, "Should detect Deno runtime"); }); Deno.test("runtime detection - Deno version exists", () => { - const version = (globalThis as any).Deno?.version?.deno; + let version = (globalThis as unknown).Deno?.version?.deno; assertExists(version, "Deno version should exist"); }); Deno.test("runtime detection - Bun not present in Deno", () => { - const isBun = typeof (globalThis as any).Bun !== "undefined"; + let isBun = typeof (globalThis as unknown).Bun !== "undefined"; assertEquals(isBun, false, "Bun should not be detected in Deno"); }); Deno.test("capabilities - filesystem available", () => { - const hasFs = typeof Deno.readFile === "function"; + let hasFs = typeof Deno.readFile === "function"; assertEquals(hasFs, true, "Filesystem should be available"); }); Deno.test("capabilities - network available", () => { - const hasNet = typeof fetch === "function"; + let hasNet = typeof fetch === "function"; assertEquals(hasNet, true, "Network (fetch) should be available"); }); Deno.test("capabilities - WebAssembly available", () => { - const hasWasm = typeof WebAssembly !== "undefined"; + let hasWasm = typeof WebAssembly !== "undefined"; assertEquals(hasWasm, true, "WebAssembly should be available"); }); -==================================== */ diff --git a/rescript-ecosystem/packages/web/dom-mounter/tests/safe_dom_high_assurance.test.affine b/rescript-ecosystem/packages/web/dom-mounter/tests/safe_dom_high_assurance.test.affine index 556257e2..97c8ebf8 100644 --- a/rescript-ecosystem/packages/web/dom-mounter/tests/safe_dom_high_assurance.test.affine +++ b/rescript-ecosystem/packages/web/dom-mounter/tests/safe_dom_high_assurance.test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module safe_dom_high_assurance.test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import { assertEquals, assert } from "https://deno.land/std@0.211.0/testing/asserts.ts"; import * as SafeDOM from "../src/SafeDOM.res.js"; @@ -25,29 +22,28 @@ const { ProvenSelector, ProvenHTML, MountTracer } = SafeDOM as typeof SafeDOM & Deno.test("selector validation rejects empty selectors and traces outcome", () => { MountTracer.clear(); - const result = ProvenSelector.validate("" as string); + let result = ProvenSelector.validate("" as string); assertEquals(result.TAG, "Error"); - const entries = MountTracer.entries(); + let entries = MountTracer.entries(); assert(entries.length >= 1); assert(entries.some((entry) => entry.event === "selector-validation")); }); Deno.test("proven HTML validation rejects unbalanced markup and logs detail", () => { MountTracer.clear(); - const html = "
"; - const result = ProvenHTML.validate(html); + let html = "
"; + let result = ProvenHTML.validate(html); assertEquals(result.TAG, "Error"); - const latest = MountTracer.latest(); + let latest = MountTracer.latest(); assert(latest.TAG === "Some"); assert(latest._0.event === "html-validation"); }); Deno.test("mount tracer records success for valid selectors", () => { MountTracer.clear(); - const result = ProvenSelector.validate("#app"); + let result = ProvenSelector.validate("#app"); assertEquals(result.TAG, "Ok"); - const entries = MountTracer.entries(); + let entries = MountTracer.entries(); assert(entries[entries.length - 1].detail.includes("selector valid")); }); -==================================== */ diff --git a/rescript-ecosystem/rescript-dom-mounter/tests/safe_dom_high_assurance.test.affine b/rescript-ecosystem/rescript-dom-mounter/tests/safe_dom_high_assurance.test.affine index 556257e2..97c8ebf8 100644 --- a/rescript-ecosystem/rescript-dom-mounter/tests/safe_dom_high_assurance.test.affine +++ b/rescript-ecosystem/rescript-dom-mounter/tests/safe_dom_high_assurance.test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module safe_dom_high_assurance.test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import { assertEquals, assert } from "https://deno.land/std@0.211.0/testing/asserts.ts"; import * as SafeDOM from "../src/SafeDOM.res.js"; @@ -25,29 +22,28 @@ const { ProvenSelector, ProvenHTML, MountTracer } = SafeDOM as typeof SafeDOM & Deno.test("selector validation rejects empty selectors and traces outcome", () => { MountTracer.clear(); - const result = ProvenSelector.validate("" as string); + let result = ProvenSelector.validate("" as string); assertEquals(result.TAG, "Error"); - const entries = MountTracer.entries(); + let entries = MountTracer.entries(); assert(entries.length >= 1); assert(entries.some((entry) => entry.event === "selector-validation")); }); Deno.test("proven HTML validation rejects unbalanced markup and logs detail", () => { MountTracer.clear(); - const html = "
"; - const result = ProvenHTML.validate(html); + let html = "
"; + let result = ProvenHTML.validate(html); assertEquals(result.TAG, "Error"); - const latest = MountTracer.latest(); + let latest = MountTracer.latest(); assert(latest.TAG === "Some"); assert(latest._0.event === "html-validation"); }); Deno.test("mount tracer records success for valid selectors", () => { MountTracer.clear(); - const result = ProvenSelector.validate("#app"); + let result = ProvenSelector.validate("#app"); assertEquals(result.TAG, "Ok"); - const entries = MountTracer.entries(); + let entries = MountTracer.entries(); assert(entries[entries.length - 1].detail.includes("selector valid")); }); -==================================== */ diff --git a/rescript-ecosystem/rescript/analysis/examples/example-project/src/syntax/sample-highlighting.affine b/rescript-ecosystem/rescript/analysis/examples/example-project/src/syntax/sample-highlighting.affine index 68fbfc74..df78b53f 100644 --- a/rescript-ecosystem/rescript/analysis/examples/example-project/src/syntax/sample-highlighting.affine +++ b/rescript-ecosystem/rescript/analysis/examples/example-project/src/syntax/sample-highlighting.affine @@ -1,15 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module sample-highlighting; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // Bindings let numberBinding = 123; -const SomeComp = { +let SomeComp = { Nested: () => null, }; @@ -49,7 +46,7 @@ let destructuring = () => { }; namespace SomeModule { - export enum t { + enum t { Some, Value, Here, @@ -57,9 +54,9 @@ namespace SomeModule { } // Decorators and classes -function someDecorator() { +fn someDecorator() { return function ( - target: any, + target: unknown, propertyKey: string, descriptor: PropertyDescriptor ) { @@ -67,7 +64,7 @@ function someDecorator() { }; } -class SomeClass { +struct SomeClass { @someDecorator() doStuff() { return 123; } @@ -77,12 +74,12 @@ class SomeClass { let interpolated = `${numberBinding} ${"123"}`; // JSX -interface Props { +struct Props { someProp: number; otherProp: string; thirdProp: SomeModule.t; } -const SomeComponent = ({ someProp, otherProp, thirdProp }: Props) => { +let SomeComponent = ({ someProp, otherProp, thirdProp }: Props) => { return null; }; @@ -97,8 +94,7 @@ let jsx = ( {"Hello"}
); -function Property() { +fn Property() { throw new Error("Function not implemented."); } -==================================== */ diff --git a/rescript-ecosystem/rescript/packages/@rescript/darwin-arm64/bin.d.affine b/rescript-ecosystem/rescript/packages/@rescript/darwin-arm64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/rescript/packages/@rescript/darwin-arm64/bin.d.affine +++ b/rescript-ecosystem/rescript/packages/@rescript/darwin-arm64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/rescript/packages/@rescript/darwin-x64/bin.d.affine b/rescript-ecosystem/rescript/packages/@rescript/darwin-x64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/rescript/packages/@rescript/darwin-x64/bin.d.affine +++ b/rescript-ecosystem/rescript/packages/@rescript/darwin-x64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/rescript/packages/@rescript/linux-arm64/bin.d.affine b/rescript-ecosystem/rescript/packages/@rescript/linux-arm64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/rescript/packages/@rescript/linux-arm64/bin.d.affine +++ b/rescript-ecosystem/rescript/packages/@rescript/linux-arm64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/rescript/packages/@rescript/linux-x64/bin.d.affine b/rescript-ecosystem/rescript/packages/@rescript/linux-x64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/rescript/packages/@rescript/linux-x64/bin.d.affine +++ b/rescript-ecosystem/rescript/packages/@rescript/linux-x64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/rescript/packages/@rescript/win32-x64/bin.d.affine b/rescript-ecosystem/rescript/packages/@rescript/win32-x64/bin.d.affine index b3ff76e9..808a40a8 100644 --- a/rescript-ecosystem/rescript/packages/@rescript/win32-x64/bin.d.affine +++ b/rescript-ecosystem/rescript/packages/@rescript/win32-x64/bin.d.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bin.d; -// TODO: Complete semantic implementation +const binDir: string; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const binDir: string; +const binPaths: BinaryPaths; -export const binPaths: BinaryPaths; - -export type BinaryPaths = { +struct BinaryPaths { { bsc_exe: string; rescript_tools_exe: string; rescript_editor_analysis_exe: string; rescript_exe: string; }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine index e267b8dc..7224953a 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/StdlibNoShims.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module StdlibNoShims.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from StdlibNoShims.res by genType. */ /* eslint-disable */ @@ -13,116 +10,115 @@ module StdlibNoShims.gen; import * as StdlibNoShimsJS from './StdlibNoShims.res.js'; -export const idInt: (x:number) => number = StdlibNoShimsJS.idInt as any; +const idInt: (x:number) => number = StdlibNoShimsJS.idInt as unknown; -export const idFloat: (x:number) => number = StdlibNoShimsJS.idFloat as any; +const idFloat: (x:number) => number = StdlibNoShimsJS.idFloat as unknown; -export const idBool: (x:boolean) => boolean = StdlibNoShimsJS.idBool as any; +const idBool: (x:boolean) => boolean = StdlibNoShimsJS.idBool as unknown; -export const idString: (x:string) => string = StdlibNoShimsJS.idString as any; +const idString: (x:string) => string = StdlibNoShimsJS.idString as unknown; -export const idBigInt: (x:bigint) => bigint = StdlibNoShimsJS.idBigInt as any; +const idBigInt: (x:bigint) => bigint = StdlibNoShimsJS.idBigInt as unknown; -export const idDate: (x:Date) => Date = StdlibNoShimsJS.idDate as any; +const idDate: (x:Date) => Date = StdlibNoShimsJS.idDate as unknown; -export const idRegExp: (x:RegExp) => RegExp = StdlibNoShimsJS.idRegExp as any; +const idRegExp: (x:RegExp) => RegExp = StdlibNoShimsJS.idRegExp as unknown; -export const idPromise: (x:Promise) => Promise = StdlibNoShimsJS.idPromise as any; +const idPromise: (x:string) => string = StdlibNoShimsJS.idPromise as unknown; -export const idDict: (x:{[id: string]: number}) => {[id: string]: number} = StdlibNoShimsJS.idDict as any; +const idDict: (x:{[id: string]: number}) => {[id: string]: number} = StdlibNoShimsJS.idDict as unknown; -export const idMap: (x:Map) => Map = StdlibNoShimsJS.idMap as any; +const idMap: (x:Map) => Map = StdlibNoShimsJS.idMap as unknown; -export const idWeakMap: (x:WeakMap) => WeakMap = StdlibNoShimsJS.idWeakMap as any; +const idWeakMap: (x:WeakMap) => WeakMap = StdlibNoShimsJS.idWeakMap as unknown; -export const idSet: (x:Set) => Set = StdlibNoShimsJS.idSet as any; +const idSet: (x:Set) => Set = StdlibNoShimsJS.idSet as unknown; -export const idWeakSet: (x:WeakSet) => WeakSet = StdlibNoShimsJS.idWeakSet as any; +const idWeakSet: (x:WeakSet) => WeakSet = StdlibNoShimsJS.idWeakSet as unknown; -export const idArray: (x:number[]) => number[] = StdlibNoShimsJS.idArray as any; +const idArray: (x:number[]) => number[] = StdlibNoShimsJS.idArray as unknown; -export const idUndefined: (x:(undefined | number)) => (undefined | number) = StdlibNoShimsJS.idUndefined as any; +const idUndefined: (x:(undefined | number)) => (undefined | number) = StdlibNoShimsJS.idUndefined as unknown; -export const idNull: (x:(null | number)) => (null | number) = StdlibNoShimsJS.idNull as any; +const idNull: (x:(null | number)) => (null | number) = StdlibNoShimsJS.idNull as unknown; -export const idNullable: (x:(null | undefined | number)) => (null | undefined | number) = StdlibNoShimsJS.idNullable as any; +const idNullable: (x:(null | undefined | number)) => (null | undefined | number) = StdlibNoShimsJS.idNullable as unknown; -export const idOption: (x:(undefined | string)) => (undefined | string) = StdlibNoShimsJS.idOption as any; +const idOption: (x:(undefined | string)) => (undefined | string) = StdlibNoShimsJS.idOption as unknown; -export const idJSON: (x:unknown) => unknown = StdlibNoShimsJS.idJSON as any; +const idJSON: (x:unknown) => unknown = StdlibNoShimsJS.idJSON as unknown; -export const idResult: (x: +const idResult: (x: { TAG: "Ok"; _0: number } | { TAG: "Error"; _0: string }) => { TAG: "Ok"; _0: number } - | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResult as any; + | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResult as unknown; -export const idResultAlias: (x: +const idResultAlias: (x: { TAG: "Ok"; _0: number } | { TAG: "Error"; _0: string }) => { TAG: "Ok"; _0: number } - | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResultAlias as any; + | { TAG: "Error"; _0: string } = StdlibNoShimsJS.idResultAlias as unknown; -export const idRef: (x:{ contents: number }) => { contents: number } = StdlibNoShimsJS.idRef as any; +const idRef: (x:{ contents: number }) => { contents: number } = StdlibNoShimsJS.idRef as unknown; -export const returnsUnit: () => void = StdlibNoShimsJS.returnsUnit as any; +const returnsUnit: () => void = StdlibNoShimsJS.returnsUnit as unknown; -export const idTuple: (x:[number, string, number]) => [number, string, number] = StdlibNoShimsJS.idTuple as any; +const idTuple: (x:[number, string, number]) => [number, string, number] = StdlibNoShimsJS.idTuple as unknown; -export const idArrayBuffer: (x:ArrayBuffer) => ArrayBuffer = StdlibNoShimsJS.idArrayBuffer as any; +const idArrayBuffer: (x:ArrayBuffer) => ArrayBuffer = StdlibNoShimsJS.idArrayBuffer as unknown; -export const idDataView: (x:DataView) => DataView = StdlibNoShimsJS.idDataView as any; +const idDataView: (x:DataView) => DataView = StdlibNoShimsJS.idDataView as unknown; -export const idInt8Array: (x:Int8Array) => Int8Array = StdlibNoShimsJS.idInt8Array as any; +const idInt8Array: (x:Int8Array) => Int8Array = StdlibNoShimsJS.idInt8Array as unknown; -export const idUint8Array: (x:Uint8Array) => Uint8Array = StdlibNoShimsJS.idUint8Array as any; +const idUint8Array: (x:Uint8Array) => Uint8Array = StdlibNoShimsJS.idUint8Array as unknown; -export const idUint8ClampedArray: (x:Uint8ClampedArray) => Uint8ClampedArray = StdlibNoShimsJS.idUint8ClampedArray as any; +const idUint8ClampedArray: (x:Uint8ClampedArray) => Uint8ClampedArray = StdlibNoShimsJS.idUint8ClampedArray as unknown; -export const idInt16Array: (x:Int16Array) => Int16Array = StdlibNoShimsJS.idInt16Array as any; +const idInt16Array: (x:Int16Array) => Int16Array = StdlibNoShimsJS.idInt16Array as unknown; -export const idUint16Array: (x:Uint16Array) => Uint16Array = StdlibNoShimsJS.idUint16Array as any; +const idUint16Array: (x:Uint16Array) => Uint16Array = StdlibNoShimsJS.idUint16Array as unknown; -export const idInt32Array: (x:Int32Array) => Int32Array = StdlibNoShimsJS.idInt32Array as any; +const idInt32Array: (x:Int32Array) => Int32Array = StdlibNoShimsJS.idInt32Array as unknown; -export const idUint32Array: (x:Uint32Array) => Uint32Array = StdlibNoShimsJS.idUint32Array as any; +const idUint32Array: (x:Uint32Array) => Uint32Array = StdlibNoShimsJS.idUint32Array as unknown; -export const idFloat32Array: (x:Float32Array) => Float32Array = StdlibNoShimsJS.idFloat32Array as any; +const idFloat32Array: (x:Float32Array) => Float32Array = StdlibNoShimsJS.idFloat32Array as unknown; -export const idFloat64Array: (x:Float64Array) => Float64Array = StdlibNoShimsJS.idFloat64Array as any; +const idFloat64Array: (x:Float64Array) => Float64Array = StdlibNoShimsJS.idFloat64Array as unknown; -export const idBigInt64Array: (x:BigInt64Array) => BigInt64Array = StdlibNoShimsJS.idBigInt64Array as any; +const idBigInt64Array: (x:BigInt64Array) => BigInt64Array = StdlibNoShimsJS.idBigInt64Array as unknown; -export const idBigUint64Array: (x:BigUint64Array) => BigUint64Array = StdlibNoShimsJS.idBigUint64Array as any; +const idBigUint64Array: (x:BigUint64Array) => BigUint64Array = StdlibNoShimsJS.idBigUint64Array as unknown; -export const idSymbol: (x:symbol) => symbol = StdlibNoShimsJS.idSymbol as any; +const idSymbol: (x:symbol) => symbol = StdlibNoShimsJS.idSymbol as unknown; -export const idIterator: (x:Iterator) => Iterator = StdlibNoShimsJS.idIterator as any; +const idIterator: (x:Iterator) => Iterator = StdlibNoShimsJS.idIterator as unknown; -export const idAsyncIterator: (x:AsyncIterator) => AsyncIterator = StdlibNoShimsJS.idAsyncIterator as any; +const idAsyncIterator: (x:AsyncIterator) => AsyncIterator = StdlibNoShimsJS.idAsyncIterator as unknown; -export const idOrdering: (x:number) => number = StdlibNoShimsJS.idOrdering as any; +const idOrdering: (x:number) => number = StdlibNoShimsJS.idOrdering as unknown; -export const idIntlCollator: (x:Intl.Collator) => Intl.Collator = StdlibNoShimsJS.idIntlCollator as any; +const idIntlCollator: (x:Intl.Collator) => Intl.Collator = StdlibNoShimsJS.idIntlCollator as unknown; -export const idIntlDateTimeFormat: (x:Intl.DateTimeFormat) => Intl.DateTimeFormat = StdlibNoShimsJS.idIntlDateTimeFormat as any; +const idIntlDateTimeFormat: (x:Intl.DateTimeFormat) => Intl.DateTimeFormat = StdlibNoShimsJS.idIntlDateTimeFormat as unknown; -export const idIntlListFormat: (x:Intl.ListFormat) => Intl.ListFormat = StdlibNoShimsJS.idIntlListFormat as any; +const idIntlListFormat: (x:Intl.ListFormat) => Intl.ListFormat = StdlibNoShimsJS.idIntlListFormat as unknown; -export const idIntlLocale: (x:Intl.Locale) => Intl.Locale = StdlibNoShimsJS.idIntlLocale as any; +const idIntlLocale: (x:Intl.Locale) => Intl.Locale = StdlibNoShimsJS.idIntlLocale as unknown; -export const idIntlNumberFormat: (x:Intl.NumberFormat) => Intl.NumberFormat = StdlibNoShimsJS.idIntlNumberFormat as any; +const idIntlNumberFormat: (x:Intl.NumberFormat) => Intl.NumberFormat = StdlibNoShimsJS.idIntlNumberFormat as unknown; -export const idIntlPluralRules: (x:Intl.PluralRules) => Intl.PluralRules = StdlibNoShimsJS.idIntlPluralRules as any; +const idIntlPluralRules: (x:Intl.PluralRules) => Intl.PluralRules = StdlibNoShimsJS.idIntlPluralRules as unknown; -export const idIntlRelativeTimeFormat: (x:Intl.RelativeTimeFormat) => Intl.RelativeTimeFormat = StdlibNoShimsJS.idIntlRelativeTimeFormat as any; +const idIntlRelativeTimeFormat: (x:Intl.RelativeTimeFormat) => Intl.RelativeTimeFormat = StdlibNoShimsJS.idIntlRelativeTimeFormat as unknown; -export const idIntlSegmenter: (x:Intl.Segmenter) => Intl.Segmenter = StdlibNoShimsJS.idIntlSegmenter as any; +const idIntlSegmenter: (x:Intl.Segmenter) => Intl.Segmenter = StdlibNoShimsJS.idIntlSegmenter as unknown; -export const idIntlSegments: (x:Intl.Segments) => Intl.Segments = StdlibNoShimsJS.idIntlSegments as any; +const idIntlSegments: (x:Intl.Segments) => Intl.Segments = StdlibNoShimsJS.idIntlSegments as unknown; -export const idJsError: (x:Error) => Error = StdlibNoShimsJS.idJsError as any; +const idJsError: (x:Error) => Error = StdlibNoShimsJS.idJsError as unknown; -export const idObj: (x:{}) => {} = StdlibNoShimsJS.idObj as any; +const idObj: (x:{}) => {} = StdlibNoShimsJS.idObj as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/index.affine b/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/index.affine index 01bbf898..b5748bf9 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/index.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/stdlib-no-shims/src/index.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module index; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // Import the generated bindings to force TS to resolve types without shims import * as S from "./StdlibNoShims.gen"; @@ -27,7 +24,7 @@ const d: Date = S.idDate(new Date()); const re: RegExp = S.idRegExp(/a/); // Promise -const p: Promise = S.idPromise(Promise.resolve("ok")); +const p: string = S.idPromise(Promise.resolve("ok")); // Dict const dict: { [id: string]: number } = S.idDict({ a: 1, b: 2 }); @@ -56,12 +53,12 @@ const j: unknown = S.idJSON({}); // Result const ok: { TAG: "Ok"; _0: number } = { TAG: "Ok", _0: 1 }; const err: { TAG: "Error"; _0: string } = { TAG: "Error", _0: "e" }; -const r1 = S.idResult(ok); -const r2 = S.idResult(err); +let r1 = S.idResult(ok); +let r2 = S.idResult(err); // result alias -const r3 = S.idResultAlias(ok); -const r4 = S.idResultAlias(err); +let r3 = S.idResultAlias(ok); +let r4 = S.idResultAlias(err); // array const arr: number[] = S.idArray([1, 2, 3]); @@ -95,7 +92,7 @@ const sym: symbol = S.idSymbol(Symbol("x")); // Iterator / AsyncIterator / Ordering const it: Iterator = S.idIterator([1, 2, 3].values()); const ait: AsyncIterator = S.idAsyncIterator({ - next(): Promise> { + next(): IteratorResult { return Promise.resolve({ done: true, value: undefined }); }, }); @@ -127,4 +124,3 @@ const _obj: {} = S.idObj({ a: 1, b: "x" }); // Tuple const _tup: [number, string, number] = S.idTuple([1, "x", 1.5]); -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/App.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/App.affine index 8976833f..e3104a6a 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/App.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/App.affine @@ -1,25 +1,21 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module App; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import * as React from "react"; import "./App.css"; -export interface Props { +struct Props { name: string; count?: number; } -class App extends React.PureComponent { +struct App extends React.PureComponent { public render() { return
; } } -export default App; +default App; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine index 9fadb4d0..dc38e90f 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/AutoAnnotate.gen.affine @@ -1,28 +1,24 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module AutoAnnotate.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from AutoAnnotate.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type variant = { TAG: "R"; _0: number }; +struct variant { { TAG: "R"; _0: number }; -export type record = { readonly variant: variant }; +struct record { { readonly variant: variant }; -export type r2 = { readonly r2: number }; +struct r2 { { readonly r2: number }; -export type r3 = { readonly r3: number }; +struct r3 { { readonly r3: number }; -export type r4 = { readonly r4: number }; +struct r4 { { readonly r4: number }; -export type annotatedVariant = +struct annotatedVariant { { TAG: "R2"; _0: r2; _1: r3 } | { TAG: "R4"; _0: r4 }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine index 7bc09242..ff6f3743 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/BucklescriptAnnotations.gen.affine @@ -1,28 +1,24 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module BucklescriptAnnotations.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from BucklescriptAnnotations.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type someMutableFields = { +struct someMutableFields { { mutable0: string; readonly immutable: number; mutable1: string; mutable2: string }; -export type someMethods = { +struct someMethods { { readonly send: (_1:string) => void; readonly on: (_1:string, _2:((_1:number) => void)) => void; readonly threeargs: (_1:number, _2:string, _3:number) => string; readonly twoArgs: (_1:number, _2:string) => number }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine index 4dcf48e1..e4d4fe0b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Comments.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Comments.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Comments.res by genType. */ /* eslint-disable */ @@ -13,15 +10,15 @@ module Comments.gen; import * as CommentsJS from './Comments.res.js'; -export type DecideSubject_payload = { +struct DecideSubject_payload { { /** A hint to use as a guide when thinking of your poem. */ readonly hint: string }; /** The input used to generate the prompt and system prompt. */ -export abstract class DecideSubject_input { protected opaque!: any }; /* simulate opaque types */ +abstract struct DecideSubject_input { protected opaque!: unknown }; /* simulate opaque types */ /** The output from evaluating the llm prompt */ -export type DecideSubject_output = { +struct DecideSubject_output { { /** The text of the poem. */ readonly text: string; /** The prompt used to generate the poem. */ @@ -31,10 +28,9 @@ export type DecideSubject_output = { }; /** Decide on a subject matter for a poem. */ -export const DecideSubject__placeholder: (run:string, times:number) => void = CommentsJS.DecideSubject._placeholder as any; +const DecideSubject__placeholder: (run:string, times:number) => void = CommentsJS.DecideSubject._placeholder as unknown; -export const DecideSubject: { +const DecideSubject: { /** Decide on a subject matter for a poem. */ -_placeholder: (run:string, times:number) => void } = CommentsJS.DecideSubject as any; +_placeholder: (run:string, times:number) => void } = CommentsJS.DecideSubject as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Core.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Core.gen.affine index 7bc7fa5a..7effc099 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Core.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Core.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Core.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Core.res by genType. */ /* eslint-disable */ @@ -16,69 +13,68 @@ import {someFunWithNullThenOptionalArgs as someFunWithNullThenOptionalArgsNotChe import {someFunWithNullUndefinedArg as someFunWithNullUndefinedArgNotChecked} from './CoreTS'; // In case of type error, check the type of 'someFunWithNullThenOptionalArgs' in 'Core.res' and './CoreTS'. -export const someFunWithNullThenOptionalArgsTypeChecked: (_1:(null | string), _2:(undefined | string)) => string = someFunWithNullThenOptionalArgsNotChecked as any; +const someFunWithNullThenOptionalArgsTypeChecked: (_1:(null | string), _2:(undefined | string)) => string = someFunWithNullThenOptionalArgsNotChecked as unknown; // Export 'someFunWithNullThenOptionalArgs' early to allow circular import from the '.bs.js' file. -export const someFunWithNullThenOptionalArgs: unknown = someFunWithNullThenOptionalArgsTypeChecked as (_1:(null | string), _2:(undefined | string)) => string as any; +const someFunWithNullThenOptionalArgs: unknown = someFunWithNullThenOptionalArgsTypeChecked as (_1:(null | string), _2:(undefined | string)) => string as unknown; // In case of type error, check the type of 'someFunWithNullUndefinedArg' in 'Core.res' and './CoreTS'. -export const someFunWithNullUndefinedArgTypeChecked: (_1:(null | undefined | string), _2:number) => string = someFunWithNullUndefinedArgNotChecked as any; +const someFunWithNullUndefinedArgTypeChecked: (_1:(null | undefined | string), _2:number) => string = someFunWithNullUndefinedArgNotChecked as unknown; // Export 'someFunWithNullUndefinedArg' early to allow circular import from the '.bs.js' file. -export const someFunWithNullUndefinedArg: unknown = someFunWithNullUndefinedArgTypeChecked as (_1:(null | undefined | string), _2:number) => string as any; +const someFunWithNullUndefinedArg: unknown = someFunWithNullUndefinedArgTypeChecked as (_1:(null | undefined | string), _2:number) => string as unknown; -const CoreJS = require('./Core.res.js'); +let CoreJS = require('./Core.res.js'); -export type variant = "A" | { TAG: "B"; _0: string }; +struct variant { "A" | { TAG: "B"; _0: string }; -export type t1 = { readonly x?: string }; +struct t1 { { readonly x?: string }; -export type t2 = { readonly x: (undefined | string) }; +struct t2 { { readonly x: (undefined | string) }; -export const null0: (x:(null | number)) => (null | number) = CoreJS.null0 as any; +const null0: (x:(null | number)) => (null | number) = CoreJS.null0 as unknown; -export const null1: (x:(null | number)) => (null | number) = CoreJS.null1 as any; +const null1: (x:(null | number)) => (null | number) = CoreJS.null1 as unknown; -export const nullable0: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable0 as any; +const nullable0: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable0 as unknown; -export const nullable1: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable1 as any; +const nullable1: (x:(null | undefined | number)) => (null | undefined | number) = CoreJS.nullable1 as unknown; -export const undefined0: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined0 as any; +const undefined0: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined0 as unknown; -export const undefined1: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined1 as any; +const undefined1: (x:(undefined | number)) => (undefined | number) = CoreJS.undefined1 as unknown; -export const dict0: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict0 as any; +const dict0: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict0 as unknown; -export const dict1: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict1 as any; +const dict1: (x:{[id: string]: string}) => {[id: string]: string} = CoreJS.dict1 as unknown; -export const promise0: (x:Promise) => Promise = CoreJS.promise0 as any; +const promise0: (x:string) => string = CoreJS.promise0 as unknown; -export const promise1: (x:Promise) => Promise = CoreJS.promise1 as any; +const promise1: (x:string) => string = CoreJS.promise1 as unknown; -export const date0: (x:Date) => Date = CoreJS.date0 as any; +const date0: (x:Date) => Date = CoreJS.date0 as unknown; -export const date1: (x:Date) => Date = CoreJS.date1 as any; +const date1: (x:Date) => Date = CoreJS.date1 as unknown; -export const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as any; +const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as unknown; -export const regexp0: (x:RegExp) => RegExp = CoreJS.regexp0 as any; +const regexp0: (x:RegExp) => RegExp = CoreJS.regexp0 as unknown; -export const regexp1: (x:RegExp) => RegExp = CoreJS.regexp1 as any; +const regexp1: (x:RegExp) => RegExp = CoreJS.regexp1 as unknown; -export const map1: (x:Map) => Map = CoreJS.map1 as any; +const map1: (x:Map) => Map = CoreJS.map1 as unknown; -export const weakmap1: (x:WeakMap) => WeakMap = CoreJS.weakmap1 as any; +const weakmap1: (x:WeakMap) => WeakMap = CoreJS.weakmap1 as unknown; -export const set1: (x:Set) => Set = CoreJS.set1 as any; +const set1: (x:Set) => Set = CoreJS.set1 as unknown; -export const weakset1: (x:WeakSet) => WeakSet = CoreJS.weakset1 as any; +const weakset1: (x:WeakSet) => WeakSet = CoreJS.weakset1 as unknown; -export const option0: (x:(undefined | string)) => (undefined | string) = CoreJS.option0 as any; +const option0: (x:(undefined | string)) => (undefined | string) = CoreJS.option0 as unknown; -export const option1: (x:(undefined | variant)) => (undefined | variant) = CoreJS.option1 as any; +const option1: (x:(undefined | variant)) => (undefined | variant) = CoreJS.option1 as unknown; -export const jsonEncodeString1: unknown = CoreJS.jsonEncodeString1 as any; +const jsonEncodeString1: unknown = CoreJS.jsonEncodeString1 as unknown; -export const jsonEncodeString2: unknown = CoreJS.jsonEncodeString2 as any; +const jsonEncodeString2: unknown = CoreJS.jsonEncodeString2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/CoreTS.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/CoreTS.affine index e3c52d68..3bf9b670 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/CoreTS.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/CoreTS.affine @@ -1,19 +1,15 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module CoreTS; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === -export declare function someFunWithNullThenOptionalArgs( +declare fn someFunWithNullThenOptionalArgs( nullable: null | string, app?: string, ): string; -export declare function someFunWithNullUndefinedArg( +declare fn someFunWithNullUndefinedArg( nullUndefined: null | undefined | string, other: number, ): string; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine index 1d8c83a9..828b3eb4 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Derivings.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Derivings.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Derivings.res by genType. */ /* eslint-disable */ @@ -13,15 +10,14 @@ module Derivings.gen; import * as DerivingsJS from './Derivings.res.js'; -export type action = +struct action { "Click" | "Cancel" | { TAG: "Submit"; _0: string }; -export const click: action = DerivingsJS.click as any; +const click: action = DerivingsJS.click as unknown; -export const submit: (_1:string) => action = DerivingsJS.submit as any; +const submit: (_1:string) => action = DerivingsJS.submit as unknown; -export const cancel: action = DerivingsJS.cancel as any; +const cancel: action = DerivingsJS.cancel as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine index aee694f6..e8ba0010 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Docstrings.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Docstrings.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Docstrings.res by genType. */ /* eslint-disable */ @@ -13,50 +10,49 @@ module Docstrings.gen; import * as DocstringsJS from './Docstrings.res.js'; -export type t = "A" | "B"; +struct t { "A" | "B"; /** hello */ -export const flat: number = DocstringsJS.flat as any; +const flat: number = DocstringsJS.flat as unknown; /** * Sign a message with a key. * * @param message - A message to be signed * @param key - The key with which to sign the message * @returns A signed message */ -export const signMessage: (message:string, key:number) => string = DocstringsJS.signMessage as any; +const signMessage: (message:string, key:number) => string = DocstringsJS.signMessage as unknown; -export const one: (a:number) => number = DocstringsJS.one as any; +const one: (a:number) => number = DocstringsJS.one as unknown; -export const two: (a:number, b:number) => number = DocstringsJS.two as any; +const two: (a:number, b:number) => number = DocstringsJS.two as unknown; -export const tree: (a:number, b:number, c:number) => number = DocstringsJS.tree as any; +const tree: (a:number, b:number, c:number) => number = DocstringsJS.tree as unknown; -export const oneU: (a:number) => number = DocstringsJS.oneU as any; +const oneU: (a:number) => number = DocstringsJS.oneU as unknown; -export const twoU: (a:number, b:number) => number = DocstringsJS.twoU as any; +const twoU: (a:number, b:number) => number = DocstringsJS.twoU as unknown; -export const treeU: (a:number, b:number, c:number) => number = DocstringsJS.treeU as any; +const treeU: (a:number, b:number, c:number) => number = DocstringsJS.treeU as unknown; -export const useParam: (param:number) => number = DocstringsJS.useParam as any; +const useParam: (param:number) => number = DocstringsJS.useParam as unknown; -export const useParamU: (param:number) => number = DocstringsJS.useParamU as any; +const useParamU: (param:number) => number = DocstringsJS.useParamU as unknown; -export const unnamed1: (param:number) => number = DocstringsJS.unnamed1 as any; +const unnamed1: (param:number) => number = DocstringsJS.unnamed1 as unknown; -export const unnamed1U: (param:number) => number = DocstringsJS.unnamed1U as any; +const unnamed1U: (param:number) => number = DocstringsJS.unnamed1U as unknown; -export const unnamed2: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2 as any; +const unnamed2: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2 as unknown; -export const unnamed2U: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2U as any; +const unnamed2U: (param_0:number, param_1:number) => number = DocstringsJS.unnamed2U as unknown; -export const grouped: (x:number, y:number, a:number, b:number, c:number, z:number) => number = DocstringsJS.grouped as any; +const grouped: (x:number, y:number, a:number, b:number, c:number, z:number) => number = DocstringsJS.grouped as unknown; -export const unitArgWithoutConversion: () => string = DocstringsJS.unitArgWithoutConversion as any; +const unitArgWithoutConversion: () => string = DocstringsJS.unitArgWithoutConversion as unknown; -export const unitArgWithoutConversionU: () => string = DocstringsJS.unitArgWithoutConversionU as any; +const unitArgWithoutConversionU: () => string = DocstringsJS.unitArgWithoutConversionU as unknown; -export const unitArgWithConversion: () => t = DocstringsJS.unitArgWithConversion as any; +const unitArgWithConversion: () => t = DocstringsJS.unitArgWithConversion as unknown; -export const unitArgWithConversionU: () => t = DocstringsJS.unitArgWithConversionU as any; +const unitArgWithConversionU: () => t = DocstringsJS.unitArgWithConversionU as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine index e3595e1c..68048931 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EmitModuleIfNoConversion.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module EmitModuleIfNoConversion.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from EmitModuleIfNoConversion.res by genType. */ /* eslint-disable */ @@ -13,16 +10,15 @@ module EmitModuleIfNoConversion.gen; import * as EmitModuleIfNoConversionJS from './EmitModuleIfNoConversion.res.js'; -export type t = "A" | { TAG: "B"; readonly name: string }; +struct t { "A" | { TAG: "B"; readonly name: string }; -export const X_foo: (t:t) => void = EmitModuleIfNoConversionJS.X.foo as any; +const X_foo: (t:t) => void = EmitModuleIfNoConversionJS.X.foo as unknown; -export const X_x: number = EmitModuleIfNoConversionJS.X.x as any; +const X_x: number = EmitModuleIfNoConversionJS.X.x as unknown; -export const Y_x: string = EmitModuleIfNoConversionJS.Y.x as any; +const Y_x: string = EmitModuleIfNoConversionJS.Y.x as unknown; -export const Y: { x: string } = EmitModuleIfNoConversionJS.Y as any; +const Y: { x: string } = EmitModuleIfNoConversionJS.Y as unknown; -export const X: { x: number; foo: (t:t) => void } = EmitModuleIfNoConversionJS.X as any; +const X: { x: number; foo: (t:t) => void } = EmitModuleIfNoConversionJS.X as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine index e9d6ff07..bf6556e8 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/EscapedNames.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module EscapedNames.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from EscapedNames.res by genType. */ /* eslint-disable */ @@ -13,21 +10,20 @@ module EscapedNames.gen; import * as EscapedNamesJS from './EscapedNames.res.js'; -export type variant = "Illegal\"Name"; +struct variant { "Illegal\"Name"; -export type UppercaseVariant = "Illegal\"Name"; +struct UppercaseVariant { "Illegal\"Name"; -export type polymorphicVariant = "Illegal\"Name"; +struct polymorphicVariant { "Illegal\"Name"; -export type object_ = { readonly normalField: number; readonly "escape\"me": number }; +struct object_ { { readonly normalField: number; readonly "escape\"me": number }; -export type record = { +struct record { { readonly normalField: variant; readonly "Renamed'Field": number; readonly "Illegal-field name": number; readonly UPPERCASE: number }; -export const myRecord: record = EscapedNamesJS.myRecord as any; +const myRecord: record = EscapedNamesJS.myRecord as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine index 7c1a9fec..05d96965 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ExportWithRename.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ExportWithRename.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module ExportWithRename.gen; import * as ExportWithRenameJS from './ExportWithRename.res.js'; -export type props = { readonly s: s }; +type props = { readonly s: s }; -export const Renamed: React.ComponentType<{ readonly s: string }> = ExportWithRenameJS.make as any; +const Renamed: React.ComponentType<{ readonly s: string }> = ExportWithRenameJS.make as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine index 9a521f2e..9e904bc7 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module FirstClassModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from FirstClassModules.res by genType. */ /* eslint-disable */ @@ -13,11 +10,11 @@ module FirstClassModules.gen; import * as FirstClassModulesJS from './FirstClassModules.res.js'; -export type MT_t = number; +struct MT_t { number; -export type MT_InnerModule3_inner = number; +struct MT_InnerModule3_inner { number; -export type firstClassModule = { +struct firstClassModule { { readonly x: number; readonly EmptyInnerModule: { }; @@ -31,9 +28,9 @@ export type firstClassModule = { readonly y: string }; -export const firstClassModule: firstClassModule = FirstClassModulesJS.firstClassModule as any; +const firstClassModule: firstClassModule = FirstClassModulesJS.firstClassModule as unknown; -export const testConvert: (m:{ +const testConvert: (m:{ readonly x: number; readonly EmptyInnerModule: { }; @@ -57,9 +54,9 @@ export const testConvert: (m:{ }; readonly Z: unknown; readonly y: string -} = FirstClassModulesJS.testConvert as any; +} = FirstClassModulesJS.testConvert as unknown; -export const someFunctorAsFunction: (x:{ +const someFunctorAsFunction: (x:{ readonly x: number; readonly EmptyInnerModule: { }; @@ -71,6 +68,5 @@ export const someFunctorAsFunction: (x:{ }; readonly Z: unknown; readonly y: string -}) => { readonly ww: string } = FirstClassModulesJS.someFunctorAsFunction as any; +}) => { readonly ww: string } = FirstClassModulesJS.someFunctorAsFunction as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine index 55b03717..e46c0f62 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module FirstClassModulesInterface.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from FirstClassModulesInterface.resi by genType. */ /* eslint-disable */ /* tslint:disable */ -export type record = { readonly x: number; readonly y: string }; +struct record { { readonly x: number; readonly y: string }; -export type firstClassModule = { readonly x: number }; +struct firstClassModule { { readonly x: number }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine index 4a0aec2a..51d673f8 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/GADT.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module GADT.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from GADT.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export abstract class t { protected opaque!: any }; /* simulate opaque types */ +abstract struct t { protected opaque!: unknown }; /* simulate opaque types */ -export abstract class tt { protected opaque!: any }; /* simulate opaque types */ +abstract struct tt { protected opaque!: unknown }; /* simulate opaque types */ -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine index ac6aa0b9..e3e186c9 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Hooks.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Hooks.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Hooks.res by genType. */ /* eslint-disable */ @@ -15,95 +12,95 @@ import * as HooksJS from './Hooks.res.js'; import type {TypedArray2_Uint8Array_t as Js_TypedArray2_Uint8Array_t} from '../src/shims/Js.shim'; -export type vehicle = { readonly name: string }; +struct vehicle { { readonly name: string }; -export type props = { readonly vehicle: vehicle }; +type props = { readonly vehicle: vehicle }; -export type Another_props = { readonly vehicle: vehicle; readonly callback: callback }; +type Another_props = { readonly vehicle: vehicle; readonly callback: callback }; -export type Inner_props = { readonly vehicle: vehicle }; +type Inner_props = { readonly vehicle: vehicle }; -export type Inner_Another_props = { readonly vehicle: vehicle }; +type Inner_Another_props = { readonly vehicle: vehicle }; -export type Inner_Inner2_props = { readonly vehicle: vehicle }; +type Inner_Inner2_props = { readonly vehicle: vehicle }; -export type Inner_Inner2_Another_props = { readonly vehicle: vehicle }; +type Inner_Inner2_Another_props = { readonly vehicle: vehicle }; -export type NoProps_props = {}; +struct NoProps_props { {}; -export type cb = (_to:vehicle) => void; +struct cb { (_to:vehicle) => void; -export type WithRename_props = { +type WithRename_props = { readonly _to: T_to; readonly _Type: T_Type; readonly cb: cb }; -export type WithRef_props = { readonly vehicle: vehicle; readonly ref?: ref }; +type WithRef_props = { readonly vehicle: vehicle; readonly ref?: ref }; -export type r = { readonly x: string }; +struct r { { readonly x: string }; -export type callback = (_1:input) => output; +type callback = (_1:input) => output; -export type testReactContext = React.Context; +struct testReactContext { React.Context; -export type testReactRef = { current: (null | number) }; +struct testReactRef { { current: (null | number) }; -export type testDomRef = React.Ref; +struct testDomRef { React.Ref; -export type testDomRef2 = React.Ref; +struct testDomRef2 { React.Ref; -export type Poly_props

= { readonly p: p }; +type Poly_props

{" "} @@ -31,9 +28,9 @@ export const make: React.FC = (x: Props) => { ); }; -class AsClassComponent extends React.PureComponent { +struct AsClassComponent extends React.PureComponent { public render() { - const RenderMe = this.props.renderMe; + let RenderMe = this.props.renderMe; return (
{" "} @@ -44,8 +41,7 @@ class AsClassComponent extends React.PureComponent { } } -export const makeRenamed = AsClassComponent; +let makeRenamed = AsClassComponent; -export default make; +default make; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/index.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/index.affine index 47e0e2a5..f5929491 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/index.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/index.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module index; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type * as React from "react"; import * as ReactDOM from "react-dom"; import App from "./App.tsx"; @@ -29,11 +26,11 @@ import { } from "./VariantsWithPayload.gen.tsx"; import * as Types from "./nested/Types.gen.tsx"; -const consoleLog = console.log; +let consoleLog = console.log; -const intList = Types.map(Types.someIntList, x => x + 1); +let intList = Types.map(Types.someIntList, x => x + 1); -const businesses = [ +let businesses = [ { address: "Poison road", name: "AcmeLTD", @@ -41,7 +38,7 @@ const businesses = [ }, ]; -const addresses = Records.findAllAddresses(businesses); +let addresses = Records.findAllAddresses(businesses); consoleLog("indList", intList); consoleLog("addresses", addresses); @@ -78,10 +75,10 @@ ReactDOM.render( document.getElementById("root") as HTMLElement, ); -const x1 = Records.getPayload(Records.payloadValue).v; -const x2 = Records.getPayloadRecord(Records.payloadValue).v; -const x3 = Records.payloadValue.payload.v; -const x4 = Records.getPayloadRecordPlusOne(Records.payloadValue).v; +let x1 = Records.getPayload(Records.payloadValue).v; +let x2 = Records.getPayloadRecord(Records.payloadValue).v; +let x3 = Records.payloadValue.payload.v; +let x4 = Records.getPayloadRecordPlusOne(Records.payloadValue).v; consoleLog("x1,x2,x3,x4 are", x1, x2, x3, x4); consoleLog( @@ -98,12 +95,12 @@ consoleLog( ); consoleLog("Variants: testConvert3to2(42) =", Variants.testConvert2to3(42)); -const absoluteValueInstance = new MyMath.AbsoluteValue(); +let absoluteValueInstance = new MyMath.AbsoluteValue(); absoluteValueInstance.prop = -3; consoleLog("absoluteValueInstance", absoluteValueInstance); -const propValue = ImportJsValue.useGetProp(absoluteValueInstance); -const absValue = ImportJsValue.useGetAbs(absoluteValueInstance); +let propValue = ImportJsValue.useGetProp(absoluteValueInstance); +let absValue = ImportJsValue.useGetAbs(absoluteValueInstance); consoleLog("ImportJsValue: getProp() =", propValue); consoleLog("ImportJsValue: getAbs() =", absValue); @@ -130,17 +127,16 @@ TestPromise.convert(Promise.resolve({ x: 3, s: "hello" })).then(x => consoleLog("TestPromise result:", x.result), ); -type Props = { +struct Props { { readonly method?: "push" | "replace"; }; -export const make: React.FC = (_x: Props) => { +const make: React.FC = (_x: Props) => { return
; }; -const signedMessage = DocStrings.signMessage("hello", 42); +let signedMessage = DocStrings.signMessage("hello", 42); consoleLog("signedMessage:", signedMessage); -export default make; +default make; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine index 0bb22292..b44a12d3 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/location/location.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module location.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from location.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = { readonly id: string; readonly name: string }; +struct t { { readonly id: string; readonly name: string }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine index 02a85ffb..a4893283 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Tuples.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Tuples.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Tuples.res by genType. */ /* eslint-disable */ @@ -13,30 +10,29 @@ module Tuples.gen; import * as TuplesJS from './Tuples.res.js'; -export type coord = [number, number, (undefined | number)]; +struct coord { [number, number, (undefined | number)]; -export type coord2 = [number, number, (null | undefined | number)]; +struct coord2 { [number, number, (null | undefined | number)]; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type couple = [person, person]; +struct couple { [person, person]; -export const testTuple: (param:[number, number]) => number = TuplesJS.testTuple as any; +const testTuple: (param:[number, number]) => number = TuplesJS.testTuple as unknown; -export const origin: [number, number, (undefined | number)] = TuplesJS.origin as any; +const origin: [number, number, (undefined | number)] = TuplesJS.origin as unknown; -export const computeArea: (param:[number, number, (undefined | number)]) => number = TuplesJS.computeArea as any; +const computeArea: (param:[number, number, (undefined | number)]) => number = TuplesJS.computeArea as unknown; -export const computeAreaWithIdent: (param:coord) => number = TuplesJS.computeAreaWithIdent as any; +const computeAreaWithIdent: (param:coord) => number = TuplesJS.computeAreaWithIdent as unknown; -export const computeAreaNoConverters: (param:[number, number]) => number = TuplesJS.computeAreaNoConverters as any; +const computeAreaNoConverters: (param:[number, number]) => number = TuplesJS.computeAreaNoConverters as unknown; -export const coord2d: (x:T1, y:T2) => [T1, T2, (undefined | T3)] = TuplesJS.coord2d as any; +const coord2d: (x:T1, y:T2) => [T1, T2, (undefined | T3)] = TuplesJS.coord2d as unknown; -export const getFirstName: (param:couple) => string = TuplesJS.getFirstName as any; +const getFirstName: (param:couple) => string = TuplesJS.getFirstName as unknown; -export const marry: (first:person, second:person) => couple = TuplesJS.marry as any; +const marry: (first:person, second:person) => couple = TuplesJS.marry as unknown; -export const changeSecondAge: (param:couple) => couple = TuplesJS.changeSecondAge as any; +const changeSecondAge: (param:couple) => couple = TuplesJS.changeSecondAge as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine index 1651f191..5d720e14 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Types.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Types.res by genType. */ /* eslint-disable */ @@ -25,61 +22,61 @@ import type {t_ as TypeNameSanitize_t_} from '../../src/TypeNameSanitize.gen'; import type {t as Location_t} from '../../src/location/location.gen'; -export type t = number; +struct t { number; -export type typeWithVars = +type typeWithVars = { TAG: "A"; _0: x; _1: y } | { TAG: "B"; _0: z }; -export type tree = { +struct tree { { readonly label: string; readonly left?: tree; readonly right?: tree }; -export type selfRecursive = { readonly self: selfRecursive }; +struct selfRecursive { { readonly self: selfRecursive }; -export type mutuallyRecursiveA = { readonly b: mutuallyRecursiveB }; +struct mutuallyRecursiveA { { readonly b: mutuallyRecursiveB }; -export type mutuallyRecursiveB = { readonly a: mutuallyRecursiveA }; +struct mutuallyRecursiveB { { readonly a: mutuallyRecursiveA }; -export abstract class opaqueVariant { protected opaque!: any }; /* simulate opaque types */ +abstract struct opaqueVariant { protected opaque!: unknown }; /* simulate opaque types */ -export type twice = [a, a]; +type twice = [a, a]; -export type genTypeMispelled = number; +struct genTypeMispelled { number; -export type dictString = {[id: string]: string}; +struct dictString { {[id: string]: string}; -export type nullOrString = (null | string); +struct nullOrString { (null | string); -export type nullOrString2 = (null | string); +struct nullOrString2 { (null | string); -export type nullOrString3 = (null | string); +struct nullOrString3 { (null | string); -export type nullOrString4 = (null | string); +struct nullOrString4 { (null | string); -export type nullableOrString = (null | undefined | string); +struct nullableOrString { (null | undefined | string); -export type nullableOrString2 = (null | undefined | string); +struct nullableOrString2 { (null | undefined | string); -export type nullableOrString3 = (null | undefined | string); +struct nullableOrString3 { (null | undefined | string); -export type nullableOrString4 = (null | undefined | string); +struct nullableOrString4 { (null | undefined | string); -export type undefinedOrString = (undefined | string); +struct undefinedOrString { (undefined | string); -export type undefinedOrString2 = (undefined | string); +struct undefinedOrString2 { (undefined | string); -export type undefinedOrString3 = (undefined | string); +struct undefinedOrString3 { (undefined | string); -export type undefinedOrString4 = (undefined | string); +struct undefinedOrString4 { (undefined | string); -export type record = { readonly i: number; readonly s: string }; +struct record { { readonly i: number; readonly s: string }; -export type decorator = (_1:a) => b; +type decorator = (_1:a) => b; -export type marshalFields = { +struct marshalFields { { readonly _rec: string; readonly _switch: string; readonly switch: string; @@ -91,55 +88,54 @@ export type marshalFields = { readonly _Uppercase__: string }; -export type marshalMutableField = { _match: number }; +struct marshalMutableField { { _match: number }; -export type ocaml_array = a[]; +type ocaml_array = a[]; -export type someRecord = { readonly id: number }; +struct someRecord { { readonly id: number }; -export type instantiateTypeParameter = ocaml_array; +struct instantiateTypeParameter { ocaml_array; -export type vector = [a, a]; -export type Vector = vector; +type vector = [a, a]; +type Vector = vector; -export type date = Date; +struct date { Date; -export type ObjectId_t = number; +struct ObjectId_t { number; -export type tPrimed = [TypeNameSanitize_t_, TypeNameSanitize_M_t__]; +struct tPrimed { [TypeNameSanitize_t_, TypeNameSanitize_M_t__]; -export const someIntList: list = TypesJS.someIntList as any; +const someIntList: list = TypesJS.someIntList as unknown; -export const map: (_1:Belt_List_t, _2:((_1:T1) => T2)) => Belt_List_t = TypesJS.map as any; +const map: (_1:Belt_List_t, _2:((_1:T1) => T2)) => Belt_List_t = TypesJS.map as unknown; -export const swap: (tree:tree) => tree = TypesJS.swap as any; +const swap: (tree:tree) => tree = TypesJS.swap as unknown; -export const selfRecursiveConverter: (param:selfRecursive) => selfRecursive = TypesJS.selfRecursiveConverter as any; +const selfRecursiveConverter: (param:selfRecursive) => selfRecursive = TypesJS.selfRecursiveConverter as unknown; -export const mutuallyRecursiveConverter: (param:mutuallyRecursiveA) => mutuallyRecursiveB = TypesJS.mutuallyRecursiveConverter as any; +const mutuallyRecursiveConverter: (param:mutuallyRecursiveA) => mutuallyRecursiveB = TypesJS.mutuallyRecursiveConverter as unknown; -export const testFunctionOnOptionsAsArgument: (a:(undefined | a), foo:((_1:(undefined | a)) => T1)) => T1 = TypesJS.testFunctionOnOptionsAsArgument as any; +const testFunctionOnOptionsAsArgument: (a:(undefined | a), foo:((_1:(undefined | a)) => T1)) => T1 = TypesJS.testFunctionOnOptionsAsArgument as unknown; -export const stringT: string = TypesJS.stringT as any; +const stringT: string = TypesJS.stringT as unknown; -export const jsStringT: string = TypesJS.jsStringT as any; +const jsStringT: string = TypesJS.jsStringT as unknown; -export const jsString2T: string = TypesJS.jsString2T as any; +const jsString2T: string = TypesJS.jsString2T as unknown; -export const jsonStringify: (_1:Js_Json_t) => string = TypesJS.jsonStringify as any; +const jsonStringify: (_1:Js_Json_t) => string = TypesJS.jsonStringify as unknown; -export const testConvertNull: (x:(null | record)) => (null | record) = TypesJS.testConvertNull as any; +const testConvertNull: (x:(null | record)) => (null | record) = TypesJS.testConvertNull as unknown; -export const testConvertLocation: (x:Location_t) => Location_t = TypesJS.testConvertLocation as any; +const testConvertLocation: (x:Location_t) => Location_t = TypesJS.testConvertLocation as unknown; -export const testMarshalFields: marshalFields = TypesJS.testMarshalFields as any; +const testMarshalFields: marshalFields = TypesJS.testMarshalFields as unknown; -export const setMatch: (x:marshalMutableField) => void = TypesJS.setMatch as any; +const setMatch: (x:marshalMutableField) => void = TypesJS.setMatch as unknown; -export const testInstantiateTypeParameter: (x:instantiateTypeParameter) => instantiateTypeParameter = TypesJS.testInstantiateTypeParameter as any; +const testInstantiateTypeParameter: (x:instantiateTypeParameter) => instantiateTypeParameter = TypesJS.testInstantiateTypeParameter as unknown; -export const currentTime: Date = TypesJS.currentTime as any; +const currentTime: Date = TypesJS.currentTime as unknown; -export const optFunction: (undefined | (() => number)) = TypesJS.optFunction as any; +const optFunction: (undefined | (() => number)) = TypesJS.optFunction as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine index 887016c7..ca17d105 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/react-app-env.d.affine @@ -1,11 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module react-app-env.d; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /// -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine index 9f73ace8..a27f48bf 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Belt.shim.affine @@ -1,13 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Belt.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type { list } from "./RescriptPervasives.shim"; -export type List_t = list; +type List_t = list; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine index ea775677..92bdc3dd 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Js.shim.affine @@ -1,15 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Js.shim; -// TODO: Complete semantic implementation +struct Json_t { unknown; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export type Json_t = unknown; +struct t { unknown; -export type t = unknown; +struct TypedArray2_Uint8Array_t { Uint8Array; -export type TypedArray2_Uint8Array_t = Uint8Array; - -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine index f6d07079..229c9a65 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/Jsx.shim.affine @@ -1,13 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Jsx.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type { ReactElement } from "react"; -export type element = ReactElement; +struct element { ReactElement; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine index b7c85262..459d1d4c 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.affine @@ -1,71 +1,67 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module JsxEvent.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === -export abstract class Animation_t { +abstract struct Animation_t { protected opaque: unknown; } -export abstract class Clipboard_t { +abstract struct Clipboard_t { protected opaque: unknown; } -export abstract class Composition_t { +abstract struct Composition_t { protected opaque: unknown; } -export abstract class Focus_t { +abstract struct Focus_t { protected opaque: unknown; } -export abstract class Form_t { +abstract struct Form_t { protected opaque: unknown; } -export abstract class Keyboard_t { +abstract struct Keyboard_t { protected opaque: unknown; } -export abstract class Image_t { +abstract struct Image_t { protected opaque: unknown; } -export abstract class Media_t { +abstract struct Media_t { protected opaque: unknown; } -export abstract class Selection_t { +abstract struct Selection_t { protected opaque: unknown; } -export abstract class Synthetic_t { +abstract struct Synthetic_t { protected opaque: unknown; } -export abstract class Touch_t { +abstract struct Touch_t { protected opaque: unknown; } -export abstract class Transition_t { +abstract struct Transition_t { protected opaque: unknown; } -export abstract class UI_t { +abstract struct UI_t { protected opaque: unknown; } -export abstract class Wheel_t { +abstract struct Wheel_t { protected opaque: unknown; } -export type inputFocusEvent = React.FocusEvent; +struct inputFocusEvent { React.FocusEvent; -export abstract class Mouse_t { +abstract struct Mouse_t { protected opaque: unknown; } -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine index d9e69a19..dc9a35a8 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/shims/RescriptPervasives.shim.affine @@ -1,31 +1,27 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module RescriptPervasives.shim; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === const $$Array = require("bs-platform/lib/js/array"); -export abstract class EmptyList { +abstract struct EmptyList { protected opaque: unknown; } -export abstract class Cons { +abstract struct Cons { protected opaque!: T; } -export type list = Cons | EmptyList; +type list = Cons | EmptyList; -export function cons(itm: T, lst: list): list { +fn cons(itm: T, lst: list): list { // biome-ignore lint/suspicious/noExplicitAny: intended use - return /* :: */ [itm, lst] as any; + return /* :: */ [itm, lst] as unknown; } // biome-ignore lint/suspicious/noExplicitAny: intended use -export const emptyList: EmptyList = /* [] */ 0 as any; +const emptyList: EmptyList = /* [] */ 0 as unknown; -export const fromArray = $$Array.to_list; +let fromArray = $$Array.to_list; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine index b7c79e53..16ba62b1 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/404.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module 404.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from 404.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module 404.gen; import * as _404JS from './404.res.js'; -export const x: number = _404JS.x as any; +const x: number = _404JS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine index 74e9cb30..8fd735b6 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/AppModal.web.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module AppModal.web.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from AppModal.web.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module AppModal.web.gen; import * as AppModal_webJS from './AppModal.web.res.js'; -export const x: number = AppModal_webJS.x as any; +const x: number = AppModal_webJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine index d11f3d79..b59390f1 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/_under.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module _under.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from _under.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module _under.gen; import * as _underJS from './_under.res.js'; -export const x: number = _underJS.x as any; +const x: number = _underJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine index 171b0ac8..455d84f3 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/strange_file_names/with_underscore.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module with_underscore.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from with_underscore.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module with_underscore.gen; import * as with_underscoreJS from './with_underscore.res.js'; -export const x: number = with_underscoreJS.x as any; +const x: number = with_underscoreJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/testReferences.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/testReferences.affine index 2e5b11a2..ccc647a7 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/testReferences.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/testReferences.affine @@ -1,23 +1,19 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module testReferences; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import * as References from "./References.gen"; const r: { contents: number } = { contents: 34 }; r.contents = 42; -export const n: number = References.access(r); +const n: number = References.access(r); const ar: References.t = References.make(34); References.set(ar, 42); -export const an: number = References.get(ar); +const an: number = References.get(ar); -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/tests/src/variantsMatching.gen.affine b/rescript-ecosystem/rescript/tests/tests/src/variantsMatching.gen.affine index f4984c3a..58d3bec6 100644 --- a/rescript-ecosystem/rescript/tests/tests/src/variantsMatching.gen.affine +++ b/rescript-ecosystem/rescript/tests/tests/src/variantsMatching.gen.affine @@ -1,30 +1,26 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module variantsMatching.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from variantsMatching.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = "thisIsA" | 42 | null | "D" | 3.14; +struct t { "thisIsA" | 42 | null | "D" | 3.14; -export type tNU = null | undefined; +struct tNU { null | undefined; -export type MyUndefined_t = undefined | a; +type MyUndefined_t = undefined | a; -export type MyNull_t = null | a; +type MyNull_t = null | a; -export type MyNullable_t = null | undefined | a; +type MyNullable_t = null | undefined | a; -export type MyNullableExtended_t = null | undefined | "WhyNotAnotherOne" | a; +type MyNullableExtended_t = null | undefined | "WhyNotAnotherOne" | a; -export type UntaggedWithBool_t = string | number | boolean | string; +struct UntaggedWithBool_t { string | number | boolean | string; -export type UntaggedWithTuple_t = string | [number, number, string]; +struct UntaggedWithTuple_t { string | [number, number, string]; -==================================== */ diff --git a/well-known-ecosystem/templates/deno-fresh/well_known_middleware.affine b/well-known-ecosystem/templates/deno-fresh/well_known_middleware.affine index 999a552c..dc683a68 100644 --- a/well-known-ecosystem/templates/deno-fresh/well_known_middleware.affine +++ b/well-known-ecosystem/templates/deno-fresh/well_known_middleware.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module well_known_middleware; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 OR PMPL-1.0-or-later // SPDX-FileCopyrightText: 2024-2025 hyperpolymath // @@ -15,7 +12,7 @@ module well_known_middleware; import { FreshContext } from "$fresh/server.ts"; // Well-known resource configuration -const WELL_KNOWN_CONFIG = { +let WELL_KNOWN_CONFIG = { // Security contact (RFC 9116) - REQUIRED: Update these values security: { contact: ["mailto:security@example.com"], @@ -45,7 +42,7 @@ const WELL_KNOWN_CONFIG = { }; // Generate security.txt content -function generateSecurityTxt(): string { +fn generateSecurityTxt(): string { const { security } = WELL_KNOWN_CONFIG; const lines: string[] = []; @@ -77,7 +74,7 @@ function generateSecurityTxt(): string { } // Generate ai.txt content -function generateAiTxt(): string { +fn generateAiTxt(): string { const { ai } = WELL_KNOWN_CONFIG; const lines: string[] = []; @@ -95,7 +92,7 @@ function generateAiTxt(): string { } // Generate humans.txt content -function generateHumansTxt(): string { +fn generateHumansTxt(): string { const { site } = WELL_KNOWN_CONFIG; const lines: string[] = ["/* TEAM */"]; @@ -116,13 +113,13 @@ function generateHumansTxt(): string { } // Well-known routes handler -export async function handler(req: Request, ctx: FreshContext) { - const url = new URL(req.url); - const path = url.pathname; +async fn handler(req: Request, ctx: FreshContext) { + let url = new URL(req.url); + let path = url.pathname; // Handle .well-known routes if (path.startsWith("/.well-known/")) { - const resource = path.replace("/.well-known/", ""); + let resource = path.replace("/.well-known/", ""); switch (resource) { case "security.txt": @@ -149,4 +146,3 @@ export async function handler(req: Request, ctx: FreshContext) { return ctx.next(); } -==================================== */ diff --git a/well-known-ecosystem/templates/deno-fresh/well_known_plugin.affine b/well-known-ecosystem/templates/deno-fresh/well_known_plugin.affine index b482f9a8..49b18295 100644 --- a/well-known-ecosystem/templates/deno-fresh/well_known_plugin.affine +++ b/well-known-ecosystem/templates/deno-fresh/well_known_plugin.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module well_known_plugin; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 OR PMPL-1.0-or-later // SPDX-FileCopyrightText: 2024-2025 hyperpolymath // @@ -14,7 +11,7 @@ module well_known_plugin; import { Plugin } from "$fresh/server.ts"; -export interface WellKnownConfig { +struct WellKnownConfig { security: { contact: string[]; expires: string; @@ -36,7 +33,7 @@ export interface WellKnownConfig { }; } -function generateSecurityTxt(config: WellKnownConfig["security"]): string { +fn generateSecurityTxt(config: WellKnownConfig["security"]): string { const lines: string[] = []; for (const contact of config.contact) { @@ -56,7 +53,7 @@ function generateSecurityTxt(config: WellKnownConfig["security"]): string { return lines.join("\n") + "\n"; } -function generateAiTxt(config: NonNullable): string { +fn generateAiTxt(config: NonNullable): string { const lines: string[] = []; if (config.policy) lines.push(`AI-Policy: ${config.policy}`); if (config.trainingOptOut !== undefined) { @@ -66,7 +63,7 @@ function generateAiTxt(config: NonNullable): string { return lines.join("\n") + "\n"; } -function generateHumansTxt(config: NonNullable): string { +fn generateHumansTxt(config: NonNullable): string { const lines: string[] = ["/* TEAM */"]; for (const member of config.team) { @@ -92,7 +89,7 @@ function generateHumansTxt(config: NonNullable): stri return lines.join("\n") + "\n"; } -export function wellKnownPlugin(config: WellKnownConfig): Plugin { +fn wellKnownPlugin(config: WellKnownConfig): Plugin { return { name: "well-known", routes: [ @@ -146,4 +143,3 @@ export function wellKnownPlugin(config: WellKnownConfig): Plugin { // ], // }); -==================================== */

= { readonly p: p }; -export type Fun_props = { readonly name: name }; +type Fun_props = { readonly name: name }; -export type RenderPropRequiresConversion_props = { readonly renderVehicle: renderVehicle }; +type RenderPropRequiresConversion_props = { readonly renderVehicle: renderVehicle }; -export type WithChildren_props = { readonly vehicle: vehicle; readonly children: children }; +type WithChildren_props = { readonly vehicle: vehicle; readonly children: children }; -export type DD_props = { readonly array: array; readonly name: name }; +type DD_props = { readonly array: array; readonly name: name }; -export const $$default: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.default as any; +const $$default: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.default as unknown; -export default $$default; +default $$default; -export const Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> = HooksJS.Another.anotherComponent as any; +const Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> = HooksJS.Another.anotherComponent as unknown; -export const Inner_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.make as any; +const Inner_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.make as unknown; -export const Inner_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Another.anotherComponent as any; +const Inner_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Another.anotherComponent as unknown; -export const Inner_Inner2_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.make as any; +const Inner_Inner2_make: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.make as unknown; -export const Inner_Inner2_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.Another.anotherComponent as any; +const Inner_Inner2_Another_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.Inner.Inner2.Another.anotherComponent as unknown; -export const NoProps_make: React.ComponentType<{}> = HooksJS.NoProps.make as any; +const NoProps_make: React.ComponentType<{}> = HooksJS.NoProps.make as unknown; -export const functionWithRenamedArgs: (_to:vehicle, _Type:vehicle, cb:cb) => string = HooksJS.functionWithRenamedArgs as any; +const functionWithRenamedArgs: (_to:vehicle, _Type:vehicle, cb:cb) => string = HooksJS.functionWithRenamedArgs as unknown; -export const WithRename_componentWithRenamedArgs: React.ComponentType<{ +const WithRename_componentWithRenamedArgs: React.ComponentType<{ readonly _to: vehicle; readonly _Type: vehicle; readonly cb: cb -}> = HooksJS.WithRename.componentWithRenamedArgs as any; +}> = HooksJS.WithRename.componentWithRenamedArgs as unknown; -export const WithRef_make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: any }> = HooksJS.WithRef.make as any; +const WithRef_make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: unknown }> = HooksJS.WithRef.make as unknown; -export const ForwardRef_input: (_1:r) => JSX.Element = HooksJS.ForwardRef.input as any; +const ForwardRef_input: (_1:r) => JSX.Element = HooksJS.ForwardRef.input as unknown; -export const Poly_polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, any] }> = HooksJS.Poly.polymorphicComponent as any; +const Poly_polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, unknown] }> = HooksJS.Poly.polymorphicComponent as unknown; -export const Fun_functionReturningReactElement: React.ComponentType<{ readonly name: string }> = HooksJS.Fun.functionReturningReactElement as any; +const Fun_functionReturningReactElement: React.ComponentType<{ readonly name: string }> = HooksJS.Fun.functionReturningReactElement as unknown; -export const RenderPropRequiresConversion_make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> = HooksJS.RenderPropRequiresConversion.make as any; +const RenderPropRequiresConversion_make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> = HooksJS.RenderPropRequiresConversion.make as unknown; -export const WithChildren_aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> = HooksJS.WithChildren.aComponentWithChildren as any; +const WithChildren_aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> = HooksJS.WithChildren.aComponentWithChildren as unknown; -export const DD_make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> = HooksJS.DD.make as any; +const DD_make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> = HooksJS.DD.make as unknown; -export const NoProps: { make: React.ComponentType<{}> } = HooksJS.NoProps as any; +const NoProps: { make: React.ComponentType<{}> } = HooksJS.NoProps as unknown; -export const Inner: { +const Inner: { Inner2: { Another: { anotherComponent: React.ComponentType<{ @@ -122,28 +119,27 @@ export const Inner: { make: React.ComponentType<{ readonly vehicle: vehicle }> -} = HooksJS.Inner as any; +} = HooksJS.Inner as unknown; -export const RenderPropRequiresConversion: { make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> } = HooksJS.RenderPropRequiresConversion as any; +const RenderPropRequiresConversion: { make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> } = HooksJS.RenderPropRequiresConversion as unknown; -export const WithRename: { componentWithRenamedArgs: React.ComponentType<{ +const WithRename: { componentWithRenamedArgs: React.ComponentType<{ readonly _to: vehicle; readonly _Type: vehicle; readonly cb: cb -}> } = HooksJS.WithRename as any; +}> } = HooksJS.WithRename as unknown; -export const ForwardRef: { input: (_1:r) => JSX.Element } = HooksJS.ForwardRef as any; +const ForwardRef: { input: (_1:r) => JSX.Element } = HooksJS.ForwardRef as unknown; -export const Fun: { functionReturningReactElement: React.ComponentType<{ readonly name: string }> } = HooksJS.Fun as any; +const Fun: { functionReturningReactElement: React.ComponentType<{ readonly name: string }> } = HooksJS.Fun as unknown; -export const WithRef: { make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: any }> } = HooksJS.WithRef as any; +const WithRef: { make: React.ComponentType<{ readonly vehicle: vehicle; readonly ref?: unknown }> } = HooksJS.WithRef as unknown; -export const WithChildren: { aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> } = HooksJS.WithChildren as any; +const WithChildren: { aComponentWithChildren: React.ComponentType<{ readonly vehicle: vehicle; readonly children: React.ReactNode }> } = HooksJS.WithChildren as unknown; -export const DD: { make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> } = HooksJS.DD as any; +const DD: { make: React.ComponentType<{ readonly array: Js_TypedArray2_Uint8Array_t; readonly name: string }> } = HooksJS.DD as unknown; -export const Another: { anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> } = HooksJS.Another as any; +const Another: { anotherComponent: React.ComponentType<{ readonly vehicle: vehicle; readonly callback: () => void }> } = HooksJS.Another as unknown; -export const Poly: { polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, any] }> } = HooksJS.Poly as any; +const Poly: { polymorphicComponent: React.ComponentType<{ readonly p: [vehicle, unknown] }> } = HooksJS.Poly as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine index c491e92e..29f5f17f 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/IgnoreInterface.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module IgnoreInterface.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from IgnoreInterface.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = number; +struct t { number; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine index e90a5c19..edfc9a07 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportHookDefault.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportHookDefault.res by genType. */ /* eslint-disable */ @@ -16,49 +13,48 @@ import {default as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; // In case of type error, check the type of 'make' in 'ImportHookDefault.res' and './hookExample'. -export const makeTypeChecked: React.ComponentType<{ +const makeTypeChecked: React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> = makeNotChecked as any; +}> = makeNotChecked as unknown; // Export 'make' early to allow circular import from the '.bs.js' file. -export const make: unknown = makeTypeChecked as React.ComponentType<{ +const make: unknown = makeTypeChecked as React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> as any; +}> as unknown; // In case of type error, check the type of 'default' in 'ImportHookDefault.res' and './hookExample'. -export const defaultTypeChecked: React.ComponentType<{ +const defaultTypeChecked: React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> = defaultNotChecked as any; +}> = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ +const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; readonly renderMe: ImportHooks_renderMe -}> as any; +}> as unknown; import type {renderMe as ImportHooks_renderMe} from './ImportHooks.gen'; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type props = { +type props = { readonly person: person; readonly children: children; readonly renderMe: renderMe }; -export type MM_props = { +type MM_props = { readonly person: person; readonly children: children; readonly renderMe: renderMe }; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine index 1a4cc330..183414dd 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportHooks.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportHooks.res by genType. */ /* eslint-disable */ @@ -16,36 +13,35 @@ import {makeRenamed as makeRenamedNotChecked} from './hookExample'; import {foo as fooNotChecked} from './hookExample'; // In case of type error, check the type of 'makeRenamed' in 'ImportHooks.res' and './hookExample'. -export const makeRenamedTypeChecked: React.ComponentType<{ +const makeRenamedTypeChecked: React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> = makeRenamedNotChecked as any; + readonly renderMe: renderMe +}> = makeRenamedNotChecked as unknown; // Export 'makeRenamed' early to allow circular import from the '.bs.js' file. -export const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentType<{ +const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> as any; + readonly renderMe: renderMe +}> as unknown; // In case of type error, check the type of 'foo' in 'ImportHooks.res' and './hookExample'. -export const fooTypeChecked: (person:person) => string = fooNotChecked as any; +const fooTypeChecked: (person:person) => string = fooNotChecked as unknown; // Export 'foo' early to allow circular import from the '.bs.js' file. -export const foo: unknown = fooTypeChecked as (person:person) => string as any; +const foo: unknown = fooTypeChecked as (person:person) => string as unknown; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type renderMe = React.ComponentType<{ readonly randomString: string; readonly poly: a }>; +type renderMe = React.ComponentType<{ readonly randomString: string; readonly poly: a }>; -export type props = { +type props = { readonly actions?: actions; readonly person: person; readonly children: children; readonly renderMe: renderMe }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine index 1911e969..7d5bc73b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportIndex.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportIndex.res by genType. */ /* eslint-disable */ @@ -14,13 +11,12 @@ module ImportIndex.gen; import {default as defaultNotChecked} from './'; // In case of type error, check the type of 'default' in 'ImportIndex.res' and './'. -export const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked as any; +const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly method?: "push" | "replace" }> as any; +const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly method?: "push" | "replace" }> as unknown; -export type props = { readonly method?: method }; +type props = { readonly method?: method }; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine index 01c6d146..a6ecb73b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ImportJsValue.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ImportJsValue.res by genType. */ /* eslint-disable */ @@ -30,60 +27,60 @@ import {polymorphic as polymorphicNotChecked} from './MyMath'; import {default as defaultNotChecked} from './MyMath'; // In case of type error, check the type of 'round' in 'ImportJsValue.res' and './MyMath'. -export const roundTypeChecked: (_1:number) => number = roundNotChecked as any; +const roundTypeChecked: (_1:number) => number = roundNotChecked as unknown; // Export 'round' early to allow circular import from the '.bs.js' file. -export const round: unknown = roundTypeChecked as (_1:number) => number as any; +const round: unknown = roundTypeChecked as (_1:number) => number as unknown; // In case of type error, check the type of 'round2' in 'ImportJsValue.res' and './MyMath'. -export const round2TypeChecked: (_1:number) => number = round2NotChecked as any; +const round2TypeChecked: (_1:number) => number = round2NotChecked as unknown; // Export 'round2' early to allow circular import from the '.bs.js' file. -export const round2: unknown = round2TypeChecked as (_1:number) => number as any; +const round2: unknown = round2TypeChecked as (_1:number) => number as unknown; // In case of type error, check the type of 'area' in 'ImportJsValue.res' and './MyMath'. -export const areaTypeChecked: (_1:point) => number = areaNotChecked as any; +const areaTypeChecked: (_1:point) => number = areaNotChecked as unknown; // Export 'area' early to allow circular import from the '.bs.js' file. -export const area: unknown = areaTypeChecked as (_1:point) => number as any; +const area: unknown = areaTypeChecked as (_1:point) => number as unknown; // In case of type error, check the type of 'returnMixedArray' in 'ImportJsValue.res' and './MyMath'. -export const returnMixedArrayTypeChecked: () => numberOrString[] = returnMixedArrayNotChecked as any; +const returnMixedArrayTypeChecked: () => numberOrString[] = returnMixedArrayNotChecked as unknown; // Export 'returnMixedArray' early to allow circular import from the '.bs.js' file. -export const returnMixedArray: unknown = returnMixedArrayTypeChecked as () => numberOrString[] as any; +const returnMixedArray: unknown = returnMixedArrayTypeChecked as () => numberOrString[] as unknown; // In case of type error, check the type of 'useColor' in 'ImportJsValue.res' and './MyMath'. -export const useColorTypeChecked: (_1:color) => number = useColorNotChecked as any; +const useColorTypeChecked: (_1:color) => number = useColorNotChecked as unknown; // Export 'useColor' early to allow circular import from the '.bs.js' file. -export const useColor: unknown = useColorTypeChecked as (_1:color) => number as any; +const useColor: unknown = useColorTypeChecked as (_1:color) => number as unknown; // In case of type error, check the type of 'higherOrder' in 'ImportJsValue.res' and './MyMath'. -export const higherOrderTypeChecked: (_1:((_1:number, _2:number) => number)) => number = higherOrderNotChecked as any; +const higherOrderTypeChecked: (_1:((_1:number, _2:number) => number)) => number = higherOrderNotChecked as unknown; // Export 'higherOrder' early to allow circular import from the '.bs.js' file. -export const higherOrder: unknown = higherOrderTypeChecked as (_1:((_1:number, _2:number) => number)) => number as any; +const higherOrder: unknown = higherOrderTypeChecked as (_1:((_1:number, _2:number) => number)) => number as unknown; // In case of type error, check the type of 'convertVariant' in 'ImportJsValue.res' and './MyMath'. -export const convertVariantTypeChecked: (_1:variant) => variant = convertVariantNotChecked as any; +const convertVariantTypeChecked: (_1:variant) => variant = convertVariantNotChecked as unknown; // Export 'convertVariant' early to allow circular import from the '.bs.js' file. -export const convertVariant: unknown = convertVariantTypeChecked as (_1:variant) => variant as any; +const convertVariant: unknown = convertVariantTypeChecked as (_1:variant) => variant as unknown; // In case of type error, check the type of 'polymorphic' in 'ImportJsValue.res' and './MyMath'. -export const polymorphicTypeChecked: (_1:a) => a = polymorphicNotChecked as any; +const polymorphicTypeChecked: (_1:a) => a = polymorphicNotChecked as unknown; // Export 'polymorphic' early to allow circular import from the '.bs.js' file. -export const polymorphic: unknown = polymorphicTypeChecked as (_1:a) => a as any; +const polymorphic: unknown = polymorphicTypeChecked as (_1:a) => a as unknown; // In case of type error, check the type of 'default' in 'ImportJsValue.res' and './MyMath'. -export const defaultTypeChecked: number = defaultNotChecked as any; +const defaultTypeChecked: number = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as number as any; +const $$default: unknown = defaultTypeChecked as number as unknown; -const ImportJsValueJS = require('./ImportJsValue.res.js'); +let ImportJsValueJS = require('./ImportJsValue.res.js'); import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; @@ -97,36 +94,35 @@ import type {polyType as $$polyType} from './MyMath'; import type {stringFunction as $$stringFunction} from './MyMath'; -export type point = { readonly x: number; readonly y: (undefined | number) }; +struct point { { readonly x: number; readonly y: (undefined | number) }; -export type numberOrString = $$numberOrString; +struct numberOrString { $$numberOrString; -export type AbsoluteValue_t = $$AbsoluteValue_t; +struct AbsoluteValue_t { $$AbsoluteValue_t; -export type stringFunction = $$stringFunction; +struct stringFunction { $$stringFunction; -export type color = "tomato" | "gray"; +struct color { "tomato" | "gray"; -export type variant = +struct variant { { TAG: "I"; _0: number } | { TAG: "S"; _0: string }; -export type num = $$num; +struct num { $$num; -export type myNum = $$myNum; +struct myNum { $$myNum; -export type polyType = $$polyType; +type polyType = $$polyType; -export const roundedNumber: number = ImportJsValueJS.roundedNumber as any; +const roundedNumber: number = ImportJsValueJS.roundedNumber as unknown; -export const areaValue: number = ImportJsValueJS.areaValue as any; +const areaValue: number = ImportJsValueJS.areaValue as unknown; -export const useGetProp: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetProp as any; +const useGetProp: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetProp as unknown; -export const useGetAbs: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetAbs as any; +const useGetAbs: (x:AbsoluteValue_t) => number = ImportJsValueJS.useGetAbs as unknown; -export const returnedFromHigherOrder: number = ImportJsValueJS.returnedFromHigherOrder as any; +const returnedFromHigherOrder: number = ImportJsValueJS.returnedFromHigherOrder as unknown; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine index 8e64d313..7137ba72 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Inherits.gen.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Inherits.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Inherits.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type red = "Ruby" | "Redwood" | "Rust"; +struct red { "Ruby" | "Redwood" | "Rust"; -export type blue = "Sapphire" | "Neon" | "Navy"; +struct blue { "Sapphire" | "Neon" | "Navy"; -export type color = red | blue; +struct color { red | blue; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine index 35d4034d..9e1c2c57 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module InnerModuleSignature.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from InnerModuleSignature.res by genType. */ /* eslint-disable */ @@ -13,10 +10,9 @@ module InnerModuleSignature.gen; import * as InnerModuleSignatureJS from './InnerModuleSignature.res.js'; -export type InnerModule_t = string; +struct InnerModule_t { string; -export const InnerModule_make: (_1:InnerModule_t) => string = InnerModuleSignatureJS.InnerModule.make as any; +const InnerModule_make: (_1:InnerModule_t) => string = InnerModuleSignatureJS.InnerModule.make as unknown; -export const InnerModule: { make: (_1:InnerModule_t) => string } = InnerModuleSignatureJS.InnerModule as any; +const InnerModule: { make: (_1:InnerModule_t) => string } = InnerModuleSignatureJS.InnerModule as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine index c623bc4b..1b40eb1d 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/JSXV4.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module JSXV4.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from JSXV4.res by genType. */ /* eslint-disable */ @@ -14,40 +11,39 @@ module JSXV4.gen; import {make as makeNotChecked} from './hookExample'; // In case of type error, check the type of 'make' in 'JSXV4.res' and './hookExample'. -export const makeTypeChecked: React.ComponentType<{ +const makeTypeChecked: React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> = makeNotChecked as any; + readonly renderMe: renderMe +}> = makeNotChecked as unknown; // Export 'make' early to allow circular import from the '.bs.js' file. -export const make: unknown = makeTypeChecked as React.ComponentType<{ +const make: unknown = makeTypeChecked as React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; readonly children: React.ReactNode; - readonly renderMe: renderMe -}> as any; + readonly renderMe: renderMe +}> as unknown; -const JSXV4JS = require('./JSXV4.res.js'); +let JSXV4JS = require('./JSXV4.res.js'); -export type CompV4_props = { readonly x: x; readonly y: y }; +type CompV4_props = { readonly x: x; readonly y: y }; -export type person = { readonly name: string; readonly age: number }; +struct person { { readonly name: string; readonly age: number }; -export type props2 = { readonly randomString: string; readonly poly: a }; +type props2 = { readonly randomString: string; readonly poly: a }; -export type renderMe = (_1:props2) => JSX.Element; +type renderMe = (_1:props2) => JSX.Element; -export type props = { +type props = { readonly actions?: actions; readonly person: person; readonly children: children; readonly renderMe: renderMe }; -export const CompV4_make: React.ComponentType<{ readonly x: string; readonly y: string }> = JSXV4JS.CompV4.make as any; +const CompV4_make: React.ComponentType<{ readonly x: string; readonly y: string }> = JSXV4JS.CompV4.make as unknown; -export const CompV4: { make: React.ComponentType<{ readonly x: string; readonly y: string }> } = JSXV4JS.CompV4 as any; +const CompV4: { make: React.ComponentType<{ readonly x: string; readonly y: string }> } = JSXV4JS.CompV4 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine index 433eaa6b..9aa918d0 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LabeledFun.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module LabeledFun.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from LabeledFun.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module LabeledFun.gen; import * as LabeledFunJS from './LabeledFun.res.js'; -export const labelled: (a:number, b:(undefined | number), c:number, _4:number, e:number, f:number) => number = LabeledFunJS.labelled as any; +const labelled: (a:number, b:(undefined | number), c:number, _4:number, e:number, f:number) => number = LabeledFunJS.labelled as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine index c00f5d1c..213f1a86 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/LetPrivate.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module LetPrivate.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from LetPrivate.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module LetPrivate.gen; import * as LetPrivateJS from './LetPrivate.res.js'; -export const y: number = LetPrivateJS.y as any; +const y: number = LetPrivateJS.y as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine index 0e48ee0c..82a66fa9 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Lib.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Lib.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Lib.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type action = +struct action { { action: "A"; _0: string } | { action: "B"; _0: string }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine index 6e710715..b663023a 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Machine.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Machine.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Machine.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module Machine.gen; import * as MachineJS from './Machine.res.js'; -export type aa = { TAG: "A"; _0: number }; +struct aa { { TAG: "A"; _0: number }; -export const a: aa = MachineJS.a as any; +const a: aa = MachineJS.a as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine index f12957a0..3187c3c4 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleAliases.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleAliases.res by genType. */ /* eslint-disable */ @@ -13,24 +10,23 @@ module ModuleAliases.gen; import * as ModuleAliasesJS from './ModuleAliases.res.js'; -export type Outer_Inner_innerT = { readonly inner: string }; +struct Outer_Inner_innerT { { readonly inner: string }; -export type Outer2_Inner2_InnerNested_t = { readonly nested: number }; +struct Outer2_Inner2_InnerNested_t { { readonly nested: number }; -export type Outer2_OuterInnerAlias_innerT = Outer_Inner_innerT; +struct Outer2_OuterInnerAlias_innerT { Outer_Inner_innerT; -export type Outer2_Inner2_OuterInnerAlias2_innerT = Outer2_OuterInnerAlias_innerT; +struct Outer2_Inner2_OuterInnerAlias2_innerT { Outer2_OuterInnerAlias_innerT; -export type Outer2Alias_OuterInnerAlias_innerT = Outer2_OuterInnerAlias_innerT; +struct Outer2Alias_OuterInnerAlias_innerT { Outer2_OuterInnerAlias_innerT; -export type Outer2Alias_Inner2_OuterInnerAlias2_innerT = Outer2_Inner2_OuterInnerAlias2_innerT; +struct Outer2Alias_Inner2_OuterInnerAlias2_innerT { Outer2_Inner2_OuterInnerAlias2_innerT; -export type InnerNestedAlias_t = Outer2_Inner2_InnerNested_t; +struct InnerNestedAlias_t { Outer2_Inner2_InnerNested_t; -export const testNested: (x:InnerNestedAlias_t) => InnerNestedAlias_t = ModuleAliasesJS.testNested as any; +const testNested: (x:InnerNestedAlias_t) => InnerNestedAlias_t = ModuleAliasesJS.testNested as unknown; -export const testInner: (x:Outer2Alias_OuterInnerAlias_innerT) => Outer2Alias_OuterInnerAlias_innerT = ModuleAliasesJS.testInner as any; +const testInner: (x:Outer2Alias_OuterInnerAlias_innerT) => Outer2Alias_OuterInnerAlias_innerT = ModuleAliasesJS.testInner as unknown; -export const testInner2: (x:Outer2Alias_Inner2_OuterInnerAlias2_innerT) => Outer2Alias_Inner2_OuterInnerAlias2_innerT = ModuleAliasesJS.testInner2 as any; +const testInner2: (x:Outer2Alias_Inner2_OuterInnerAlias2_innerT) => Outer2Alias_Inner2_OuterInnerAlias2_innerT = ModuleAliasesJS.testInner2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine index b45d4fd7..000d0269 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleAliases2.gen.affine @@ -1,26 +1,22 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleAliases2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleAliases2.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type record = { readonly x: number; readonly y: string }; +struct record { { readonly x: number; readonly y: string }; -export type Outer_outer = { readonly outer: string }; +struct Outer_outer { { readonly outer: string }; -export type Outer_Inner_inner = { readonly inner: string }; +struct Outer_Inner_inner { { readonly inner: string }; -export type OuterAlias_outer = Outer_outer; +struct OuterAlias_outer { Outer_outer; -export type OuterAlias_Inner_inner = Outer_Inner_inner; +struct OuterAlias_Inner_inner { Outer_Inner_inner; -export type InnerAlias_inner = OuterAlias_Inner_inner; +struct InnerAlias_inner { OuterAlias_Inner_inner; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine index 0dfeabc0..e3b5e06d 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution1.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleResolution1.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleResolution1.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t1 = { readonly foo: string; readonly bar: number }; +struct t1 { { readonly foo: string; readonly bar: number }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine index 245fa1e7..9efd07e1 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/ModuleResolution2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module ModuleResolution2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from ModuleResolution2.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module ModuleResolution2.gen; import type {t1 as ModuleResolution1_t1} from './ModuleResolution1.gen'; -export type t2 = { readonly dependency: ModuleResolution1_t1 }; +struct t2 { { readonly dependency: ModuleResolution1_t1 }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine index efafad75..c65022b3 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MoreVariants.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MoreVariants.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from MoreVariants.res by genType. */ /* eslint-disable */ @@ -13,12 +10,11 @@ module MoreVariants.gen; import * as MoreVariantsJS from './MoreVariants.res.js'; -export type withRenaming = "type_" | "b"; +struct withRenaming { "type_" | "b"; -export type withoutRenaming = "type_" | "b"; +struct withoutRenaming { "type_" | "b"; -export const testWithRenaming: (x:withRenaming) => withRenaming = MoreVariantsJS.testWithRenaming as any; +const testWithRenaming: (x:withRenaming) => withRenaming = MoreVariantsJS.testWithRenaming as unknown; -export const testWithoutRenaming: (x:withoutRenaming) => withoutRenaming = MoreVariantsJS.testWithoutRenaming as any; +const testWithoutRenaming: (x:withoutRenaming) => withoutRenaming = MoreVariantsJS.testWithoutRenaming as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.affine index 93f304cb..5c3313aa 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.affine @@ -1,17 +1,13 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyInput; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import type * as React from "react"; -type Props = React.InputHTMLAttributes; +struct Props { React.InputHTMLAttributes; const MyInput: React.FC = props => ; -export default MyInput; +default MyInput; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine index b294fd49..f950fe33 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyInput.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyInput.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from MyInput.res by genType. */ /* eslint-disable */ @@ -14,17 +11,16 @@ module MyInput.gen; import {default as defaultNotChecked} from './MyInput'; // In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'. -export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as any; +const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as unknown; // Export '$$default' early to allow circular import from the '.bs.js' file. -export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any; +const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as unknown; import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; -export type inputFocusEvent = $$inputFocusEvent; +struct inputFocusEvent { $$inputFocusEvent; -export type props = { readonly onFocus?: onFocus }; +type props = { readonly onFocus?: onFocus }; -export default $$default; +default $$default; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyMath.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyMath.affine index 29522c4b..86a33f12 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyMath.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyMath.affine @@ -1,23 +1,20 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyMath; -// TODO: Complete semantic implementation +const round: (_: number) => number = Math.round; -/* === ORIGINAL TYPESCRIPT CONTEXT === -export const round: (_: number) => number = Math.round; +let round2 = round; -export const round2 = round; - -export const area = (point: { x: number; y?: number }): number => +let area = (point: { x: number; y?: number }): number => point.x * (point.y === undefined ? 1 : point.y); -export type numberOrString = number | string; +struct numberOrString { number | string; -export const returnMixedArray = (): Array => [1, 2]; +let returnMixedArray = (): Array => [1, 2]; -export class AbsoluteValue { +struct AbsoluteValue { public prop!: number; public getProp(): number { return this.prop; @@ -27,22 +24,21 @@ export class AbsoluteValue { } } -export type stringFunction = (_: string) => string; +struct stringFunction { (_: string) => string; -export const useColor = (_x: "tomato" | "gray"): number => 0; +let useColor = (_x: "tomato" | "gray"): number => 0; -export const higherOrder = (foo: (_1: number, _2: number) => number) => +let higherOrder = (foo: (_1: number, _2: number) => number) => foo(3, 4); // biome-ignore lint/suspicious/noExplicitAny: intended use -export const convertVariant = (x: any) => x; +let convertVariant = (x: unknown) => x; -export const polymorphic = (x: T): T => x; +let polymorphic = (x: T): T => x; -export type num = number; +struct num { number; -export type polyType = { x: T }; +type polyType = { x: T }; -export default 34; +default 34; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine index a7936f06..0638327f 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/MyModule.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module MyModule.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from MyModule.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module MyModule.gen; import * as MyModuleJS from './MyModule.res.js'; -export type t = number; +struct t { number; -export const add: (a:t, b:t) => t = MyModuleJS.add as any; +const add: (a:t, b:t) => t = MyModuleJS.add as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine index 3076d079..c26451d4 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NestedModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NestedModules.res by genType. */ /* eslint-disable */ @@ -13,29 +10,29 @@ module NestedModules.gen; import * as NestedModulesJS from './NestedModules.res.js'; -export type Universe_nestedType = string[]; +struct Universe_nestedType { string[]; -export type Universe_Nested2_nested2Type = Array; +struct Universe_Nested2_nested2Type { Array; -export type Universe_Nested2_Nested3_nested3Type = Array>; +struct Universe_Nested2_Nested3_nested3Type { Array>; -export type Universe_variant = "A" | { TAG: "B"; _0: string }; +struct Universe_variant { "A" | { TAG: "B"; _0: string }; -export const notNested: number = NestedModulesJS.notNested as any; +const notNested: number = NestedModulesJS.notNested as unknown; -export const Universe_theAnswer: number = NestedModulesJS.Universe.theAnswer as any; +const Universe_theAnswer: number = NestedModulesJS.Universe.theAnswer as unknown; -export const Universe_Nested2_nested2Value: number = NestedModulesJS.Universe.Nested2.nested2Value as any; +const Universe_Nested2_nested2Value: number = NestedModulesJS.Universe.Nested2.nested2Value as unknown; -export const Universe_Nested2_Nested3_nested3Value: string = NestedModulesJS.Universe.Nested2.Nested3.nested3Value as any; +const Universe_Nested2_Nested3_nested3Value: string = NestedModulesJS.Universe.Nested2.Nested3.nested3Value as unknown; -export const Universe_Nested2_Nested3_nested3Function: (x:Universe_Nested2_nested2Type) => Universe_Nested2_nested2Type = NestedModulesJS.Universe.Nested2.Nested3.nested3Function as any; +const Universe_Nested2_Nested3_nested3Function: (x:Universe_Nested2_nested2Type) => Universe_Nested2_nested2Type = NestedModulesJS.Universe.Nested2.Nested3.nested3Function as unknown; -export const Universe_Nested2_nested2Function: (x:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type = NestedModulesJS.Universe.Nested2.nested2Function as any; +const Universe_Nested2_nested2Function: (x:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type = NestedModulesJS.Universe.Nested2.nested2Function as unknown; -export const Universe_someString: string = NestedModulesJS.Universe.someString as any; +const Universe_someString: string = NestedModulesJS.Universe.someString as unknown; -export const Universe: { +const Universe: { theAnswer: number; Nested2: { nested2Function: (x:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type; @@ -46,6 +43,5 @@ export const Universe: { } }; someString: string -} = NestedModulesJS.Universe as any; +} = NestedModulesJS.Universe as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine index f3991234..6657b71b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedModulesInSignature.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NestedModulesInSignature.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NestedModulesInSignature.resi by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module NestedModulesInSignature.gen; import * as NestedModulesInSignatureJS from './NestedModulesInSignature.res.js'; -export const Universe_theAnswer: number = NestedModulesInSignatureJS.Universe.theAnswer as any; +const Universe_theAnswer: number = NestedModulesInSignatureJS.Universe.theAnswer as unknown; -export const Universe: { theAnswer: number } = NestedModulesInSignatureJS.Universe as any; +const Universe: { theAnswer: number } = NestedModulesInSignatureJS.Universe as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine index d21824ed..677cf3cb 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NestedVariants.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NestedVariants.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NestedVariants.res by genType. */ /* eslint-disable */ @@ -13,69 +10,68 @@ module NestedVariants.gen; import * as NestedVariantsJS from './NestedVariants.res.js'; -export type typeL = +struct typeL { { TAG: "NonUnary"; _0: number; _1: number }; -export type typeC = +struct typeC { { TAG: "C"; _0: string } | { TAG: "D"; _0: string }; -export type typeB = { readonly c: typeC }; +struct typeB { { readonly c: typeC }; -export type typeD = { TAG: "Int"; _0: number }; +struct typeD { { TAG: "Int"; _0: number }; -export type typeE = number; +struct typeE { number; -export type typeA = +type typeA = { TAG: "A"; _0: a; _1: number } | { TAG: "B"; _0: a; _1: number }; -export type typeF = { TAG: "F"; _0: a } | { TAG: "G"; _0: a }; +type typeF = { TAG: "F"; _0: a } | { TAG: "G"; _0: a }; -export type typeH = +struct typeH { { TAG: "H"; _0: typeD; _1: number } | { TAG: "I"; _0: typeD; _1: number }; -export type typeJ = { TAG: "J"; _0: typeD; _1: typeD }; +struct typeJ { { TAG: "J"; _0: typeD; _1: typeD }; -export type typeK = { TAG: "K"; _0: typeD; _1: typeD }; +struct typeK { { TAG: "K"; _0: typeD; _1: typeD }; -export type boxedBinary = +struct boxedBinary { { TAG: "BB"; _0: typeD; _1: number } | { TAG: "Z"; _0: number }; -export type unboxedBinary = { TAG: "UB"; _0: typeD; _1: number }; +struct unboxedBinary { { TAG: "UB"; _0: typeD; _1: number }; -export type inline = +struct inline { { TAG: "I"; readonly i: number; readonly j: number } | { TAG: "J"; readonly i: number; readonly j: number } | { TAG: "K"; _0: number; _1: number } | { TAG: "L"; _0: { readonly j: number; readonly i: number } }; -export const makeVariant: () => typeL = NestedVariantsJS.makeVariant as any; +const makeVariant: () => typeL = NestedVariantsJS.makeVariant as unknown; -export const makeABC: () => typeA = NestedVariantsJS.makeABC as any; +const makeABC: () => typeA = NestedVariantsJS.makeABC as unknown; -export const makeBC: () => typeB = NestedVariantsJS.makeBC as any; +const makeBC: () => typeB = NestedVariantsJS.makeBC as unknown; -export const makeAC: () => typeA = NestedVariantsJS.makeAC as any; +const makeAC: () => typeA = NestedVariantsJS.makeAC as unknown; -export const makeAD: () => typeA = NestedVariantsJS.makeAD as any; +const makeAD: () => typeA = NestedVariantsJS.makeAD as unknown; -export const makeAE: () => typeA = NestedVariantsJS.makeAE as any; +const makeAE: () => typeA = NestedVariantsJS.makeAE as unknown; -export const makeFD: () => typeF = NestedVariantsJS.makeFD as any; +const makeFD: () => typeF = NestedVariantsJS.makeFD as unknown; -export const makeHD: () => typeH = NestedVariantsJS.makeHD as any; +const makeHD: () => typeH = NestedVariantsJS.makeHD as unknown; -export const makeJ: () => typeJ = NestedVariantsJS.makeJ as any; +const makeJ: () => typeJ = NestedVariantsJS.makeJ as unknown; -export const makeK: () => typeK = NestedVariantsJS.makeK as any; +const makeK: () => typeK = NestedVariantsJS.makeK as unknown; -export const testBoxedBinary: (param:boxedBinary) => number = NestedVariantsJS.testBoxedBinary as any; +const testBoxedBinary: (param:boxedBinary) => number = NestedVariantsJS.testBoxedBinary as unknown; -export const testUnboxedBinary: (param:unboxedBinary) => number = NestedVariantsJS.testUnboxedBinary as any; +const testUnboxedBinary: (param:unboxedBinary) => number = NestedVariantsJS.testUnboxedBinary as unknown; -export const testInline: (x:inline) => inline = NestedVariantsJS.testInline as any; +const testInline: (x:inline) => inline = NestedVariantsJS.testInline as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine index 0347e6a1..ed06dbe2 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NonrecursiveTypes.gen.affine @@ -1,24 +1,20 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NonrecursiveTypes.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NonrecursiveTypes.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type notRecursive = number; +struct notRecursive { number; -export type M_notRecursive = notRecursive[]; +struct M_notRecursive { notRecursive[]; -export type M_recursive = { readonly self: M_recursive }; +struct M_recursive { { readonly self: M_recursive }; -export type M_mutualRecursive = { readonly a: M_a }; +struct M_mutualRecursive { { readonly a: M_a }; -export type M_a = { readonly self: M_mutualRecursive }; +struct M_a { { readonly self: M_mutualRecursive }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine index 17a46a5e..72b3ecbd 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/NumericPolyVar.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module NumericPolyVar.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from NumericPolyVar.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t = 12 | 0 | "b"; +struct t { 12 | 0 | "b"; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Object.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Object.gen.affine index e279b412..d5835cb7 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Object.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Object.gen.affine @@ -1,18 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Object.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Object.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type someType = { readonly crop?: string; readonly "fp-z"?: string }; +struct someType { { readonly crop?: string; readonly "fp-z"?: string }; -export type someType2 = { readonly crop: (undefined | string); readonly "fp-z": (undefined | string) }; +struct someType2 { { readonly crop: (undefined | string); readonly "fp-z": (undefined | string) }; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine index cc37a9dd..941ed876 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/OnClick2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module OnClick2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from OnClick2.res by genType. */ /* eslint-disable */ @@ -15,8 +12,7 @@ import * as OnClick2JS from './OnClick2.res.js'; import type {Mouse_t as JsxEvent_Mouse_t} from '../src/shims/JsxEvent.shim'; -export type props = { readonly onClick: onClick }; +type props = { readonly onClick: onClick }; -export const make: React.ComponentType<{ readonly onClick: (_1:JsxEvent_Mouse_t) => void }> = OnClick2JS.make as any; +const make: React.ComponentType<{ readonly onClick: (_1:JsxEvent_Mouse_t) => void }> = OnClick2JS.make as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine index b4931ddd..646abd9e 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Opaque.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Opaque.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Opaque.res by genType. */ /* eslint-disable */ @@ -15,12 +12,11 @@ import * as OpaqueJS from './Opaque.res.js'; import type {business as Records_business} from './Records.gen'; -export abstract class opaqueFromRecords { protected opaque!: any }; /* simulate opaque types */ +abstract struct opaqueFromRecords { protected opaque!: unknown }; /* simulate opaque types */ -export type pair = [opaqueFromRecords, opaqueFromRecords]; +struct pair { [opaqueFromRecords, opaqueFromRecords]; -export const noConversion: (x:opaqueFromRecords) => opaqueFromRecords = OpaqueJS.noConversion as any; +const noConversion: (x:opaqueFromRecords) => opaqueFromRecords = OpaqueJS.noConversion as unknown; -export const testConvertNestedRecordFromOtherFile: (x:Records_business) => Records_business = OpaqueJS.testConvertNestedRecordFromOtherFile as any; +const testConvertNestedRecordFromOtherFile: (x:Records_business) => Records_business = OpaqueJS.testConvertNestedRecordFromOtherFile as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Records.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Records.gen.affine index 03b9c4e4..5a0d289a 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Records.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Records.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Records.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Records.res by genType. */ /* eslint-disable */ @@ -15,35 +12,35 @@ import * as RecordsJS from './Records.res.js'; import type {list} from '../src/shims/RescriptPervasives.shim'; -export type coord = { +struct coord { { readonly x: number; readonly y: number; readonly z: (undefined | number) }; -export type person = { +struct person { { readonly name: string; readonly age: number; readonly address: (undefined | string) }; -export type business = { +struct business { { readonly name: string; readonly owner: (undefined | person); readonly address: (undefined | string) }; -export type payload = { readonly num: number; readonly payload: a }; +type payload = { readonly num: number; readonly payload: a }; -export type record = { readonly v: number; readonly w: number }; +struct record { { readonly v: number; readonly w: number }; -export type business2 = { +struct business2 { { readonly name: string; readonly owner: (null | undefined | person); readonly address2: (null | undefined | string) }; -export type mix = { +struct mix { { readonly a: number; readonly b: number; readonly c?: { @@ -52,11 +49,11 @@ export type mix = { } }; -export type myRec = { readonly type: string }; +struct myRec { { readonly type: string }; -export type myObj = { readonly type_: string }; +struct myObj { { readonly type_: string }; -export type myRecBsAs = { +struct myRecBsAs { { readonly jsValid0: string; readonly type: string; readonly "the-key": string; @@ -65,54 +62,53 @@ export type myRecBsAs = { readonly "1number": string }; -export const origin: coord = RecordsJS.origin as any; +const origin: coord = RecordsJS.origin as unknown; -export const computeArea: (param:coord) => number = RecordsJS.computeArea as any; +const computeArea: (param:coord) => number = RecordsJS.computeArea as unknown; -export const coord2d: (x:number, y:number) => coord = RecordsJS.coord2d as any; +const coord2d: (x:number, y:number) => coord = RecordsJS.coord2d as unknown; -export const findAddress: (business:business) => list = RecordsJS.findAddress as any; +const findAddress: (business:business) => list = RecordsJS.findAddress as unknown; -export const someBusiness: business = RecordsJS.someBusiness as any; +const someBusiness: business = RecordsJS.someBusiness as unknown; -export const findAllAddresses: (businesses:business[]) => string[] = RecordsJS.findAllAddresses as any; +const findAllAddresses: (businesses:business[]) => string[] = RecordsJS.findAllAddresses as unknown; -export const getPayload: (param:payload) => T1 = RecordsJS.getPayload as any; +const getPayload: (param:payload) => T1 = RecordsJS.getPayload as unknown; -export const getPayloadRecord: (param:payload) => record = RecordsJS.getPayloadRecord as any; +const getPayloadRecord: (param:payload) => record = RecordsJS.getPayloadRecord as unknown; -export const recordValue: record = RecordsJS.recordValue as any; +const recordValue: record = RecordsJS.recordValue as unknown; -export const payloadValue: payload = RecordsJS.payloadValue as any; +const payloadValue: payload = RecordsJS.payloadValue as unknown; -export const getPayloadRecordPlusOne: (param:payload) => record = RecordsJS.getPayloadRecordPlusOne as any; +const getPayloadRecordPlusOne: (param:payload) => record = RecordsJS.getPayloadRecordPlusOne as unknown; -export const findAddress2: (business:business2) => list = RecordsJS.findAddress2 as any; +const findAddress2: (business:business2) => list = RecordsJS.findAddress2 as unknown; -export const someBusiness2: business2 = RecordsJS.someBusiness2 as any; +const someBusiness2: business2 = RecordsJS.someBusiness2 as unknown; -export const computeArea3: (o:{ +const computeArea3: (o:{ readonly x: number; readonly y: number; readonly z: (null | undefined | number) -}) => number = RecordsJS.computeArea3 as any; +}) => number = RecordsJS.computeArea3 as unknown; -export const computeArea4: (o:{ +const computeArea4: (o:{ readonly x: number; readonly y: number; readonly z?: number -}) => number = RecordsJS.computeArea4 as any; +}) => number = RecordsJS.computeArea4 as unknown; -export const testMyRec: (x:myRec) => string = RecordsJS.testMyRec as any; +const testMyRec: (x:myRec) => string = RecordsJS.testMyRec as unknown; -export const testMyRec2: (x:myRec) => myRec = RecordsJS.testMyRec2 as any; +const testMyRec2: (x:myRec) => myRec = RecordsJS.testMyRec2 as unknown; -export const testMyObj: (x:myObj) => string = RecordsJS.testMyObj as any; +const testMyObj: (x:myObj) => string = RecordsJS.testMyObj as unknown; -export const testMyObj2: (x:myObj) => myObj = RecordsJS.testMyObj2 as any; +const testMyObj2: (x:myObj) => myObj = RecordsJS.testMyObj2 as unknown; -export const testMyRecBsAs: (x:myRecBsAs) => string[] = RecordsJS.testMyRecBsAs as any; +const testMyRecBsAs: (x:myRecBsAs) => string[] = RecordsJS.testMyRecBsAs as unknown; -export const testMyRecBsAs2: (x:myRecBsAs) => myRecBsAs = RecordsJS.testMyRecBsAs2 as any; +const testMyRecBsAs2: (x:myRecBsAs) => myRecBsAs = RecordsJS.testMyRecBsAs2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/References.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/References.gen.affine index 62602655..48f50fe4 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/References.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/References.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module References.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from References.res by genType. */ /* eslint-disable */ @@ -13,26 +10,25 @@ module References.gen; import * as ReferencesJS from './References.res.js'; -export abstract class R_t { protected opaque!: a }; /* simulate opaque types */ +abstract struct R_t { protected opaque!: a }; /* simulate opaque types */ -export type t = R_t; +type t = R_t; -export type requiresConversion = { readonly x: number }; +struct requiresConversion { { readonly x: number }; -export const create: (x:number) => { contents: number } = ReferencesJS.create as any; +const create: (x:number) => { contents: number } = ReferencesJS.create as unknown; -export const access: (r:{ contents: number }) => number = ReferencesJS.access as any; +const access: (r:{ contents: number }) => number = ReferencesJS.access as unknown; -export const update: (r:{ contents: number }) => void = ReferencesJS.update as any; +const update: (r:{ contents: number }) => void = ReferencesJS.update as unknown; -export const get: (_1:R_t) => T1 = ReferencesJS.get as any; +const get: (_1:R_t) => T1 = ReferencesJS.get as unknown; -export const make: (_1:T1) => R_t = ReferencesJS.make as any; +const make: (_1:T1) => R_t = ReferencesJS.make as unknown; -export const set: (_1:R_t, _2:T1) => void = ReferencesJS.set as any; +const set: (_1:R_t, _2:T1) => void = ReferencesJS.set as unknown; -export const destroysRefIdentity: (x:{ contents: requiresConversion }) => { contents: requiresConversion } = ReferencesJS.destroysRefIdentity as any; +const destroysRefIdentity: (x:{ contents: requiresConversion }) => { contents: requiresConversion } = ReferencesJS.destroysRefIdentity as unknown; -export const preserveRefIdentity: (x:R_t) => R_t = ReferencesJS.preserveRefIdentity as any; +const preserveRefIdentity: (x:R_t) => R_t = ReferencesJS.preserveRefIdentity as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine index 56f3d330..d6d08b4d 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Shadow.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Shadow.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Shadow.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module Shadow.gen; import * as ShadowJS from './Shadow.res.js'; -export const test: () => string = ShadowJS.test as any; +const test: () => string = ShadowJS.test as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine index 4079183a..da35124b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestEmitInnerModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestEmitInnerModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestEmitInnerModules.res by genType. */ /* eslint-disable */ @@ -13,14 +10,13 @@ module TestEmitInnerModules.gen; import * as TestEmitInnerModulesJS from './TestEmitInnerModules.res.js'; -export const Inner_x: number = TestEmitInnerModulesJS.Inner.x as any; +const Inner_x: number = TestEmitInnerModulesJS.Inner.x as unknown; -export const Inner_y: string = TestEmitInnerModulesJS.Inner.y as any; +const Inner_y: string = TestEmitInnerModulesJS.Inner.y as unknown; -export const Outer_Medium_Inner_y: number = TestEmitInnerModulesJS.Outer.Medium.Inner.y as any; +const Outer_Medium_Inner_y: number = TestEmitInnerModulesJS.Outer.Medium.Inner.y as unknown; -export const Inner: { x: number; y: string } = TestEmitInnerModulesJS.Inner as any; +const Inner: { x: number; y: string } = TestEmitInnerModulesJS.Inner as unknown; -export const Outer: { Medium: { Inner: { y: number } } } = TestEmitInnerModulesJS.Outer as any; +const Outer: { Medium: { Inner: { y: number } } } = TestEmitInnerModulesJS.Outer as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine index 5464f792..2f345142 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestFirstClassModules.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestFirstClassModules.res by genType. */ /* eslint-disable */ @@ -19,14 +16,13 @@ import type {firstClassModule as FirstClassModules_firstClassModule} from './Fir import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; -export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; +type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; -export const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as any; +const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as unknown; -export const convertInterface: (x:FirstClassModulesInterface_firstClassModule) => FirstClassModulesInterface_firstClassModule = TestFirstClassModulesJS.convertInterface as any; +const convertInterface: (x:FirstClassModulesInterface_firstClassModule) => FirstClassModulesInterface_firstClassModule = TestFirstClassModulesJS.convertInterface as unknown; -export const convertRecord: (x:FirstClassModulesInterface_record) => FirstClassModulesInterface_record = TestFirstClassModulesJS.convertRecord as any; +const convertRecord: (x:FirstClassModulesInterface_record) => FirstClassModulesInterface_record = TestFirstClassModulesJS.convertRecord as unknown; -export const convertFirstClassModuleWithTypeEquations: (x:{ readonly out: ((_1:T1) => T1); readonly Inner: { readonly inn: ((_1:T2) => T2) } }) => { readonly out: (_1:T1) => T1; readonly Inner: { readonly inn: (_1:T2) => T2 } } = TestFirstClassModulesJS.convertFirstClassModuleWithTypeEquations as any; +const convertFirstClassModuleWithTypeEquations: (x:{ readonly out: ((_1:T1) => T1); readonly Inner: { readonly inn: ((_1:T2) => T2) } }) => { readonly out: (_1:T1) => T1; readonly Inner: { readonly inn: (_1:T2) => T2 } } = TestFirstClassModulesJS.convertFirstClassModuleWithTypeEquations as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine index e38afb1f..7029c22b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestImmutableArray.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestImmutableArray.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestImmutableArray.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module TestImmutableArray.gen; import * as TestImmutableArrayJS from './TestImmutableArray.res.js'; -export const testImmutableArrayGet: (arr:ReadonlyArray) => (undefined | T1) = TestImmutableArrayJS.testImmutableArrayGet as any; +const testImmutableArrayGet: (arr:ReadonlyArray) => (undefined | T1) = TestImmutableArrayJS.testImmutableArrayGet as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine index c19d7f8b..e43795ea 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestModuleAliases.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestModuleAliases.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestModuleAliases.res by genType. */ /* eslint-disable */ @@ -21,28 +18,27 @@ import type {Outer_outer as ModuleAliases2_Outer_outer} from './ModuleAliases2.g import type {record as ModuleAliases2_record} from './ModuleAliases2.gen'; -export type OtherFile_record = { readonly x: number; readonly y: string }; +struct OtherFile_record { { readonly x: number; readonly y: string }; -export type record = ModuleAliases2_record; +struct record { ModuleAliases2_record; -export type record2 = ModuleAliases2_record; +struct record2 { ModuleAliases2_record; -export type outer = ModuleAliases2_Outer_outer; +struct outer { ModuleAliases2_Outer_outer; -export type outer2 = ModuleAliases2_Outer_outer; +struct outer2 { ModuleAliases2_Outer_outer; -export type my2 = ModuleAliases2_Outer_Inner_inner; +struct my2 { ModuleAliases2_Outer_Inner_inner; -export type inner1 = ModuleAliases2_InnerAlias_inner; +struct inner1 { ModuleAliases2_InnerAlias_inner; -export type inner2 = ModuleAliases2_Outer_Inner_inner; +struct inner2 { ModuleAliases2_Outer_Inner_inner; -export const testInner1: (x:inner1) => inner1 = TestModuleAliasesJS.testInner1 as any; +const testInner1: (x:inner1) => inner1 = TestModuleAliasesJS.testInner1 as unknown; -export const testInner1Expanded: (x:ModuleAliases2_InnerAlias_inner) => ModuleAliases2_InnerAlias_inner = TestModuleAliasesJS.testInner1Expanded as any; +const testInner1Expanded: (x:ModuleAliases2_InnerAlias_inner) => ModuleAliases2_InnerAlias_inner = TestModuleAliasesJS.testInner1Expanded as unknown; -export const testInner2: (x:inner2) => inner2 = TestModuleAliasesJS.testInner2 as any; +const testInner2: (x:inner2) => inner2 = TestModuleAliasesJS.testInner2 as unknown; -export const testInner2Expanded: (x:ModuleAliases2_Outer_Inner_inner) => ModuleAliases2_Outer_Inner_inner = TestModuleAliasesJS.testInner2Expanded as any; +const testInner2Expanded: (x:ModuleAliases2_Outer_Inner_inner) => ModuleAliases2_Outer_Inner_inner = TestModuleAliasesJS.testInner2Expanded as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine index 0dbc2ec5..beba73d1 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TestPromise.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TestPromise.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TestPromise.res by genType. */ /* eslint-disable */ @@ -13,14 +10,13 @@ module TestPromise.gen; import * as TestPromiseJS from './TestPromise.res.js'; -export type promise = Promise; +type promise = a; -export type fromPayload = { readonly x: number; readonly s: string }; +struct fromPayload { { readonly x: number; readonly s: string }; -export type toPayload = { readonly result: string }; +struct toPayload { { readonly result: string }; -export const convert: (p:Promise) => Promise = TestPromiseJS.convert as any; +const convert: (p:fromPayload) => toPayload = TestPromiseJS.convert as unknown; -export const barx: (x:(undefined | Promise<(undefined | string)>), _2:void) => boolean = TestPromiseJS.barx as any; +const barx: (x:(undefined | (undefined | string)), _2:void) => boolean = TestPromiseJS.barx as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine index 723c18ef..3e127bdc 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TransitiveType1.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TransitiveType1.res by genType. */ /* eslint-disable */ @@ -17,8 +14,7 @@ import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; -export const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as any; +const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as unknown; -export const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as any; +const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine index 3a2028b3..0f6c1590 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TransitiveType2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TransitiveType2.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module TransitiveType2.gen; import type {t3 as TransitiveType3_t3} from './TransitiveType3.gen'; -export type t2 = (undefined | TransitiveType3_t3); +struct t2 { (undefined | TransitiveType3_t3); -export type t2Alias = t2; +struct t2Alias { t2; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine index be1d3747..33144148 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TransitiveType3.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TransitiveType3.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TransitiveType3.res by genType. */ /* eslint-disable */ @@ -13,8 +10,7 @@ module TransitiveType3.gen; import * as TransitiveType3JS from './TransitiveType3.res.js'; -export type t3 = { readonly i: number; readonly s: string }; +struct t3 { { readonly i: number; readonly s: string }; -export const convertT3: (x:t3) => t3 = TransitiveType3JS.convertT3 as any; +const convertT3: (x:t3) => t3 = TransitiveType3JS.convertT3 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine index 53921776..94391b0f 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeNameSanitize.gen.affine @@ -1,20 +1,16 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeNameSanitize.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeNameSanitize.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type t_ = number; +struct t_ { number; -export type M_t__ = number; +struct M_t__ { number; -export type pair = [t_, M_t__]; +struct pair { [t_, M_t__]; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine index eafda865..e0cc7635 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams1.gen.affine @@ -1,16 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeParams1.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeParams1.res by genType. */ /* eslint-disable */ /* tslint:disable */ -export type ocaml_array = a[]; +type ocaml_array = a[]; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine index dfcd0afa..c69126e2 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams2.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeParams2.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeParams2.res by genType. */ /* eslint-disable */ @@ -13,10 +10,9 @@ module TypeParams2.gen; import type {ocaml_array as TypeParams1_ocaml_array} from './TypeParams1.gen'; -export type item = { readonly id: number }; +struct item { { readonly id: number }; -export type items = TypeParams1_ocaml_array; +struct items { TypeParams1_ocaml_array; -export type items2 = item[]; +struct items2 { item[]; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine index 5a32f93a..d34a3af0 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module TypeParams3.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from TypeParams3.res by genType. */ /* eslint-disable */ @@ -17,8 +14,7 @@ import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; import type {items as TypeParams2_items} from './TypeParams2.gen'; -export const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as any; +const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as unknown; -export const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as any; +const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine index 13d45c6a..66310b6c 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Unboxed.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Unboxed.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Unboxed.res by genType. */ /* eslint-disable */ @@ -13,26 +10,25 @@ module Unboxed.gen; import * as UnboxedJS from './Unboxed.res.js'; -export type v1 = number; +struct v1 { number; -export type v2 = number; +struct v2 { number; -export type r1 = number; +struct r1 { number; -export type r2 = string; +struct r2 { string; -export type t = number[] | number | ((_1:number) => number); +struct t { number[] | number | ((_1:number) => number); -export type tabIndex = "0" | "1" | 0; +struct tabIndex { "0" | "1" | 0; -export const testV1: (x:v1) => v1 = UnboxedJS.testV1 as any; +const testV1: (x:v1) => v1 = UnboxedJS.testV1 as unknown; -export const r2Test: (x:r2) => r2 = UnboxedJS.r2Test as any; +const r2Test: (x:r2) => r2 = UnboxedJS.r2Test as unknown; -export const a: tabIndex = UnboxedJS.a as any; +const a: tabIndex = UnboxedJS.a as unknown; -export const b: tabIndex = UnboxedJS.b as any; +const b: tabIndex = UnboxedJS.b as unknown; -export const zero: 0 = UnboxedJS.zero as any; +const zero: 0 = UnboxedJS.zero as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine index d31531ff..93c34038 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Uncurried.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Uncurried.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Uncurried.res by genType. */ /* eslint-disable */ @@ -13,40 +10,39 @@ module Uncurried.gen; import * as UncurriedJS from './Uncurried.res.js'; -export type u0 = () => string; +struct u0 { () => string; -export type u1 = (_1:number) => string; +struct u1 { (_1:number) => string; -export type u2 = (_1:number, _2:string) => string; +struct u2 { (_1:number, _2:string) => string; -export type u3 = (_1:number, _2:string, _3:number) => string; +struct u3 { (_1:number, _2:string, _3:number) => string; -export type auth = { readonly login: () => string }; +struct auth { { readonly login: () => string }; -export type authU = { readonly loginU: () => string }; +struct authU { { readonly loginU: () => string }; -export const uncurried0: () => string = UncurriedJS.uncurried0 as any; +const uncurried0: () => string = UncurriedJS.uncurried0 as unknown; -export const uncurried1: (x:number) => string = UncurriedJS.uncurried1 as any; +const uncurried1: (x:number) => string = UncurriedJS.uncurried1 as unknown; -export const uncurried2: (x:number, y:string) => string = UncurriedJS.uncurried2 as any; +const uncurried2: (x:number, y:string) => string = UncurriedJS.uncurried2 as unknown; -export const uncurried3: (x:number, y:string, z:number) => string = UncurriedJS.uncurried3 as any; +const uncurried3: (x:number, y:string, z:number) => string = UncurriedJS.uncurried3 as unknown; -export const curried3: (x:number, y:string, z:number) => string = UncurriedJS.curried3 as any; +const curried3: (x:number, y:string, z:number) => string = UncurriedJS.curried3 as unknown; -export const callback: (cb:(() => number)) => string = UncurriedJS.callback as any; +const callback: (cb:(() => number)) => string = UncurriedJS.callback as unknown; -export const callback2: (auth:auth) => string = UncurriedJS.callback2 as any; +const callback2: (auth:auth) => string = UncurriedJS.callback2 as unknown; -export const callback2U: (auth:authU) => string = UncurriedJS.callback2U as any; +const callback2U: (auth:authU) => string = UncurriedJS.callback2U as unknown; -export const sumU: (n:number, m:number) => void = UncurriedJS.sumU as any; +const sumU: (n:number, m:number) => void = UncurriedJS.sumU as unknown; -export const sumU2: (n:number) => (_1:number) => void = UncurriedJS.sumU2 as any; +const sumU2: (n:number) => (_1:number) => void = UncurriedJS.sumU2 as unknown; -export const sumCurried: (n:number) => (_1:number) => void = UncurriedJS.sumCurried as any; +const sumCurried: (n:number) => (_1:number) => void = UncurriedJS.sumCurried as unknown; -export const sumLblCurried: (s:string, n:number) => (m:number) => void = UncurriedJS.sumLblCurried as any; +const sumLblCurried: (s:string, n:number) => (m:number) => void = UncurriedJS.sumLblCurried as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine index 52ea9695..41030c07 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Usage.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Usage.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Usage.res by genType. */ /* eslint-disable */ @@ -15,6 +12,5 @@ import * as UsageJS from './Usage.res.js'; import type {MyModuleAlias_t as Wrapper_MyModuleAlias_t} from './Wrapper.gen'; -export const b: Wrapper_MyModuleAlias_t = UsageJS.b as any; +const b: Wrapper_MyModuleAlias_t = UsageJS.b as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine index 3e220029..763703fe 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/UseImportJsValue.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module UseImportJsValue.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from UseImportJsValue.res by genType. */ /* eslint-disable */ @@ -17,8 +14,7 @@ import type {AbsoluteValue_t as ImportJsValue_AbsoluteValue_t} from './ImportJsV import type {stringFunction as ImportJsValue_stringFunction} from './ImportJsValue.gen'; -export const useGetProp: (x:ImportJsValue_AbsoluteValue_t) => number = UseImportJsValueJS.useGetProp as any; +const useGetProp: (x:ImportJsValue_AbsoluteValue_t) => number = UseImportJsValueJS.useGetProp as unknown; -export const useTypeImportedInOtherModule: (x:ImportJsValue_stringFunction) => ImportJsValue_stringFunction = UseImportJsValueJS.useTypeImportedInOtherModule as any; +const useTypeImportedInOtherModule: (x:ImportJsValue_stringFunction) => ImportJsValue_stringFunction = UseImportJsValueJS.useTypeImportedInOtherModule as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine index a92b8a46..2428fe4c 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Variants.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Variants.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Variants.res by genType. */ /* eslint-disable */ @@ -15,7 +12,7 @@ import * as VariantsJS from './Variants.res.js'; import type {list} from '../src/shims/RescriptPervasives.shim'; -export type weekday = +struct weekday { "monday" | "tuesday" | "wednesday" @@ -24,71 +21,70 @@ export type weekday = | "saturday" | "sunday"; -export type testGenTypeAs = "type_" | "module_" | "fortytwo"; +struct testGenTypeAs { "type_" | "module_" | "fortytwo"; -export type testGenTypeAs2 = "type_" | "module" | 42; +struct testGenTypeAs2 { "type_" | "module" | 42; -export type testGenTypeAs3 = "type_" | "module" | 42; +struct testGenTypeAs3 { "type_" | "module" | 42; -export type x1 = "x" | "x1"; +struct x1 { "x" | "x1"; -export type x2 = "x" | "x2"; +struct x2 { "x" | "x2"; -export type type_ = "Type"; -export type type = type_; +struct type_ { "Type"; +struct type { type_; -export type myList = "E" | { TAG: "C"; _0: number; _1: myList }; +struct myList { "E" | { TAG: "C"; _0: number; _1: myList }; -export type builtinList = list; +struct builtinList { list; -export type result1 = +type result1 = { TAG: "Ok"; _0: a } | { TAG: "Error"; _0: b }; -export type result2 = +type result2 = { TAG: "Ok"; _0: a } | { TAG: "Error"; _0: b }; -export type result3 = +type result3 = { TAG: "Ok"; _0: a } | { TAG: "Error"; _0: b }; -export const isWeekend: (x:weekday) => boolean = VariantsJS.isWeekend as any; +const isWeekend: (x:weekday) => boolean = VariantsJS.isWeekend as unknown; -export const monday: "monday" = VariantsJS.monday as any; +const monday: "monday" = VariantsJS.monday as unknown; -export const saturday: "saturday" = VariantsJS.saturday as any; +const saturday: "saturday" = VariantsJS.saturday as unknown; -export const sunday: "sunday" = VariantsJS.sunday as any; +const sunday: "sunday" = VariantsJS.sunday as unknown; -export const onlySunday: (param:"sunday") => void = VariantsJS.onlySunday as any; +const onlySunday: (param:"sunday") => void = VariantsJS.onlySunday as unknown; -export const swap: (x:"saturday" | "sunday") => "saturday" | "sunday" = VariantsJS.swap as any; +const swap: (x:"saturday" | "sunday") => "saturday" | "sunday" = VariantsJS.swap as unknown; -export const testConvert: (x:testGenTypeAs) => testGenTypeAs = VariantsJS.testConvert as any; +const testConvert: (x:testGenTypeAs) => testGenTypeAs = VariantsJS.testConvert as unknown; -export const fortytwoOK: testGenTypeAs = VariantsJS.fortytwoOK as any; +const fortytwoOK: testGenTypeAs = VariantsJS.fortytwoOK as unknown; -export const fortytwoBAD: "fortytwo" = VariantsJS.fortytwoBAD as any; +const fortytwoBAD: "fortytwo" = VariantsJS.fortytwoBAD as unknown; -export const testConvert2: (x:testGenTypeAs2) => testGenTypeAs2 = VariantsJS.testConvert2 as any; +const testConvert2: (x:testGenTypeAs2) => testGenTypeAs2 = VariantsJS.testConvert2 as unknown; -export const testConvert3: (x:testGenTypeAs3) => testGenTypeAs3 = VariantsJS.testConvert3 as any; +const testConvert3: (x:testGenTypeAs3) => testGenTypeAs3 = VariantsJS.testConvert3 as unknown; -export const testConvert2to3: (x:testGenTypeAs2) => testGenTypeAs3 = VariantsJS.testConvert2to3 as any; +const testConvert2to3: (x:testGenTypeAs2) => testGenTypeAs3 = VariantsJS.testConvert2to3 as unknown; -export const id1: (x:x1) => x1 = VariantsJS.id1 as any; +const id1: (x:x1) => x1 = VariantsJS.id1 as unknown; -export const id2: (x:x2) => x2 = VariantsJS.id2 as any; +const id2: (x:x2) => x2 = VariantsJS.id2 as unknown; -export const polyWithOpt: (foo:string) => (undefined | ( +const polyWithOpt: (foo:string) => (undefined | ( { NAME: "One"; VAL: string } - | { NAME: "Two"; VAL: number })) = VariantsJS.polyWithOpt as any; + | { NAME: "Two"; VAL: number })) = VariantsJS.polyWithOpt as unknown; -export const restResult1: (x:result1) => result1 = VariantsJS.restResult1 as any; +const restResult1: (x:result1) => result1 = VariantsJS.restResult1 as unknown; -export const restResult2: (x:result2) => result2 = VariantsJS.restResult2 as any; +const restResult2: (x:result2) => result2 = VariantsJS.restResult2 as unknown; -export const restResult3: (x:result3) => result3 = VariantsJS.restResult3 as any; +const restResult3: (x:result3) => result3 = VariantsJS.restResult3 as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine index 843346b0..af469d1b 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/VariantsWithPayload.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module VariantsWithPayload.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from VariantsWithPayload.res by genType. */ /* eslint-disable */ @@ -13,9 +10,9 @@ module VariantsWithPayload.gen; import * as VariantsWithPayloadJS from './VariantsWithPayload.res.js'; -export type payload = { readonly x: number; readonly y?: string }; +struct payload { { readonly x: number; readonly y?: string }; -export type withPayload = +struct withPayload { "a" | "b" | "True" @@ -23,40 +20,39 @@ export type withPayload = | "Half" | { NAME: "c"; VAL: payload }; -export type manyPayloads = +struct manyPayloads { { NAME: "one"; VAL: number } | { NAME: "two"; VAL: [string, string] } | { NAME: "three"; VAL: payload }; -export type simpleVariant = "A" | "B" | "C"; +struct simpleVariant { "A" | "B" | "C"; -export type variantWithPayloads = +struct variantWithPayloads { "A" | { TAG: "B"; _0: number } | { TAG: "C"; _0: number; _1: number } | { TAG: "D"; _0: number; _1: number } | { TAG: "E"; _0: number; _1: string; _2: number }; -export type variant1Int = { TAG: "R"; _0: number }; +struct variant1Int { { TAG: "R"; _0: number }; -export type variant1Object = { TAG: "R"; _0: payload }; +struct variant1Object { { TAG: "R"; _0: payload }; -export const testWithPayload: (x:withPayload) => withPayload = VariantsWithPayloadJS.testWithPayload as any; +const testWithPayload: (x:withPayload) => withPayload = VariantsWithPayloadJS.testWithPayload as unknown; -export const printVariantWithPayload: (x:withPayload) => void = VariantsWithPayloadJS.printVariantWithPayload as any; +const printVariantWithPayload: (x:withPayload) => void = VariantsWithPayloadJS.printVariantWithPayload as unknown; -export const testManyPayloads: (x:manyPayloads) => manyPayloads = VariantsWithPayloadJS.testManyPayloads as any; +const testManyPayloads: (x:manyPayloads) => manyPayloads = VariantsWithPayloadJS.testManyPayloads as unknown; -export const printManyPayloads: (x:manyPayloads) => void = VariantsWithPayloadJS.printManyPayloads as any; +const printManyPayloads: (x:manyPayloads) => void = VariantsWithPayloadJS.printManyPayloads as unknown; -export const testSimpleVariant: (x:simpleVariant) => simpleVariant = VariantsWithPayloadJS.testSimpleVariant as any; +const testSimpleVariant: (x:simpleVariant) => simpleVariant = VariantsWithPayloadJS.testSimpleVariant as unknown; -export const testVariantWithPayloads: (x:variantWithPayloads) => variantWithPayloads = VariantsWithPayloadJS.testVariantWithPayloads as any; +const testVariantWithPayloads: (x:variantWithPayloads) => variantWithPayloads = VariantsWithPayloadJS.testVariantWithPayloads as unknown; -export const printVariantWithPayloads: (x:variantWithPayloads) => void = VariantsWithPayloadJS.printVariantWithPayloads as any; +const printVariantWithPayloads: (x:variantWithPayloads) => void = VariantsWithPayloadJS.printVariantWithPayloads as unknown; -export const testVariant1Int: (x:variant1Int) => variant1Int = VariantsWithPayloadJS.testVariant1Int as any; +const testVariant1Int: (x:variant1Int) => variant1Int = VariantsWithPayloadJS.testVariant1Int as unknown; -export const testVariant1Object: (x:variant1Object) => variant1Object = VariantsWithPayloadJS.testVariant1Object as any; +const testVariant1Object: (x:variant1Object) => variant1Object = VariantsWithPayloadJS.testVariant1Object as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine index af1bbcaa..de13f094 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Warnings.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Warnings.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Warnings.res by genType. */ /* eslint-disable */ @@ -13,6 +10,5 @@ module Warnings.gen; import * as WarningsJS from './Warnings.res.js'; -export const ddd: number = WarningsJS.x as any; +const ddd: number = WarningsJS.x as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine index d3d6f3b6..554a91ab 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/Wrapper.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module Wrapper.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from Wrapper.res by genType. */ /* eslint-disable */ @@ -13,10 +10,9 @@ module Wrapper.gen; import * as WrapperJS from './Wrapper.res.js'; -export type MyModuleAlias_t = number; +struct MyModuleAlias_t { number; -export const MyModuleAlias_add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t = WrapperJS.MyModuleAlias.add as any; +const MyModuleAlias_add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t = WrapperJS.MyModuleAlias.add as unknown; -export const MyModuleAlias: { add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t } = WrapperJS.MyModuleAlias as any; +const MyModuleAlias: { add: (_1:MyModuleAlias_t, _2:MyModuleAlias_t) => MyModuleAlias_t } = WrapperJS.MyModuleAlias as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/counter.gen.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/counter.gen.affine index 7b5c8f13..057fb381 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/counter.gen.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/counter.gen.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module counter.gen; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === /* TypeScript file generated from counter.res by genType. */ /* eslint-disable */ @@ -15,6 +12,5 @@ import * as counterJS from './counter.res.js'; import type {aa as Machine_aa} from './Machine.gen'; -export const b: Machine_aa = counterJS.b as any; +const b: Machine_aa = counterJS.b as unknown; -==================================== */ diff --git a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/hookExample.affine b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/hookExample.affine index a4d1c80c..db689cef 100644 --- a/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/hookExample.affine +++ b/rescript-ecosystem/rescript/tests/gentype_tests/typescript-react-example/src/hookExample.affine @@ -1,17 +1,14 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module hookExample; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === import * as React from "react"; -export const foo = (person: { readonly name: string; readonly age: number }) => +let foo = (person: { readonly name: string; readonly age: number }) => person.name; -type Props = { +struct Props { { readonly person: { readonly name: string; readonly age: number }; readonly children: React.ReactNode; readonly renderMe: React.ComponentType<{ @@ -20,8 +17,8 @@ type Props = { }>; }; -export const make: React.FC = (x: Props) => { - const RenderMe = x.renderMe; +const make: React.FC = (x: Props) => { + let RenderMe = x.renderMe; return (