Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - fix(lean/elaborator.cpp): reject Sort and suggest Prop #732

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 5 additions & 1 deletion src/frontends/lean/elaborator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3513,7 +3513,11 @@ expr elaborator::visit(expr const & e, optional<expr> const & expected_type) {
} else if (is_emptyc_or_emptys(e)) {
return visit_emptyc_or_emptys(e, expected_type);
} else if (is_sort_wo_universe(e)) {
return visit(get_annotation_arg(e), expected_type);
auto& arg = get_annotation_arg(e);
if (sort_level(arg) == mk_level_zero())
report_or_throw(elaborator_exception(arg,
"invalid universe `Sort`, use `Sort 0` or `Prop` instead"));
return visit(arg, expected_type);
} else {
switch (e.kind()) {
case expr_kind::Var: lean_unreachable(); // LCOV_EXCL_LINE
Expand Down
3 changes: 3 additions & 0 deletions tests/lean/sort.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#check Sort
digama0 marked this conversation as resolved.
Show resolved Hide resolved
#check Sort 0
#check Prop
4 changes: 4 additions & 0 deletions tests/lean/sort.lean.expected.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sort.lean:1:7: error: invalid universe `Sort`, use `Sort 0` or `Prop` instead
Prop : Type
Prop : Type
Prop : Type