Correctly handle `[]` type in union for encoding

Fix the bug which manifests itself when encoding a record with a field of type `[type1] | type2`.
Before that `encode_gen` would generate warning "this clause cannot match because a previous clause at line 25 always matches" and would treat any value as `[type1]`.
No the list is handled using guard `is_list` so no ambiguity here.