fix(frontends/lean/scanner): fixes #626

This commit is contained in:
Leonardo de Moura 2015-05-26 11:33:38 -07:00
parent 7f0951b8e7
commit 25e41b9b09
5 changed files with 57 additions and 3 deletions

View file

@ -61,9 +61,12 @@ bool is_letter_like_unicode(unsigned u) {
}
bool is_super_sub_script_alnum_unicode(unsigned u) {
return
(0x2070 <= u && u <= 0x2079) ||
(0x207f <= u && u <= 0x2089) ||
(0x2090 <= u && u <= 0x209c);
(0x2070 <= u && u <= 0x2079) || // most (numeric) superscripts
(0x207f <= u && u <= 0x2089) || // n superscript and numberic subscripts
(0x2090 <= u && u <= 0x209c) || // letter-like subscripts
u == 0x00B2 || // 2 superscript
u == 0x00B3 || // 3 superscript
u == 0x00B9; // 1 superscript
}
void scanner::next() {

9
tests/lean/626a.lean Normal file
View file

@ -0,0 +1,9 @@
namespace foo
definition C¹ := nat
definition foo (c : C¹) := nat.rec_on c _ _
end foo
namespace boo
notation `C¹` := nat
definition foo (c : C¹) := nat.rec_on c _ _
end boo

View file

@ -0,0 +1,28 @@
626a.lean:3:29: error: don't know how to synthesize placeholder
c : C¹
⊢ nat → Type
626a.lean:3:42: error: don't know how to synthesize placeholder
c : C¹
⊢ ?M_1
626a.lean:3:44: error: don't know how to synthesize placeholder
c : C¹
⊢ Π (a : nat),
?M_1 → ?M_1
626a.lean:3:29: error: failed to add declaration 'foo.foo' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term
λ (c : C¹),
nat.rec_on c ?M_2 ?M_3
626a.lean:8:29: error: don't know how to synthesize placeholder
c : C¹
⊢ C¹ → Type
626a.lean:8:42: error: don't know how to synthesize placeholder
c : C¹
⊢ ?M_1
626a.lean:8:44: error: don't know how to synthesize placeholder
c : C¹
⊢ Π (a : C¹),
?M_1 → ?M_1
626a.lean:8:29: error: failed to add declaration 'boo.foo' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term
λ (c : C¹),
nat.rec_on c ?M_2 ?M_3

4
tests/lean/626b.hlean Normal file
View file

@ -0,0 +1,4 @@
import hit.circle
open circle
definition f (x : S¹) : bool := circle.rec_on x _ _

View file

@ -0,0 +1,10 @@
626b.hlean:4:48: error: don't know how to synthesize placeholder
x : S¹
⊢ bool
626b.hlean:4:50: error: don't know how to synthesize placeholder
x : S¹
⊢ eq.transport (λ (a : S¹), bool) loop ?M_1 = ?M_1
626b.hlean:4:32: error: failed to add declaration 'f' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term
λ (x : S¹),
circle.rec_on x ?M_1 ?M_2