Skip to content

Commit

Permalink
Update test refs
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Aug 24, 2023
1 parent 97feb0e commit dce3670
Show file tree
Hide file tree
Showing 1,486 changed files with 5,132 additions and 998 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
//// [class.d.ts]
//// [test.ts]
A.Point.Origin, new A.Point(0, 0);
// unexpected error here, bug 840000
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
};
//// [test.ts]
A.Point.Origin, new A.Point(0, 0);
// unexpected error here, bug 840000
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts]
// all expected to be errors
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var clodule1 = function clodule1() {
_class_call_check(this, clodule1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var A, Point, A1, Point1 = function() {
function Point(x, y) {
_class_call_check(this, Point), this.x = x, this.y = y;
}
return Point.Origin = function() {
return Point.Origin // unexpected error here bug 840246
= function() {
return {
x: 0,
y: 0
Expand All @@ -13,16 +14,19 @@ var A, Point, A1, Point1 = function() {
}();
(Point1 || (Point1 = {})).Origin = function() {
return null;
}, A = A1 || (A1 = {}), Point = function() {
} //expected duplicate identifier error
, A = A1 || (A1 = {}), Point = function() {
function Point(x, y) {
_class_call_check(this, Point), this.x = x, this.y = y;
}
return Point.Origin = function() {
return Point.Origin // unexpected error here bug 840246
= function() {
return {
x: 0,
y: 0
};
}, Point;
}(), A.Point = Point, (Point = A.Point || (A.Point = {})).Origin = function() {
return "";
};
} //expected duplicate identifier error
;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var X, X1, Y, Point;
(Point = (Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0);
//// [test.ts]
//var cl: { x: number; y: number; }
new X.Y.Point(1, 1), X.Y.Point.Origin;
// error not expected here same as bug 83996 ?
//// [simple.ts]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var A = function A() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ var X, X1, Y;
let Point;
(Point = (Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0);
//// [test.ts]
//var cl: { x: number; y: number; }
new X.Y.Point(1, 1), X.Y.Point.Origin;
// error not expected here same as bug 83996 ?
//// [simple.ts]
class A {
}
Expand Down
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/ES5For-of37.2.minified.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [ES5For-of37.ts]
// https://github.com/microsoft/TypeScript/issues/30083
for(var _i = 0, _iter = [
0,
1,
Expand All @@ -8,6 +9,7 @@ for(var _i = 0, _iter = [
]; _i < _iter.length; _i++){
var i = _iter[_i];
try {
// Ensure catch binding for the following loop is reset per iteration:
for(var _i1 = 0, _iter1 = [
1,
2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [ES5For-ofTypeCheck10.ts]
// In ES3/5, you cannot for...of over an arbitrary iterable.
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var StringIterator = function() {
function StringIterator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ M1 = M || (M = {}), C = function() {
_class_call_check(this, C);
}
return C.prototype[_$Symbol.iterator] = function() {}, C;
}(), M1.C = C, (new C)[_$Symbol.iterator], (new M.C)[Symbol.iterator];
}(), M1.C = C, /*#__PURE__*/ (new C)[_$Symbol.iterator], (new M.C)[Symbol.iterator];
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
_class_call_check(this, C);
}
return C.prototype[Symbol.iterator] = function() {}, C;
}()))[Symbol.iterator](0);
}()))[Symbol.iterator](0) // Should error
;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var A, A1;
};
//// [test.ts]
A.Point, A.Point(), A.Point.Origin;
// not expected to be an error.
//// [simple.ts]
var B, B1, Point;
Point = function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
//// [InvalidNonInstantiatedModule.ts]
M;
M; // Error, not instantiated can not be used as var
// Error only a namespace
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
//// [simple.ts]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(A || (A = {})).Instance = new A();
// duplicate identifier
var A = function A() {
_class_call_check(this, A);
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
_class_call_check(this, Plane), this.tl = tl, this.br = br;
};
//// [part3.ts]
// test the merging actually worked
var o = A.Origin, o = A.Utils.mirror(o);
new A.Utils.Plane(o, {
x: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
_class_call_check(this, Plane), this.tl = tl, this.br = br;
};
//// [part3.ts]
// test the merging actually worked
var o = A.Origin, o = A.Utils.mirror(o);
new A.Utils.Plane(o, {
x: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//// [accessorsAreNotContextuallyTyped.ts]
// accessors are not contextually typed
var c;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _create_class } from "@swc/helpers/_/_create_class";
c.x("");
c.x(""); // string
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ const obj = new class extends Base {
set x(value) {
console.log(`x was set to ${value}`);
}
}();
console.log(obj.x);
}(); // nothing printed
console.log(obj.x); // number
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//// [accessorsOverrideProperty9.ts]
// #41347, based on microsoft/rushstack
// Mixin utilities
// Base class
class ApiItem {
get members() {
return [];
Expand All @@ -14,7 +17,9 @@ function ApiItemContainerMixin(baseClass) {
}
};
}
// Subclass inheriting from mixin
export class ApiEnum extends ApiItemContainerMixin(ApiItem) {
// This worked prior to TypeScript 4.0:
get members() {
return [];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [additionOperatorWithConstrainedTypeParameter.ts]
// test for #17069
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [additionOperatorWithNullValueAndInvalidOperator.ts]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//// [additionOperatorWithNullValueAndValidOperator.ts]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
var E, E1;
(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", E.a, E.a, E.a, E.a;
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [additionOperatorWithOnlyNullValueOrUndefinedValue.ts]
// bug 819721
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//// [additionOperatorWithTypeParameter.ts]
// type parameter type is not a valid operand of addition operator
var E, E1;
(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b";
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [additionOperatorWithUndefinedValueAndInvalidOperands.ts]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//// [additionOperatorWithUndefinedValueAndValidOperator.ts]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
var E, E1;
(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", E.a, E.a, E.a, E.a;
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [ambientAccessors.ts]
// ok to use accessors in ambient class in ES3
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//// [ambientDeclarations.ts]
var E1, E2, E3, E11, E21, E31;
// Ambient variable without type annotation
var // Ambient enum
E1, // Ambient enum with integer literal initializer
E2, // Ambient enum members are always exported with or without export keyword
E3, E11, E21, E31;
(E11 = E1 || (E1 = {}))[E11.x = 0] = "x", E11[E11.y = 1] = "y", E11[E11.z = 2] = "z", (E21 = E2 || (E2 = {}))[E21.q = 0] = "q", E21[E21.a = 1] = "a", E21[E21.b = 2] = "b", E21[E21.c = 2] = "c", E21[E21.d = 3] = "d", (E31 = E3 || (E3 = {}))[E31.A = 0] = "A", E3.B, M1.x, M1.fn();
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//// [ambientDeclarationsExternal.ts]
//// [decls.ts]
// Ambient external module with export assignment
// Ambient external import declaration referencing ambient external module using top level module name
//// [consumer.ts]
//!
//! x Import assignment cannot be used when targeting ECMAScript modules. Consider using `import * as ns from "mod"`, `import {a} from "mod"`, `import d from "mod"`, or another module format instead.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//// [declarations.d.ts]
//// [user.ts]
///<reference path="declarations.d.ts" />
import { foo, baz } from "foobarbaz";
foo(baz);
import { foos } from "foosball";
foo(foos);
// Works with relative file name
import fileText from "./file!text";
foo(fileText);
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
export { };
//// [testB.ts]
export { };
// Error
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [types.ts]
//// [test.ts]
ohno.a;
ohno.a // oh no
;
export { };
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//// [ambientEnumDeclaration1.ts]
// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions.
var E, E1;
(E1 = E || (E = {}))[E1.a = 10] = "a", E1[E1.b = 11] = "b", E1[E1.c = 11] = "c", E1[E1.d = 12] = "d", E1[E1.e = 655360] = "e";
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//// [ambientEnumDeclaration2.ts]
// In ambient enum declarations that specify no const modifier, enum member declarations
// that omit a value are considered computed members (as opposed to having auto- incremented values assigned).
var E, E1, E2, E11;
(E2 = E || (E = {}))[E2.a = 0] = "a", E2[E2.b = 1] = "b", (E11 = E1 || (E1 = {}))[E11.a = 0] = "a", E11[E11.b = 1] = "b";
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//// [declarations1.d.ts]
//// [declarations2.d.ts]
//// [user.ts]
///<reference path="declarations1.d.ts" />
///<reference path="declarations1.d.ts" />
export { };
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//// [declarations1.d.ts]
//// [declarations2.d.ts]
//// [user.ts]
///<reference path="declarations1.d.ts" />
///<reference path="declarations1.d.ts" />
export { };
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export * from "jquery";
//// [reExportUser.ts]
import { x } from "./reExportX";
import * as $ from "./reExportAll";
// '$' is not callable, it is an object.
x($);
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [Compilation.js]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
// from webpack/lib/Compilation.js and filed at #26427
/** @param {{ [s: string]: number }} map */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
export var C = function() {
function C() {
_class_call_check(this, C), this.assets = {};
_class_call_check(this, C), /** @type {{ [assetName: string]: number}} */ this.assets = {};
}
return C.prototype.m = function() {
this.assets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//// [anyAsConstructor.ts]
// any is considered an untyped function call
// can be called except with type arguments which is an error
var x;
new x(), new x("hello"), new x(x), new x(x);
// no error
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//// [anyAsFunctionCall.ts]
// any is considered an untyped function call
// can be called except with type arguments which is an error
var x;
x(), x("hello"), x(x);
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//// [anyAsGenericFunctionCall.ts]
// any is considered an untyped function call
// can be called except with type arguments which is an error
var x;
import "@swc/helpers/_/_class_call_check";
x(), x("hello"), x(x), x(x);
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//// [anyAssignabilityInInheritance.ts]
// any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
function f() {}
foo2(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), (E = E1 || (E1 = {}))[E.A = 0] = "A", foo3(a), (f || (f = {})).bar = 1, foo3(a);
var E, a, E1, CC = function CC() {
_class_call_check(this, CC);
};
(CC || (CC = {})).bar = 1, foo3(a), foo3(a), foo3(a);
// any
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
var E, E1;
import "@swc/helpers/_/_class_call_check";
(E1 = E || (E = {}))[E1.A = 0] = "A";
//function foo<T, U extends T, V extends Date>(x: T, y: U, z: V) {
// x = a;
// y = a;
// z = a;
//}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [anyAssignableToEveryType2.ts]
// any is not a subtype of any other types, but is assignable, all the below should work
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
function f() {}
(E = E1 || (E1 = {}))[E.A = 0] = "A", (f || (f = {})).bar = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//// [apparentTypeSubtyping.ts]
// subtype checks use the apparent type of the target type
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//// [apparentTypeSupertype.ts]
// subtype checks use the apparent type of the target type
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [argumentExpressionContextualTyping.ts]
// In a typed function call, argument expressions are contextually typed by their corresponding parameter types.
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
function foo(param) {
Expand Down Expand Up @@ -44,3 +45,4 @@ foo({
e: 3
}
});
// Error because x has an array type namely (string|number)[]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [arithmeticOperatorWithTypeParameter.ts]
// type parameter type is not valid for arithmetic operand
1 change: 1 addition & 0 deletions crates/swc/tests/tsc-references/arrayLiteral.2.minified.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//// [arrayLiteral.ts]
// valid uses of array literals
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//// [arrayLiteralExpressionContextualTyping.ts]
// In a contextually typed array literal expression containing no spread elements, an element expression at index N is contextually typed by
// the type of the property with the numeric name N in the contextual type, if any, or otherwise
// the numeric index type of the contextual type, if any.
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
var tup = [
1,
Expand All @@ -23,3 +26,4 @@ var tup = [
2,
3
].concat(_to_consumable_array(tup));
// Error
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//// [arrayLiteralInference.ts]
// Repro from #31204
var AppType, AppStyle;
var AppType1;
export { AppType1 as AppType };
Expand Down
Loading

0 comments on commit dce3670

Please sign in to comment.