Skip to content

Commit 422b7ca

Browse files
committed
---
yaml --- r: 991 b: refs/heads/master c: b79de6b h: refs/heads/master i: 989: 2375135 987: ef739f1 983: 11ca011 975: 1d4c498 959: 0db4a83 v: v3
1 parent 1d15940 commit 422b7ca

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 376b35e6186d68e431b32b6632bf52f5433ab4d7
2+
refs/heads/master: b79de6b76cbdcb8f2a8e44433d262c3389f28058

trunk/src/comp/middle/typeck.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,23 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
12231223
case (ast.expr_unary(?unop, ?oper, _)) {
12241224
auto oper_1 = check_expr(fcx, oper);
12251225
auto oper_t = expr_ty(oper_1);
1226-
// FIXME: Unops have a bit more subtlety than this.
1226+
alt (unop) {
1227+
case (ast.box) { oper_t = plain_ty(ty_box(oper_t)); }
1228+
case (ast.deref) {
1229+
alt (oper_t.struct) {
1230+
case (ty_box(?inner_t)) {
1231+
oper_t = inner_t;
1232+
}
1233+
case (_) {
1234+
fcx.ccx.sess.span_err
1235+
(expr.span,
1236+
"dereferencing non-box type: "
1237+
+ ty_to_str(oper_t));
1238+
}
1239+
}
1240+
}
1241+
case (_) { /* fall through */ }
1242+
}
12271243
ret @fold.respan[ast.expr_](expr.span,
12281244
ast.expr_unary(unop, oper_1,
12291245
ast.ann_type(oper_t)));

0 commit comments

Comments
 (0)