@@ -1461,6 +1461,12 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
1461
1461
auto t = fcx. ccx. item_types. get( vdef. _1) ;
1462
1462
auto len = _vec. len[ ast. ident] ( p. node. idents) ;
1463
1463
auto last_id = p. node. idents. ( len - 1 u) ;
1464
+
1465
+ auto ty_params = fcx. ccx. item_ty_params. get( vdef. _0) ;
1466
+ auto tag_ty = fcx. ccx. item_types. get( vdef. _0) ;
1467
+ auto tpt = tup( some( ty_params) , tag_ty) ;
1468
+ auto ann = instantiate_path( fcx, p, tpt, pat. span) ;
1469
+
1464
1470
alt ( t. struct ) {
1465
1471
// N-ary variants have function types.
1466
1472
case ( ty. ty_fn( _, ?args, ?tag_ty) ) {
@@ -1483,14 +1489,11 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
1483
1489
new_subpats += vec( check_pat( fcx, subpat) ) ;
1484
1490
}
1485
1491
1486
- auto ann = ast. ann_type( tag_ty, none[ vec[ @ty. t] ] ) ;
1487
1492
new_pat = ast. pat_tag( p, new_subpats, vdef_opt, ann) ;
1488
1493
}
1489
1494
1490
1495
// Nullary variants have tag types.
1491
1496
case ( ty. ty_tag( ?tid, _) ) {
1492
- // TODO: ty params
1493
-
1494
1497
auto subpats_len = _vec. len[ @ast. pat] ( subpats) ;
1495
1498
if ( subpats_len > 0 u) {
1496
1499
// TODO: pluralize properly
@@ -1504,9 +1507,6 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
1504
1507
fail; // TODO: recover
1505
1508
}
1506
1509
1507
- let vec[ @ty. t] tys = vec( ) ; // FIXME
1508
- auto ann = ast. ann_type( plain_ty( ty. ty_tag( tid, tys) ) ,
1509
- none[ vec[ @ty. t] ] ) ;
1510
1510
new_pat = ast. pat_tag( p, subpats, vdef_opt, ann) ;
1511
1511
}
1512
1512
}
0 commit comments