diff options
| author | Patrick Walton <[email protected]> | 2010-10-21 11:31:04 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-10-21 11:31:04 -0700 |
| commit | 194f38fdff2b2067413b6eabf3d6da57fbba2dc1 (patch) | |
| tree | eb27acb9f91d526f4e4a6a3097a56c778dd94004 /src/boot/fe | |
| parent | Use "friendly" type names when reporting a "mismatched type-params" error (diff) | |
| download | rust-194f38fdff2b2067413b6eabf3d6da57fbba2dc1.tar.xz rust-194f38fdff2b2067413b6eabf3d6da57fbba2dc1.zip | |
rustboot: Don't use ridiculous type names when describing simple types like int and uint
Diffstat (limited to 'src/boot/fe')
| -rw-r--r-- | src/boot/fe/ast.ml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml index 78b3ac51..f81f614f 100644 --- a/src/boot/fe/ast.ml +++ b/src/boot/fe/ast.ml @@ -516,6 +516,17 @@ let sane_name (n:name) : bool = | NAME_ext (prefix, _) -> sane_prefix prefix ;; +(* Error messages always refer to simple types structurally, not by their + * user-defined names. *) +let rec ty_is_simple (ty:ty) : bool = + match ty with + TY_any | TY_nil | TY_bool | TY_mach _ | TY_int | TY_uint | TY_char + | TY_str | TY_task | TY_type -> true + | TY_vec ty | TY_chan ty | TY_port ty -> ty_is_simple ty + | TY_tup tys -> List.for_all ty_is_simple (Array.to_list tys) + | _ -> false +;; + (* * We have multiple subset-categories of expression: * |