Issue 1:
Spread operator does not work when run with native promises in Chrome:

let args = [(Yeah, Nah) => Yeah()]
let promise = new Promise(...args)

Uncaught TypeError: [object Object] is not a promise

https://babeljs.io/repl/#?experimental=true&playground=false&evaluate=true&loose=false&spec=false&code=let%20args%20%3D%20%5B(Yeah%2C%20Nah)%20%3D%3E%20Yeah()%5D%0Alet%20promise%20%3D%20new%20Promise(...args)

Issue 2:
Bug Report

Current Behavior

Transpilation of the code fails with the following error.

TypeError: .../babel-duplicate-definition-error/index.js: Duplicate declaration "Foo"
3 | export default function wrap() {
4 | return function() {
> 5 | class Foo {
| ^
6 | @autobind
7 | method() {}
8 | }
at File.buildCodeFrameError (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/core/lib/transformation/file/file.js:259:12)
at Scope.checkBlockScopedCollisions (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/scope/index.js:347:22)
at Scope.registerBinding (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/scope/index.js:504:16)
at Scope.registerDeclaration (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/scope/index.js:444:14)
at Object.BlockScoped (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/scope/index.js:189:28)
at Object.newFn (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/visitors.js:230:17)
at NodePath._call (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/path/context.js:36:14)
at NodePath.visit (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/path/context.js:88:12)
at TraversalContext.visitQueue (/private/tmp/babel-duplicate-definition-error/node_modules/@babel/traverse/lib/context.js:118:16)

Input Code

Executable gist: https://gist.github.com/dantman/81ab0e3f823ce287d1bd8b2a65b4ad52

Must use @babel/preset-env with a target like node: 8

Must use @babel/plugin-proposal-decorators with legacy: true

import {autobind} from 'core-decorators';

export default function wrap() {
return function() {
class Foo {
@autobind
method() {}
}

return Foo;
};
}

Expected behavior/code

A clear and concise description of what you expected to happen (or code).

Babel Configuration (.babelrc, package.json, cli command)

{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": 8
}
}
]
],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": true}]
]
}

{
"scripts": {
"start": "babel index.js"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/preset-env": "^7.0.0"
},
"dependencies": {
"core-decorators": "^0.20.0"
}
}

npm install
npm start # babel index.js

Environment

Babel version(s): v7.0.0

Node/npm version: Tested and confirmed in Node 8/9/10 with npm 5.6.0

OS: OSX 10.12.16

Monorepo: no

How you are using Babel: cli and jest

Additional context

#8525 may be related, however I'm reporting it separately because this error happens with a different type of code and does not have "(This is an error on an internal node. Probably an internal error.)" in the error message.

If you make any of the following changes the error goes away:

Remove the @autobind decorator

Remove the export default

Remove the return function() {} so that wrap returns Foo directly.

Remove the node target from env (i.e. change the target so env does not emit a number of transforms)