diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-11-10 01:16:02 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-11-10 01:16:02 -0800 |
commit | 1193171f64f6b65d3ec714aa2d1d22b4e1d05832 (patch) | |
tree | c74d397d4c1ab3be995dfc121e7fd14f39481daf /021check_instruction.cc | |
parent | e5e3640cfbfb7621c80c30a3f25eeae34c272322 (diff) | |
download | mu-1193171f64f6b65d3ec714aa2d1d22b4e1d05832.tar.gz |
4120
Support explicit conversions from number to character.
Diffstat (limited to '021check_instruction.cc')
-rw-r--r-- | 021check_instruction.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc index a32c6178..4cf74a0f 100644 --- a/021check_instruction.cc +++ b/021check_instruction.cc @@ -87,6 +87,13 @@ def main [ ] +error: main: can't copy '1:address:num' to '2:char'; types don't match +:(scenario write_number_to_character_allowed) +def main [ + 1:num <- copy 97 + 2:char <- copy 1:num +] +$error: 0 + :(scenario write_boolean_to_number_allowed) def main [ 1:bool <- copy 1/true @@ -109,6 +116,7 @@ bool types_coercible(const reagent& to, const reagent& from) { if (types_match(to, from)) return true; if (is_mu_address(from) && is_real_mu_number(to)) return true; if (is_mu_boolean(from) && is_real_mu_number(to)) return true; + if (is_real_mu_number(from) && is_mu_character(to)) return true; // End types_coercible Special-cases return false; } |