Skip to content

Commit c07d9ab

Browse files
committed
---
yaml --- r: 1373 b: refs/heads/master c: c9956a6 h: refs/heads/master i: 1371: 2fcc84c v: v3
1 parent bc883f7 commit c07d9ab

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: f951b52e91c5c0487ad4d3a5454b193f15146d6a
2+
refs/heads/master: c9956a65b49f9cf2b1a691f2b88d61ada753d271

trunk/src/comp/middle/ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ fn block_ty(&ast.block b) -> @t {
656656
fn pat_ty(@ast.pat pat) -> @t {
657657
alt (pat.node) {
658658
case (ast.pat_wild(?ann)) { ret ann_to_type(ann); }
659+
case (ast.pat_lit(_, ?ann)) { ret ann_to_type(ann); }
659660
case (ast.pat_bind(_, _, ?ann)) { ret ann_to_type(ann); }
660661
case (ast.pat_tag(_, _, _, ?ann)) { ret ann_to_type(ann); }
661662
}

trunk/src/comp/middle/typeck.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,10 @@ fn demand_pat(&@fn_ctxt fcx, @ty.t expected, @ast.pat pat) -> @ast.pat {
807807
auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
808808
p_1 = ast.pat_wild(ast.ann_type(t));
809809
}
810+
case (ast.pat_lit(?lit, ?ann)) {
811+
auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
812+
p_1 = ast.pat_lit(lit, ast.ann_type(t));
813+
}
810814
case (ast.pat_bind(?id, ?did, ?ann)) {
811815
auto t = demand(fcx, pat.span, expected, ann_to_type(ann));
812816
fcx.locals.insert(did, t);
@@ -1093,6 +1097,9 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
10931097
case (ast.pat_wild(_)) {
10941098
new_pat = ast.pat_wild(ast.ann_type(next_ty_var(fcx.ccx)));
10951099
}
1100+
case (ast.pat_lit(?lt, _)) {
1101+
new_pat = ast.pat_lit(lt, ast.ann_type(check_lit(lt)));
1102+
}
10961103
case (ast.pat_bind(?id, ?def_id, _)) {
10971104
auto ann = ast.ann_type(next_ty_var(fcx.ccx));
10981105
new_pat = ast.pat_bind(id, def_id, ann);

0 commit comments

Comments
 (0)