lean4-htt/tests/lean/run/nested_common_subexpr_issue.lean
Leonardo de Moura f36fca875c feag(frontends/lean): explicit delimiters in declaration parameters
Comment from parser.h

This commit makes sure that all declaration parameters must be surrounded with some kind of bracket. (e.g., '()', '{}', '[]').
The goal is to avoid counter-intuitive declarations such as:

              example p : false := trivial
              def main proof : false := trivial

which would be parsed as

              example (p : false) : _ := trivial

              def main (proof : false) : _ := trivial

where `_` in both cases is elaborated into `true`. This issue was raised by @gebner in the slack channel.

Remark: we still want implicit delimiters for lambda/pi expressions. That is, we want to write

               fun x : t, s
           or
               fun x, s

instead of

               fun (x : t), s
2017-09-15 10:07:09 -07:00

17 lines
336 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- set_option trace.compiler true
def fib_aux : ×
| 0 := (0, 1)
| (n+1) := let p := fib_aux n in (p.2, p.1 + p.2)
def fib (n) := (fib_aux n).2
#eval fib 10000
def fib_aux2 : ×
| 0 := (0, 1)
| (n+1) := let (a, b) := fib_aux2 n in (b, a + b)
def fib2 (n) := (fib_aux2 n).2
#eval fib2 10000