pkl icon indicating copy to clipboard operation
pkl copied to clipboard

Method supercall doesn't work inside let expression

Open HT154 opened this issue 2 months ago • 0 comments

open class A {
  function foo() = "a"
}

class B extends A {
  function foo() =
    let (bar = "b")
      super.foo() + bar
}

Result

–– Pkl Error ––
Cannot invoke a supermethod from here.

8 | super.foo() + bar
    ^^^^^^^^^^^
at test#B.foo.<function#1> (file://<dir>/test.pkl, line 8)

This works as expected:

class B extends A {
  function foo() =
    super.foo() + "b"
}

HT154 avatar Nov 06 '25 19:11 HT154