Compiler should check for duplicates in record's property name
Closed this issue · 3 comments
psyCodelist commented
In elm 18, you can create a record like this:
type alias State =
{ title : String
, forms : Forms.State
, forms : Forms.State
}this will work on all modern browsers except IE 11 and below. It will generate the following Javascript run time error:
"Multiple Definitions of a Property Not Allowed in Strict Mode".
process-bot commented
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
decioferreira commented
Just for reference, running the generated Javascript in this situation on "PhantomJS 2.1.1" will output: SyntaxError: Unexpected token ','
evancz commented
In my development build, I get the following error:
-- NAME CLASH --------------------------------------------------------- temp.elm
This record has multiple `forms` fields. One here:
6| , forms : Forms.State
^^^^^
And another one here:
7| , forms : Forms.State
^^^^^
How can I know which one you want? Rename one of them!
So it should be fixed in the next release. Thank you for the report!