Skip to content

Instantly share code, notes, and snippets.

@DmytroMitin
Last active June 2, 2020 12:43
Show Gist options
  • Save DmytroMitin/257729dddd733527d4445903cd16047c to your computer and use it in GitHub Desktop.
Save DmytroMitin/257729dddd733527d4445903cd16047c to your computer and use it in GitHub Desktop.
Pattern matching in Dotty 0.24.0-RC1
// x match {
// case _: Box[Square] | _: Box[Circle] => ???
// }
[info] matchResult10[Nothing]:
[info] {
[info] case val x13: Object = App.x()
[info] matchAlts1[Unit]:
[info] {
[info] matchAlts2[Unit]:
[info] {
[info] if x13.isInstanceOf[App.App$Box] then
[info] return[matchAlts2] ()
[info] else ()
[info] if x13.isInstanceOf[App.App$Box] then
[info] return[matchAlts2] ()
[info] else ()
[info] return[matchAlts1] ()
[info] }
[info] ???()
[info] }
[info] throw new MatchError(x13)
[info] }
// x match {
// case _: (Box[Square] | Box[Circle]) => ???
// }
[info] matchResult10[Nothing]:
[info] {
[info] case val x13: Object = App.x()
[info] if
[info] x13.isInstanceOf[App.App$Box].||(
[info] x13.isInstanceOf[App.App$Box]
[info] )
[info] then
[info] {
[info] ???()
[info] }
[info] else ()
[info] throw new MatchError(x13)
[info] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment