underscoreio/essential-scala

Compilation warning (4.2.2.1)

Closed this issue · 0 comments

4.2.2.1 Printing Shapes

Let’s revisit the Shapes example from the previous section.

I guess it refers to 4.1.4.3 Shaping Up 2 (Da Streets), because its last exercise with shapes, where we created Rectangular trait and extend Rectangle and Square classes from it.

So, if we add Draw object from 4.2.2.1 solution into code from 4.1.4.3 it will compile with warning:

Warning:(10, 37) match may not be exhaustive.
It would fail on the following input: Rectangular()
def apply(shape: Shape): String = shape match {