tomas-abrahamsson/gpb — pull request #11 by klajo (2014-03-13 11:56:04+00:00)
Title: Fail with an `expected_msg' error also for optional fields

Assume the following message definitions:

message m1 {
required m2 f1 = 1;
optional m2 f2 = 2;
}
message m2 {
required uint32 f1 = 1;
}
message m3 {
required uint32 f1 = 1;
}

gpb fails with this error when the required field f1 is assigned the
wrong message type:

{gpb_type_error, {{expected_msg,m2}, [{value,{m3,1}}, {path,'m1.f1'}]}}

The same did not apply to the optional field f2 however, where gpb
instead crashed. gpb now fails with a proper error also for optional
fields.