@@ -78,7 +78,7 @@ register_builtin_option autoLift : Bool := {
7878}
7979
8080/-- Coerces `expr` to `expectedType` using `CoeT`. -/
81- def coerceSimple ? (expr expectedType : Expr) : MetaM (LOption (Expr × List Name)) := do
81+ def coerceSimpleRecordingNames ? (expr expectedType : Expr) : MetaM (LOption (Expr × List Name)) := do
8282 let eType ← inferType expr
8383 let u ← getLevel eType
8484 let v ← getLevel expectedType
@@ -92,6 +92,13 @@ def coerceSimple? (expr expectedType : Expr) : MetaM (LOption (Expr × List Name
9292 | .undef => return .undef
9393 | .none => return .none
9494
95+ /-- Coerces `expr` to `expectedType` using `CoeT`. -/
96+ def coerceSimple? (expr expectedType : Expr) : MetaM (LOption Expr) := do
97+ match ← coerceSimpleRecordingNames? expr expectedType with
98+ | .some (result, _) => return .some result
99+ | .none => return .none
100+ | .undef => return .undef
101+
95102/-- Coerces `expr` to a function type. -/
96103def coerceToFunction? (expr : Expr) : MetaM (Option Expr) := do
97104 -- constructing expression manually because mkAppM wouldn't assign universe mvars
@@ -259,7 +266,7 @@ def coerceCollectingNames? (expr expectedType : Expr) : MetaM (LOption (Expr ×
259266 if let some fn ← coerceToFunction? expr then
260267 if ← isDefEq (← inferType fn) expectedType then
261268 return .some (fn, [])
262- coerceSimple ? expr expectedType
269+ coerceSimpleRecordingNames ? expr expectedType
263270
264271/--
265272Coerces `expr` to the type `expectedType`.
0 commit comments