<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">Where null-explicit type
patterns would help is when there are legitimate (human)
ambiguities about whether nulls are wanted here. In a world
where we have T!/T? type patterns, you can think of the pattern
`T t` as having _inferred nullity_; it is really either T! or
T?, and we determine which from context. Where we would want
explicit nullity is either when the inference chooses something
that you don't want, such as: <br>
<br>
These mostly come down to things like:<br>
<br>
Box<Number> b = ...<br>
<br>
switch (b) { <br>
case Box(Integer i) -> ...<br>
case Box(Float f) -> ...<br>
case Box(Number! n) -> ...<br>
}<br>
<br>
or where the inference feels "not obvious" and you want to be
explicit. <br>
<br>
As it turns out, your first example is nonsensical: <br>
<br>
</font></font><br>
<blockquote type="cite" cite="mid:CAKDaPBfLb10PWcJ0C5T=Yzch7v6vkR4enAT-6Gm3p2dCZ7qacA@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div>```</div>
<div>switch (p) {<br>
case Pair!(Pair?(A a, B b), Pair?(C c, D d)): ...<br>
}<br>
</div>
<div>```</div>
</div>
</div>
</blockquote>
<br>
Here, the nested pattern `Pair?(A a, B b)` makes no sense, because
it is a record pattern, and a record pattern *cannot* match null
(because it needs a non-null receiver on which to invoke the
accessors and/or deconstructor.) So even in a world with emotional
type patterns, this pattern would be rejected by the compiler as
illegal. <br>
<br>
<br>
</body>
</html>