v79
09/13/2018, 6:26 PMwhen
in my main code. This is just in a test class. I am just surprised the compiler was understanding that result
must be a Post
just because post
is from a cast. Especially is it is possible for my function to return a PostGeneration.Error
or a <http://PostGeneration.Post|PostGeneration.Post>
. I'm going to write a test case which should return a PostGeneration.Error
and see what happens...Pavlo Liapota
09/13/2018, 6:31 PMresult
is Post
then everything will work as expected
if result
is Error
then class cast exception will be thrown and no statements after cast will be executed
so compiler assumption is safePavlo Liapota
09/13/2018, 6:35 PMresult
is Post
just after assertTrue(isPost)
statement.v79
09/13/2018, 6:46 PM