{'fraction_non_alphanumeric': 0.015402843601895734, 'fraction_numerical': 0.0, 'mean_word_length': 5.5, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Type-Safe Covariant Specialization with Generalized Matching

Matching is a relation between object types originally designed to support type-safe subclassing with binary methods. In this paper we generalize it to deal with general covariance by allowing field and method parameter types to change covariantly in matching types. In addition, object types may explicitly contain virtual types which can also change covariantly. The result is a significant increase in the flexibility of subclassing. The new definition is accompanied by appropriate machinery, allowing the loss of subsumption to be compensated by match-bounded parameterization and hash types. We define a language LGM supporting generalized matching, its typing rules, and its operational semantics and establish a subject reduction theorem showing the soundness of the system.