Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Changes to the Lean backend:
- Add support for default methods of traits (#1777)
- Add support for pattern matching on constant literals (#1789)
- Add support for binding subpatterns in match constructs (#1790)
- Add error when using patterns in function parameters (#1792)

Miscellaneous:
- Reserve extraction folder for auto-generated files in Lean examples (#1754)
Expand Down
9 changes: 8 additions & 1 deletion rust-engine/src/backends/lean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,14 @@ set_option linter.unusedVariables false
}

fn param(&self, param: &Param) -> DocBuilder<A> {
self.pat_typed(&param.pat)
if matches!(
*param.pat.kind,
PatKind::Wild | PatKind::Ascription { .. } | PatKind::Binding { sub_pat: None, .. }
) {
self.pat_typed(&param.pat)
} else {
emit_error!(issue 1791, "Function parameters must not contain patterns")
}
}

fn item(&self, Item { ident, kind, meta }: &Item) -> DocBuilder<A> {
Expand Down
Loading