Is there a generally accepted name for creating types that select a subset of other types?
First, the field-subset model of subtyping, while uncommon in OO languages, is common in PL theory for modelling subtyping. It's often called row subtyping.

I'm not sure if there's a general name for all the other things you've described, but I think the closest fit is refinement types, which come in many flavours.


Liquid types refine types by a boolean predicate, i.e. you can make a type which contains all values from another type satisfying a certain predicate. For example, you could have $\{ i : Int \mid 0 &lt; i &lt; 10 \}$ as a refinement of $Int$.
Datasort Refinements are similar to liquid types, but they constrain a type by the shape of its values. So, you can refine $(List\ Int)$ to  $ T = Cons(Int, Cons(Int, List))$, and $T$ is then the type of all $Int$-containing lists of length 2 or more.


More generally, Set-theoretic types  describe a system where can form types using intersection, union, and negation operations on existing types. Here, there is a close correspondence between subtyping and the subset-relationship between values in a type.

A general comment is that I think you need to be careful distinguishing terms from types. While you're describing sensible operations on types, the SQL example and the Prolog unification example are both operations on terms, and not on types, so they're really something different from what you're describing.

I don't think destructuring assingment has anything to do with the other things, it's just a shorthand for pattern-matching, either where there's only one case, or where we throw an error in all but one case.

Bonus Discussion

Why is this not common? Type-checking is performed often, and adding too many features makes it undecidable. The refinement-types I listed above depend on SMT-solvers for typechecking, since they require solving logical constraints.

Are there langauges that support these? The main ones I can think of are Liquid Haskell and Dependent ML. I'm not sure how often they show up in an object-oriented context, because these are areas under active research, and functional languages are generally faster to incorporate bleeding-edge ideas from PL research.