Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions KLR/Trace/NKI.lean
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ partial def fnCall
let args <- bindArgs f (ref :: args) kwargs
callFn f args
| _ => throw s!"{func} is not a method of {cls}"
| .ref name (.object cls) => do
match <- lookup? (.str cls "__call__") with
| some (.source f) =>
let ref := Term.ref name (.object cls)
let args <- bindArgs f (ref :: args) kwargs
callFn f args
| _ => throw s!"class {cls} is not callable (no __call__ method)"
| t => throw s!"'{Term.kindStr t}' is not a callable type"

-- Statements
Expand Down
Loading