static bool check_type(compile_t* c, LLVMValueRef ptr, LLVMValueRef desc, ast_t* pattern_type, LLVMBasicBlockRef next_block) { switch(ast_id(pattern_type)) { case TK_NOMINAL: // We are trying to capture the match expression as a nominal. return check_nominal(c, desc, pattern_type, next_block); case TK_TUPLETYPE: // We are trying to capture the match expression as a tuple. return check_tuple(c, ptr, desc, pattern_type, next_block); case TK_UNIONTYPE: // We are trying to capture the match expression as a union. return check_union(c, ptr, desc, pattern_type, next_block); case TK_ISECTTYPE: // We are trying to capture the match expression as an intersection. return check_isect(c, ptr, desc, pattern_type, next_block); case TK_ARROW: // We are trying to capture the match expression as a viewpoint type, so // try again with the right-hand side of the arrow. return check_type(c, ptr, desc, ast_childidx(pattern_type, 1), next_block); default: {} } assert(0); return false; }
mt_iterator(list *_erased,sc_iterator *hi) { SC_ABORT(); host_i = hi; erased = _erased; if (check_tuple()) next(); }
sc_retval next() { sc_retval rv; do { if (host_i->is_over()) return host_i->next(); rv = host_i->next(); } while (check_tuple()); return rv; }
bool check_tuple(Tuple tuple) { return check_tuple(tuple.row,tuple.col); }
TEST(tagged_tuple, tuple) { check_tuple(); check_tuple<Y>("hello"); check_tuple<Z, X>('=', "world"); check_tuple<X, Y, Z>(5.6, 10, true); }