From 1193171f64f6b65d3ec714aa2d1d22b4e1d05832 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 10 Nov 2017 01:16:02 -0800 Subject: 4120 Support explicit conversions from number to character. --- 021check_instruction.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to '021check_instruction.cc') 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; } -- cgit 1.4.1-2-gfad0