Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate function declarations in blocks should throw early error in sloppy mode #144

Closed
bterlson opened this issue Jan 19, 2016 · 4 comments

Comments

@bterlson
Copy link
Contributor

{
    function foo() { }
    function foo() { }
}

Expected: Early syntax error. Actual: no error, second function wins always near as I can tell.

Duplicate function names are allowed at top level but not in blocks. Spidermonkey came across web compat issues trying to implement this, so are going to go more slowly. V8 has it in Canary and will test out these semantics in their Beta channel. Hopefully if all goes well there we can fix this bug without worry.

@bterlson bterlson added the Bug label Jan 19, 2016
@ajklein
Copy link

ajklein commented Jan 22, 2016

We ran into another compat issue with foxnews.com (serving Akamai's media player): https://code.google.com/p/chromium/issues/detail?id=579395

@ianwjhalliday
Copy link
Collaborator

Thanks @ajklein. @bterlson sounds like we should leave ChakraCore as is and TC39 should amend the spec.

@bterlson
Copy link
Contributor Author

@ianwjhalliday Depends. I tend to think that not throwing an error here is bad for many reasons. If we are forced to support it due to web compat then we have no choice, but let's wait and see what data @syg's telemetry finds. Also perhaps Canary has telemetry enabled (@ajklein)? But I think it's safe to add ye olde pending TC39 consensus label :)

@bterlson
Copy link
Contributor Author

Consensus is we must allow duplicate func decls in blocks sloppy mode. tc39/ecma262#400 proposes a spec fix for this, but this issue can be closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants