New Issue: 'import Regex' breaks ability to write 'if myre.match(...)'

17633, "bradcray", "'import Regex' breaks ability to write 'if myre.match(...)'", "2021-05-04T18:44:03Z"

Summary of Problem

As a user who prefers import to use, compiling and running the following program:

import Regex;

var myre=Regex.compile("hello[0-9]");
if myre.match("hello0") then writeln("Yes!");

results in an error:

testit.chpl:4: error: type 'regexMatch' used in if or while condition

This is because, in the current compiler and language definition, support for using an arbitrary type in a conditional is implemented using a (not user-facing) standalone _cond_test() routine that is used in conditionals to convert types into booleans. The nature of this failure is that _cond_test(:regexMatch) is implemented in Regex and is not brought in by the import statement, breaking the conditional statement.

Resolving this issue may involve further design and discussion about how (and whether) users can permit arbitrary types to be used in conditional contexts; potentially converting _cond_test() to a user-facing feature. It feels related to recent discussions on implicit conversions and operator methods.