Commit 8335d4e 1 parent 62c3e56 commit 8335d4e Copy full SHA for 8335d4e
File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -4,19 +4,21 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Sebastian Ullrich, Leonardo de Moura
5
5
-/
6
6
import Lean.Meta.Check
7
+ import Lean.Util.CollectLevelParams
7
8
8
9
namespace Lean.Meta
9
10
10
11
unsafe def evalExprCore (α) (value : Expr) (checkType : Expr → MetaM Unit) (safety := DefinitionSafety.safe) : MetaM α :=
11
12
withoutModifyingEnv do
12
13
let name ← mkFreshUserName `_tmp
13
14
let value ← instantiateMVars value
15
+ let us := collectLevelParams {} value |>.params
14
16
if value.hasMVar then
15
17
throwError "failed to evaluate expression, it contains metavariables{indentExpr value}"
16
18
let type ← inferType value
17
19
checkType type
18
20
let decl := Declaration.defnDecl {
19
- name, levelParams := [] , type
21
+ name, levelParams := us.toList , type
20
22
value, hints := ReducibilityHints.opaque,
21
23
safety
22
24
}
Original file line number Diff line number Diff line change
1
+ import Lean
2
+
3
+ open Lean
4
+
5
+ def foo. {u} : Nat := (ULift.up.{u} Nat.zero).down
6
+
7
+ universe u in
8
+ #eval foo.{u}
9
+
10
+ -- this used to produce an error
11
+ #eval do
12
+ let u : Lean.Level := .param `u
13
+ Meta.evalExpr Nat (.const ``Nat []) (.const ``foo [u])
You can’t perform that action at this time.
0 commit comments