mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-13 05:37:13 -05:00
Merge branch 'streamlineDestructuring' into isolateObjectSpread
This commit is contained in:
@@ -234,8 +234,8 @@ namespace ts {
|
||||
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
const nameExpression = (<ComputedPropertyName>node.name).expression;
|
||||
// treat computed property names where expression is string/numeric literal as just string/numeric literal
|
||||
if (isStringOrNumericLiteral(nameExpression.kind)) {
|
||||
return (<LiteralExpression>nameExpression).text;
|
||||
if (isStringOrNumericLiteral(nameExpression)) {
|
||||
return nameExpression.text;
|
||||
}
|
||||
|
||||
Debug.assert(isWellKnownSymbolSyntactically(nameExpression));
|
||||
@@ -3209,7 +3209,7 @@ namespace ts {
|
||||
break;
|
||||
|
||||
case SyntaxKind.SpreadAssignment:
|
||||
transformFlags |= TransformFlags.AssertESNext | TransformFlags.ContainsSpread | TransformFlags.ContainsObjectSpread;
|
||||
transformFlags |= TransformFlags.AssertESNext | TransformFlags.ContainsObjectSpread;
|
||||
break;
|
||||
|
||||
case SyntaxKind.SuperKeyword:
|
||||
@@ -3261,10 +3261,10 @@ namespace ts {
|
||||
transformFlags |= TransformFlags.ContainsLexicalThis;
|
||||
}
|
||||
|
||||
if (subtreeFlags & TransformFlags.ContainsSpread) {
|
||||
if (subtreeFlags & TransformFlags.ContainsObjectSpread) {
|
||||
// If an ObjectLiteralExpression contains a spread element, then it
|
||||
// is an ES next node.
|
||||
transformFlags |= TransformFlags.AssertESNext | TransformFlags.ContainsObjectSpread;
|
||||
transformFlags |= TransformFlags.AssertESNext;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -3030,7 +3030,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isComputedNonLiteralName(name: PropertyName): boolean {
|
||||
return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteral((<ComputedPropertyName>name).expression.kind);
|
||||
return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteral((<ComputedPropertyName>name).expression);
|
||||
}
|
||||
|
||||
function getRestType(source: Type, properties: PropertyName[], symbol: Symbol): Type {
|
||||
@@ -8907,7 +8907,7 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getTypeOfDestructuredProperty(type: Type, name: Identifier | LiteralExpression | ComputedPropertyName) {
|
||||
function getTypeOfDestructuredProperty(type: Type, name: PropertyName) {
|
||||
const text = getTextOfPropertyName(name);
|
||||
return getTypeOfPropertyOfType(type, text) ||
|
||||
isNumericLiteralName(text) && getIndexTypeOfType(type, IndexKind.Number) ||
|
||||
@@ -9936,8 +9936,7 @@ namespace ts {
|
||||
// Due to the emit for class decorators, any reference to the class from inside of the class body
|
||||
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
|
||||
// behavior of class names in ES6.
|
||||
if (languageVersion === ScriptTarget.ES2015
|
||||
&& declaration.kind === SyntaxKind.ClassDeclaration
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration
|
||||
&& nodeIsDecorated(declaration)) {
|
||||
let container = getContainingClass(node);
|
||||
while (container !== undefined) {
|
||||
@@ -11165,10 +11164,10 @@ namespace ts {
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getObjectLiteralIndexInfo(node: ObjectLiteralExpression, properties: Symbol[], kind: IndexKind): IndexInfo {
|
||||
function getObjectLiteralIndexInfo(propertyNodes: NodeArray<ObjectLiteralElementLike>, offset: number, properties: Symbol[], kind: IndexKind): IndexInfo {
|
||||
const propTypes: Type[] = [];
|
||||
for (let i = 0; i < properties.length; i++) {
|
||||
if (kind === IndexKind.String || isNumericName(node.properties[i].name)) {
|
||||
if (kind === IndexKind.String || isNumericName(propertyNodes[i + offset].name)) {
|
||||
propTypes.push(getTypeOfSymbol(properties[i]));
|
||||
}
|
||||
}
|
||||
@@ -11194,7 +11193,9 @@ namespace ts {
|
||||
let hasComputedStringProperty = false;
|
||||
let hasComputedNumberProperty = false;
|
||||
|
||||
for (const memberDecl of node.properties) {
|
||||
let offset = 0;
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
const memberDecl = node.properties[i];
|
||||
let member = memberDecl.symbol;
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment ||
|
||||
memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment ||
|
||||
@@ -11263,6 +11264,7 @@ namespace ts {
|
||||
return unknownType;
|
||||
}
|
||||
spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false);
|
||||
offset = i + 1;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -11316,8 +11318,8 @@ namespace ts {
|
||||
return createObjectLiteralType();
|
||||
|
||||
function createObjectLiteralType() {
|
||||
const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.String) : undefined;
|
||||
const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.Number) : undefined;
|
||||
const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, IndexKind.String) : undefined;
|
||||
const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, IndexKind.Number) : undefined;
|
||||
const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
|
||||
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshLiteral;
|
||||
result.flags |= TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
|
||||
@@ -14501,6 +14503,8 @@ namespace ts {
|
||||
case SyntaxKind.LessThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanEqualsToken:
|
||||
if (checkForDisallowedESSymbolOperand(operator)) {
|
||||
leftType = getBaseTypeOfLiteralType(leftType);
|
||||
rightType = getBaseTypeOfLiteralType(rightType);
|
||||
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
|
||||
reportOperatorError();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};`;
|
||||
@@ -45,8 +48,11 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
const restHelper = `
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};`;
|
||||
|
||||
|
||||
@@ -102,12 +102,12 @@ namespace ts {
|
||||
|
||||
// Literals
|
||||
|
||||
export function createLiteral(textSource: StringLiteral | Identifier, location?: TextRange): StringLiteral;
|
||||
export function createLiteral(textSource: StringLiteral | NumericLiteral | Identifier, location?: TextRange): StringLiteral;
|
||||
export function createLiteral(value: string, location?: TextRange): StringLiteral;
|
||||
export function createLiteral(value: number, location?: TextRange): NumericLiteral;
|
||||
export function createLiteral(value: boolean, location?: TextRange): BooleanLiteral;
|
||||
export function createLiteral(value: string | number | boolean, location?: TextRange): PrimaryExpression;
|
||||
export function createLiteral(value: string | number | boolean | StringLiteral | Identifier, location?: TextRange): PrimaryExpression {
|
||||
export function createLiteral(value: string | number | boolean | StringLiteral | NumericLiteral | Identifier, location?: TextRange): PrimaryExpression {
|
||||
if (typeof value === "number") {
|
||||
const node = <NumericLiteral>createNode(SyntaxKind.NumericLiteral, location, /*flags*/ undefined);
|
||||
node.text = value.toString();
|
||||
@@ -3259,7 +3259,10 @@ namespace ts {
|
||||
// `"a"` in `let { "a": b } = ...`
|
||||
// `1` in `let { 1: b } = ...`
|
||||
if ((<BindingElement>bindingElement).propertyName) {
|
||||
return (<BindingElement>bindingElement).propertyName;
|
||||
const propertyName = (<BindingElement>bindingElement).propertyName;
|
||||
return isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression)
|
||||
? propertyName.expression
|
||||
: propertyName;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -3270,7 +3273,10 @@ namespace ts {
|
||||
// `"a"` in `({ "a": b } = ...)`
|
||||
// `1` in `({ 1: b } = ...)`
|
||||
if ((<PropertyAssignment>bindingElement).name) {
|
||||
return (<PropertyAssignment>bindingElement).name;
|
||||
const propertyName = (<PropertyAssignment>bindingElement).name;
|
||||
return isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression)
|
||||
? propertyName.expression
|
||||
: propertyName;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -3282,7 +3288,9 @@ namespace ts {
|
||||
|
||||
const target = getTargetOfBindingOrAssignmentElement(bindingElement);
|
||||
if (target && isPropertyName(target)) {
|
||||
return target;
|
||||
return isComputedPropertyName(target) && isStringOrNumericLiteral(target.expression)
|
||||
? target.expression
|
||||
: target;
|
||||
}
|
||||
|
||||
Debug.fail("Invalid property name for binding element.");
|
||||
|
||||
@@ -1168,7 +1168,7 @@ namespace ts {
|
||||
|
||||
function parsePropertyNameWorker(allowComputedPropertyNames: boolean): PropertyName {
|
||||
if (token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral) {
|
||||
return parseLiteralNode(/*internName*/ true);
|
||||
return <StringLiteral | NumericLiteral>parseLiteralNode(/*internName*/ true);
|
||||
}
|
||||
if (allowComputedPropertyNames && token() === SyntaxKind.OpenBracketToken) {
|
||||
return parseComputedPropertyName();
|
||||
@@ -5514,7 +5514,7 @@ namespace ts {
|
||||
node.flags |= NodeFlags.GlobalAugmentation;
|
||||
}
|
||||
else {
|
||||
node.name = parseLiteralNode(/*internName*/ true);
|
||||
node.name = <StringLiteral>parseLiteralNode(/*internName*/ true);
|
||||
}
|
||||
|
||||
if (token() === SyntaxKind.OpenBraceToken) {
|
||||
|
||||
@@ -244,12 +244,15 @@ namespace ts {
|
||||
boundValue = ensureIdentifier(host, boundValue, reuseIdentifierExpressions, location);
|
||||
}
|
||||
let bindingElements: BindingOrAssignmentElement[];
|
||||
let computedTempVariables: Expression[];
|
||||
for (let i = 0; i < numElements; i++) {
|
||||
const element = elements[i];
|
||||
if (!getRestIndicatorOfBindingOrAssignmentElement(element)) {
|
||||
const propertyName = getPropertyNameOfBindingOrAssignmentElement(element);
|
||||
if (host.level >= FlattenLevel.ObjectRest
|
||||
&& !(element.transformFlags & (TransformFlags.ContainsRest | TransformFlags.ContainsObjectRest))
|
||||
&& !(getTargetOfBindingOrAssignmentElement(element).transformFlags & (TransformFlags.ContainsRest | TransformFlags.ContainsObjectRest))) {
|
||||
&& !(getTargetOfBindingOrAssignmentElement(element).transformFlags & (TransformFlags.ContainsRest | TransformFlags.ContainsObjectRest))
|
||||
&& !isComputedPropertyName(propertyName)) {
|
||||
bindingElements = append(bindingElements, element);
|
||||
}
|
||||
else {
|
||||
@@ -257,8 +260,10 @@ namespace ts {
|
||||
host.emitBindingOrAssignment(host.createObjectBindingOrAssignmentPattern(bindingElements), boundValue, location, bindingTarget);
|
||||
bindingElements = undefined;
|
||||
}
|
||||
const propertyName = getPropertyNameOfBindingOrAssignmentElement(element);
|
||||
const value = createDestructuringPropertyAccess(host, boundValue, propertyName);
|
||||
if (isComputedPropertyName(propertyName)) {
|
||||
computedTempVariables = append(computedTempVariables, (value as ElementAccessExpression).argumentExpression);
|
||||
}
|
||||
flattenBindingOrAssignmentElement(host, element, value, /*location*/ element);
|
||||
}
|
||||
}
|
||||
@@ -267,7 +272,7 @@ namespace ts {
|
||||
host.emitBindingOrAssignment(host.createObjectBindingOrAssignmentPattern(bindingElements), boundValue, location, bindingTarget);
|
||||
bindingElements = undefined;
|
||||
}
|
||||
const value = createRestCall(boundValue, elements, bindingTarget);
|
||||
const value = createRestCall(boundValue, elements, computedTempVariables, bindingTarget);
|
||||
flattenBindingOrAssignmentElement(host, element, value, element);
|
||||
}
|
||||
}
|
||||
@@ -433,17 +438,28 @@ namespace ts {
|
||||
|
||||
/** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
|
||||
* `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/
|
||||
function createRestCall(value: Expression, elements: BindingOrAssignmentElement[], location: TextRange): Expression {
|
||||
const propertyNames: LiteralExpression[] = [];
|
||||
function createRestCall(value: Expression, elements: BindingOrAssignmentElement[], computedTempVariables: Expression[], location: TextRange): Expression {
|
||||
const propertyNames: Expression[] = [];
|
||||
for (let i = 0; i < elements.length - 1; i++) {
|
||||
if (isOmittedExpression(elements[i])) {
|
||||
continue;
|
||||
const propertyName = getPropertyNameOfBindingOrAssignmentElement(elements[i]);
|
||||
if (propertyName) {
|
||||
if (isComputedPropertyName(propertyName)) {
|
||||
// get the temp name and put that in there instead, like `_tmp + ""`
|
||||
const temp = computedTempVariables.shift();
|
||||
propertyNames.push(
|
||||
createConditional(
|
||||
createStrictEquality(createTypeOf(temp), createLiteral("symbol")),
|
||||
createToken(SyntaxKind.QuestionToken),
|
||||
temp,
|
||||
createToken(SyntaxKind.ColonToken),
|
||||
createAdd(temp, createLiteral(""))
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
propertyNames.push(createLiteral(propertyName));
|
||||
}
|
||||
}
|
||||
const str = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
|
||||
str.pos = location.pos;
|
||||
str.end = location.end;
|
||||
str.text = getTextOfPropertyName(getPropertyNameOfBindingOrAssignmentElement(elements[i]));
|
||||
propertyNames.push(str);
|
||||
}
|
||||
const args = createSynthesizedNodeArray([value, createArrayLiteral(propertyNames, location)]);
|
||||
return createCall(createIdentifier("__rest"), undefined, args);
|
||||
|
||||
@@ -1011,7 +1011,20 @@ namespace ts {
|
||||
|
||||
// Return the result if we have an immediate super() call on the last statement.
|
||||
if (superCallExpression && statementOffset === ctorStatements.length - 1) {
|
||||
statements.push(createReturn(superCallExpression));
|
||||
const returnStatement = createReturn(superCallExpression);
|
||||
|
||||
if (superCallExpression.kind !== SyntaxKind.BinaryExpression
|
||||
|| (superCallExpression as BinaryExpression).left.kind !== SyntaxKind.CallExpression) {
|
||||
Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
|
||||
}
|
||||
|
||||
// Shift comments from the original super call to the return statement.
|
||||
setCommentRange(returnStatement, getCommentRange(
|
||||
setEmitFlags(
|
||||
(superCallExpression as BinaryExpression).left,
|
||||
EmitFlags.NoComments)));
|
||||
|
||||
statements.push(returnStatement);
|
||||
return SuperCaptureResult.ReplaceWithReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -579,9 +579,9 @@ namespace ts {
|
||||
|
||||
export type EntityName = Identifier | QualifiedName;
|
||||
|
||||
export type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
|
||||
export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
|
||||
|
||||
export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
|
||||
export type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
|
||||
|
||||
export interface Declaration extends Node {
|
||||
_declarationBrand: any;
|
||||
@@ -589,7 +589,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface DeclarationStatement extends Declaration, Statement {
|
||||
name?: Identifier | LiteralExpression;
|
||||
name?: Identifier | StringLiteral | NumericLiteral;
|
||||
}
|
||||
|
||||
export interface ComputedPropertyName extends Node {
|
||||
@@ -919,7 +919,7 @@ namespace ts {
|
||||
|
||||
export interface StringLiteral extends LiteralExpression {
|
||||
kind: SyntaxKind.StringLiteral;
|
||||
/* @internal */ textSourceNode?: Identifier | StringLiteral; // Allows a StringLiteral to get its text from another node (used by transforms).
|
||||
/* @internal */ textSourceNode?: Identifier | StringLiteral | NumericLiteral; // Allows a StringLiteral to get its text from another node (used by transforms).
|
||||
}
|
||||
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
@@ -1746,7 +1746,7 @@ namespace ts {
|
||||
|
||||
export interface ModuleDeclaration extends DeclarationStatement {
|
||||
kind: SyntaxKind.ModuleDeclaration;
|
||||
name: Identifier | LiteralExpression;
|
||||
name: Identifier | StringLiteral;
|
||||
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
|
||||
}
|
||||
|
||||
@@ -1952,7 +1952,7 @@ namespace ts {
|
||||
|
||||
export interface JSDocRecordMember extends PropertySignature {
|
||||
kind: SyntaxKind.JSDocRecordMember;
|
||||
name: Identifier | LiteralExpression;
|
||||
name: Identifier | StringLiteral | NumericLiteral;
|
||||
type?: JSDocType;
|
||||
}
|
||||
|
||||
|
||||
@@ -493,7 +493,7 @@ namespace ts {
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return (<LiteralExpression>name).text;
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
if (isStringOrNumericLiteral((<ComputedPropertyName>name).expression.kind)) {
|
||||
if (isStringOrNumericLiteral((<ComputedPropertyName>name).expression)) {
|
||||
return (<LiteralExpression>(<ComputedPropertyName>name).expression).text;
|
||||
}
|
||||
}
|
||||
@@ -1262,6 +1262,7 @@ namespace ts {
|
||||
case SyntaxKind.Decorator:
|
||||
case SyntaxKind.JsxExpression:
|
||||
case SyntaxKind.JsxSpreadAttribute:
|
||||
case SyntaxKind.SpreadAssignment:
|
||||
return true;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return (<ExpressionWithTypeArguments>parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
||||
@@ -1879,8 +1880,10 @@ namespace ts {
|
||||
return isFunctionLike(node) && hasModifier(node, ModifierFlags.Async) && !isAccessor(node);
|
||||
}
|
||||
|
||||
export function isStringOrNumericLiteral(kind: SyntaxKind): boolean {
|
||||
return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral;
|
||||
export function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral {
|
||||
const kind = node.kind;
|
||||
return kind === SyntaxKind.StringLiteral
|
||||
|| kind === SyntaxKind.NumericLiteral;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1896,7 +1899,7 @@ namespace ts {
|
||||
|
||||
export function isDynamicName(name: DeclarationName): boolean {
|
||||
return name.kind === SyntaxKind.ComputedPropertyName &&
|
||||
!isStringOrNumericLiteral((<ComputedPropertyName>name).expression.kind) &&
|
||||
!isStringOrNumericLiteral((<ComputedPropertyName>name).expression) &&
|
||||
!isWellKnownSymbolSyntactically((<ComputedPropertyName>name).expression);
|
||||
}
|
||||
|
||||
@@ -1909,7 +1912,7 @@ namespace ts {
|
||||
return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);
|
||||
}
|
||||
|
||||
export function getPropertyNameForPropertyNameNode(name: DeclarationName): string {
|
||||
export function getPropertyNameForPropertyNameNode(name: DeclarationName | ParameterDeclaration): string {
|
||||
if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral || name.kind === SyntaxKind.Parameter) {
|
||||
return (<Identifier | LiteralExpression>name).text;
|
||||
}
|
||||
|
||||
@@ -2013,13 +2013,13 @@ namespace FourSlash {
|
||||
this.raiseError("Errors expected.");
|
||||
}
|
||||
|
||||
if (diagnostics.length > 1 && errorCode !== undefined) {
|
||||
if (diagnostics.length > 1 && errorCode === undefined) {
|
||||
this.raiseError("When there's more than one error, you must specify the errror to fix.");
|
||||
}
|
||||
|
||||
const diagnostic = !errorCode ? diagnostics[0] : ts.find(diagnostics, d => d.code == errorCode);
|
||||
|
||||
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]);
|
||||
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.start + diagnostic.length, [diagnostic.code]);
|
||||
}
|
||||
|
||||
public verifyCodeFixAtPosition(expectedText: string, errorCode?: number) {
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
///<reference path='superFixes.ts' />
|
||||
///<reference path='unusedIdentifierFixes.ts' />
|
||||
167
src/services/codefixes/unusedIdentifierFixes.ts
Normal file
167
src/services/codefixes/unusedIdentifierFixes.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
/* @internal */
|
||||
namespace ts.codefix {
|
||||
registerCodeFix({
|
||||
errorCodes: [
|
||||
Diagnostics._0_is_declared_but_never_used.code,
|
||||
Diagnostics.Property_0_is_declared_but_never_used.code
|
||||
],
|
||||
getCodeActions: (context: CodeFixContext) => {
|
||||
const sourceFile = context.sourceFile;
|
||||
const start = context.span.start;
|
||||
|
||||
let token = getTokenAtPosition(sourceFile, start);
|
||||
|
||||
// this handles var ["computed"] = 12;
|
||||
if (token.kind === SyntaxKind.OpenBracketToken) {
|
||||
token = getTokenAtPosition(sourceFile, start + 1);
|
||||
}
|
||||
|
||||
switch (token.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
switch (token.parent.kind) {
|
||||
case ts.SyntaxKind.VariableDeclaration:
|
||||
switch (token.parent.parent.parent.kind) {
|
||||
case SyntaxKind.ForStatement:
|
||||
const forStatement = <ForStatement>token.parent.parent.parent;
|
||||
const forInitializer = <VariableDeclarationList>forStatement.initializer;
|
||||
if (forInitializer.declarations.length === 1) {
|
||||
return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos);
|
||||
}
|
||||
else {
|
||||
return removeSingleItem(forInitializer.declarations, token);
|
||||
}
|
||||
|
||||
case SyntaxKind.ForOfStatement:
|
||||
const forOfStatement = <ForOfStatement>token.parent.parent.parent;
|
||||
if (forOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
const forOfInitializer = <VariableDeclarationList>forOfStatement.initializer;
|
||||
return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ForInStatement:
|
||||
// There is no valid fix in the case of:
|
||||
// for .. in
|
||||
return undefined;
|
||||
|
||||
case SyntaxKind.CatchClause:
|
||||
const catchClause = <CatchClause>token.parent.parent;
|
||||
const parameter = catchClause.variableDeclaration.getChildren()[0];
|
||||
return createCodeFix("", parameter.pos, parameter.end - parameter.pos);
|
||||
|
||||
default:
|
||||
const variableStatement = <VariableStatement>token.parent.parent.parent;
|
||||
if (variableStatement.declarationList.declarations.length === 1) {
|
||||
return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos);
|
||||
}
|
||||
else {
|
||||
const declarations = variableStatement.declarationList.declarations;
|
||||
return removeSingleItem(declarations, token);
|
||||
}
|
||||
}
|
||||
|
||||
case SyntaxKind.TypeParameter:
|
||||
const typeParameters = (<DeclarationWithTypeParameters>token.parent.parent).typeParameters;
|
||||
if (typeParameters.length === 1) {
|
||||
return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);
|
||||
}
|
||||
else {
|
||||
return removeSingleItem(typeParameters, token);
|
||||
}
|
||||
|
||||
case ts.SyntaxKind.Parameter:
|
||||
const functionDeclaration = <FunctionDeclaration>token.parent.parent;
|
||||
if (functionDeclaration.parameters.length === 1) {
|
||||
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
|
||||
}
|
||||
else {
|
||||
return removeSingleItem(functionDeclaration.parameters, token);
|
||||
}
|
||||
|
||||
// handle case where 'import a = A;'
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
const importEquals = findImportDeclaration(token);
|
||||
return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
|
||||
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
const namedImports = <NamedImports>token.parent.parent;
|
||||
if (namedImports.elements.length === 1) {
|
||||
// Only 1 import and it is unused. So the entire declaration should be removed.
|
||||
const importSpec = findImportDeclaration(token);
|
||||
return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
|
||||
}
|
||||
else {
|
||||
return removeSingleItem(namedImports.elements, token);
|
||||
}
|
||||
|
||||
// handle case where "import d, * as ns from './file'"
|
||||
// or "'import {a, b as ns} from './file'"
|
||||
case SyntaxKind.ImportClause: // this covers both 'import |d|' and 'import |d,| *'
|
||||
const importClause = <ImportClause>token.parent;
|
||||
if (!importClause.namedBindings) { // |import d from './file'| or |import * as ns from './file'|
|
||||
const importDecl = findImportDeclaration(importClause);
|
||||
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
|
||||
}
|
||||
else { // import |d,| * as ns from './file'
|
||||
return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);
|
||||
}
|
||||
|
||||
case SyntaxKind.NamespaceImport:
|
||||
const namespaceImport = <NamespaceImport>token.parent;
|
||||
if (namespaceImport.name == token && !(<ImportClause>namespaceImport.parent).name) {
|
||||
const importDecl = findImportDeclaration(namespaceImport);
|
||||
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
|
||||
}
|
||||
else {
|
||||
const start = (<ImportClause>namespaceImport.parent).name.end;
|
||||
return createCodeFix("", start, (<ImportClause>namespaceImport.parent).namedBindings.end - start);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
|
||||
|
||||
case SyntaxKind.NamespaceImport:
|
||||
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
|
||||
}
|
||||
if (isDeclarationName(token)) {
|
||||
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
|
||||
}
|
||||
else if (isLiteralComputedPropertyDeclarationName(token)) {
|
||||
return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function findImportDeclaration(token: Node): Node {
|
||||
let importDecl = token;
|
||||
while (importDecl.kind != SyntaxKind.ImportDeclaration && importDecl.parent) {
|
||||
importDecl = importDecl.parent;
|
||||
}
|
||||
|
||||
return importDecl;
|
||||
}
|
||||
|
||||
function createCodeFix(newText: string, start: number, length: number): CodeAction[] {
|
||||
return [{
|
||||
description: getLocaleSpecificMessage(Diagnostics.Remove_unused_identifiers),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{ newText, span: { start, length } }]
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
||||
function removeSingleItem<T extends Node>(elements: NodeArray<T>, token: T): CodeAction[] {
|
||||
if (elements[0] === token.parent) {
|
||||
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1);
|
||||
}
|
||||
else {
|
||||
return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1188,7 +1188,7 @@ namespace ts.FindAllReferences {
|
||||
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
const nameExpression = (<ComputedPropertyName>node.name).expression;
|
||||
// treat computed property names where expression is string/numeric literal as just string/numeric literal
|
||||
if (isStringOrNumericLiteral(nameExpression.kind)) {
|
||||
if (isStringOrNumericLiteral(nameExpression)) {
|
||||
return (<LiteralExpression>nameExpression).text;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
@@ -1282,7 +1282,7 @@ namespace ts {
|
||||
if (isImportOrExportSpecifierName(location)) {
|
||||
return location.getText();
|
||||
}
|
||||
else if (isStringOrNumericLiteral(location.kind) &&
|
||||
else if (isStringOrNumericLiteral(location) &&
|
||||
location.parent.kind === SyntaxKind.ComputedPropertyName) {
|
||||
return (<LiteralExpression>location).text;
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop1.ts(69,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop1.ts(86,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop1.ts(92,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop1.ts(109,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop1.ts (4 errors) ====
|
||||
//==== let
|
||||
for (let x in {}) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x of []) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
let x, y;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
//=========const
|
||||
for (const x in {}) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x = 1, y = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
@@ -32,10 +32,10 @@ for (let x of []) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -90,16 +90,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
@@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -188,16 +188,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
@@ -246,21 +246,21 @@ for (const x of []) {
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 0
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -269,34 +269,34 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -304,49 +304,49 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -355,46 +355,46 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -402,27 +402,27 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(69,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(86,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(92,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(109,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop1_ES6.ts (4 errors) ====
|
||||
//==== let
|
||||
for (let x in {}) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x of []) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
let x, y;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
//=========const
|
||||
for (const x in {}) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x = 1, y = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
}
|
||||
@@ -32,10 +32,10 @@ for (let x of []) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -90,16 +90,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
@@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -188,16 +188,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
@@ -246,21 +246,21 @@ for (const x of []) {
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 0
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -269,34 +269,34 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -304,49 +304,49 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x});
|
||||
>(function() { return x}) : () => number
|
||||
>function() { return x} : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -355,46 +355,46 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -402,27 +402,27 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + y});
|
||||
>(function() { return x + y}) : () => number
|
||||
>function() { return x + y} : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
}
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop2.ts(108,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop2.ts(133,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop2.ts(142,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop2.ts(170,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop2.ts (4 errors) ====
|
||||
|
||||
|
||||
// ========let
|
||||
function foo0(x) {
|
||||
for (let x of []) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo0_1(x) {
|
||||
for (let x in []) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo1(x) {
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo2(x) {
|
||||
while (1 === 1) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo3(x) {
|
||||
do {
|
||||
let x;
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
function foo4(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let a = arguments.length;
|
||||
let x = 1;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo5(x) {
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function foo6(x) {
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo7(x) {
|
||||
do {
|
||||
let x, y;
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
|
||||
function foo8(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
///=======const
|
||||
function foo0_c(x) {
|
||||
for (const x of []) {
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo0_1_c(x) {
|
||||
for (const x in []) {
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo1_c(x) {
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo2_c(x) {
|
||||
while (1 === 1) {
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo3_c(x) {
|
||||
do {
|
||||
const x = 1;
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
function foo4_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const a = arguments.length;
|
||||
const x = 1;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo5_c(x) {
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function foo6_c(x) {
|
||||
while (1 === 1) {
|
||||
const x = 1, y =1 ;
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo7_c(x) {
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
@@ -68,10 +68,10 @@ function foo1(x) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -168,10 +168,10 @@ function foo4(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
@@ -183,7 +183,7 @@ function foo4(x) {
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + a });
|
||||
>(function() { return x + a }) : () => number
|
||||
@@ -207,12 +207,12 @@ function foo5(x) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -328,16 +328,16 @@ function foo8(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
let a = arguments.length;
|
||||
>a : number
|
||||
@@ -430,11 +430,11 @@ function foo1_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -446,14 +446,14 @@ function foo1_c(x) {
|
||||
>(function() { return x + a }) : () => number
|
||||
>function() { return x + a } : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>a : number
|
||||
|
||||
(() => x + a);
|
||||
>(() => x + a) : () => number
|
||||
>() => x + a : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -495,8 +495,8 @@ function foo3_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -508,14 +508,14 @@ function foo3_c(x) {
|
||||
>(function() { return x + a }) : () => number
|
||||
>function() { return x + a } : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
|
||||
(() => x + a);
|
||||
>(() => x + a) : () => number
|
||||
>() => x + a : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
|
||||
} while (1 === 1)
|
||||
@@ -529,11 +529,11 @@ function foo4_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -542,21 +542,21 @@ function foo4_c(x) {
|
||||
>length : number
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + a });
|
||||
>(function() { return x + a }) : () => number
|
||||
>function() { return x + a } : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
|
||||
(() => x + a);
|
||||
>(() => x + a) : () => number
|
||||
>() => x + a : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -566,13 +566,13 @@ function foo5_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -585,8 +585,8 @@ function foo5_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -594,8 +594,8 @@ function foo5_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -611,10 +611,10 @@ function foo6_c(x) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y =1 ;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -627,8 +627,8 @@ function foo6_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -636,8 +636,8 @@ function foo6_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -648,10 +648,10 @@ function foo7_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -664,8 +664,8 @@ function foo7_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -673,8 +673,8 @@ function foo7_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
} while (1 === 1)
|
||||
@@ -689,15 +689,15 @@ function foo8_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -710,8 +710,8 @@ function foo8_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -719,8 +719,8 @@ function foo8_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(107,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(132,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(141,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(169,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop2_ES6.ts (4 errors) ====
|
||||
|
||||
// ========let
|
||||
function foo0(x) {
|
||||
for (let x of []) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo0_1(x) {
|
||||
for (let x in []) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo1(x) {
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo2(x) {
|
||||
while (1 === 1) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo3(x) {
|
||||
do {
|
||||
let x;
|
||||
let a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
function foo4(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let a = arguments.length;
|
||||
let x = 1;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo5(x) {
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function foo6(x) {
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo7(x) {
|
||||
do {
|
||||
let x, y;
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
|
||||
function foo8(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
let a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
///=======const
|
||||
function foo0_c(x) {
|
||||
for (const x of []) {
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo0_1_c(x) {
|
||||
for (const x in []) {
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo1_c(x) {
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo2_c(x) {
|
||||
while (1 === 1) {
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo3_c(x) {
|
||||
do {
|
||||
const x = 1;
|
||||
const a = arguments.length;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
function foo4_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const a = arguments.length;
|
||||
const x = 1;
|
||||
(function() { return x + a });
|
||||
(() => x + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo5_c(x) {
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function foo6_c(x) {
|
||||
while (1 === 1) {
|
||||
const x = 1, y =1 ;
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
|
||||
function foo7_c(x) {
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
} while (1 === 1)
|
||||
}
|
||||
|
||||
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
const a = arguments.length;
|
||||
(function() { return x + y + a });
|
||||
(() => x + y + a);
|
||||
}
|
||||
}
|
||||
@@ -67,10 +67,10 @@ function foo1(x) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -167,10 +167,10 @@ function foo4(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
@@ -182,7 +182,7 @@ function foo4(x) {
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + a });
|
||||
>(function() { return x + a }) : () => number
|
||||
@@ -206,12 +206,12 @@ function foo5(x) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -327,16 +327,16 @@ function foo8(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
let a = arguments.length;
|
||||
>a : number
|
||||
@@ -429,11 +429,11 @@ function foo1_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -445,14 +445,14 @@ function foo1_c(x) {
|
||||
>(function() { return x + a }) : () => number
|
||||
>function() { return x + a } : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>a : number
|
||||
|
||||
(() => x + a);
|
||||
>(() => x + a) : () => number
|
||||
>() => x + a : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -494,8 +494,8 @@ function foo3_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -507,14 +507,14 @@ function foo3_c(x) {
|
||||
>(function() { return x + a }) : () => number
|
||||
>function() { return x + a } : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
|
||||
(() => x + a);
|
||||
>(() => x + a) : () => number
|
||||
>() => x + a : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
|
||||
} while (1 === 1)
|
||||
@@ -528,11 +528,11 @@ function foo4_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -541,21 +541,21 @@ function foo4_c(x) {
|
||||
>length : number
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + a });
|
||||
>(function() { return x + a }) : () => number
|
||||
>function() { return x + a } : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
|
||||
(() => x + a);
|
||||
>(() => x + a) : () => number
|
||||
>() => x + a : () => number
|
||||
>x + a : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -565,13 +565,13 @@ function foo5_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -584,8 +584,8 @@ function foo5_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -593,8 +593,8 @@ function foo5_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -610,10 +610,10 @@ function foo6_c(x) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y =1 ;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -626,8 +626,8 @@ function foo6_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -635,8 +635,8 @@ function foo6_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
@@ -647,10 +647,10 @@ function foo7_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -663,8 +663,8 @@ function foo7_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -672,8 +672,8 @@ function foo7_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>a : number
|
||||
|
||||
} while (1 === 1)
|
||||
@@ -688,15 +688,15 @@ function foo8_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
const a = arguments.length;
|
||||
>a : number
|
||||
@@ -709,8 +709,8 @@ function foo8_c(x) {
|
||||
>function() { return x + y + a } : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>a : number
|
||||
|
||||
(() => x + y + a);
|
||||
@@ -718,8 +718,8 @@ function foo8_c(x) {
|
||||
>() => x + y + a : () => number
|
||||
>x + y + a : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop3.ts(132,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop3.ts(164,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop3.ts(175,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop3.ts(209,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop3.ts (4 errors) ====
|
||||
///=========let
|
||||
declare function use(a: any);
|
||||
function foo0(x) {
|
||||
for (let x of []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo0_1(x) {
|
||||
for (let x in []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo1(x) {
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo2(x) {
|
||||
while (1 === 1) {
|
||||
let x = 1;
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo3(x) {
|
||||
do {
|
||||
let x;
|
||||
var v;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo4(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
var v = y;
|
||||
let x = 1;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo5(x) {
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo6(x) {
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v)
|
||||
}
|
||||
|
||||
function foo7(x) {
|
||||
do {
|
||||
let x, y;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo8(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
//===const
|
||||
function foo0_c(x) {
|
||||
for (const x of []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo0_1_c(x) {
|
||||
for (const x in []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo1_c(x) {
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo2_c(x) {
|
||||
while (1 === 1) {
|
||||
const x = 1;
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo3_c(x) {
|
||||
do {
|
||||
const x = 1;
|
||||
var v;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo4_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = y;
|
||||
const x = 1;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo5_c(x) {
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo6_c(x) {
|
||||
while (1 === 1) {
|
||||
const x = 1, y = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v)
|
||||
}
|
||||
|
||||
function foo7_c(x) {
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
@@ -76,10 +76,10 @@ function foo1(x) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -119,7 +119,7 @@ function foo2(x) {
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
@@ -179,7 +179,7 @@ function foo3(x) {
|
||||
use(v);
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
function foo4(x) {
|
||||
@@ -188,10 +188,10 @@ function foo4(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
@@ -201,7 +201,7 @@ function foo4(x) {
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
@@ -230,12 +230,12 @@ function foo5(x) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -283,8 +283,8 @@ function foo6(x) {
|
||||
>y : any
|
||||
|
||||
var v = x;
|
||||
>v : any
|
||||
>x : any
|
||||
>v : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => any
|
||||
@@ -293,7 +293,7 @@ function foo6(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
|
||||
(() => x + y + v);
|
||||
>(() => x + y + v) : () => any
|
||||
@@ -302,13 +302,13 @@ function foo6(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
use(v)
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
function foo7(x) {
|
||||
@@ -321,8 +321,8 @@ function foo7(x) {
|
||||
>y : any
|
||||
|
||||
var v = x;
|
||||
>v : any
|
||||
>x : any
|
||||
>v : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => any
|
||||
@@ -331,7 +331,7 @@ function foo7(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
|
||||
(() => x + y + v);
|
||||
>(() => x + y + v) : () => any
|
||||
@@ -340,7 +340,7 @@ function foo7(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
|
||||
} while (1 === 1);
|
||||
>1 === 1 : boolean
|
||||
@@ -350,7 +350,7 @@ function foo7(x) {
|
||||
use(v);
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -360,16 +360,16 @@ function foo8(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
@@ -471,28 +471,28 @@ function foo1_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
>function() { return x + v } : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>v : number
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => number
|
||||
>() => x + v : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -512,25 +512,25 @@ function foo2_c(x) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
>function() { return x + v } : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => number
|
||||
>() => x + v : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -546,8 +546,8 @@ function foo3_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v;
|
||||
>v : any
|
||||
@@ -556,14 +556,14 @@ function foo3_c(x) {
|
||||
>(function() { return x + v }) : () => any
|
||||
>function() { return x + v } : () => any
|
||||
>x + v : any
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : any
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => any
|
||||
>() => x + v : () => any
|
||||
>x + v : any
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : any
|
||||
|
||||
} while (1 === 1);
|
||||
@@ -574,7 +574,7 @@ function foo3_c(x) {
|
||||
use(v);
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
function foo4_c(x) {
|
||||
@@ -582,32 +582,32 @@ function foo4_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
var v = y;
|
||||
>v : number
|
||||
>y : number
|
||||
>y : 0
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
>function() { return x + v } : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => number
|
||||
>() => x + v : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -622,25 +622,25 @@ function foo5_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -648,8 +648,8 @@ function foo5_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -670,22 +670,22 @@ function foo6_c(x) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -693,8 +693,8 @@ function foo6_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -710,22 +710,22 @@ function foo7_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -733,8 +733,8 @@ function foo7_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
} while (1 === 1);
|
||||
@@ -754,27 +754,27 @@ function foo8_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -782,8 +782,8 @@ function foo8_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>v : number
|
||||
}
|
||||
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(133,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(165,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(176,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(210,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop3_ES6.ts (4 errors) ====
|
||||
|
||||
///=========let
|
||||
declare function use(a: any);
|
||||
function foo0(x) {
|
||||
for (let x of []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo0_1(x) {
|
||||
for (let x in []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo1(x) {
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo2(x) {
|
||||
while (1 === 1) {
|
||||
let x = 1;
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo3(x) {
|
||||
do {
|
||||
let x;
|
||||
var v;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo4(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
var v = y;
|
||||
let x = 1;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo5(x) {
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo6(x) {
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v)
|
||||
}
|
||||
|
||||
function foo7(x) {
|
||||
do {
|
||||
let x, y;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo8(x) {
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
//===const
|
||||
function foo0_c(x) {
|
||||
for (const x of []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo0_1_c(x) {
|
||||
for (const x in []) {
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo1_c(x) {
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo2_c(x) {
|
||||
while (1 === 1) {
|
||||
const x = 1;
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo3_c(x) {
|
||||
do {
|
||||
const x = 1;
|
||||
var v;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo4_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = y;
|
||||
const x = 1;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
function foo5_c(x) {
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo6_c(x) {
|
||||
while (1 === 1) {
|
||||
const x = 1, y = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v)
|
||||
}
|
||||
|
||||
function foo7_c(x) {
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
} while (1 === 1);
|
||||
|
||||
use(v);
|
||||
}
|
||||
|
||||
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
}
|
||||
|
||||
use(v);
|
||||
}
|
||||
@@ -77,10 +77,10 @@ function foo1(x) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -120,7 +120,7 @@ function foo2(x) {
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
@@ -180,7 +180,7 @@ function foo3(x) {
|
||||
use(v);
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
function foo4(x) {
|
||||
@@ -189,10 +189,10 @@ function foo4(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
@@ -202,7 +202,7 @@ function foo4(x) {
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
@@ -231,12 +231,12 @@ function foo5(x) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -284,8 +284,8 @@ function foo6(x) {
|
||||
>y : any
|
||||
|
||||
var v = x;
|
||||
>v : any
|
||||
>x : any
|
||||
>v : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => any
|
||||
@@ -294,7 +294,7 @@ function foo6(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
|
||||
(() => x + y + v);
|
||||
>(() => x + y + v) : () => any
|
||||
@@ -303,13 +303,13 @@ function foo6(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
use(v)
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
function foo7(x) {
|
||||
@@ -322,8 +322,8 @@ function foo7(x) {
|
||||
>y : any
|
||||
|
||||
var v = x;
|
||||
>v : any
|
||||
>x : any
|
||||
>v : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => any
|
||||
@@ -332,7 +332,7 @@ function foo7(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
|
||||
(() => x + y + v);
|
||||
>(() => x + y + v) : () => any
|
||||
@@ -341,7 +341,7 @@ function foo7(x) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v : any
|
||||
>v : undefined
|
||||
|
||||
} while (1 === 1);
|
||||
>1 === 1 : boolean
|
||||
@@ -351,7 +351,7 @@ function foo7(x) {
|
||||
use(v);
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -361,16 +361,16 @@ function foo8(x) {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
@@ -472,28 +472,28 @@ function foo1_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
>function() { return x + v } : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>v : number
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => number
|
||||
>() => x + v : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -513,25 +513,25 @@ function foo2_c(x) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
>function() { return x + v } : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => number
|
||||
>() => x + v : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -547,8 +547,8 @@ function foo3_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v;
|
||||
>v : any
|
||||
@@ -557,14 +557,14 @@ function foo3_c(x) {
|
||||
>(function() { return x + v }) : () => any
|
||||
>function() { return x + v } : () => any
|
||||
>x + v : any
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : any
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => any
|
||||
>() => x + v : () => any
|
||||
>x + v : any
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : any
|
||||
|
||||
} while (1 === 1);
|
||||
@@ -575,7 +575,7 @@ function foo3_c(x) {
|
||||
use(v);
|
||||
>use(v) : any
|
||||
>use : (a: any) => any
|
||||
>v : any
|
||||
>v : undefined
|
||||
}
|
||||
|
||||
function foo4_c(x) {
|
||||
@@ -583,32 +583,32 @@ function foo4_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
var v = y;
|
||||
>v : number
|
||||
>y : number
|
||||
>y : 0
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
(function() { return x + v });
|
||||
>(function() { return x + v }) : () => number
|
||||
>function() { return x + v } : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
|
||||
(() => x + v);
|
||||
>(() => x + v) : () => number
|
||||
>() => x + v : () => number
|
||||
>x + v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -623,25 +623,25 @@ function foo5_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -649,8 +649,8 @@ function foo5_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -671,22 +671,22 @@ function foo6_c(x) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -694,8 +694,8 @@ function foo6_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -711,22 +711,22 @@ function foo7_c(x) {
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -734,8 +734,8 @@ function foo7_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v : number
|
||||
|
||||
} while (1 === 1);
|
||||
@@ -755,27 +755,27 @@ function foo8_c(x) {
|
||||
>x : any
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v = x;
|
||||
>v : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v });
|
||||
>(function() { return x + y + v }) : () => number
|
||||
>function() { return x + y + v } : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>v : number
|
||||
|
||||
(() => x + y + v);
|
||||
@@ -783,8 +783,8 @@ function foo8_c(x) {
|
||||
>() => x + y + v : () => number
|
||||
>x + y + v : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>v : number
|
||||
}
|
||||
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop4.ts(90,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop4.ts(110,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop4.ts(117,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop4.ts(137,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop4.ts (4 errors) ====
|
||||
|
||||
//======let
|
||||
export function exportedFoo() {
|
||||
return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8;
|
||||
}
|
||||
|
||||
for (let x of []) {
|
||||
var v0 = x;
|
||||
(function() { return x + v0});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x in []) {
|
||||
var v00 = x;
|
||||
(function() { return x + v00});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
var v1 = x;
|
||||
(function() { return x + v1});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x;
|
||||
var v2 = x;
|
||||
(function() { return x + v2});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
var v3 = x;
|
||||
(function() { return x + v3});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
var v4 = x;
|
||||
(function() { return x + v4});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
var v5 = x;
|
||||
(function() { return x + y + v5});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
var v6 = x;
|
||||
(function() { return x + y + v6});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
let x, y;
|
||||
var v7 = x;
|
||||
(function() { return x + y + v7});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
var v8 = x;
|
||||
(function() { return x + y + v8});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
//======const
|
||||
export function exportedFoo2() {
|
||||
return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c;
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
var v0_c = x;
|
||||
(function() { return x + v0_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
var v00_c = x;
|
||||
(function() { return x + v00});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v1_c = x;
|
||||
(function() { return x + v1_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x =1;
|
||||
var v2_c = x;
|
||||
(function() { return x + v2_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
var v3_c = x;
|
||||
(function() { return x + v3_c});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v4_c = x;
|
||||
(function() { return x + v4_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v5_c = x;
|
||||
(function() { return x + y + v5_c});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x = 1, y = 1;
|
||||
var v6_c = x;
|
||||
(function() { return x + y + v6_c});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
var v7_c = x;
|
||||
(function() { return x + y + v7_c});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v8_c = x;
|
||||
(function() { return x + y + v8_c});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ export function exportedFoo() {
|
||||
>v0 : any
|
||||
>v00 : string
|
||||
>v1 : number
|
||||
>v2 : any
|
||||
>v3 : any
|
||||
>v2 : undefined
|
||||
>v3 : undefined
|
||||
>v4 : number
|
||||
>v5 : number
|
||||
>v6 : any
|
||||
>v7 : any
|
||||
>v6 : undefined
|
||||
>v7 : undefined
|
||||
>v8 : number
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ for (let x in []) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -103,15 +103,15 @@ while (1 === 1) {
|
||||
>x : any
|
||||
|
||||
var v2 = x;
|
||||
>v2 : any
|
||||
>x : any
|
||||
>v2 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + v2});
|
||||
>(function() { return x + v2}) : () => any
|
||||
>function() { return x + v2} : () => any
|
||||
>x + v2 : any
|
||||
>x : any
|
||||
>v2 : any
|
||||
>v2 : undefined
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => any
|
||||
@@ -124,15 +124,15 @@ do {
|
||||
>x : any
|
||||
|
||||
var v3 = x;
|
||||
>v3 : any
|
||||
>x : any
|
||||
>v3 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + v3});
|
||||
>(function() { return x + v3}) : () => any
|
||||
>function() { return x + v3} : () => any
|
||||
>x + v3 : any
|
||||
>x : any
|
||||
>v3 : any
|
||||
>v3 : undefined
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => any
|
||||
@@ -146,16 +146,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v4 = x;
|
||||
>v4 : number
|
||||
@@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -216,8 +216,8 @@ while (1 === 1) {
|
||||
>y : any
|
||||
|
||||
var v6 = x;
|
||||
>v6 : any
|
||||
>x : any
|
||||
>v6 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v6});
|
||||
>(function() { return x + y + v6}) : () => any
|
||||
@@ -226,7 +226,7 @@ while (1 === 1) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v6 : any
|
||||
>v6 : undefined
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => any
|
||||
@@ -242,8 +242,8 @@ do {
|
||||
>y : any
|
||||
|
||||
var v7 = x;
|
||||
>v7 : any
|
||||
>x : any
|
||||
>v7 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v7});
|
||||
>(function() { return x + y + v7}) : () => any
|
||||
@@ -252,7 +252,7 @@ do {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v7 : any
|
||||
>v7 : undefined
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => any
|
||||
@@ -268,16 +268,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v8 = x;
|
||||
>v8 : number
|
||||
@@ -369,27 +369,27 @@ for (const x in []) {
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v1_c = x;
|
||||
>v1_c : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + v1_c});
|
||||
>(function() { return x + v1_c}) : () => number
|
||||
>function() { return x + v1_c} : () => number
|
||||
>x + v1_c : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>v1_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 0
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -398,46 +398,46 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x =1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v2_c = x;
|
||||
>v2_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v2_c});
|
||||
>(function() { return x + v2_c}) : () => number
|
||||
>function() { return x + v2_c} : () => number
|
||||
>x + v2_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v2_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v3_c = x;
|
||||
>v3_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v3_c});
|
||||
>(function() { return x + v3_c}) : () => number
|
||||
>function() { return x + v3_c} : () => number
|
||||
>x + v3_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v3_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -445,61 +445,61 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v4_c = x;
|
||||
>v4_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v4_c});
|
||||
>(function() { return x + v4_c}) : () => number
|
||||
>function() { return x + v4_c} : () => number
|
||||
>x + v4_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v4_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v5_c = x;
|
||||
>v5_c : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + y + v5_c});
|
||||
>(function() { return x + y + v5_c}) : () => number
|
||||
>function() { return x + y + v5_c} : () => number
|
||||
>x + y + v5_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>v5_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -508,58 +508,58 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v6_c = x;
|
||||
>v6_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v6_c});
|
||||
>(function() { return x + y + v6_c}) : () => number
|
||||
>function() { return x + y + v6_c} : () => number
|
||||
>x + y + v6_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v6_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v7_c = x;
|
||||
>v7_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v7_c});
|
||||
>(function() { return x + y + v7_c}) : () => number
|
||||
>function() { return x + y + v7_c} : () => number
|
||||
>x + y + v7_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v7_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -567,34 +567,34 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v8_c = x;
|
||||
>v8_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v8_c});
|
||||
>(function() { return x + y + v8_c}) : () => number
|
||||
>function() { return x + y + v8_c} : () => number
|
||||
>x + y + v8_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>v8_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(90,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(110,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(117,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(137,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop4_ES6.ts (4 errors) ====
|
||||
|
||||
//======let
|
||||
export function exportedFoo() {
|
||||
return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8;
|
||||
}
|
||||
|
||||
for (let x of []) {
|
||||
var v0 = x;
|
||||
(function() { return x + v0});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x in []) {
|
||||
var v00 = x;
|
||||
(function() { return x + v00});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
var v1 = x;
|
||||
(function() { return x + v1});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x;
|
||||
var v2 = x;
|
||||
(function() { return x + v2});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
var v3 = x;
|
||||
(function() { return x + v3});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
var v4 = x;
|
||||
(function() { return x + v4});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
var v5 = x;
|
||||
(function() { return x + y + v5});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
let x, y;
|
||||
var v6 = x;
|
||||
(function() { return x + y + v6});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
let x, y;
|
||||
var v7 = x;
|
||||
(function() { return x + y + v7});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
let x = 1;
|
||||
var v8 = x;
|
||||
(function() { return x + y + v8});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
//======const
|
||||
export function exportedFoo2() {
|
||||
return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c;
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
var v0_c = x;
|
||||
(function() { return x + v0_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
var v00_c = x;
|
||||
(function() { return x + v00});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v1_c = x;
|
||||
(function() { return x + v1_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x =1;
|
||||
var v2_c = x;
|
||||
(function() { return x + v2_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
var v3_c = x;
|
||||
(function() { return x + v3_c});
|
||||
(() => x);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v4_c = x;
|
||||
(function() { return x + v4_c});
|
||||
(() => x);
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v5_c = x;
|
||||
(function() { return x + y + v5_c});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
const x = 1, y = 1;
|
||||
var v6_c = x;
|
||||
(function() { return x + y + v6_c});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
var v7_c = x;
|
||||
(function() { return x + y + v7_c});
|
||||
(() => x + y);
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v8_c = x;
|
||||
(function() { return x + y + v8_c});
|
||||
(() => x + y);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ export function exportedFoo() {
|
||||
>v0 : any
|
||||
>v00 : string
|
||||
>v1 : number
|
||||
>v2 : any
|
||||
>v3 : any
|
||||
>v2 : undefined
|
||||
>v3 : undefined
|
||||
>v4 : number
|
||||
>v5 : number
|
||||
>v6 : any
|
||||
>v7 : any
|
||||
>v6 : undefined
|
||||
>v7 : undefined
|
||||
>v8 : number
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ for (let x in []) {
|
||||
|
||||
for (let x = 0; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -103,15 +103,15 @@ while (1 === 1) {
|
||||
>x : any
|
||||
|
||||
var v2 = x;
|
||||
>v2 : any
|
||||
>x : any
|
||||
>v2 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + v2});
|
||||
>(function() { return x + v2}) : () => any
|
||||
>function() { return x + v2} : () => any
|
||||
>x + v2 : any
|
||||
>x : any
|
||||
>v2 : any
|
||||
>v2 : undefined
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => any
|
||||
@@ -124,15 +124,15 @@ do {
|
||||
>x : any
|
||||
|
||||
var v3 = x;
|
||||
>v3 : any
|
||||
>x : any
|
||||
>v3 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + v3});
|
||||
>(function() { return x + v3}) : () => any
|
||||
>function() { return x + v3} : () => any
|
||||
>x + v3 : any
|
||||
>x : any
|
||||
>v3 : any
|
||||
>v3 : undefined
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => any
|
||||
@@ -146,16 +146,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v4 = x;
|
||||
>v4 : number
|
||||
@@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) {
|
||||
|
||||
for (let x = 0, y = 1; x < 1; ++x) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++x : number
|
||||
>x : number
|
||||
|
||||
@@ -216,8 +216,8 @@ while (1 === 1) {
|
||||
>y : any
|
||||
|
||||
var v6 = x;
|
||||
>v6 : any
|
||||
>x : any
|
||||
>v6 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v6});
|
||||
>(function() { return x + y + v6}) : () => any
|
||||
@@ -226,7 +226,7 @@ while (1 === 1) {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v6 : any
|
||||
>v6 : undefined
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => any
|
||||
@@ -242,8 +242,8 @@ do {
|
||||
>y : any
|
||||
|
||||
var v7 = x;
|
||||
>v7 : any
|
||||
>x : any
|
||||
>v7 : undefined
|
||||
>x : undefined
|
||||
|
||||
(function() { return x + y + v7});
|
||||
>(function() { return x + y + v7}) : () => any
|
||||
@@ -252,7 +252,7 @@ do {
|
||||
>x + y : any
|
||||
>x : any
|
||||
>y : any
|
||||
>v7 : any
|
||||
>v7 : undefined
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => any
|
||||
@@ -268,16 +268,16 @@ do {
|
||||
|
||||
for (let y = 0; y < 1; ++y) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
>++y : number
|
||||
>y : number
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>1 : 1
|
||||
|
||||
var v8 = x;
|
||||
>v8 : number
|
||||
@@ -369,27 +369,27 @@ for (const x in []) {
|
||||
}
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v1_c = x;
|
||||
>v1_c : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + v1_c});
|
||||
>(function() { return x + v1_c}) : () => number
|
||||
>function() { return x + v1_c} : () => number
|
||||
>x + v1_c : number
|
||||
>x : number
|
||||
>x : 0
|
||||
>v1_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 0
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -398,46 +398,46 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x =1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v2_c = x;
|
||||
>v2_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v2_c});
|
||||
>(function() { return x + v2_c}) : () => number
|
||||
>function() { return x + v2_c} : () => number
|
||||
>x + v2_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v2_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v3_c = x;
|
||||
>v3_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v3_c});
|
||||
>(function() { return x + v3_c}) : () => number
|
||||
>function() { return x + v3_c} : () => number
|
||||
>x + v3_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v3_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -445,61 +445,61 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v4_c = x;
|
||||
>v4_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + v4_c});
|
||||
>(function() { return x + v4_c}) : () => number
|
||||
>function() { return x + v4_c} : () => number
|
||||
>x + v4_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
>v4_c : number
|
||||
|
||||
(() => x);
|
||||
>(() => x) : () => number
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
>x : 1
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>0 : 0
|
||||
>y : 1
|
||||
>1 : 1
|
||||
>x < 1 : boolean
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 0
|
||||
>1 : 1
|
||||
|
||||
var v5_c = x;
|
||||
>v5_c : number
|
||||
>x : number
|
||||
>x : 0
|
||||
|
||||
(function() { return x + y + v5_c});
|
||||
>(function() { return x + y + v5_c}) : () => number
|
||||
>function() { return x + y + v5_c} : () => number
|
||||
>x + y + v5_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
>v5_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 0
|
||||
>y : 1
|
||||
}
|
||||
|
||||
while (1 === 1) {
|
||||
@@ -508,58 +508,58 @@ while (1 === 1) {
|
||||
>1 : 1
|
||||
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v6_c = x;
|
||||
>v6_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v6_c});
|
||||
>(function() { return x + y + v6_c}) : () => number
|
||||
>function() { return x + y + v6_c} : () => number
|
||||
>x + y + v6_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v6_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
}
|
||||
|
||||
do {
|
||||
const x = 1, y = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
>y : 1
|
||||
>1 : 1
|
||||
|
||||
var v7_c = x;
|
||||
>v7_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v7_c});
|
||||
>(function() { return x + y + v7_c}) : () => number
|
||||
>function() { return x + y + v7_c} : () => number
|
||||
>x + y + v7_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
>v7_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 1
|
||||
|
||||
} while (1 === 1)
|
||||
>1 === 1 : boolean
|
||||
@@ -567,34 +567,34 @@ do {
|
||||
>1 : 1
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
>y : number
|
||||
>0 : number
|
||||
>y : 0
|
||||
>0 : 0
|
||||
>y < 1 : boolean
|
||||
>y : number
|
||||
>1 : number
|
||||
>y : 0
|
||||
>1 : 1
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
var v8_c = x;
|
||||
>v8_c : number
|
||||
>x : number
|
||||
>x : 1
|
||||
|
||||
(function() { return x + y + v8_c});
|
||||
>(function() { return x + y + v8_c}) : () => number
|
||||
>function() { return x + y + v8_c} : () => number
|
||||
>x + y + v8_c : number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
>v8_c : number
|
||||
|
||||
(() => x + y);
|
||||
>(() => x + y) : () => number
|
||||
>() => x + y : () => number
|
||||
>x + y : number
|
||||
>x : number
|
||||
>y : number
|
||||
>x : 1
|
||||
>y : 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop5.ts(170,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5.ts(174,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5.ts(211,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5.ts(225,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5.ts(229,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop5.ts (6 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop5.ts (2 errors) ====
|
||||
declare function use(a: any);
|
||||
|
||||
//====let
|
||||
@@ -177,8 +173,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||
|
||||
function foo1_c(x) {
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
@@ -222,8 +216,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||
|
||||
function foo4_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = y;
|
||||
let x = 1;
|
||||
(function() { return x + v });
|
||||
@@ -238,8 +230,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||
|
||||
function foo5_c(x) {
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
@@ -285,8 +275,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(171,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(175,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(212,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(226,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(230,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop5_ES6.ts (6 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop5_ES6.ts (2 errors) ====
|
||||
|
||||
declare function use(a: any);
|
||||
|
||||
@@ -178,8 +174,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||
|
||||
function foo1_c(x) {
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + v });
|
||||
(() => x + v);
|
||||
@@ -223,8 +217,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||
|
||||
function foo4_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = y;
|
||||
let x = 1;
|
||||
(function() { return x + v });
|
||||
@@ -239,8 +231,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||
|
||||
function foo5_c(x) {
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
@@ -286,8 +276,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(144,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(147,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(150,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(179,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(191,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(194,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(197,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop6.ts (8 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop6.ts (4 errors) ====
|
||||
// ====let
|
||||
for (let x of []) {
|
||||
(function() { return x});
|
||||
@@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
if (x == 1) {
|
||||
@@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
@@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
if (x == 1) {
|
||||
@@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(144,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(147,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(150,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(179,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(191,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(194,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(197,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop6_ES6.ts (8 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop6_ES6.ts (4 errors) ====
|
||||
// ====let
|
||||
for (let x of []) {
|
||||
(function() { return x});
|
||||
@@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||
|
||||
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
if (x == 1) {
|
||||
@@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
@@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||
}
|
||||
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
if (x == 1) {
|
||||
@@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||
} while (1 === 1)
|
||||
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(227,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(230,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(233,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(236,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(239,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(283,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(302,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(305,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(308,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(311,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(314,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop7.ts (12 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop7.ts (8 errors) ====
|
||||
//===let
|
||||
l0:
|
||||
for (let x of []) {
|
||||
@@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||
|
||||
l1_c:
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
if (x == 1) {
|
||||
@@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||
|
||||
l4_c:
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
@@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||
|
||||
l5_c:
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
if (x == 1) {
|
||||
@@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||
|
||||
l8_c:
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(227,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(230,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(233,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(236,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(239,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(283,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(302,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(305,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(308,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(311,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(314,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
|
||||
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop7_ES6.ts (12 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop7_ES6.ts (8 errors) ====
|
||||
//===let
|
||||
l0:
|
||||
for (let x of []) {
|
||||
@@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||
|
||||
l1_c:
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
if (x == 1) {
|
||||
@@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||
|
||||
l4_c:
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x});
|
||||
(() => x);
|
||||
@@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||
|
||||
l5_c:
|
||||
for (const x = 0, y = 1; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
if (x == 1) {
|
||||
@@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||
|
||||
l8_c:
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
const x = 1;
|
||||
(function() { return x + y});
|
||||
(() => x + y);
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(66,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(68,27): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(70,31): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(73,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(76,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(79,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
@@ -19,7 +16,7 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(117,17): error TS2365: Operator
|
||||
tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator '==' cannot be applied to types '0' and '3'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop8.ts (19 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop8.ts (16 errors) ====
|
||||
function foo() {
|
||||
l0:
|
||||
for (let z = 0; z < 1; ++z) {
|
||||
@@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator
|
||||
function foo_c() {
|
||||
l0:
|
||||
for (const z = 0; z < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
l1:
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
ll1:
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y });
|
||||
(() => x + y);
|
||||
if (y == 1) {
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(66,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(68,27): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(70,31): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(73,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(76,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(79,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
|
||||
@@ -19,7 +16,7 @@ tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(117,17): error TS2365: Opera
|
||||
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(120,17): error TS2365: Operator '==' cannot be applied to types '0' and '3'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/capturedLetConstInLoop8_ES6.ts (19 errors) ====
|
||||
==== tests/cases/compiler/capturedLetConstInLoop8_ES6.ts (16 errors) ====
|
||||
function foo() {
|
||||
l0:
|
||||
for (let z = 0; z < 1; ++z) {
|
||||
@@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(120,17): error TS2365: Opera
|
||||
function foo_c() {
|
||||
l0:
|
||||
for (const z = 0; z < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
l1:
|
||||
for (const x = 0; x < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
ll1:
|
||||
for (const y = 0; y < 1;) {
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
(function() { return x + y });
|
||||
(() => x + y);
|
||||
if (y == 1) {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(5,1): error TS2365: Operator '>' cannot be applied to types 'BrandedNum' and '0'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(10,1): error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(15,1): error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'.
|
||||
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(20,1): error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts (4 errors) ====
|
||||
type BrandedNum = number & { __numberBrand: any };
|
||||
var x : BrandedNum;
|
||||
|
||||
// operator >
|
||||
x > 0;
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'BrandedNum' and '0'.
|
||||
x > <number>0;
|
||||
x > <BrandedNum>0;
|
||||
|
||||
// operator <
|
||||
x < 0;
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'.
|
||||
x < <number>0;
|
||||
x < <BrandedNum>0;
|
||||
|
||||
// operator >=
|
||||
x >= 0;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'.
|
||||
x >= <number>0;
|
||||
x >= <BrandedNum>0;
|
||||
|
||||
// operator <=
|
||||
x <= 0;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'.
|
||||
x <= <number>0;
|
||||
x <= <BrandedNum>0;
|
||||
|
||||
// operator ==
|
||||
x == 0;
|
||||
x == <number>0;
|
||||
x == <BrandedNum>0;
|
||||
|
||||
// operator !=
|
||||
x != 0;
|
||||
x != <number>0;
|
||||
x != <BrandedNum>0;
|
||||
|
||||
// operator ===
|
||||
x === 0;
|
||||
x === <number>0;
|
||||
x === <BrandedNum>0;
|
||||
|
||||
// operator !==
|
||||
x !== 0;
|
||||
x !== <number>0;
|
||||
x !== <BrandedNum>0;
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts ===
|
||||
type BrandedNum = number & { __numberBrand: any };
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
>__numberBrand : Symbol(__numberBrand, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 28))
|
||||
|
||||
var x : BrandedNum;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator >
|
||||
x > 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x > <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x > <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator <
|
||||
x < 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x < <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x < <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator >=
|
||||
x >= 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x >= <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x >= <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator <=
|
||||
x <= 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x <= <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x <= <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator ==
|
||||
x == 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x == <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x == <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator !=
|
||||
x != 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x != <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x != <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator ===
|
||||
x === 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x === <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x === <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
// operator !==
|
||||
x !== 0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x !== <number>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
|
||||
x !== <BrandedNum>0;
|
||||
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts ===
|
||||
type BrandedNum = number & { __numberBrand: any };
|
||||
>BrandedNum : BrandedNum
|
||||
>__numberBrand : any
|
||||
|
||||
var x : BrandedNum;
|
||||
>x : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
|
||||
// operator >
|
||||
x > 0;
|
||||
>x > 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x > <number>0;
|
||||
>x > <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x > <BrandedNum>0;
|
||||
>x > <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator <
|
||||
x < 0;
|
||||
>x < 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x < <number>0;
|
||||
>x < <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x < <BrandedNum>0;
|
||||
>x < <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator >=
|
||||
x >= 0;
|
||||
>x >= 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x >= <number>0;
|
||||
>x >= <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x >= <BrandedNum>0;
|
||||
>x >= <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator <=
|
||||
x <= 0;
|
||||
>x <= 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x <= <number>0;
|
||||
>x <= <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x <= <BrandedNum>0;
|
||||
>x <= <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator ==
|
||||
x == 0;
|
||||
>x == 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x == <number>0;
|
||||
>x == <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x == <BrandedNum>0;
|
||||
>x == <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator !=
|
||||
x != 0;
|
||||
>x != 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x != <number>0;
|
||||
>x != <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x != <BrandedNum>0;
|
||||
>x != <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator ===
|
||||
x === 0;
|
||||
>x === 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x === <number>0;
|
||||
>x === <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x === <BrandedNum>0;
|
||||
>x === <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
// operator !==
|
||||
x !== 0;
|
||||
>x !== 0 : boolean
|
||||
>x : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
x !== <number>0;
|
||||
>x !== <number>0 : boolean
|
||||
>x : BrandedNum
|
||||
><number>0 : number
|
||||
>0 : 0
|
||||
|
||||
x !== <BrandedNum>0;
|
||||
>x !== <BrandedNum>0 : boolean
|
||||
>x : BrandedNum
|
||||
><BrandedNum>0 : BrandedNum
|
||||
>BrandedNum : BrandedNum
|
||||
>0 : 0
|
||||
|
||||
@@ -41,13 +41,13 @@ let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}];
|
||||
// destructuring in variable declarations
|
||||
var foo = "bar";
|
||||
var _a = foo, bar = { bar: "bar" }[_a];
|
||||
var _b = "bar", bar2 = { bar: "bar" }[_b];
|
||||
var bar2 = { bar: "bar" }["bar"];
|
||||
var foo2 = function () { return "bar"; };
|
||||
var _c = foo2(), bar3 = { bar: "bar" }[_c];
|
||||
var _d = foo, bar4 = [{ bar: "bar" }][0][_d];
|
||||
var _e = foo2(), bar5 = [{ bar: "bar" }][0][_e];
|
||||
var _b = foo2(), bar3 = { bar: "bar" }[_b];
|
||||
var _c = foo, bar4 = [{ bar: "bar" }][0][_c];
|
||||
var _d = foo2(), bar5 = [{ bar: "bar" }][0][_d];
|
||||
function f1(_a) {
|
||||
var _b = "bar", x = _a[_b];
|
||||
var x = _a["bar"];
|
||||
}
|
||||
function f2(_a) {
|
||||
var _b = foo, x = _a[_b];
|
||||
@@ -62,14 +62,14 @@ function f5(_a) {
|
||||
var _b = foo2(), x = _a[0][_b];
|
||||
}
|
||||
// report errors on type errors in computed properties used in destructuring
|
||||
var _f = foo(), bar6 = [{ bar: "bar" }][0][_f];
|
||||
var _g = foo.toExponential(), bar7 = [{ bar: "bar" }][0][_g];
|
||||
var _e = foo(), bar6 = [{ bar: "bar" }][0][_e];
|
||||
var _f = foo.toExponential(), bar7 = [{ bar: "bar" }][0][_f];
|
||||
// destructuring assignment
|
||||
(_h = foo, bar = { bar: "bar" }[_h]);
|
||||
(_j = "bar", bar2 = { bar: "bar" }[_j]);
|
||||
(_k = foo2(), bar3 = { bar: "bar" }[_k]);
|
||||
_l = foo, bar4 = [{ bar: "bar" }][0][_l];
|
||||
_m = foo2(), bar5 = [{ bar: "bar" }][0][_m];
|
||||
_o = foo(), bar4 = [{ bar: "bar" }][0][_o];
|
||||
_p = (1 + {}), bar4 = [{ bar: "bar" }][0][_p];
|
||||
var _h, _j, _k, _l, _m, _o, _p;
|
||||
(_g = foo, bar = { bar: "bar" }[_g]);
|
||||
(bar2 = { bar: "bar" }["bar"]);
|
||||
(_h = foo2(), bar3 = { bar: "bar" }[_h]);
|
||||
_j = foo, bar4 = [{ bar: "bar" }][0][_j];
|
||||
_k = foo2(), bar5 = [{ bar: "bar" }][0][_k];
|
||||
_l = foo(), bar4 = [{ bar: "bar" }][0][_l];
|
||||
_m = (1 + {}), bar4 = [{ bar: "bar" }][0][_m];
|
||||
var _g, _h, _j, _k, _l, _m;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts(35,1): error TS2365: Operator '>' cannot be applied to types '2' and '1'.
|
||||
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts(58,23): error TS2365: Operator '>' cannot be applied to types '2' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts (2 errors) ====
|
||||
//Cond ? Expr1 : Expr2, Cond is of boolean type, Expr1 and Expr2 have the same type
|
||||
var condBoolean: boolean;
|
||||
|
||||
var exprAny1: any;
|
||||
var exprBoolean1: boolean;
|
||||
var exprNumber1: number;
|
||||
var exprString1: string;
|
||||
var exprIsObject1: Object;
|
||||
|
||||
var exprAny2: any;
|
||||
var exprBoolean2: boolean;
|
||||
var exprNumber2: number;
|
||||
var exprString2: string;
|
||||
var exprIsObject2: Object;
|
||||
|
||||
//Cond is a boolean type variable
|
||||
condBoolean ? exprAny1 : exprAny2;
|
||||
condBoolean ? exprBoolean1 : exprBoolean2;
|
||||
condBoolean ? exprNumber1 : exprNumber2;
|
||||
condBoolean ? exprString1 : exprString2;
|
||||
condBoolean ? exprIsObject1 : exprIsObject2;
|
||||
condBoolean ? exprString1 : exprBoolean1; // union
|
||||
|
||||
//Cond is a boolean type literal
|
||||
true ? exprAny1 : exprAny2;
|
||||
false ? exprBoolean1 : exprBoolean2;
|
||||
true ? exprNumber1 : exprNumber2;
|
||||
false ? exprString1 : exprString2;
|
||||
true ? exprIsObject1 : exprIsObject2;
|
||||
true ? exprString1 : exprBoolean1; // union
|
||||
|
||||
//Cond is a boolean type expression
|
||||
!true ? exprAny1 : exprAny2;
|
||||
typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
2 > 1 ? exprNumber1 : exprNumber2;
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types '2' and '1'.
|
||||
null === undefined ? exprString1 : exprString2;
|
||||
true || false ? exprIsObject1 : exprIsObject2;
|
||||
null === undefined ? exprString1 : exprBoolean1; // union
|
||||
|
||||
//Results shoud be same as Expr1 and Expr2
|
||||
var resultIsAny1 = condBoolean ? exprAny1 : exprAny2;
|
||||
var resultIsBoolean1 = condBoolean ? exprBoolean1 : exprBoolean2;
|
||||
var resultIsNumber1 = condBoolean ? exprNumber1 : exprNumber2;
|
||||
var resultIsString1 = condBoolean ? exprString1 : exprString2;
|
||||
var resultIsObject1 = condBoolean ? exprIsObject1 : exprIsObject2;
|
||||
var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // union
|
||||
|
||||
var resultIsAny2 = true ? exprAny1 : exprAny2;
|
||||
var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2;
|
||||
var resultIsNumber2 = true ? exprNumber1 : exprNumber2;
|
||||
var resultIsString2 = false ? exprString1 : exprString2;
|
||||
var resultIsObject2 = true ? exprIsObject1 : exprIsObject2;
|
||||
var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union
|
||||
var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union
|
||||
|
||||
var resultIsAny3 = !true ? exprAny1 : exprAny2;
|
||||
var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2;
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types '2' and '1'.
|
||||
var resultIsString3 = null === undefined ? exprString1 : exprString2;
|
||||
var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2;
|
||||
var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoolean1; // union
|
||||
|
||||
@@ -75,37 +75,37 @@ condBoolean ? exprString1 : exprBoolean1; // union
|
||||
//Cond is a boolean type literal
|
||||
true ? exprAny1 : exprAny2;
|
||||
>true ? exprAny1 : exprAny2 : any
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprAny1 : any
|
||||
>exprAny2 : any
|
||||
|
||||
false ? exprBoolean1 : exprBoolean2;
|
||||
>false ? exprBoolean1 : exprBoolean2 : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprBoolean1 : boolean
|
||||
>exprBoolean2 : boolean
|
||||
|
||||
true ? exprNumber1 : exprNumber2;
|
||||
>true ? exprNumber1 : exprNumber2 : number
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprNumber1 : number
|
||||
>exprNumber2 : number
|
||||
|
||||
false ? exprString1 : exprString2;
|
||||
>false ? exprString1 : exprString2 : string
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprString1 : string
|
||||
>exprString2 : string
|
||||
|
||||
true ? exprIsObject1 : exprIsObject2;
|
||||
>true ? exprIsObject1 : exprIsObject2 : Object
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprIsObject1 : Object
|
||||
>exprIsObject2 : Object
|
||||
|
||||
true ? exprString1 : exprBoolean1; // union
|
||||
>true ? exprString1 : exprBoolean1 : string | boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprString1 : string
|
||||
>exprBoolean1 : boolean
|
||||
|
||||
@@ -113,7 +113,7 @@ true ? exprString1 : exprBoolean1; // union
|
||||
!true ? exprAny1 : exprAny2;
|
||||
>!true ? exprAny1 : exprAny2 : any
|
||||
>!true : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprAny1 : any
|
||||
>exprAny2 : any
|
||||
|
||||
@@ -121,7 +121,7 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
||||
>typeof "123" == "string" : boolean
|
||||
>typeof "123" : string
|
||||
>"123" : string
|
||||
>"123" : "123"
|
||||
>"string" : "string"
|
||||
>exprBoolean1 : boolean
|
||||
>exprBoolean2 : boolean
|
||||
@@ -129,8 +129,8 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
2 > 1 ? exprNumber1 : exprNumber2;
|
||||
>2 > 1 ? exprNumber1 : exprNumber2 : number
|
||||
>2 > 1 : boolean
|
||||
>2 : number
|
||||
>1 : number
|
||||
>2 : 2
|
||||
>1 : 1
|
||||
>exprNumber1 : number
|
||||
>exprNumber2 : number
|
||||
|
||||
@@ -145,7 +145,7 @@ null === undefined ? exprString1 : exprString2;
|
||||
true || false ? exprIsObject1 : exprIsObject2;
|
||||
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
||||
>true || false : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
>false : false
|
||||
>exprIsObject1 : Object
|
||||
>exprIsObject2 : Object
|
||||
@@ -204,49 +204,49 @@ var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // unio
|
||||
var resultIsAny2 = true ? exprAny1 : exprAny2;
|
||||
>resultIsAny2 : any
|
||||
>true ? exprAny1 : exprAny2 : any
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprAny1 : any
|
||||
>exprAny2 : any
|
||||
|
||||
var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2;
|
||||
>resultIsBoolean2 : boolean
|
||||
>false ? exprBoolean1 : exprBoolean2 : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprBoolean1 : boolean
|
||||
>exprBoolean2 : boolean
|
||||
|
||||
var resultIsNumber2 = true ? exprNumber1 : exprNumber2;
|
||||
>resultIsNumber2 : number
|
||||
>true ? exprNumber1 : exprNumber2 : number
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprNumber1 : number
|
||||
>exprNumber2 : number
|
||||
|
||||
var resultIsString2 = false ? exprString1 : exprString2;
|
||||
>resultIsString2 : string
|
||||
>false ? exprString1 : exprString2 : string
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprString1 : string
|
||||
>exprString2 : string
|
||||
|
||||
var resultIsObject2 = true ? exprIsObject1 : exprIsObject2;
|
||||
>resultIsObject2 : Object
|
||||
>true ? exprIsObject1 : exprIsObject2 : Object
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprIsObject1 : Object
|
||||
>exprIsObject2 : Object
|
||||
|
||||
var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union
|
||||
>resultIsStringOrBoolean2 : string | boolean
|
||||
>true ? exprString1 : exprBoolean1 : string | boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprString1 : string
|
||||
>exprBoolean1 : boolean
|
||||
|
||||
var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union
|
||||
>resultIsStringOrBoolean3 : string | boolean
|
||||
>false ? exprString1 : exprBoolean1 : string | boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprString1 : string
|
||||
>exprBoolean1 : boolean
|
||||
|
||||
@@ -254,7 +254,7 @@ var resultIsAny3 = !true ? exprAny1 : exprAny2;
|
||||
>resultIsAny3 : any
|
||||
>!true ? exprAny1 : exprAny2 : any
|
||||
>!true : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
>exprAny1 : any
|
||||
>exprAny2 : any
|
||||
|
||||
@@ -263,7 +263,7 @@ var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
||||
>typeof "123" == "string" : boolean
|
||||
>typeof "123" : string
|
||||
>"123" : string
|
||||
>"123" : "123"
|
||||
>"string" : "string"
|
||||
>exprBoolean1 : boolean
|
||||
>exprBoolean2 : boolean
|
||||
@@ -272,8 +272,8 @@ var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2;
|
||||
>resultIsNumber3 : number
|
||||
>2 > 1 ? exprNumber1 : exprNumber2 : number
|
||||
>2 > 1 : boolean
|
||||
>2 : number
|
||||
>1 : number
|
||||
>2 : 2
|
||||
>1 : 1
|
||||
>exprNumber1 : number
|
||||
>exprNumber2 : number
|
||||
|
||||
@@ -290,7 +290,7 @@ var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2;
|
||||
>resultIsObject3 : Object
|
||||
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
||||
>true || false : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
>false : false
|
||||
>exprIsObject1 : Object
|
||||
>exprIsObject2 : Object
|
||||
@@ -300,7 +300,7 @@ var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoo
|
||||
>typeof "123" === "string" ? exprString1 : exprBoolean1 : string | boolean
|
||||
>typeof "123" === "string" : boolean
|
||||
>typeof "123" : string
|
||||
>"123" : string
|
||||
>"123" : "123"
|
||||
>"string" : "string"
|
||||
>exprString1 : string
|
||||
>exprBoolean1 : boolean
|
||||
|
||||
@@ -4,14 +4,12 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec
|
||||
tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(10,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property.
|
||||
tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-errors.ts (11 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ====
|
||||
|
||||
// error, missing intialicer
|
||||
const c1;
|
||||
@@ -34,8 +32,6 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator
|
||||
|
||||
// error, assigning to a const
|
||||
for(const c8 = 0; c8 < 1; c8++) { }
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
~~
|
||||
!!! error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property.
|
||||
|
||||
@@ -47,6 +43,4 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator
|
||||
// error, can not be unintalized
|
||||
for(const c10 = 0, c11; c10 < 1;) { }
|
||||
~~~
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
||||
@@ -1,21 +0,0 @@
|
||||
tests/cases/compiler/constDeclarations-scopes2.ts(9,19): error TS2365: Operator '<' cannot be applied to types '0' and '10'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-scopes2.ts (1 errors) ====
|
||||
|
||||
// global
|
||||
const c = "string";
|
||||
|
||||
var n: number;
|
||||
var b: boolean;
|
||||
|
||||
// for scope
|
||||
for (const c = 0; c < 10; n = c ) {
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '10'.
|
||||
// for block
|
||||
const c = false;
|
||||
b = c;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
// global
|
||||
const c = "string";
|
||||
>c : string
|
||||
>"string" : string
|
||||
>c : "string"
|
||||
>"string" : "string"
|
||||
|
||||
var n: number;
|
||||
>n : number
|
||||
@@ -13,24 +13,24 @@ var b: boolean;
|
||||
|
||||
// for scope
|
||||
for (const c = 0; c < 10; n = c ) {
|
||||
>c : number
|
||||
>0 : number
|
||||
>c : 0
|
||||
>0 : 0
|
||||
>c < 10 : boolean
|
||||
>c : number
|
||||
>10 : number
|
||||
>n = c : number
|
||||
>c : 0
|
||||
>10 : 10
|
||||
>n = c : 0
|
||||
>n : number
|
||||
>c : number
|
||||
>c : 0
|
||||
|
||||
// for block
|
||||
const c = false;
|
||||
>c : boolean
|
||||
>false : boolean
|
||||
>c : false
|
||||
>false : false
|
||||
|
||||
b = c;
|
||||
>b = c : boolean
|
||||
>b = c : false
|
||||
>b : boolean
|
||||
>c : boolean
|
||||
>c : false
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
tests/cases/compiler/constDeclarations.ts(8,19): error TS2365: Operator '<' cannot be applied to types '0' and '9'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations.ts (1 errors) ====
|
||||
|
||||
// No error
|
||||
const c1 = false;
|
||||
const c2: number = 23;
|
||||
const c3 = 0, c4 :string = "", c5 = null;
|
||||
|
||||
|
||||
for(const c4 = 0; c4 < 9; ) { break; }
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '9'.
|
||||
|
||||
|
||||
for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
|
||||
@@ -2,36 +2,36 @@
|
||||
|
||||
// No error
|
||||
const c1 = false;
|
||||
>c1 : boolean
|
||||
>false : boolean
|
||||
>c1 : false
|
||||
>false : false
|
||||
|
||||
const c2: number = 23;
|
||||
>c2 : number
|
||||
>23 : number
|
||||
>23 : 23
|
||||
|
||||
const c3 = 0, c4 :string = "", c5 = null;
|
||||
>c3 : number
|
||||
>0 : number
|
||||
>c3 : 0
|
||||
>0 : 0
|
||||
>c4 : string
|
||||
>"" : string
|
||||
>"" : ""
|
||||
>c5 : any
|
||||
>null : null
|
||||
|
||||
|
||||
for(const c4 = 0; c4 < 9; ) { break; }
|
||||
>c4 : number
|
||||
>0 : number
|
||||
>c4 : 0
|
||||
>0 : 0
|
||||
>c4 < 9 : boolean
|
||||
>c4 : number
|
||||
>9 : number
|
||||
>c4 : 0
|
||||
>9 : 9
|
||||
|
||||
|
||||
for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
|
||||
>c5 : number
|
||||
>0 : number
|
||||
>c6 : number
|
||||
>0 : number
|
||||
>c5 : 0
|
||||
>0 : 0
|
||||
>c6 : 0
|
||||
>0 : 0
|
||||
>c5 < c6 : boolean
|
||||
>c5 : number
|
||||
>c6 : number
|
||||
>c5 : 0
|
||||
>c6 : 0
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ function f2(_a) {
|
||||
var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v.toString(); } : _b;
|
||||
}
|
||||
function f3(_a) {
|
||||
var _b = "show", _c = _a[_b], showRename = _c === void 0 ? function (v) { return v.toString(); } : _c;
|
||||
var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v.toString(); } : _b;
|
||||
}
|
||||
function ff(_a) {
|
||||
var _b = _a.nested, nested = _b === void 0 ? { show: function (v) { return v.toString(); } } : _b;
|
||||
|
||||
@@ -35,7 +35,7 @@ function f2(_a) {
|
||||
var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v; } : _b;
|
||||
}
|
||||
function f3(_a) {
|
||||
var _b = "show", _c = _a[_b], showRename = _c === void 0 ? function (v) { return v; } : _c;
|
||||
var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v; } : _b;
|
||||
}
|
||||
function ff(_a) {
|
||||
var _b = _a.nested, nestedRename = _b === void 0 ? { show: function (v) { return v; } } : _b;
|
||||
|
||||
@@ -2,7 +2,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithm
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
~
|
||||
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
bytes.push(fb.readByte());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithme
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
~
|
||||
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
bytes.push(fb.readByte());
|
||||
|
||||
@@ -16,16 +16,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var C = (function () {
|
||||
var C = C_1 = (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C.x = function () { return C.y; };
|
||||
C.x = function () { return C_1.y; };
|
||||
C.prototype.method = function () { };
|
||||
return C;
|
||||
}());
|
||||
C.y = 1;
|
||||
C = __decorate([
|
||||
C = C_1 = __decorate([
|
||||
foo
|
||||
], C);
|
||||
export default C;
|
||||
var C_1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(8,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and '7'.
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
|
||||
tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
|
||||
@@ -20,7 +20,7 @@ tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' ca
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and '7'.
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
|
||||
f(g < A, B > +(7));
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
@@ -29,6 +29,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//// [objectRest.ts]
|
||||
let o = { a: 1, b: 'no' }
|
||||
var o = { a: 1, b: 'no' }
|
||||
var { ...clone } = o;
|
||||
var { a, ...justB } = o;
|
||||
var { a, b: renamed, ...empty } = o;
|
||||
@@ -31,21 +31,29 @@ class Removable {
|
||||
}
|
||||
var removable = new Removable();
|
||||
var { removed, ...removableRest } = removable;
|
||||
|
||||
let computed = 'b';
|
||||
let computed2 = 'a';
|
||||
var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
|
||||
({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o);
|
||||
|
||||
|
||||
//// [objectRest.js]
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};
|
||||
let o = { a: 1, b: 'no' };
|
||||
var o = { a: 1, b: 'no' };
|
||||
var clone = __rest(o, []);
|
||||
var { a } = o, justB = __rest(o, ["a"]);
|
||||
var { a, b: renamed } = o, empty = __rest(o, ["a", "b"]);
|
||||
var { ['b']: renamed } = o, justA = __rest(o, ["b"]);
|
||||
var { 'b': renamed } = o, justA = __rest(o, ["b"]);
|
||||
var { ['b']: renamed } = o, justA = __rest(o, ['b']);
|
||||
var { 'b': renamed } = o, justA = __rest(o, ['b']);
|
||||
var { b: { '0': n, '1': oooo } } = o, justA = __rest(o, ["b"]);
|
||||
let o2 = { c: 'terrible idea?', d: 'yes' };
|
||||
var { d: renamed } = o2, d = __rest(o2, ["d"]);
|
||||
@@ -64,4 +72,8 @@ class Removable {
|
||||
}
|
||||
var removable = new Removable();
|
||||
var { removed } = removable, removableRest = __rest(removable, ["removed"]);
|
||||
var _d, _f;
|
||||
let computed = 'b';
|
||||
let computed2 = 'a';
|
||||
var _g = computed, stillNotGreat = o[_g], _h = computed2, soSo = o[_h], o = __rest(o, [typeof _g === "symbol" ? _g : _g + "", typeof _h === "symbol" ? _h : _h + ""]);
|
||||
(_j = computed, stillNotGreat = o[_j], _k = computed2, soSo = o[_k], o = __rest(o, [typeof _j === "symbol" ? _j : _j + "", typeof _k === "symbol" ? _k : _k + ""]));
|
||||
var _d, _f, _j, _k;
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
=== tests/cases/conformance/types/rest/objectRest.ts ===
|
||||
let o = { a: 1, b: 'no' }
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
var o = { a: 1, b: 'no' }
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
>a : Symbol(a, Decl(objectRest.ts, 0, 9))
|
||||
>b : Symbol(b, Decl(objectRest.ts, 0, 15))
|
||||
|
||||
var { ...clone } = o;
|
||||
>clone : Symbol(clone, Decl(objectRest.ts, 1, 5))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
var { a, ...justB } = o;
|
||||
>a : Symbol(a, Decl(objectRest.ts, 2, 5), Decl(objectRest.ts, 3, 5))
|
||||
>justB : Symbol(justB, Decl(objectRest.ts, 2, 8))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
var { a, b: renamed, ...empty } = o;
|
||||
>a : Symbol(a, Decl(objectRest.ts, 2, 5), Decl(objectRest.ts, 3, 5))
|
||||
>b : Symbol(b, Decl(objectRest.ts, 0, 15))
|
||||
>renamed : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5))
|
||||
>empty : Symbol(empty, Decl(objectRest.ts, 3, 20))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
var { ['b']: renamed, ...justA } = o;
|
||||
>'b' : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5))
|
||||
>renamed : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5))
|
||||
>justA : Symbol(justA, Decl(objectRest.ts, 4, 21), Decl(objectRest.ts, 5, 19), Decl(objectRest.ts, 6, 31))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
var { 'b': renamed, ...justA } = o;
|
||||
>renamed : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5))
|
||||
>justA : Symbol(justA, Decl(objectRest.ts, 4, 21), Decl(objectRest.ts, 5, 19), Decl(objectRest.ts, 6, 31))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
var { b: { '0': n, '1': oooo }, ...justA } = o;
|
||||
>b : Symbol(b, Decl(objectRest.ts, 0, 15))
|
||||
>n : Symbol(n, Decl(objectRest.ts, 6, 10))
|
||||
>oooo : Symbol(oooo, Decl(objectRest.ts, 6, 18))
|
||||
>justA : Symbol(justA, Decl(objectRest.ts, 4, 21), Decl(objectRest.ts, 5, 19), Decl(objectRest.ts, 6, 31))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
let o2 = { c: 'terrible idea?', d: 'yes' };
|
||||
>o2 : Symbol(o2, Decl(objectRest.ts, 8, 3))
|
||||
@@ -91,8 +91,10 @@ var { x: { ka, ...nested }, y: other, ...rest } = complex;
|
||||
({x: { ka, ...nested }, y: other, ...rest} = complex);
|
||||
>x : Symbol(x, Decl(objectRest.ts, 16, 2))
|
||||
>ka : Symbol(ka, Decl(objectRest.ts, 16, 6))
|
||||
>nested : Symbol(nested, Decl(objectRest.ts, 15, 14))
|
||||
>y : Symbol(y, Decl(objectRest.ts, 16, 23))
|
||||
>other : Symbol(other, Decl(objectRest.ts, 15, 27))
|
||||
>rest : Symbol(rest, Decl(objectRest.ts, 15, 37))
|
||||
>complex : Symbol(complex, Decl(objectRest.ts, 14, 3))
|
||||
|
||||
var { x, ...fresh } = { x: 1, y: 2 };
|
||||
@@ -103,6 +105,7 @@ var { x, ...fresh } = { x: 1, y: 2 };
|
||||
|
||||
({ x, ...fresh } = { x: 1, y: 2 });
|
||||
>x : Symbol(x, Decl(objectRest.ts, 18, 2))
|
||||
>fresh : Symbol(fresh, Decl(objectRest.ts, 17, 8))
|
||||
>x : Symbol(x, Decl(objectRest.ts, 18, 20))
|
||||
>y : Symbol(y, Decl(objectRest.ts, 18, 26))
|
||||
|
||||
@@ -144,3 +147,25 @@ var { removed, ...removableRest } = removable;
|
||||
>removableRest : Symbol(removableRest, Decl(objectRest.ts, 31, 14))
|
||||
>removable : Symbol(removable, Decl(objectRest.ts, 30, 3))
|
||||
|
||||
let computed = 'b';
|
||||
>computed : Symbol(computed, Decl(objectRest.ts, 33, 3))
|
||||
|
||||
let computed2 = 'a';
|
||||
>computed2 : Symbol(computed2, Decl(objectRest.ts, 34, 3))
|
||||
|
||||
var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
|
||||
>computed : Symbol(computed, Decl(objectRest.ts, 33, 3))
|
||||
>stillNotGreat : Symbol(stillNotGreat, Decl(objectRest.ts, 35, 5))
|
||||
>computed2 : Symbol(computed2, Decl(objectRest.ts, 34, 3))
|
||||
>soSo : Symbol(soSo, Decl(objectRest.ts, 35, 32))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o);
|
||||
>computed : Symbol(computed, Decl(objectRest.ts, 33, 3))
|
||||
>stillNotGreat : Symbol(stillNotGreat, Decl(objectRest.ts, 35, 5))
|
||||
>computed2 : Symbol(computed2, Decl(objectRest.ts, 34, 3))
|
||||
>soSo : Symbol(soSo, Decl(objectRest.ts, 35, 32))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/types/rest/objectRest.ts ===
|
||||
let o = { a: 1, b: 'no' }
|
||||
var o = { a: 1, b: 'no' }
|
||||
>o : { a: number; b: string; }
|
||||
>{ a: 1, b: 'no' } : { a: number; b: string; }
|
||||
>a : number
|
||||
@@ -101,10 +101,10 @@ var { x: { ka, ...nested }, y: other, ...rest } = complex;
|
||||
>x : { ki: any; ka: any; }
|
||||
>{ ka, ...nested } : { ki: any; ka: any; }
|
||||
>ka : any
|
||||
>nested : any
|
||||
>nested : { ki: any; }
|
||||
>y : number
|
||||
>other : number
|
||||
>rest : any
|
||||
>rest : {}
|
||||
>complex : { x: { ka: any; ki: any; }; y: number; }
|
||||
|
||||
var { x, ...fresh } = { x: 1, y: 2 };
|
||||
@@ -121,7 +121,7 @@ var { x, ...fresh } = { x: 1, y: 2 };
|
||||
>{ x, ...fresh } = { x: 1, y: 2 } : { x: number; y: number; }
|
||||
>{ x, ...fresh } : { y: number; x: number; }
|
||||
>x : number
|
||||
>fresh : any
|
||||
>fresh : { y: number; }
|
||||
>{ x: 1, y: 2 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : 1
|
||||
@@ -168,3 +168,30 @@ var { removed, ...removableRest } = removable;
|
||||
>removableRest : { both: number; remainder: string; }
|
||||
>removable : Removable
|
||||
|
||||
let computed = 'b';
|
||||
>computed : string
|
||||
>'b' : "b"
|
||||
|
||||
let computed2 = 'a';
|
||||
>computed2 : string
|
||||
>'a' : "a"
|
||||
|
||||
var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
|
||||
>computed : string
|
||||
>stillNotGreat : any
|
||||
>computed2 : string
|
||||
>soSo : any
|
||||
>o : { a: number; b: string; }
|
||||
>o : { a: number; b: string; }
|
||||
|
||||
({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o);
|
||||
>({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o) : { a: number; b: string; }
|
||||
>{ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o : { a: number; b: string; }
|
||||
>{ [computed]: stillNotGreat, [computed2]: soSo, ...o } : { a: number; b: string; }
|
||||
>computed : string
|
||||
>stillNotGreat : any
|
||||
>computed2 : string
|
||||
>soSo : any
|
||||
>o : { a: number; b: string; }
|
||||
>o : { a: number; b: string; }
|
||||
|
||||
|
||||
45
tests/baselines/reference/objectRest2.js
Normal file
45
tests/baselines/reference/objectRest2.js
Normal file
@@ -0,0 +1,45 @@
|
||||
//// [objectRest2.ts]
|
||||
// test for #12203
|
||||
declare function connectionFromArray(objects: number, args: any): {};
|
||||
function rootConnection(name: string) {
|
||||
return {
|
||||
resolve: async (context, args) => {
|
||||
const { objects } = await { objects: 12 };
|
||||
return {
|
||||
...connectionFromArray(objects, args)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
rootConnection('test');
|
||||
|
||||
|
||||
//// [objectRest2.js]
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function rootConnection(name) {
|
||||
return {
|
||||
resolve: (context, args) => __awaiter(this, void 0, void 0, function* () {
|
||||
const { objects } = yield { objects: 12 };
|
||||
return __assign({}, connectionFromArray(objects, args));
|
||||
})
|
||||
};
|
||||
}
|
||||
rootConnection('test');
|
||||
34
tests/baselines/reference/objectRest2.symbols
Normal file
34
tests/baselines/reference/objectRest2.symbols
Normal file
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/conformance/types/rest/objectRest2.ts ===
|
||||
// test for #12203
|
||||
declare function connectionFromArray(objects: number, args: any): {};
|
||||
>connectionFromArray : Symbol(connectionFromArray, Decl(objectRest2.ts, 0, 0))
|
||||
>objects : Symbol(objects, Decl(objectRest2.ts, 1, 37))
|
||||
>args : Symbol(args, Decl(objectRest2.ts, 1, 53))
|
||||
|
||||
function rootConnection(name: string) {
|
||||
>rootConnection : Symbol(rootConnection, Decl(objectRest2.ts, 1, 69))
|
||||
>name : Symbol(name, Decl(objectRest2.ts, 2, 24))
|
||||
|
||||
return {
|
||||
resolve: async (context, args) => {
|
||||
>resolve : Symbol(resolve, Decl(objectRest2.ts, 3, 10))
|
||||
>context : Symbol(context, Decl(objectRest2.ts, 4, 20))
|
||||
>args : Symbol(args, Decl(objectRest2.ts, 4, 28))
|
||||
|
||||
const { objects } = await { objects: 12 };
|
||||
>objects : Symbol(objects, Decl(objectRest2.ts, 5, 15))
|
||||
>objects : Symbol(objects, Decl(objectRest2.ts, 5, 35))
|
||||
|
||||
return {
|
||||
...connectionFromArray(objects, args)
|
||||
>connectionFromArray : Symbol(connectionFromArray, Decl(objectRest2.ts, 0, 0))
|
||||
>objects : Symbol(objects, Decl(objectRest2.ts, 5, 15))
|
||||
>args : Symbol(args, Decl(objectRest2.ts, 4, 28))
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
rootConnection('test');
|
||||
>rootConnection : Symbol(rootConnection, Decl(objectRest2.ts, 1, 69))
|
||||
|
||||
45
tests/baselines/reference/objectRest2.types
Normal file
45
tests/baselines/reference/objectRest2.types
Normal file
@@ -0,0 +1,45 @@
|
||||
=== tests/cases/conformance/types/rest/objectRest2.ts ===
|
||||
// test for #12203
|
||||
declare function connectionFromArray(objects: number, args: any): {};
|
||||
>connectionFromArray : (objects: number, args: any) => {}
|
||||
>objects : number
|
||||
>args : any
|
||||
|
||||
function rootConnection(name: string) {
|
||||
>rootConnection : (name: string) => { resolve: (context: any, args: any) => Promise<{}>; }
|
||||
>name : string
|
||||
|
||||
return {
|
||||
>{ resolve: async (context, args) => { const { objects } = await { objects: 12 }; return { ...connectionFromArray(objects, args) }; } } : { resolve: (context: any, args: any) => Promise<{}>; }
|
||||
|
||||
resolve: async (context, args) => {
|
||||
>resolve : (context: any, args: any) => Promise<{}>
|
||||
>async (context, args) => { const { objects } = await { objects: 12 }; return { ...connectionFromArray(objects, args) }; } : (context: any, args: any) => Promise<{}>
|
||||
>context : any
|
||||
>args : any
|
||||
|
||||
const { objects } = await { objects: 12 };
|
||||
>objects : number
|
||||
>await { objects: 12 } : { objects: number; }
|
||||
>{ objects: 12 } : { objects: number; }
|
||||
>objects : number
|
||||
>12 : 12
|
||||
|
||||
return {
|
||||
>{ ...connectionFromArray(objects, args) } : {}
|
||||
|
||||
...connectionFromArray(objects, args)
|
||||
>connectionFromArray(objects, args) : {}
|
||||
>connectionFromArray : (objects: number, args: any) => {}
|
||||
>objects : number
|
||||
>args : any
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
rootConnection('test');
|
||||
>rootConnection('test') : { resolve: (context: any, args: any) => Promise<{}>; }
|
||||
>rootConnection : (name: string) => { resolve: (context: any, args: any) => Promise<{}>; }
|
||||
>'test' : "test"
|
||||
|
||||
@@ -17,8 +17,11 @@ var { a: [{ ...nested2 }, ...y], b: { z, ...c }, ...rest2 } = overEmit;
|
||||
//// [objectRestAssignment.js]
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};
|
||||
let ka;
|
||||
|
||||
@@ -22,8 +22,10 @@ let complex: { x: { ka, ki }, y: number };
|
||||
({x: { ka, ...nested }, y: other, ...rest} = complex);
|
||||
>x : Symbol(x, Decl(objectRestAssignment.ts, 5, 2))
|
||||
>ka : Symbol(ka, Decl(objectRestAssignment.ts, 5, 6))
|
||||
>nested : Symbol(nested, Decl(objectRestAssignment.ts, 1, 3))
|
||||
>y : Symbol(y, Decl(objectRestAssignment.ts, 5, 23))
|
||||
>other : Symbol(other, Decl(objectRestAssignment.ts, 2, 3))
|
||||
>rest : Symbol(rest, Decl(objectRestAssignment.ts, 3, 3))
|
||||
>complex : Symbol(complex, Decl(objectRestAssignment.ts, 4, 3))
|
||||
|
||||
// should be:
|
||||
@@ -52,8 +54,11 @@ var { a: [{ ...nested2 }, ...y], b: { z, ...c }, ...rest2 } = overEmit;
|
||||
|
||||
({ a: [{ ...nested2 }, ...y], b: { z, ...c }, ...rest2 } = overEmit);
|
||||
>a : Symbol(a, Decl(objectRestAssignment.ts, 12, 2))
|
||||
>nested2 : Symbol(nested2, Decl(objectRestAssignment.ts, 11, 11))
|
||||
>y : Symbol(y, Decl(objectRestAssignment.ts, 11, 25))
|
||||
>b : Symbol(b, Decl(objectRestAssignment.ts, 12, 29))
|
||||
>z : Symbol(z, Decl(objectRestAssignment.ts, 12, 34))
|
||||
>c : Symbol(c, Decl(objectRestAssignment.ts, 11, 40))
|
||||
>rest2 : Symbol(rest2, Decl(objectRestAssignment.ts, 11, 48))
|
||||
>overEmit : Symbol(overEmit, Decl(objectRestAssignment.ts, 8, 3))
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ let complex: { x: { ka, ki }, y: number };
|
||||
>x : { ki: any; ka: any; }
|
||||
>{ ka, ...nested } : { ki: any; ka: any; }
|
||||
>ka : any
|
||||
>nested : any
|
||||
>nested : { ki: any; }
|
||||
>y : number
|
||||
>other : number
|
||||
>rest : any
|
||||
>rest : {}
|
||||
>complex : { x: { ka: any; ki: any; }; y: number; }
|
||||
|
||||
// should be:
|
||||
@@ -63,13 +63,13 @@ var { a: [{ ...nested2 }, ...y], b: { z, ...c }, ...rest2 } = overEmit;
|
||||
>a : { ka: string; x: string; }[]
|
||||
>[{ ...nested2 }, ...y] : { ka: string; x: string; }[]
|
||||
>{ ...nested2 } : { ka: string; x: string; }
|
||||
>nested2 : any
|
||||
>nested2 : { ka: string; x: string; }
|
||||
>...y : { ka: string; x: string; }
|
||||
>y : { ka: string; x: string; }[]
|
||||
>b : { ki: string; ku: string; z: string; }
|
||||
>{ z, ...c } : { ki: string; ku: string; z: string; }
|
||||
>z : string
|
||||
>c : any
|
||||
>rest2 : any
|
||||
>c : { ki: string; ku: string; }
|
||||
>rest2 : { ke: string; ko: string; }
|
||||
>overEmit : { a: { ka: string; x: string; }[]; b: { z: string; ki: string; ku: string; }; ke: string; ko: string; }
|
||||
|
||||
|
||||
@@ -20,13 +20,19 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};
|
||||
let array;
|
||||
|
||||
@@ -23,6 +23,7 @@ let rrestOff: { y: string };
|
||||
for ({ x: xx, ...rrestOff } of array ) {
|
||||
>x : Symbol(x, Decl(objectRestForOf.ts, 6, 6))
|
||||
>xx : Symbol(xx, Decl(objectRestForOf.ts, 4, 3))
|
||||
>rrestOff : Symbol(rrestOff, Decl(objectRestForOf.ts, 5, 3))
|
||||
>array : Symbol(array, Decl(objectRestForOf.ts, 0, 3))
|
||||
|
||||
[xx, rrestOff];
|
||||
@@ -35,6 +36,7 @@ for (const norest of array.map(a => ({ ...a, x: 'a string' }))) {
|
||||
>array : Symbol(array, Decl(objectRestForOf.ts, 0, 3))
|
||||
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(objectRestForOf.ts, 9, 31))
|
||||
>a : Symbol(a, Decl(objectRestForOf.ts, 9, 31))
|
||||
>x : Symbol(x, Decl(objectRestForOf.ts, 9, 44))
|
||||
|
||||
[norest.x, norest.y];
|
||||
|
||||
@@ -25,7 +25,7 @@ for ({ x: xx, ...rrestOff } of array ) {
|
||||
>{ x: xx, ...rrestOff } : { y: string; x: number; }
|
||||
>x : { x: number; y: string; }
|
||||
>xx : number
|
||||
>rrestOff : any
|
||||
>rrestOff : { y: string; }
|
||||
>array : { x: number; y: string; }[]
|
||||
|
||||
[xx, rrestOff];
|
||||
@@ -43,7 +43,7 @@ for (const norest of array.map(a => ({ ...a, x: 'a string' }))) {
|
||||
>a : { x: number; y: string; }
|
||||
>({ ...a, x: 'a string' }) : { x: string; y: string; }
|
||||
>{ ...a, x: 'a string' } : { x: string; y: string; }
|
||||
>a : any
|
||||
>a : { x: number; y: string; }
|
||||
>x : string
|
||||
>'a string' : "a string"
|
||||
|
||||
|
||||
@@ -15,8 +15,11 @@ let rest: { b: string }
|
||||
//// [objectRestNegative.js]
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};
|
||||
var o = { a: 1, b: 'no' };
|
||||
|
||||
@@ -11,8 +11,11 @@ suddenly(({ x: { z = 12, ...nested }, ...rest } = { x: { z: 1, ka: 1 }, y: 'noo'
|
||||
//// [objectRestParameter.js]
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};
|
||||
function cloneAgain(_a) {
|
||||
|
||||
@@ -87,6 +87,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
@@ -105,7 +108,7 @@ var combinedMid = __assign({}, o, { b: 'ok' }, o2);
|
||||
var combinedAfter = __assign({}, o, o2, { b: 'ok' });
|
||||
var combinedNested = __assign({}, __assign({ a: 4 }, { b: false, c: 'overriden' }), { d: 'actually new' }, { a: 5, d: 'maybe new' });
|
||||
var combinedNestedChangeType = __assign({}, __assign({ a: 1 }, { b: false, c: 'overriden' }), { c: -1 });
|
||||
var propertyNested = __assign({ a: __assign({}, o) });
|
||||
var propertyNested = { a: __assign({}, o) };
|
||||
// accessors don't copy the descriptor
|
||||
// (which means that readonly getters become read/write properties)
|
||||
var op = { get a() { return 6; } };
|
||||
|
||||
@@ -21,6 +21,7 @@ let addAfter: { a: number, b: string, c: boolean } =
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 4, 37))
|
||||
|
||||
{ ...o, c: false }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 5, 11))
|
||||
|
||||
let addBefore: { a: number, b: string, c: boolean } =
|
||||
@@ -31,6 +32,7 @@ let addBefore: { a: number, b: string, c: boolean } =
|
||||
|
||||
{ c: false, ...o }
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 7, 5))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
|
||||
// Note: ignore still changes the order that properties are printed
|
||||
let ignore: { a: number, b: string } =
|
||||
@@ -40,6 +42,7 @@ let ignore: { a: number, b: string } =
|
||||
|
||||
{ b: 'ignored', ...o }
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 10, 5))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
|
||||
let override: { a: number, b: string } =
|
||||
>override : Symbol(override, Decl(objectSpread.ts, 11, 3))
|
||||
@@ -47,6 +50,7 @@ let override: { a: number, b: string } =
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 11, 26))
|
||||
|
||||
{ ...o, b: 'override' }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 12, 11))
|
||||
|
||||
let nested: { a: number, b: boolean, c: string } =
|
||||
@@ -68,6 +72,9 @@ let combined: { a: number, b: string, c: boolean } =
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 15, 37))
|
||||
|
||||
{ ...o, ...o2 }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>o2 : Symbol(o2, Decl(objectSpread.ts, 1, 3))
|
||||
|
||||
let combinedBefore: { a: number, b: string, c: boolean } =
|
||||
>combinedBefore : Symbol(combinedBefore, Decl(objectSpread.ts, 17, 3))
|
||||
>a : Symbol(a, Decl(objectSpread.ts, 17, 21))
|
||||
@@ -76,6 +83,8 @@ let combinedBefore: { a: number, b: string, c: boolean } =
|
||||
|
||||
{ b: 'ok', ...o, ...o2 }
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 18, 5))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>o2 : Symbol(o2, Decl(objectSpread.ts, 1, 3))
|
||||
|
||||
let combinedMid: { a: number, b: string, c: boolean } =
|
||||
>combinedMid : Symbol(combinedMid, Decl(objectSpread.ts, 19, 3))
|
||||
@@ -84,7 +93,9 @@ let combinedMid: { a: number, b: string, c: boolean } =
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 19, 40))
|
||||
|
||||
{ ...o, b: 'ok', ...o2 }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 20, 11))
|
||||
>o2 : Symbol(o2, Decl(objectSpread.ts, 1, 3))
|
||||
|
||||
let combinedAfter: { a: number, b: string, c: boolean } =
|
||||
>combinedAfter : Symbol(combinedAfter, Decl(objectSpread.ts, 21, 3))
|
||||
@@ -93,6 +104,8 @@ let combinedAfter: { a: number, b: string, c: boolean } =
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 21, 42))
|
||||
|
||||
{ ...o, ...o2, b: 'ok' }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>o2 : Symbol(o2, Decl(objectSpread.ts, 1, 3))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 22, 18))
|
||||
|
||||
let combinedNested: { a: number, b: boolean, c: string, d: string } =
|
||||
@@ -130,6 +143,7 @@ let propertyNested: { a: { a: number, b: string } } =
|
||||
|
||||
{ a: { ... o } }
|
||||
>a : Symbol(a, Decl(objectSpread.ts, 28, 5))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
|
||||
// accessors don't copy the descriptor
|
||||
// (which means that readonly getters become read/write properties)
|
||||
@@ -143,6 +157,7 @@ let getter: { a: number, c: number } =
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 32, 24))
|
||||
|
||||
{ ...op, c: 7 }
|
||||
>op : Symbol(op, Decl(objectSpread.ts, 31, 3))
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 33, 12))
|
||||
|
||||
getter.a = 12;
|
||||
@@ -160,6 +175,7 @@ let anything: any;
|
||||
|
||||
let spreadAny = { ...anything };
|
||||
>spreadAny : Symbol(spreadAny, Decl(objectSpread.ts, 41, 3))
|
||||
>anything : Symbol(anything, Decl(objectSpread.ts, 40, 3))
|
||||
|
||||
// methods are not enumerable
|
||||
class C { p = 1; m() { } }
|
||||
@@ -175,12 +191,14 @@ let c: C = new C()
|
||||
let spreadC: { p: number } = { ...c }
|
||||
>spreadC : Symbol(spreadC, Decl(objectSpread.ts, 46, 3))
|
||||
>p : Symbol(p, Decl(objectSpread.ts, 46, 14))
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 45, 3))
|
||||
|
||||
// own methods are enumerable
|
||||
let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } };
|
||||
>cplus : Symbol(cplus, Decl(objectSpread.ts, 49, 3))
|
||||
>p : Symbol(p, Decl(objectSpread.ts, 49, 12))
|
||||
>plus : Symbol(plus, Decl(objectSpread.ts, 49, 23))
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 45, 3))
|
||||
>plus : Symbol(plus, Decl(objectSpread.ts, 49, 48))
|
||||
>this : Symbol(__object, Decl(objectSpread.ts, 41, 15))
|
||||
|
||||
@@ -196,6 +214,7 @@ let changeTypeAfter: { a: string, b: string } =
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 53, 33))
|
||||
|
||||
{ ...o, a: 'wrong type?' }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(objectSpread.ts, 54, 11))
|
||||
|
||||
let changeTypeBefore: { a: number, b: string } =
|
||||
@@ -205,6 +224,7 @@ let changeTypeBefore: { a: number, b: string } =
|
||||
|
||||
{ a: 'wrong type?', ...o };
|
||||
>a : Symbol(a, Decl(objectSpread.ts, 56, 5))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
|
||||
let changeTypeBoth: { a: string, b: number } =
|
||||
>changeTypeBoth : Symbol(changeTypeBoth, Decl(objectSpread.ts, 57, 3))
|
||||
@@ -212,6 +232,8 @@ let changeTypeBoth: { a: string, b: number } =
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 57, 32))
|
||||
|
||||
{ ...o, ...swap };
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>swap : Symbol(swap, Decl(objectSpread.ts, 2, 3))
|
||||
|
||||
// optional
|
||||
let definiteBoolean: { sn: boolean };
|
||||
@@ -233,14 +255,23 @@ let optionalNumber: { sn?: number };
|
||||
let optionalUnionStops: { sn: string | number | boolean } = { ...definiteBoolean, ...definiteString, ...optionalNumber };
|
||||
>optionalUnionStops : Symbol(optionalUnionStops, Decl(objectSpread.ts, 65, 3))
|
||||
>sn : Symbol(sn, Decl(objectSpread.ts, 65, 25))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpread.ts, 61, 3))
|
||||
>definiteString : Symbol(definiteString, Decl(objectSpread.ts, 62, 3))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpread.ts, 64, 3))
|
||||
|
||||
let optionalUnionDuplicates: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...optionalString, ...optionalNumber };
|
||||
>optionalUnionDuplicates : Symbol(optionalUnionDuplicates, Decl(objectSpread.ts, 66, 3))
|
||||
>sn : Symbol(sn, Decl(objectSpread.ts, 66, 30))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpread.ts, 61, 3))
|
||||
>definiteString : Symbol(definiteString, Decl(objectSpread.ts, 62, 3))
|
||||
>optionalString : Symbol(optionalString, Decl(objectSpread.ts, 63, 3))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpread.ts, 64, 3))
|
||||
|
||||
let allOptional: { sn?: string | number } = { ...optionalString, ...optionalNumber };
|
||||
>allOptional : Symbol(allOptional, Decl(objectSpread.ts, 67, 3))
|
||||
>sn : Symbol(sn, Decl(objectSpread.ts, 67, 18))
|
||||
>optionalString : Symbol(optionalString, Decl(objectSpread.ts, 63, 3))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpread.ts, 64, 3))
|
||||
|
||||
// computed property
|
||||
let computedFirst: { a: number, b: string, "before everything": number } =
|
||||
@@ -250,6 +281,7 @@ let computedFirst: { a: number, b: string, "before everything": number } =
|
||||
|
||||
{ ['before everything']: 12, ...o, b: 'yes' }
|
||||
>'before everything' : Symbol(['before everything'], Decl(objectSpread.ts, 71, 5))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 71, 38))
|
||||
|
||||
let computedMiddle: { a: number, b: string, c: boolean, "in the middle": number } =
|
||||
@@ -259,8 +291,10 @@ let computedMiddle: { a: number, b: string, c: boolean, "in the middle": number
|
||||
>c : Symbol(c, Decl(objectSpread.ts, 72, 43))
|
||||
|
||||
{ ...o, ['in the middle']: 13, b: 'maybe?', ...o2 }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>'in the middle' : Symbol(['in the middle'], Decl(objectSpread.ts, 73, 11))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 73, 34))
|
||||
>o2 : Symbol(o2, Decl(objectSpread.ts, 1, 3))
|
||||
|
||||
let computedAfter: { a: number, b: string, "at the end": number } =
|
||||
>computedAfter : Symbol(computedAfter, Decl(objectSpread.ts, 74, 3))
|
||||
@@ -268,6 +302,7 @@ let computedAfter: { a: number, b: string, "at the end": number } =
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 74, 31))
|
||||
|
||||
{ ...o, b: 'yeah', ['at the end']: 14 }
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 75, 11))
|
||||
>'at the end' : Symbol(['at the end'], Decl(objectSpread.ts, 75, 22))
|
||||
|
||||
@@ -279,6 +314,7 @@ let shortCutted: { a: number, b: string } = { ...o, a }
|
||||
>shortCutted : Symbol(shortCutted, Decl(objectSpread.ts, 78, 3))
|
||||
>a : Symbol(a, Decl(objectSpread.ts, 78, 18))
|
||||
>b : Symbol(b, Decl(objectSpread.ts, 78, 29))
|
||||
>o : Symbol(o, Decl(objectSpread.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(objectSpread.ts, 78, 51))
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ let addAfter: { a: number, b: string, c: boolean } =
|
||||
|
||||
{ ...o, c: false }
|
||||
>{ ...o, c: false } : { c: false; a: number; b: string; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>c : boolean
|
||||
>false : false
|
||||
|
||||
@@ -46,7 +46,7 @@ let addBefore: { a: number, b: string, c: boolean } =
|
||||
>{ c: false, ...o } : { a: number; b: string; c: false; }
|
||||
>c : boolean
|
||||
>false : false
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
|
||||
// Note: ignore still changes the order that properties are printed
|
||||
let ignore: { a: number, b: string } =
|
||||
@@ -58,7 +58,7 @@ let ignore: { a: number, b: string } =
|
||||
>{ b: 'ignored', ...o } : { a: number; b: string; }
|
||||
>b : string
|
||||
>'ignored' : "ignored"
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
|
||||
let override: { a: number, b: string } =
|
||||
>override : { a: number; b: string; }
|
||||
@@ -67,7 +67,7 @@ let override: { a: number, b: string } =
|
||||
|
||||
{ ...o, b: 'override' }
|
||||
>{ ...o, b: 'override' } : { b: string; a: number; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>b : string
|
||||
>'override' : "override"
|
||||
|
||||
@@ -98,8 +98,8 @@ let combined: { a: number, b: string, c: boolean } =
|
||||
|
||||
{ ...o, ...o2 }
|
||||
>{ ...o, ...o2 } : { b: string; c: boolean; a: number; }
|
||||
>o : any
|
||||
>o2 : any
|
||||
>o : { a: number; b: string; }
|
||||
>o2 : { b: string; c: boolean; }
|
||||
|
||||
let combinedBefore: { a: number, b: string, c: boolean } =
|
||||
>combinedBefore : { a: number; b: string; c: boolean; }
|
||||
@@ -111,8 +111,8 @@ let combinedBefore: { a: number, b: string, c: boolean } =
|
||||
>{ b: 'ok', ...o, ...o2 } : { b: string; c: boolean; a: number; }
|
||||
>b : string
|
||||
>'ok' : "ok"
|
||||
>o : any
|
||||
>o2 : any
|
||||
>o : { a: number; b: string; }
|
||||
>o2 : { b: string; c: boolean; }
|
||||
|
||||
let combinedMid: { a: number, b: string, c: boolean } =
|
||||
>combinedMid : { a: number; b: string; c: boolean; }
|
||||
@@ -122,10 +122,10 @@ let combinedMid: { a: number, b: string, c: boolean } =
|
||||
|
||||
{ ...o, b: 'ok', ...o2 }
|
||||
>{ ...o, b: 'ok', ...o2 } : { b: string; c: boolean; a: number; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>b : string
|
||||
>'ok' : "ok"
|
||||
>o2 : any
|
||||
>o2 : { b: string; c: boolean; }
|
||||
|
||||
let combinedAfter: { a: number, b: string, c: boolean } =
|
||||
>combinedAfter : { a: number; b: string; c: boolean; }
|
||||
@@ -135,8 +135,8 @@ let combinedAfter: { a: number, b: string, c: boolean } =
|
||||
|
||||
{ ...o, ...o2, b: 'ok' }
|
||||
>{ ...o, ...o2, b: 'ok' } : { b: string; c: boolean; a: number; }
|
||||
>o : any
|
||||
>o2 : any
|
||||
>o : { a: number; b: string; }
|
||||
>o2 : { b: string; c: boolean; }
|
||||
>b : string
|
||||
>'ok' : "ok"
|
||||
|
||||
@@ -195,7 +195,7 @@ let propertyNested: { a: { a: number, b: string } } =
|
||||
>{ a: { ... o } } : { a: { a: number; b: string; }; }
|
||||
>a : { a: number; b: string; }
|
||||
>{ ... o } : { a: number; b: string; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
|
||||
// accessors don't copy the descriptor
|
||||
// (which means that readonly getters become read/write properties)
|
||||
@@ -212,7 +212,7 @@ let getter: { a: number, c: number } =
|
||||
|
||||
{ ...op, c: 7 }
|
||||
>{ ...op, c: 7 } : { c: number; readonly a: number; }
|
||||
>op : any
|
||||
>op : { readonly a: number; }
|
||||
>c : number
|
||||
>7 : 7
|
||||
|
||||
@@ -256,7 +256,7 @@ let spreadC: { p: number } = { ...c }
|
||||
>spreadC : { p: number; }
|
||||
>p : number
|
||||
>{ ...c } : { p: number; }
|
||||
>c : any
|
||||
>c : C
|
||||
|
||||
// own methods are enumerable
|
||||
let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } };
|
||||
@@ -264,7 +264,7 @@ let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } }
|
||||
>p : number
|
||||
>plus : () => void
|
||||
>{ ...c, plus() { return this.p + 1; } } : { plus(): any; p: number; }
|
||||
>c : any
|
||||
>c : C
|
||||
>plus : () => any
|
||||
>this.p + 1 : any
|
||||
>this.p : any
|
||||
@@ -286,7 +286,7 @@ let changeTypeAfter: { a: string, b: string } =
|
||||
|
||||
{ ...o, a: 'wrong type?' }
|
||||
>{ ...o, a: 'wrong type?' } : { a: string; b: string; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>a : string
|
||||
>'wrong type?' : "wrong type?"
|
||||
|
||||
@@ -299,7 +299,7 @@ let changeTypeBefore: { a: number, b: string } =
|
||||
>{ a: 'wrong type?', ...o } : { a: number; b: string; }
|
||||
>a : string
|
||||
>'wrong type?' : "wrong type?"
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
|
||||
let changeTypeBoth: { a: string, b: number } =
|
||||
>changeTypeBoth : { a: string; b: number; }
|
||||
@@ -308,8 +308,8 @@ let changeTypeBoth: { a: string, b: number } =
|
||||
|
||||
{ ...o, ...swap };
|
||||
>{ ...o, ...swap } : { a: string; b: number; }
|
||||
>o : any
|
||||
>swap : any
|
||||
>o : { a: number; b: string; }
|
||||
>swap : { a: string; b: number; }
|
||||
|
||||
// optional
|
||||
let definiteBoolean: { sn: boolean };
|
||||
@@ -332,25 +332,25 @@ let optionalUnionStops: { sn: string | number | boolean } = { ...definiteBoolean
|
||||
>optionalUnionStops : { sn: string | number | boolean; }
|
||||
>sn : string | number | boolean
|
||||
>{ ...definiteBoolean, ...definiteString, ...optionalNumber } : { sn: string | number; }
|
||||
>definiteBoolean : any
|
||||
>definiteString : any
|
||||
>optionalNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>definiteString : { sn: string; }
|
||||
>optionalNumber : { sn?: number; }
|
||||
|
||||
let optionalUnionDuplicates: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...optionalString, ...optionalNumber };
|
||||
>optionalUnionDuplicates : { sn: string | number; }
|
||||
>sn : string | number
|
||||
>{ ...definiteBoolean, ...definiteString, ...optionalString, ...optionalNumber } : { sn: string | number; }
|
||||
>definiteBoolean : any
|
||||
>definiteString : any
|
||||
>optionalString : any
|
||||
>optionalNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>definiteString : { sn: string; }
|
||||
>optionalString : { sn?: string; }
|
||||
>optionalNumber : { sn?: number; }
|
||||
|
||||
let allOptional: { sn?: string | number } = { ...optionalString, ...optionalNumber };
|
||||
>allOptional : { sn?: string | number; }
|
||||
>sn : string | number
|
||||
>{ ...optionalString, ...optionalNumber } : { sn?: string | number; }
|
||||
>optionalString : any
|
||||
>optionalNumber : any
|
||||
>optionalString : { sn?: string; }
|
||||
>optionalNumber : { sn?: number; }
|
||||
|
||||
// computed property
|
||||
let computedFirst: { a: number, b: string, "before everything": number } =
|
||||
@@ -362,7 +362,7 @@ let computedFirst: { a: number, b: string, "before everything": number } =
|
||||
>{ ['before everything']: 12, ...o, b: 'yes' } : { b: string; a: number; ['before everything']: number; }
|
||||
>'before everything' : "before everything"
|
||||
>12 : 12
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>b : string
|
||||
>'yes' : "yes"
|
||||
|
||||
@@ -374,12 +374,12 @@ let computedMiddle: { a: number, b: string, c: boolean, "in the middle": number
|
||||
|
||||
{ ...o, ['in the middle']: 13, b: 'maybe?', ...o2 }
|
||||
>{ ...o, ['in the middle']: 13, b: 'maybe?', ...o2 } : { b: string; c: boolean; ['in the middle']: number; a: number; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>'in the middle' : "in the middle"
|
||||
>13 : 13
|
||||
>b : string
|
||||
>'maybe?' : "maybe?"
|
||||
>o2 : any
|
||||
>o2 : { b: string; c: boolean; }
|
||||
|
||||
let computedAfter: { a: number, b: string, "at the end": number } =
|
||||
>computedAfter : { a: number; b: string; "at the end": number; }
|
||||
@@ -388,7 +388,7 @@ let computedAfter: { a: number, b: string, "at the end": number } =
|
||||
|
||||
{ ...o, b: 'yeah', ['at the end']: 14 }
|
||||
>{ ...o, b: 'yeah', ['at the end']: 14 } : { b: string; ['at the end']: number; a: number; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>b : string
|
||||
>'yeah' : "yeah"
|
||||
>'at the end' : "at the end"
|
||||
@@ -404,7 +404,7 @@ let shortCutted: { a: number, b: string } = { ...o, a }
|
||||
>a : number
|
||||
>b : string
|
||||
>{ ...o, a } : { a: number; b: string; }
|
||||
>o : any
|
||||
>o : { a: number; b: string; }
|
||||
>a : number
|
||||
|
||||
|
||||
|
||||
34
tests/baselines/reference/objectSpreadComputedProperty.js
Normal file
34
tests/baselines/reference/objectSpreadComputedProperty.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//// [objectSpreadComputedProperty.ts]
|
||||
// fixes #12200
|
||||
function f() {
|
||||
let n: number = 12;
|
||||
let m: number = 13;
|
||||
let a: any = null;
|
||||
const o1 = { ...{}, [n]: n };
|
||||
const o2 = { ...{}, [a]: n };
|
||||
const o3 = { [a]: n, ...{}, [n]: n, ...{}, [m]: m };
|
||||
}
|
||||
|
||||
|
||||
//// [objectSpreadComputedProperty.js]
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
// fixes #12200
|
||||
function f() {
|
||||
var n = 12;
|
||||
var m = 13;
|
||||
var a = null;
|
||||
var o1 = __assign({}, (_a = {}, _a[n] = n, _a));
|
||||
var o2 = __assign({}, (_b = {}, _b[a] = n, _b));
|
||||
var o3 = __assign((_c = {}, _c[a] = n, _c), {}, (_d = {}, _d[n] = n, _d), {}, (_e = {}, _e[m] = m, _e));
|
||||
var _a, _b, _c, _d, _e;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/conformance/types/spread/objectSpreadComputedProperty.ts ===
|
||||
// fixes #12200
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(objectSpreadComputedProperty.ts, 0, 0))
|
||||
|
||||
let n: number = 12;
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
|
||||
let m: number = 13;
|
||||
>m : Symbol(m, Decl(objectSpreadComputedProperty.ts, 3, 7))
|
||||
|
||||
let a: any = null;
|
||||
>a : Symbol(a, Decl(objectSpreadComputedProperty.ts, 4, 7))
|
||||
|
||||
const o1 = { ...{}, [n]: n };
|
||||
>o1 : Symbol(o1, Decl(objectSpreadComputedProperty.ts, 5, 9))
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
|
||||
const o2 = { ...{}, [a]: n };
|
||||
>o2 : Symbol(o2, Decl(objectSpreadComputedProperty.ts, 6, 9))
|
||||
>a : Symbol(a, Decl(objectSpreadComputedProperty.ts, 4, 7))
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
|
||||
const o3 = { [a]: n, ...{}, [n]: n, ...{}, [m]: m };
|
||||
>o3 : Symbol(o3, Decl(objectSpreadComputedProperty.ts, 7, 9))
|
||||
>a : Symbol(a, Decl(objectSpreadComputedProperty.ts, 4, 7))
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
>n : Symbol(n, Decl(objectSpreadComputedProperty.ts, 2, 7))
|
||||
>m : Symbol(m, Decl(objectSpreadComputedProperty.ts, 3, 7))
|
||||
>m : Symbol(m, Decl(objectSpreadComputedProperty.ts, 3, 7))
|
||||
}
|
||||
|
||||
44
tests/baselines/reference/objectSpreadComputedProperty.types
Normal file
44
tests/baselines/reference/objectSpreadComputedProperty.types
Normal file
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/conformance/types/spread/objectSpreadComputedProperty.ts ===
|
||||
// fixes #12200
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
let n: number = 12;
|
||||
>n : number
|
||||
>12 : 12
|
||||
|
||||
let m: number = 13;
|
||||
>m : number
|
||||
>13 : 13
|
||||
|
||||
let a: any = null;
|
||||
>a : any
|
||||
>null : null
|
||||
|
||||
const o1 = { ...{}, [n]: n };
|
||||
>o1 : {}
|
||||
>{ ...{}, [n]: n } : {}
|
||||
>{} : {}
|
||||
>n : number
|
||||
>n : number
|
||||
|
||||
const o2 = { ...{}, [a]: n };
|
||||
>o2 : {}
|
||||
>{ ...{}, [a]: n } : {}
|
||||
>{} : {}
|
||||
>a : any
|
||||
>n : number
|
||||
|
||||
const o3 = { [a]: n, ...{}, [n]: n, ...{}, [m]: m };
|
||||
>o3 : {}
|
||||
>{ [a]: n, ...{}, [n]: n, ...{}, [m]: m } : {}
|
||||
>a : any
|
||||
>n : number
|
||||
>{} : {}
|
||||
>n : number
|
||||
>n : number
|
||||
>{} : {}
|
||||
>m : number
|
||||
>m : number
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@ let indexed2: Indexed2;
|
||||
|
||||
let i = { ...indexed, b: 11 };
|
||||
>i : Symbol(i, Decl(objectSpreadIndexSignature.ts, 10, 3))
|
||||
>indexed : Symbol(indexed, Decl(objectSpreadIndexSignature.ts, 8, 3))
|
||||
>b : Symbol(b, Decl(objectSpreadIndexSignature.ts, 10, 21))
|
||||
|
||||
// only indexed has indexer, so i[101]: any
|
||||
@@ -35,6 +36,8 @@ i[101];
|
||||
|
||||
let ii = { ...indexed, ...indexed2 };
|
||||
>ii : Symbol(ii, Decl(objectSpreadIndexSignature.ts, 13, 3))
|
||||
>indexed : Symbol(indexed, Decl(objectSpreadIndexSignature.ts, 8, 3))
|
||||
>indexed2 : Symbol(indexed2, Decl(objectSpreadIndexSignature.ts, 9, 3))
|
||||
|
||||
// both have indexer, so i[1001]: number | boolean
|
||||
ii[1001];
|
||||
|
||||
@@ -28,7 +28,7 @@ let indexed2: Indexed2;
|
||||
let i = { ...indexed, b: 11 };
|
||||
>i : { b: number; a: number; }
|
||||
>{ ...indexed, b: 11 } : { b: number; a: number; }
|
||||
>indexed : any
|
||||
>indexed : Indexed
|
||||
>b : number
|
||||
>11 : 11
|
||||
|
||||
@@ -41,8 +41,8 @@ i[101];
|
||||
let ii = { ...indexed, ...indexed2 };
|
||||
>ii : { [x: string]: number | boolean; c: boolean; a: number; }
|
||||
>{ ...indexed, ...indexed2 } : { [x: string]: number | boolean; c: boolean; a: number; }
|
||||
>indexed : any
|
||||
>indexed2 : any
|
||||
>indexed : Indexed
|
||||
>indexed2 : Indexed2
|
||||
|
||||
// both have indexer, so i[1001]: number | boolean
|
||||
ii[1001];
|
||||
|
||||
@@ -77,6 +77,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -11,6 +11,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ const y = { a: 'yes', b: 'no' };
|
||||
const o = { x: 1, ...y };
|
||||
>o : Symbol(o, Decl(objectSpreadNoTransform.ts, 1, 5))
|
||||
>x : Symbol(x, Decl(objectSpreadNoTransform.ts, 1, 11))
|
||||
>y : Symbol(y, Decl(objectSpreadNoTransform.ts, 0, 5))
|
||||
|
||||
var b;
|
||||
>b : Symbol(b, Decl(objectSpreadNoTransform.ts, 2, 3))
|
||||
@@ -16,5 +17,6 @@ var rest;
|
||||
|
||||
({ b, ...rest } = o);
|
||||
>b : Symbol(b, Decl(objectSpreadNoTransform.ts, 4, 2))
|
||||
>rest : Symbol(rest, Decl(objectSpreadNoTransform.ts, 3, 3))
|
||||
>o : Symbol(o, Decl(objectSpreadNoTransform.ts, 1, 5))
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const o = { x: 1, ...y };
|
||||
>{ x: 1, ...y } : { a: string; b: string; x: number; }
|
||||
>x : number
|
||||
>1 : 1
|
||||
>y : any
|
||||
>y : { a: string; b: string; }
|
||||
|
||||
var b;
|
||||
>b : any
|
||||
@@ -25,6 +25,6 @@ var rest;
|
||||
>{ b, ...rest } = o : { a: string; b: string; x: number; }
|
||||
>{ b, ...rest } : any
|
||||
>b : any
|
||||
>rest : any
|
||||
>rest : undefined
|
||||
>o : { a: string; b: string; x: number; }
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -31,30 +31,51 @@ function f(
|
||||
let optionalUnionStops: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...optionalNumber };
|
||||
>optionalUnionStops : Symbol(optionalUnionStops, Decl(objectSpreadStrictNull.ts, 9, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 9, 29))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpreadStrictNull.ts, 1, 11))
|
||||
>definiteString : Symbol(definiteString, Decl(objectSpreadStrictNull.ts, 2, 37))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpreadStrictNull.ts, 4, 36))
|
||||
|
||||
let optionalUnionDuplicates: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...optionalString, ...optionalNumber };
|
||||
>optionalUnionDuplicates : Symbol(optionalUnionDuplicates, Decl(objectSpreadStrictNull.ts, 10, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 10, 34))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpreadStrictNull.ts, 1, 11))
|
||||
>definiteString : Symbol(definiteString, Decl(objectSpreadStrictNull.ts, 2, 37))
|
||||
>optionalString : Symbol(optionalString, Decl(objectSpreadStrictNull.ts, 3, 35))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpreadStrictNull.ts, 4, 36))
|
||||
|
||||
let allOptional: { sn?: string | number } = { ...optionalString, ...optionalNumber };
|
||||
>allOptional : Symbol(allOptional, Decl(objectSpreadStrictNull.ts, 11, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 11, 22))
|
||||
>optionalString : Symbol(optionalString, Decl(objectSpreadStrictNull.ts, 3, 35))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpreadStrictNull.ts, 4, 36))
|
||||
|
||||
// undefined
|
||||
let undefinedUnionStops: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...undefinedNumber };
|
||||
>undefinedUnionStops : Symbol(undefinedUnionStops, Decl(objectSpreadStrictNull.ts, 14, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 14, 30))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpreadStrictNull.ts, 1, 11))
|
||||
>definiteString : Symbol(definiteString, Decl(objectSpreadStrictNull.ts, 2, 37))
|
||||
>undefinedNumber : Symbol(undefinedNumber, Decl(objectSpreadStrictNull.ts, 6, 48))
|
||||
|
||||
let undefinedUnionDuplicates: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...undefinedString, ...undefinedNumber };
|
||||
>undefinedUnionDuplicates : Symbol(undefinedUnionDuplicates, Decl(objectSpreadStrictNull.ts, 15, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 15, 35))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpreadStrictNull.ts, 1, 11))
|
||||
>definiteString : Symbol(definiteString, Decl(objectSpreadStrictNull.ts, 2, 37))
|
||||
>undefinedString : Symbol(undefinedString, Decl(objectSpreadStrictNull.ts, 5, 36))
|
||||
>undefinedNumber : Symbol(undefinedNumber, Decl(objectSpreadStrictNull.ts, 6, 48))
|
||||
|
||||
let allUndefined: { sn: string | number | undefined } = { ...undefinedString, ...undefinedNumber };
|
||||
>allUndefined : Symbol(allUndefined, Decl(objectSpreadStrictNull.ts, 16, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 16, 23))
|
||||
>undefinedString : Symbol(undefinedString, Decl(objectSpreadStrictNull.ts, 5, 36))
|
||||
>undefinedNumber : Symbol(undefinedNumber, Decl(objectSpreadStrictNull.ts, 6, 48))
|
||||
|
||||
let undefinedWithOptionalContinues: { sn: string | number | boolean } = { ...definiteBoolean, ...undefinedString, ...optionalNumber };
|
||||
>undefinedWithOptionalContinues : Symbol(undefinedWithOptionalContinues, Decl(objectSpreadStrictNull.ts, 18, 7))
|
||||
>sn : Symbol(sn, Decl(objectSpreadStrictNull.ts, 18, 41))
|
||||
>definiteBoolean : Symbol(definiteBoolean, Decl(objectSpreadStrictNull.ts, 1, 11))
|
||||
>undefinedString : Symbol(undefinedString, Decl(objectSpreadStrictNull.ts, 5, 36))
|
||||
>optionalNumber : Symbol(optionalNumber, Decl(objectSpreadStrictNull.ts, 4, 36))
|
||||
}
|
||||
|
||||
|
||||
@@ -32,57 +32,57 @@ function f(
|
||||
>optionalUnionStops : { sn: string | number; }
|
||||
>sn : string | number
|
||||
>{ ...definiteBoolean, ...definiteString, ...optionalNumber } : { sn: string | number; }
|
||||
>definiteBoolean : any
|
||||
>definiteString : any
|
||||
>optionalNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>definiteString : { sn: string; }
|
||||
>optionalNumber : { sn?: number | undefined; }
|
||||
|
||||
let optionalUnionDuplicates: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...optionalString, ...optionalNumber };
|
||||
>optionalUnionDuplicates : { sn: string | number; }
|
||||
>sn : string | number
|
||||
>{ ...definiteBoolean, ...definiteString, ...optionalString, ...optionalNumber } : { sn: string | number; }
|
||||
>definiteBoolean : any
|
||||
>definiteString : any
|
||||
>optionalString : any
|
||||
>optionalNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>definiteString : { sn: string; }
|
||||
>optionalString : { sn?: string | undefined; }
|
||||
>optionalNumber : { sn?: number | undefined; }
|
||||
|
||||
let allOptional: { sn?: string | number } = { ...optionalString, ...optionalNumber };
|
||||
>allOptional : { sn?: string | number | undefined; }
|
||||
>sn : string | number | undefined
|
||||
>{ ...optionalString, ...optionalNumber } : { sn?: string | number | undefined; }
|
||||
>optionalString : any
|
||||
>optionalNumber : any
|
||||
>optionalString : { sn?: string | undefined; }
|
||||
>optionalNumber : { sn?: number | undefined; }
|
||||
|
||||
// undefined
|
||||
let undefinedUnionStops: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...undefinedNumber };
|
||||
>undefinedUnionStops : { sn: string | number; }
|
||||
>sn : string | number
|
||||
>{ ...definiteBoolean, ...definiteString, ...undefinedNumber } : { sn: string | number; }
|
||||
>definiteBoolean : any
|
||||
>definiteString : any
|
||||
>undefinedNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>definiteString : { sn: string; }
|
||||
>undefinedNumber : { sn: number | undefined; }
|
||||
|
||||
let undefinedUnionDuplicates: { sn: string | number } = { ...definiteBoolean, ...definiteString, ...undefinedString, ...undefinedNumber };
|
||||
>undefinedUnionDuplicates : { sn: string | number; }
|
||||
>sn : string | number
|
||||
>{ ...definiteBoolean, ...definiteString, ...undefinedString, ...undefinedNumber } : { sn: string | number; }
|
||||
>definiteBoolean : any
|
||||
>definiteString : any
|
||||
>undefinedString : any
|
||||
>undefinedNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>definiteString : { sn: string; }
|
||||
>undefinedString : { sn: string | undefined; }
|
||||
>undefinedNumber : { sn: number | undefined; }
|
||||
|
||||
let allUndefined: { sn: string | number | undefined } = { ...undefinedString, ...undefinedNumber };
|
||||
>allUndefined : { sn: string | number | undefined; }
|
||||
>sn : string | number | undefined
|
||||
>{ ...undefinedString, ...undefinedNumber } : { sn: string | number | undefined; }
|
||||
>undefinedString : any
|
||||
>undefinedNumber : any
|
||||
>undefinedString : { sn: string | undefined; }
|
||||
>undefinedNumber : { sn: number | undefined; }
|
||||
|
||||
let undefinedWithOptionalContinues: { sn: string | number | boolean } = { ...definiteBoolean, ...undefinedString, ...optionalNumber };
|
||||
>undefinedWithOptionalContinues : { sn: string | number | boolean; }
|
||||
>sn : string | number | boolean
|
||||
>{ ...definiteBoolean, ...undefinedString, ...optionalNumber } : { sn: string | number | boolean; }
|
||||
>definiteBoolean : any
|
||||
>undefinedString : any
|
||||
>optionalNumber : any
|
||||
>definiteBoolean : { sn: boolean; }
|
||||
>undefinedString : { sn: string | undefined; }
|
||||
>optionalNumber : { sn?: number | undefined; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,5): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts (2 errors) ====
|
||||
1 > > 2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,8): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts (2 errors) ====
|
||||
1 >/**/> 2;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(2,1): error TS1109: Expression expected.
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbigu
|
||||
~~~
|
||||
> 2;
|
||||
~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -18,6 +18,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(5,14): error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(6,14): error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(7,14): error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(8,14): error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(9,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(10,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/relationalOperatorComparable.ts(11,14): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/relationalOperatorComparable.ts (7 errors) ====
|
||||
function f(onethree: 1 | 3, two: 2) {
|
||||
const t = true;
|
||||
const f = false;
|
||||
let a1 = onethree < two; // ok
|
||||
let a2 = onethree < true; // error, number and boolean
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'.
|
||||
let a3 = onethree <= false; // error, number and boolean
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'.
|
||||
let a4 = onethree >= t; // error, number and boolean
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'.
|
||||
let a5 = onethree > f; // error, number and boolean
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'.
|
||||
let a6 = true < onethree; // error, boolean and number
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
|
||||
let a7 = false < two; // error, boolean and number
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
|
||||
let a8 = 'foo' < onethree; // error, string and number
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
||||
let a9 = onethree < 1; // ok
|
||||
let a10 = 1 < two; // ok
|
||||
let a11 = 2 < 1; // ok
|
||||
}
|
||||
|
||||
34
tests/baselines/reference/relationalOperatorComparable.js
Normal file
34
tests/baselines/reference/relationalOperatorComparable.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//// [relationalOperatorComparable.ts]
|
||||
function f(onethree: 1 | 3, two: 2) {
|
||||
const t = true;
|
||||
const f = false;
|
||||
let a1 = onethree < two; // ok
|
||||
let a2 = onethree < true; // error, number and boolean
|
||||
let a3 = onethree <= false; // error, number and boolean
|
||||
let a4 = onethree >= t; // error, number and boolean
|
||||
let a5 = onethree > f; // error, number and boolean
|
||||
let a6 = true < onethree; // error, boolean and number
|
||||
let a7 = false < two; // error, boolean and number
|
||||
let a8 = 'foo' < onethree; // error, string and number
|
||||
let a9 = onethree < 1; // ok
|
||||
let a10 = 1 < two; // ok
|
||||
let a11 = 2 < 1; // ok
|
||||
}
|
||||
|
||||
|
||||
//// [relationalOperatorComparable.js]
|
||||
function f(onethree, two) {
|
||||
var t = true;
|
||||
var f = false;
|
||||
var a1 = onethree < two; // ok
|
||||
var a2 = onethree < true; // error, number and boolean
|
||||
var a3 = onethree <= false; // error, number and boolean
|
||||
var a4 = onethree >= t; // error, number and boolean
|
||||
var a5 = onethree > f; // error, number and boolean
|
||||
var a6 = true < onethree; // error, boolean and number
|
||||
var a7 = false < two; // error, boolean and number
|
||||
var a8 = 'foo' < onethree; // error, string and number
|
||||
var a9 = onethree < 1; // ok
|
||||
var a10 = 1 < two; // ok
|
||||
var a11 = 2 < 1; // ok
|
||||
}
|
||||
@@ -7,12 +7,11 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (11 errors) ====
|
||||
|
||||
let abc: "ABC" = "ABC";
|
||||
let xyz: "XYZ" = "XYZ";
|
||||
@@ -47,8 +46,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
let j = abc < xyz;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
|
||||
let k = abc === xyz;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
|
||||
|
||||
32
tests/baselines/reference/superCallWithCommentEmit01.js
Normal file
32
tests/baselines/reference/superCallWithCommentEmit01.js
Normal file
@@ -0,0 +1,32 @@
|
||||
//// [superCallWithCommentEmit01.ts]
|
||||
class A {
|
||||
constructor(public text: string) { }
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
constructor(text: string) {
|
||||
// this is subclass constructor
|
||||
super(text)
|
||||
}
|
||||
}
|
||||
|
||||
//// [superCallWithCommentEmit01.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var A = (function () {
|
||||
function A(text) {
|
||||
this.text = text;
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B(text) {
|
||||
// this is subclass constructor
|
||||
return _super.call(this, text) || this;
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
21
tests/baselines/reference/superCallWithCommentEmit01.symbols
Normal file
21
tests/baselines/reference/superCallWithCommentEmit01.symbols
Normal file
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/superCallWithCommentEmit01.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(superCallWithCommentEmit01.ts, 0, 0))
|
||||
|
||||
constructor(public text: string) { }
|
||||
>text : Symbol(A.text, Decl(superCallWithCommentEmit01.ts, 1, 16))
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : Symbol(B, Decl(superCallWithCommentEmit01.ts, 2, 1))
|
||||
>A : Symbol(A, Decl(superCallWithCommentEmit01.ts, 0, 0))
|
||||
|
||||
constructor(text: string) {
|
||||
>text : Symbol(text, Decl(superCallWithCommentEmit01.ts, 5, 16))
|
||||
|
||||
// this is subclass constructor
|
||||
super(text)
|
||||
>super : Symbol(A, Decl(superCallWithCommentEmit01.ts, 0, 0))
|
||||
>text : Symbol(text, Decl(superCallWithCommentEmit01.ts, 5, 16))
|
||||
}
|
||||
}
|
||||
22
tests/baselines/reference/superCallWithCommentEmit01.types
Normal file
22
tests/baselines/reference/superCallWithCommentEmit01.types
Normal file
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/superCallWithCommentEmit01.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
constructor(public text: string) { }
|
||||
>text : string
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
constructor(text: string) {
|
||||
>text : string
|
||||
|
||||
// this is subclass constructor
|
||||
super(text)
|
||||
>super(text) : void
|
||||
>super : typeof A
|
||||
>text : string
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -21,6 +21,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
@@ -23,6 +23,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user