Method supercall doesn't work inside let expression #362

Open
opened 2025-12-30 01:23:50 +01:00 by adam · 0 comments
Owner

Originally created by @HT154 on GitHub (Nov 6, 2025).

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"
}
Originally created by @HT154 on GitHub (Nov 6, 2025). ```pkl 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: ```pkl class B extends A { function foo() = super.foo() + "b" } ```
adam added the bug label 2025-12-30 01:23:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#362