Skip to content

Fix lifter problems #285

@LPTK

Description

@LPTK

TODO

  • Member classes are not lifted correctly: they are no longer accessible from the original owner (outer definition).
  • The current lifter has these comment:
    // the current problem is that we need extra code to find which variables were really defined by a function
    // this may be resolved in the future when the IR gets explicit variable declarations
    // TODO: let declarations inside loops (also broken without class lifting)
    // I'll fix it once it's fixed in the IR since we will have more tools to determine
    // what locals belong to what block.
    We should add explicit variable declarations and simplify this code.
  • Ordering problems introduced by the lifter will be solved by fixing Reorder simple classes and require let class on the others #278
  • Also see all the test cases in hkmc2/shared/src/test/mlscript/backlog/Lifter.mls
  • Modules are not lifted at all. In the future, we want to introduce parameterized modules, which would allow us to properly lift them. Though It's not clear if we want modules inside other definitions in the first place.
  • Lifting functions with spread arguments (i.e. fun f(...rest)) is broken.
  • This test does not work:
    class A(x) with
      class B(y) with
        fun getB() = x + y
      fun getA() = this.B(2).getB()
    A(1).getA()
    as B is lifted out and the selection this.B does not have a FieldSymbol, meaning we can't properly detect references to the class B. See the relevant test in the backlog for a possible lifting method.
    See Class Lifter #266 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions