# Making union types even more useful

**URL:** <https://contributors.scala-lang.org/t/making-union-types-even-more-useful/4927>\
**Category:** Language Design\
**Created:** [March 7, 2021, 5:24pm UTC](https://contributors.scala-lang.org/t/making-union-types-even-more-useful/4927 "2021-03-07T17:24:12Z")\
**Posts on this page:** 1\
**Showing post:** 53

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [March 10, 2021, 11:24pm UTC](https://contributors.scala-lang.org/t/making-union-types-even-more-useful/4927/53 "2021-03-10T23:24:46Z")

</div>

> [@megri](#):
>
> However, despite the compiler telling us that the Y branch is unchecked, it still infers the union for a “naked” match

This happens because exhaustivity checking is run at a later phase than typechecking. Trying to move some of the logic from exhaustivity checking into the typer to give more precise types to the default case branch would be an interesting thing to try but no on has attempted that experiment so far.

---

_[View the full topic](https://contributors.scala-lang.org/t/making-union-types-even-more-useful/4927)._
