@@ -162,10 +162,11 @@ export kind_is_durable;
162162export meta_kind, kind_lteq, type_kind, type_kind_ext;
163163export operators;
164164export type_err, terr_vstore_kind;
165- export terr_mismatch, terr_onceness_mismatch;
165+ export terr_integer_as_char , terr_mismatch, terr_onceness_mismatch;
166166export type_err_to_str, note_and_explain_type_err;
167167export expected_found;
168168export type_needs_drop;
169+ export type_is_char;
169170export type_is_empty;
170171export type_is_integral;
171172export type_is_numeric;
@@ -714,6 +715,7 @@ enum type_err {
714715 terr_in_field( @type_err , ast:: ident ) ,
715716 terr_sorts( expected_found < t > ) ,
716717 terr_self_substs,
718+ terr_integer_as_char,
717719 terr_no_integral_type,
718720 terr_no_floating_point_type,
719721}
@@ -2541,6 +2543,13 @@ fn type_is_integral(ty: t) -> bool {
25412543 }
25422544}
25432545
2546+ fn type_is_char(ty: t) -> bool {
2547+ match get(ty).sty {
2548+ ty_int(ty_char) => true,
2549+ _ => false
2550+ }
2551+ }
2552+
25442553fn type_is_fp(ty: t) -> bool {
25452554 match get(ty).sty {
25462555 ty_infer(FloatVar(_)) | ty_float(_) => true,
@@ -3510,6 +3519,10 @@ fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
35103519 ~"couldn' t determine an appropriate integral type for integer \
35113520 literal"
35123521 }
3522+ terr_integer_as_char => {
3523+ ~"integer literals can' t be inferred to char type \
3524+ ( try an explicit cast) "
3525+ }
35133526 terr_no_floating_point_type => {
35143527 ~"couldn' t determine an appropriate floating point type for \
35153528 floating point literal"
0 commit comments