lean4-htt/tests/elab/lcnf_export_borrow_error.lean
Henrik Böving e2120d85c0
feat: throw an error when export declarations have borrow annotations (#13017)
This PR ensures that when a declaration is marked with `@[export]`, the
compiler throws an error if
any of its arguments are marked as borrowed.
2026-03-20 23:22:52 +00:00

12 lines
490 B
Text

module
/-! Assert that putting a borrow annotation on an export errors -/
/--
error: Declaration bar is marked as `export` but some of its parameters have borrow annotations.
Consider using `set_option compiler.ignoreBorrowAnnotation true in` to supress the borrow annotations in its type.
If the declaration is part of an `export`/`extern` pair make sure to also supress the annotations at the `extern` declaration.
-/
#guard_msgs in
@[export foo]
public def bar (x : @& String) := x