lang: Prevent struct types with duplicate fields

Struct types with duplicate fields are invalid types and weren't caught
by the parser. This fixes the issue and adds some associated tests. It
also checks and tests for duplicate struct value field names.

As a technical side-note, this doesn't change the lang/types/ functions
to remove panics-- the signatures are simplified to make their use
simple, and we intentionally panic if they're used incorrectly. In this
case, one was being used without having previously validated the input.

Thanks to Patrick Meyer for finding this issue via fuzzing!
This commit is contained in:
James Shubin
2020-02-27 18:52:02 -05:00
parent 380d03257f
commit 70eecd5289
11 changed files with 75 additions and 8 deletions

View File

@@ -0,0 +1 @@
# err: err1: parser: `syntax error: unexpected $end, expecting EQUALS` @1:6