Inliner and refresher fixes#506
Merged
Merged
Conversation
This commit seems to uncover a lot of bugs probably related to inlining # Conflicts: # hkmc2/shared/src/test/mlscript/deforest/fusibility.mls # hkmc2/shared/src/test/mlscript/opt/InlineModuleMethods.mls
Agent-Logs-Url: https://github.com/LPTK/mlscript/sessions/b07c80eb-8e80-4382-8e61-53c072d6e23f Co-authored-by: LPTK <2545083+LPTK@users.noreply.github.com> # Conflicts: # hkmc2/shared/src/test/mlscript/codegen/ClassInFun.mls # hkmc2/shared/src/test/mlscript/lifter/DefnsInClass.mls
…e-mapped ctor symbols When the inliner copies a function body containing a data class definition, the SymbolRefresher creates fresh symbols. Two issues were fixed: 1. The refreshed ClassSymbol was missing its source-level `defn`, causing JSBuilder's `shouldBeLifted` to return false and the static block to assign `this` directly to the variable (instead of `.class` property), overwriting the wrapper function. 2. The ClassCtorSymbol could already be mapped to a TermSymbol (by the FunDefn case for the wrapper function). The original assertion `assert(!mapping.isDefinedAt(cs))` would crash. Now we create a fresh ClassCtorSymbol without overwriting the mapping, preserving correct MemberRef disambiguation for the wrapper function. Co-authored-by: LPTK <2545083+LPTK@users.noreply.github.com>
ClassInFun.mls and FunInClass.mls: assertion crashes now produce correct results. LazyFingerTreeTest.mls: pre-existing compile test failure reflected in runtime. Co-authored-by: LPTK <2545083+LPTK@users.noreply.github.com> # Conflicts: # hkmc2/shared/src/test/mlscript/codegen/ClassInFun.mls # hkmc2/shared/src/test/mlscript/codegen/FunInClass.mls
…for number literal property access Co-authored-by: LPTK <2545083+LPTK@users.noreply.github.com> # Conflicts: # hkmc2/shared/src/main/scala/hkmc2/codegen/BlockSimplifier.scala # hkmc2/shared/src/test/mlscript/HkScratch.mls # hkmc2/shared/src/test/mlscript/ucs/patterns/SimpleTuple.mls
Fix symbol refresher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The inlining threshold was not properly picked up in diff-tests (it defaulted to 1). Fixing this exposed a bunch of issues, which I mostly fixed throguh Copilot/Codex.