You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
let/ else pattern matching does not substitute in expected type #3065
This impacts leanprover-community/quote4, which transpiles to this type of let statement.
Steps to Reproduce
The following does not work:
example (n : Nat) (i : Fin n) : Option (Fin 3) := dolet3 := n | failure
return i -- fails, pattern match did not substitute in hypothesisexample (n : Nat) (i : Fin 3) : Option (Fin n) := dolet3 := n | failure
return i -- fails, pattern match did not substitute in goal
but the corresponding match does:
example (n : Nat) (i : Fin n) : Option (Fin 3) := domatch n with
| 3 => return i -- ok
| _ => failure
example (n : Nat) (i : Fin 3) : Option (Fin n) := domatch n with
| 3 => return i -- ok
| _ => failure
as does if let
example (n : Nat) (i : Fin n) : Option (Fin 3) := doiflet3 := n then
return i
else
failure
example (n : Nat) (i : Fin 3) : Option (Fin n) := doiflet3 := n then
return i
else
failure
Expected behavior: All three examples should behave identically
Actual behavior: The first one does not type-check
Activity
fix: allow generalization in let (#3060)