Skip to content

Conversation

@marcgrr
Copy link
Contributor

@marcgrr marcgrr commented Mar 31, 2017

Similar to #46.

I had a courier record Foo { bar: Bar? } and I used it to write a bug:

foo match {
  case Foo(Some(bar)) => doStuff(bar)
}

The bug is that the match is not exhaustive. The scala exhaustivity checker would have caught this if Foo's generated unapply method had return type Some[Foo] instead of Option[Foo].

Unfortunately, the unapply method in the RecordClass.scala.txt template has some ways of returning None, which I had to remove in order to make this work.

I don't really understand why the catching that used to be there is necessary. Surely when you have an instance of a record, returning all of its fields should always succeed? If that's true, then the catching is not necessary.

(sorry I accidentally closed #54 and I don't know how to reopen it, so this is just a duplicate of #54)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants