Skip to content

Commit e4b0f0f

Browse files
committed
---
yaml --- r: 2839 b: refs/heads/master c: c7e3f88 h: refs/heads/master i: 2837: ea47f06 2835: c067d50 2831: 547f67a v: v3
1 parent e3e451c commit e4b0f0f

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
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: 973b93ee2a58f80b9f1f0e1fd707348c75c0137f
2+
refs/heads/master: c7e3f88c93883ecbb27dcdfb7d8ec6e263b126b0

trunk/src/comp/middle/typeck.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,10 +1171,20 @@ mod pushdown {
11711171
let ty_param_substs_and_ty res_t = demand::full(scx, pat.span,
11721172
expected, tt, tps, NO_AUTODEREF);
11731173

1174-
// TODO: push down type from "expected".
1175-
write::ty_fixup(scx, ann.id,
1176-
ty::ann_to_ty_param_substs_opt_and_ty
1177-
(scx.fcx.ccx.tcx.node_types, ann));
1174+
auto ty_params_subst = ty::ann_to_ty_param_substs_opt_and_ty
1175+
(scx.fcx.ccx.tcx.node_types, ann);
1176+
1177+
auto ty_params_opt;
1178+
alt (ty_params_subst._0) {
1179+
case (none[vec[ty::t]]) {
1180+
ty_params_opt = none[vec[ty::t]];
1181+
}
1182+
case (some[vec[ty::t]](?tps)) {
1183+
ty_params_opt = some[vec[ty::t]](tag_tps);
1184+
}
1185+
}
1186+
1187+
write::ty_fixup(scx, ann.id, tup(ty_params_opt, tt));
11781188
}
11791189
}
11801190
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// xfail-stage0
2+
3+
tag maybe[T] {
4+
nothing;
5+
just(T);
6+
}
7+
8+
fn foo(maybe[int] x) {
9+
alt (x) {
10+
case (nothing) {log_err "A";}
11+
case (just(?a)) {log_err "B";}
12+
}
13+
}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)