mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #10239 from Microsoft/fix10193
Fix 10193: Compiler crash with decorator and two "export default"s
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/compiler/a.js(3,16): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (3 errors) ====
|
||||
export default class a {
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
}
|
||||
export default var a = 10;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -1,16 +1,13 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2323: Cannot redeclare exported variable 'default'.
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/es6/modules/m1.ts(11,1): error TS2323: Cannot redeclare exported variable 'default'.
|
||||
tests/cases/conformance/es6/modules/m1.ts(11,1): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof foo' is not callable. Did you mean to include 'new'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (4 errors) ====
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ====
|
||||
|
||||
export default class foo {
|
||||
~~~
|
||||
!!! error TS2323: Cannot redeclare exported variable 'default'.
|
||||
~~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
}
|
||||
@@ -24,7 +21,7 @@ tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typ
|
||||
var x = 10;
|
||||
export default x;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2323: Cannot redeclare exported variable 'default'.
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ====
|
||||
import Entity from "./m1"
|
||||
|
||||
19
tests/baselines/reference/multipleExportDefault1.errors.txt
Normal file
19
tests/baselines/reference/multipleExportDefault1.errors.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/externalModules/multipleExportDefault1.ts(1,25): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/externalModules/multipleExportDefault1.ts(5,1): error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/multipleExportDefault1.ts (2 errors) ====
|
||||
export default function Foo (){
|
||||
~~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
~~~~~~~~~~~~~~~~
|
||||
uhoh: "another default",
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
};
|
||||
~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
20
tests/baselines/reference/multipleExportDefault1.js
Normal file
20
tests/baselines/reference/multipleExportDefault1.js
Normal file
@@ -0,0 +1,20 @@
|
||||
//// [multipleExportDefault1.ts]
|
||||
export default function Foo (){
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
|
||||
|
||||
//// [multipleExportDefault1.js]
|
||||
"use strict";
|
||||
function Foo() {
|
||||
}
|
||||
exports.__esModule = true;
|
||||
exports["default"] = Foo;
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
uhoh: "another default"
|
||||
};
|
||||
18
tests/baselines/reference/multipleExportDefault2.errors.txt
Normal file
18
tests/baselines/reference/multipleExportDefault2.errors.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
tests/cases/conformance/externalModules/multipleExportDefault2.ts(1,1): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/externalModules/multipleExportDefault2.ts(5,25): error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/multipleExportDefault2.ts (2 errors) ====
|
||||
export default {
|
||||
~~~~~~~~~~~~~~~~
|
||||
uhoh: "another default",
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
};
|
||||
~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
export default function Foo() { }
|
||||
~~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
18
tests/baselines/reference/multipleExportDefault2.js
Normal file
18
tests/baselines/reference/multipleExportDefault2.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//// [multipleExportDefault2.ts]
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
|
||||
export default function Foo() { }
|
||||
|
||||
|
||||
|
||||
//// [multipleExportDefault2.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
uhoh: "another default"
|
||||
};
|
||||
function Foo() { }
|
||||
exports.__esModule = true;
|
||||
exports["default"] = Foo;
|
||||
18
tests/baselines/reference/multipleExportDefault3.errors.txt
Normal file
18
tests/baselines/reference/multipleExportDefault3.errors.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
tests/cases/conformance/externalModules/multipleExportDefault3.ts(1,1): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/externalModules/multipleExportDefault3.ts(5,22): error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/multipleExportDefault3.ts (2 errors) ====
|
||||
export default {
|
||||
~~~~~~~~~~~~~~~~
|
||||
uhoh: "another default",
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
};
|
||||
~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
export default class C { }
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
22
tests/baselines/reference/multipleExportDefault3.js
Normal file
22
tests/baselines/reference/multipleExportDefault3.js
Normal file
@@ -0,0 +1,22 @@
|
||||
//// [multipleExportDefault3.ts]
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
|
||||
export default class C { }
|
||||
|
||||
|
||||
|
||||
//// [multipleExportDefault3.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
uhoh: "another default"
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
exports.__esModule = true;
|
||||
exports["default"] = C;
|
||||
16
tests/baselines/reference/multipleExportDefault4.errors.txt
Normal file
16
tests/baselines/reference/multipleExportDefault4.errors.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/externalModules/multipleExportDefault4.ts(1,22): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/externalModules/multipleExportDefault4.ts(3,1): error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/multipleExportDefault4.ts (2 errors) ====
|
||||
export default class C { }
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
export default {
|
||||
~~~~~~~~~~~~~~~~
|
||||
uhoh: "another default",
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
};
|
||||
~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
20
tests/baselines/reference/multipleExportDefault4.js
Normal file
20
tests/baselines/reference/multipleExportDefault4.js
Normal file
@@ -0,0 +1,20 @@
|
||||
//// [multipleExportDefault4.ts]
|
||||
export default class C { }
|
||||
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
|
||||
//// [multipleExportDefault4.js]
|
||||
"use strict";
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
exports.__esModule = true;
|
||||
exports["default"] = C;
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
uhoh: "another default"
|
||||
};
|
||||
11
tests/baselines/reference/multipleExportDefault5.errors.txt
Normal file
11
tests/baselines/reference/multipleExportDefault5.errors.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/externalModules/multipleExportDefault5.ts(1,25): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/externalModules/multipleExportDefault5.ts(2,22): error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/multipleExportDefault5.ts (2 errors) ====
|
||||
export default function bar() { }
|
||||
~~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
export default class C {}
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
16
tests/baselines/reference/multipleExportDefault5.js
Normal file
16
tests/baselines/reference/multipleExportDefault5.js
Normal file
@@ -0,0 +1,16 @@
|
||||
//// [multipleExportDefault5.ts]
|
||||
export default function bar() { }
|
||||
export default class C {}
|
||||
|
||||
//// [multipleExportDefault5.js]
|
||||
"use strict";
|
||||
function bar() { }
|
||||
exports.__esModule = true;
|
||||
exports["default"] = bar;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
exports.__esModule = true;
|
||||
exports["default"] = C;
|
||||
20
tests/baselines/reference/multipleExportDefault6.errors.txt
Normal file
20
tests/baselines/reference/multipleExportDefault6.errors.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/externalModules/multipleExportDefault6.ts(1,1): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/conformance/externalModules/multipleExportDefault6.ts(5,1): error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/multipleExportDefault6.ts (2 errors) ====
|
||||
export default {
|
||||
~~~~~~~~~~~~~~~~
|
||||
lol: 1
|
||||
~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
|
||||
export default {
|
||||
~~~~~~~~~~~~~~~~
|
||||
lol: 2
|
||||
~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
19
tests/baselines/reference/multipleExportDefault6.js
Normal file
19
tests/baselines/reference/multipleExportDefault6.js
Normal file
@@ -0,0 +1,19 @@
|
||||
//// [multipleExportDefault6.ts]
|
||||
export default {
|
||||
lol: 1
|
||||
}
|
||||
|
||||
export default {
|
||||
lol: 2
|
||||
}
|
||||
|
||||
//// [multipleExportDefault6.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
lol: 1
|
||||
};
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
lol: 2
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
export default function Foo (){
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
|
||||
export default function Foo() { }
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
|
||||
export default class C { }
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export default class C { }
|
||||
|
||||
export default {
|
||||
uhoh: "another default",
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
export default function bar() { }
|
||||
export default class C {}
|
||||
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
lol: 1
|
||||
}
|
||||
|
||||
export default {
|
||||
lol: 2
|
||||
}
|
||||
Reference in New Issue
Block a user