From 5d67fac7966b6f05611d014420eb4971b8016c31 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 11 Feb 2016 16:13:10 -0800 Subject: 2646 - redo static dispatch algorithm The old approach of ad hoc boosts and penalties based on various features was repeatedly running into exceptions and bugs. New organization: multiple tiered scores interleaved with tie-breaks. The moment one tier yields one or more candidates, we stop scanning further tiers. Just break ties and return. --- 021check_instruction.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to '021check_instruction.cc') diff --git a/021check_instruction.cc b/021check_instruction.cc index de5d8394..cf0a8d74 100644 --- a/021check_instruction.cc +++ b/021check_instruction.cc @@ -117,6 +117,15 @@ bool types_match(const reagent& to, const reagent& from) { return types_strictly_match(to, from); } +bool types_strictly_match_except_literal_against_boolean(const reagent& to, const reagent& from) { + // to sidestep type-checking, use /unsafe in the source. + // this will be highlighted in red inside vim. just for setting up some tests. + if (is_literal(from) + && to.type && to.type->value == get(Type_ordinal, "boolean")) + return boolean_matches_literal(to, from); + return types_strictly_match(to, from); +} + bool boolean_matches_literal(const reagent& to, const reagent& from) { if (!is_literal(from)) return false; if (!to.type) return false; -- cgit 1.4.1-2-gfad0