Skip to content

Implement Typed IR - #504

Draft
Derppening wants to merge 259 commits into
hkust-taco:hkmc2from
Derppening:enhance/typed-ir
Draft

Implement Typed IR#504
Derppening wants to merge 259 commits into
hkust-taco:hkmc2from
Derppening:enhance/typed-ir

Conversation

@Derppening

Copy link
Copy Markdown
Contributor

No description provided.

LPTK and others added 30 commits May 21, 2026 13:21
# Conflicts:
#	hkmc2/shared/src/main/scala/hkmc2/codegen/BlockSimplifier.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/Lowering.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/ReflectionInstrumenter.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/StackSafeTransform.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/UsedVarAnalyzer.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/js/JSBuilder.scala
#	hkmc2/shared/src/test/mlscript/block-staging/Nested.mls
#	hkmc2/shared/src/test/mlscript/codegen/BlockPrinter.mls
#	hkmc2/shared/src/test/mlscript/codegen/FirstClassFunctionTransform.mls
#	hkmc2/shared/src/test/mlscript/codegen/Hygiene.mls
#	hkmc2/shared/src/test/mlscript/codegen/PlainClasses.mls
#	hkmc2/shared/src/test/mlscript/deforest/relaxedPrograms.mls
#	hkmc2/shared/src/test/mlscript/lifter/PrivateMutableFields.mls
# Conflicts:
#	hkmc2/shared/src/main/scala/hkmc2/codegen/HandlerLowering.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/Lifter.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/Lowering.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/ReflectionInstrumenter.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/StackSafeTransform.scala
… add :fixme to Debugging.mls

Co-authored-by: LPTK <2545083+LPTK@users.noreply.github.com>
@Derppening

Copy link
Copy Markdown
Contributor Author

Most of the work should be done now. I will go through the changes once more tomorrow and clean this up.

@Derppening

Copy link
Copy Markdown
Contributor Author

For some reason I can't reproduce the diff in the CI locally...

-//│       set tmp = Runtime⁰.Tuple¹.get¹(c, 1);
+//│       set tmp = Runtime⁰.Tuple⁰.get⁰(c, 1);

@Derppening

Copy link
Copy Markdown
Contributor Author

Dropped e95e681 and merged LPTK#27 into this branch to fix the Prelude.mls cache issue.

@Derppening

Derppening commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Pushed two more fixes:

  • Added support for curried functions in ErasedType.FuncRef

    Partially-applied curried functions used to incorrectly collapse to the type of the return value rather than a FuncRef with the applied parameter lists dropped from its signature.

  • Fixed a mismatch between the representation of Object in the erased type system and the backends

    ErasedType.Object represents the top-reference type (which includes types like Int), whereas Object in JS/Wasm represents globalThis.Object and the $Object base class, which notably exclude Number (in JS) and i31ref (in Wasm)

I will go through the whole diff tomorrow (especially the new difftests) to try to unslopify some of the changes and simplify the verbose explanations Claude likes to attach to its work. I will mark this ready-for-review once this is done.

Edit: Depends on LPTK#27.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants