<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace"><br>
As it turns out, your first example is nonsensical: <br>
<br>
</font></font><br>
<blockquote type="cite">
<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></div></blockquote><div><br></div><div>Yeah, I don't know how I missed that, because I actually considered the same thing for `case Pair?(Pair? a, Pair? b)` and realized that it makes no sense ...</div><div><br></div><div>But then I assume if we had `Pair` declared as `record Pair<A, B>(A? a, B? b) {}`, then I could use this to not match a `Pair` instance with null fields:</div><div><br></div><div>```</div><div>switch (p) {<br> case Pair!(String! a, String! b): ...<br>}<br></div><div>```</div><div><br></div><div>And writing `String` would be inferred to be `String?` in this case.</div></div></div>