zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Misleading error message when using parametrized types in a wrong way.

Open MisterGC opened this issue 3 years ago • 1 comments

zserio reports: ERROR] myschema.zs:6:5: Parameterized type instantiation 'StructWithParam' has wrong number of arguments! Expecting 1, got 2!

when using the following schema:

package myschema;                                
                                                 
struct Test                                      
{                                                
    StructWithParams(10) value;                   
};                                               
                                                 
struct StructWithParams(int32 first, int32 second)
{                                                
};     

zserio should report it the other way around as StructWithParams defines how many parameters (=2) are expected.

Further improvements for the error message:

  • show exact signature StructWithParam(int32, int32) in the error message
  • report if there are too few / too many parameters

MisterGC avatar Oct 14 '22 15:10 MisterGC

Thanks for that, we will fix it in current milestone.

mikir avatar Oct 18 '22 06:10 mikir