Merge remote-tracking branch 'origin/master' into tsserverVS-WIP

This commit is contained in:
Vladimir Matsveyeu committed 2016-07-28 13:05:32 -07:00
commit 2cb3122e62
486 files changed
+14751 -5225

No files matched your search

+10
View File
@@ -13,3 +13,13 @@ os:
matrix:
fast_finish: true
exclude:
- os: osx
node_js: '4'
- os: osx
node_js: '0.10'
branches:
only:
- master
- transforms
+13 -30
View File
@@ -710,7 +710,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
const originalMap = file.sourceMap;
const prebundledContent = file.contents.toString();
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
originalMap.sources = originalMap.sources.map(s => path.resolve(s));
originalMap.sources = originalMap.sources.map(s => path.resolve("src", s));
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
originalMap.file = "built/local/_stream_0.js";
@@ -918,36 +918,19 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
return gulp.src([serverFile, serverFile + ".map"]).pipe(gulp.dest("../TypeScript-Sublime-Plugin/tsserver/"));
});
const tslintRuleDir = "scripts/tslint";
const tslintRules = [
"nextLineRule",
"preferConstRule",
"booleanTriviaRule",
"typeOperatorSpacingRule",
"noInOperatorRule",
"noIncrementDecrementRule",
"objectLiteralSurroundingSpaceRule",
];
const tslintRulesFiles = tslintRules.map(function(p) {
return path.join(tslintRuleDir, p + ".ts");
gulp.task("build-rules", "Compiles tslint rules to js", () => {
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ false);
const dest = path.join(builtLocalDirectory, "tslint");
return gulp.src("scripts/tslint/**/*.ts")
.pipe(newer({
dest,
ext: ".js"
}))
.pipe(sourcemaps.init())
.pipe(tsc(settings))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(dest));
});
const tslintRulesOutFiles = tslintRules.map(function(p, i) {
const pathname = path.join(builtLocalDirectory, "tslint", p + ".js");
gulp.task(pathname, false, [], () => {
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ false);
return gulp.src(tslintRulesFiles[i])
.pipe(newer(pathname))
.pipe(sourcemaps.init())
.pipe(tsc(settings))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(path.join(builtLocalDirectory, "tslint")));
});
return pathname;
});
gulp.task("build-rules", "Compiles tslint rules to js", tslintRulesOutFiles);
function getLinterOptions() {
return {
+2 -10
View File
@@ -491,15 +491,6 @@ task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "r
exec(cmd);
});
var scriptsTsdJson = path.join(scriptsDirectory, "tsd.json");
file(scriptsTsdJson);
task("tsd-scripts", [scriptsTsdJson], function () {
var cmd = "tsd --config " + scriptsTsdJson + " install";
console.log(cmd);
exec(cmd);
}, { async: true });
var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests");
var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js");
var importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts");
@@ -680,7 +671,7 @@ var run = path.join(builtLocalDirectory, "run.js");
compileFile(
/*outFile*/ run,
/*source*/ harnessSources,
/*prereqs*/ [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources),
/*prereqs*/ [builtLocalDirectory, tscFile].concat(libraryTargets).concat(servicesSources).concat(harnessSources),
/*prefixes*/ [],
/*useBuiltCompiler:*/ true,
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"] });
@@ -1025,6 +1016,7 @@ var tslintRules = [
"noInOperatorRule",
"noIncrementDecrementRule",
"objectLiteralSurroundingSpaceRule",
"noTypeAssertionWhitespaceRule"
];
var tslintRulesFiles = tslintRules.map(function(p) {
return path.join(tslintRuleDir, p + ".ts");
-1
View File
@@ -73,7 +73,6 @@
"sorcery": "latest",
"through2": "latest",
"ts-node": "latest",
"tsd": "latest",
"tslint": "next",
"typescript": "next"
},
-12
View File
@@ -1,12 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node/node.d.ts": {
"commit": "5f480287834a2615274eea31574b713e64decf17"
}
}
}
@@ -0,0 +1,25 @@
import * as Lint from "tslint/lib/lint";
import * as ts from "typescript";
export class Rule extends Lint.Rules.AbstractRule {
public static TRAILING_FAILURE_STRING = "Excess trailing whitespace found around type assertion.";
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(new TypeAssertionWhitespaceWalker(sourceFile, this.getOptions()));
}
}
class TypeAssertionWhitespaceWalker extends Lint.RuleWalker {
public visitNode(node: ts.Node) {
if (node.kind === ts.SyntaxKind.TypeAssertionExpression) {
const refined = node as ts.TypeAssertion;
const leftSideWhitespaceStart = refined.type.getEnd() + 1;
const rightSideWhitespaceEnd = refined.expression.getStart();
if (leftSideWhitespaceStart !== rightSideWhitespaceEnd) {
this.addFailure(this.createFailure(leftSideWhitespaceStart, rightSideWhitespaceEnd, Rule.TRAILING_FAILURE_STRING));
}
}
super.visitNode(node);
}
}
+4 -18
View File
@@ -618,18 +618,10 @@ namespace ts {
return false;
}
function isNarrowingNullCheckOperands(expr1: Expression, expr2: Expression) {
return (expr1.kind === SyntaxKind.NullKeyword || expr1.kind === SyntaxKind.Identifier && (<Identifier>expr1).text === "undefined") && isNarrowableOperand(expr2);
}
function isNarrowingTypeofOperands(expr1: Expression, expr2: Expression) {
return expr1.kind === SyntaxKind.TypeOfExpression && isNarrowableOperand((<TypeOfExpression>expr1).expression) && expr2.kind === SyntaxKind.StringLiteral;
}
function isNarrowingDiscriminant(expr: Expression) {
return expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
}
function isNarrowingBinaryExpression(expr: BinaryExpression) {
switch (expr.operatorToken.kind) {
case SyntaxKind.EqualsToken:
@@ -638,9 +630,8 @@ namespace ts {
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
return isNarrowingNullCheckOperands(expr.right, expr.left) || isNarrowingNullCheckOperands(expr.left, expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) ||
isNarrowingDiscriminant(expr.left) || isNarrowingDiscriminant(expr.right);
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
case SyntaxKind.InstanceOfKeyword:
return isNarrowableOperand(expr.left);
case SyntaxKind.CommaToken:
@@ -664,11 +655,6 @@ namespace ts {
return isNarrowableReference(expr);
}
function isNarrowingSwitchStatement(switchStatement: SwitchStatement) {
const expr = switchStatement.expression;
return expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
}
function createBranchLabel(): FlowLabel {
return {
flags: FlowFlags.BranchLabel,
@@ -718,7 +704,7 @@ namespace ts {
}
function createFlowSwitchClause(antecedent: FlowNode, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): FlowNode {
if (!isNarrowingSwitchStatement(switchStatement)) {
if (!isNarrowingExpression(switchStatement.expression)) {
return antecedent;
}
setFlowNodeReferenced(antecedent);
@@ -1983,7 +1969,7 @@ namespace ts {
function bindThisPropertyAssignment(node: BinaryExpression) {
// Declare a 'member' in case it turns out the container was an ES5 class or ES6 constructor
let assignee: Node;
if (container.kind === SyntaxKind.FunctionDeclaration || container.kind === SyntaxKind.FunctionDeclaration) {
if (container.kind === SyntaxKind.FunctionDeclaration || container.kind === SyntaxKind.FunctionExpression) {
assignee = container;
}
else if (container.kind === SyntaxKind.Constructor) {
+747 -378
View File
File diff suppressed because it is too large. Load diff
+2 -9
View File
@@ -139,12 +139,12 @@ namespace ts {
{
name: "noUnusedLocals",
type: "boolean",
description: Diagnostics.Report_errors_on_unused_locals,
description: Diagnostics.Report_errors_on_unused_locals,
},
{
name: "noUnusedParameters",
type: "boolean",
description: Diagnostics.Report_errors_on_unused_parameters,
description: Diagnostics.Report_errors_on_unused_parameters,
},
{
name: "noLib",
@@ -693,9 +693,6 @@ namespace ts {
return output;
}
// Skip over any minified JavaScript files (ending in ".min.js")
// Skip over dotted files and folders as well
const ignoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/;
/**
* Parse the contents of a config file (tsconfig.json).
* @param json The contents of the config file to parse
@@ -1007,10 +1004,6 @@ namespace ts {
continue;
}
if (ignoreFileNamePattern.test(file)) {
continue;
}
// We may have included a wildcard path with a lower priority
// extension due to the user-defined order of entries in the
// "include" array. If there is a lower priority extension in the
+52 -9
View File
@@ -93,10 +93,10 @@ namespace ts {
return undefined;
}
export function contains<T>(array: T[], value: T, areEqual?: (a: T, b: T) => boolean): boolean {
export function contains<T>(array: T[], value: T): boolean {
if (array) {
for (const v of array) {
if (areEqual ? areEqual(v, value) : v === value) {
if (v === value) {
return true;
}
}
@@ -183,10 +183,13 @@ namespace ts {
let result: T[];
if (array) {
result = [];
for (const item of array) {
if (!contains(result, item, areEqual)) {
result.push(item);
loop: for (const item of array) {
for (const res of result) {
if (areEqual ? areEqual(res, item) : res === item) {
continue loop;
}
}
result.push(item);
}
}
return result;
@@ -933,11 +936,29 @@ namespace ts {
const reservedCharacterPattern = /[^\w\s\/]/g;
const wildcardCharCodes = [CharacterCodes.asterisk, CharacterCodes.question];
/**
* Matches any single directory segment unless it is the last segment and a .min.js file
* Breakdown:
* [^./] # matches everything up to the first . character (excluding directory seperators)
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
*/
const singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*";
const singleAsteriskRegexFragmentOther = "[^/]*";
export function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude") {
if (specs === undefined || specs.length === 0) {
return undefined;
}
const replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther;
const singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther;
/**
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
* files or directories, does not match subdirectories that start with a . character
*/
const doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?";
let pattern = "";
let hasWrittenSubpattern = false;
spec: for (const spec of specs) {
@@ -958,13 +979,13 @@ namespace ts {
components[0] = removeTrailingDirectorySeparator(components[0]);
let optionalCount = 0;
for (const component of components) {
for (let component of components) {
if (component === "**") {
if (hasRecursiveDirectoryWildcard) {
continue spec;
}
subpattern += "(/.+?)?";
subpattern += doubleAsteriskRegexFragment;
hasRecursiveDirectoryWildcard = true;
hasWrittenComponent = true;
}
@@ -978,6 +999,20 @@ namespace ts {
subpattern += directorySeparator;
}
if (usage !== "exclude") {
// The * and ? wildcards should not match directories or files that start with . if they
// appear first in a component. Dotted directories and files can be included explicitly
// like so: **/.*/.*
if (component.charCodeAt(0) === CharacterCodes.asterisk) {
subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
component = component.substr(1);
}
else if (component.charCodeAt(0) === CharacterCodes.question) {
subpattern += "[^./]";
component = component.substr(1);
}
}
subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
hasWrittenComponent = true;
}
@@ -1003,8 +1038,16 @@ namespace ts {
return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$");
}
function replaceWildcardCharacter(match: string) {
return match === "*" ? "[^/]*" : match === "?" ? "[^/]" : "\\" + match;
function replaceWildCardCharacterFiles(match: string) {
return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles);
}
function replaceWildCardCharacterOther(match: string) {
return replaceWildcardCharacter(match, singleAsteriskRegexFragmentOther);
}
function replaceWildcardCharacter(match: string, singleAsteriskRegexFragment: string) {
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
}
export interface FileSystemEntries {
+1 -1
View File
@@ -397,7 +397,7 @@ namespace ts {
case SyntaxKind.NullKeyword:
case SyntaxKind.NeverKeyword:
case SyntaxKind.ThisType:
case SyntaxKind.StringLiteralType:
case SyntaxKind.LiteralType:
return writeTextOfNode(currentText, type);
case SyntaxKind.ExpressionWithTypeArguments:
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);
+10 -2
View File
@@ -1755,6 +1755,10 @@
"category": "Error",
"code": 2534
},
"Enum type '{0}' has members with initializers that are not literals.": {
"category": "Error",
"code": 2535
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600
@@ -2336,6 +2340,10 @@
"category": "Error",
"code": 5065
},
"Substitutions for pattern '{0}' shouldn't be an empty array.": {
"category": "Error",
"code": 5066
},
"Concatenate and emit output to single file.": {
"category": "Message",
"code": 6001
@@ -2800,11 +2808,11 @@
"category": "Error",
"code": 6133
},
"Report errors on unused locals.": {
"Report errors on unused locals.": {
"category": "Message",
"code": 6134
},
"Report errors on unused parameters.": {
"Report errors on unused parameters.": {
"category": "Message",
"code": 6135
},
+12 -8
View File
@@ -2667,7 +2667,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
isNameOfExportedDeclarationInNonES6Module(node.operand);
if (internalExportChanged) {
emitAliasEqual(<Identifier> node.operand);
emitAliasEqual(<Identifier>node.operand);
}
write(tokenToString(node.operator));
@@ -2722,7 +2722,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
}
else if (internalExportChanged) {
emitAliasEqual(<Identifier> node.operand);
emitAliasEqual(<Identifier>node.operand);
emit(node.operand);
if (node.operator === SyntaxKind.PlusPlusToken) {
write(" += 1");
@@ -5526,13 +5526,17 @@ const _super = (function (geti, seti) {
// If the class has static properties, and it's a class expression, then we'll need
// to specialize the emit a bit. for a class expression of the form:
//
// class C { static a = 1; static b = 2; ... }
// (class C { static a = 1; static b = 2; ... })
//
// We'll emit:
//
// let C_1 = class C{};
// C_1.a = 1;
// C_1.b = 2; // so forth and so on
// ((C_1 = class C {
// // Normal class body
// },
// C_1.a = 1,
// C_1.b = 2,
// C_1));
// var C_1;
//
// This keeps the expression as an expression, while ensuring that the static parts
// of it have been initialized by the time it is used.
@@ -5541,7 +5545,7 @@ const _super = (function (geti, seti) {
let generatedName: string;
if (isClassExpressionWithStaticProperties) {
generatedName = getGeneratedNameForNode(node.name);
generatedName = node.name ? getGeneratedNameForNode(node.name) : makeUniqueName("classExpression");
const synthesizedNode = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
synthesizedNode.text = generatedName;
recordTempDeclaration(synthesizedNode);
@@ -6041,7 +6045,7 @@ const _super = (function (geti, seti) {
return;
case SyntaxKind.StringKeyword:
case SyntaxKind.StringLiteralType:
case SyntaxKind.LiteralType:
write("String");
return;
+335 -306
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -2,7 +2,7 @@
namespace ts {
declare const performance: { now?(): number } | undefined;
/** Gets a timestamp with (at least) ms resolution */
export const timestamp = typeof performance !== "undefined" && performance.now ? performance.now : Date.now ? Date.now : () => +(new Date());
export const timestamp = typeof performance !== "undefined" && performance.now ? () => performance.now() : Date.now ? Date.now : () => +(new Date());
}
/*@internal*/
@@ -106,4 +106,4 @@ namespace ts.performance {
measures = undefined;
profilerEvent = undefined;
}
}
}
+10 -7
View File
@@ -2205,6 +2205,9 @@ namespace ts {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key));
}
if (isArray(options.paths[key])) {
if (options.paths[key].length === 0) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key));
}
for (const subst of options.paths[key]) {
const typeOfSubst = typeof subst;
if (typeOfSubst === "string") {
@@ -2257,7 +2260,7 @@ namespace ts {
const languageVersion = options.target || ScriptTarget.ES3;
const outFile = options.outFile || options.out;
const firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
const firstNonAmbientExternalModuleSourceFile = forEach(files, f => isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
if (options.isolatedModules) {
if (options.module === ModuleKind.None && languageVersion < ScriptTarget.ES6) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));
@@ -2269,10 +2272,10 @@ namespace ts {
programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && options.module === ModuleKind.None) {
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && options.module === ModuleKind.None) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
programDiagnostics.add(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
}
// Cannot specify module gen that isn't amd or system with --out
@@ -2280,9 +2283,9 @@ namespace ts {
if (options.module && !(options.module === ModuleKind.AMD || options.module === ModuleKind.System)) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile"));
}
else if (options.module === undefined && firstExternalModuleSourceFile) {
const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
programDiagnostics.add(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
}
}
+66 -43
View File
@@ -210,7 +210,7 @@ namespace ts {
IntersectionType,
ParenthesizedType,
ThisType,
StringLiteralType,
LiteralType,
// Binding patterns
ObjectBindingPattern,
ArrayBindingPattern,
@@ -361,7 +361,7 @@ namespace ts {
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword,
FirstTypeNode = TypePredicate,
LastTypeNode = StringLiteralType,
LastTypeNode = LiteralType,
FirstPunctuation = OpenBraceToken,
LastPunctuation = CaretEqualsToken,
FirstToken = Unknown,
@@ -794,8 +794,9 @@ namespace ts {
}
// @kind(SyntaxKind.StringLiteralType)
export interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
export interface LiteralTypeNode extends TypeNode {
_stringLiteralTypeBrand: any;
literal: Expression;
}
// @kind(SyntaxKind.StringLiteral)
@@ -1917,6 +1918,7 @@ namespace ts {
InElementType = 0x00000040, // Writing an array or union element type
UseFullyQualifiedType = 0x00000080, // Write out the fully qualified type name (eg. Module.Type, instead of Type)
InFirstTypeArgument = 0x00000100, // Writing first type argument of the instantiated type
InTypeAlias = 0x00000200, // Writing type in type alias declaration
}
export const enum SymbolFormatFlags {
@@ -2070,8 +2072,8 @@ namespace ts {
Enum = RegularEnum | ConstEnum,
Variable = FunctionScopedVariable | BlockScopedVariable,
Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor,
Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter | TypeAlias,
Namespace = ValueModule | NamespaceModule,
Type = Class | Interface | Enum | EnumMember | TypeLiteral | ObjectLiteral | TypeParameter | TypeAlias,
Namespace = ValueModule | NamespaceModule | Enum,
Module = ValueModule | NamespaceModule,
Accessor = GetAccessor | SetAccessor,
@@ -2085,7 +2087,7 @@ namespace ts {
ParameterExcludes = Value,
PropertyExcludes = None,
EnumMemberExcludes = Value,
EnumMemberExcludes = Value | Type,
FunctionExcludes = Value & ~(Function | ValueModule),
ClassExcludes = (Value | Type) & ~(ValueModule | Interface), // class-interface mergability done in checker.ts
InterfaceExcludes = Type & ~(Interface | Class),
@@ -2216,57 +2218,65 @@ namespace ts {
}
export const enum TypeFlags {
Any = 0x00000001,
String = 0x00000002,
Number = 0x00000004,
Boolean = 0x00000008,
Void = 0x00000010,
Undefined = 0x00000020,
Null = 0x00000040,
Enum = 0x00000080, // Enum type
StringLiteral = 0x00000100, // String literal type
TypeParameter = 0x00000200, // Type parameter
Class = 0x00000400, // Class
Interface = 0x00000800, // Interface
Reference = 0x00001000, // Generic type reference
Tuple = 0x00002000, // Tuple
Union = 0x00004000, // Union (T | U)
Intersection = 0x00008000, // Intersection (T & U)
Anonymous = 0x00010000, // Anonymous
Instantiated = 0x00020000, // Instantiated anonymous type
Any = 1 << 0,
String = 1 << 1,
Number = 1 << 2,
Boolean = 1 << 3,
Enum = 1 << 4,
StringLiteral = 1 << 5,
NumberLiteral = 1 << 6,
BooleanLiteral = 1 << 7,
EnumLiteral = 1 << 8,
ESSymbol = 1 << 9, // Type of symbol primitive introduced in ES6
Void = 1 << 10,
Undefined = 1 << 11,
Null = 1 << 12,
Never = 1 << 13, // Never type
TypeParameter = 1 << 14, // Type parameter
Class = 1 << 15, // Class
Interface = 1 << 16, // Interface
Reference = 1 << 17, // Generic type reference
Tuple = 1 << 18, // Tuple
Union = 1 << 19, // Union (T | U)
Intersection = 1 << 20, // Intersection (T & U)
Anonymous = 1 << 21, // Anonymous
Instantiated = 1 << 22, // Instantiated anonymous type
/* @internal */
FromSignature = 0x00040000, // Created for signature assignment check
ObjectLiteral = 0x00080000, // Originates in an object literal
ObjectLiteral = 1 << 23, // Originates in an object literal
/* @internal */
FreshObjectLiteral = 0x00100000, // Fresh object literal type
FreshObjectLiteral = 1 << 24, // Fresh object literal type
/* @internal */
ContainsWideningType = 0x00200000, // Type is or contains undefined or null widening type
ContainsWideningType = 1 << 25, // Type is or contains undefined or null widening type
/* @internal */
ContainsObjectLiteral = 0x00400000, // Type is or contains object literal type
ContainsObjectLiteral = 1 << 26, // Type is or contains object literal type
/* @internal */
ContainsAnyFunctionType = 0x00800000, // Type is or contains object literal type
ESSymbol = 0x01000000, // Type of symbol primitive introduced in ES6
ThisType = 0x02000000, // This type
ObjectLiteralPatternWithComputedProperties = 0x04000000, // Object literal type implied by binding pattern has computed properties
Never = 0x08000000, // Never type
ContainsAnyFunctionType = 1 << 27, // Type is or contains object literal type
ThisType = 1 << 28, // This type
ObjectLiteralPatternWithComputedProperties = 1 << 29, // Object literal type implied by binding pattern has computed properties
/* @internal */
Nullable = Undefined | Null,
Literal = StringLiteral | NumberLiteral | BooleanLiteral | EnumLiteral,
/* @internal */
Falsy = Void | Undefined | Null, // TODO: Add false, 0, and ""
DefinitelyFalsy = StringLiteral | NumberLiteral | BooleanLiteral | Void | Undefined | Null,
PossiblyFalsy = DefinitelyFalsy | String | Number | Boolean,
/* @internal */
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null | Never,
Intrinsic = Any | String | Number | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never,
/* @internal */
Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum,
Primitive = String | Number | Boolean | Enum | ESSymbol | Void | Undefined | Null | Literal,
StringLike = String | StringLiteral,
NumberLike = Number | Enum,
NumberLike = Number | NumberLiteral | Enum | EnumLiteral,
BooleanLike = Boolean | BooleanLiteral,
EnumLike = Enum | EnumLiteral,
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
UnionOrIntersection = Union | Intersection,
StructuredType = ObjectType | Union | Intersection,
StructuredOrTypeParameter = StructuredType | TypeParameter,
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
Narrowable = Any | StructuredType | TypeParameter | StringLike | NumberLike | Boolean | ESSymbol,
Narrowable = Any | StructuredType | TypeParameter | StringLike | NumberLike | BooleanLike | ESSymbol,
NotUnionOrUnit = Any | String | Number | ESSymbol | ObjectType,
/* @internal */
RequiresWidening = ContainsWideningType | ContainsObjectLiteral,
/* @internal */
@@ -2281,6 +2291,8 @@ namespace ts {
/* @internal */ id: number; // Unique ID
symbol?: Symbol; // Symbol associated with type (if any)
pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any)
aliasSymbol?: Symbol; // Alias associated with type
aliasTypeArguments?: Type[]; // Alias type arguments (if any)
}
/* @internal */
@@ -2290,10 +2302,20 @@ namespace ts {
}
// String literal types (TypeFlags.StringLiteral)
export interface StringLiteralType extends Type {
export interface LiteralType extends Type {
text: string; // Text of string literal
}
// Enum types (TypeFlags.Enum)
export interface EnumType extends Type {
memberTypes: Map<EnumLiteralType>;
}
// Enum types (TypeFlags.EnumLiteral)
export interface EnumLiteralType extends LiteralType {
baseType: EnumType & UnionType;
}
// Object types (TypeFlags.ObjectType)
export interface ObjectType extends Type { }
@@ -2343,9 +2365,9 @@ namespace ts {
export interface UnionOrIntersectionType extends Type {
types: Type[]; // Constituent types
/* @internal */
reducedType: Type; // Reduced union type (all subtypes removed)
/* @internal */
resolvedProperties: SymbolTable; // Cache of resolved properties
/* @internal */
couldContainTypeParameters: boolean;
}
export interface UnionType extends UnionOrIntersectionType { }
@@ -2414,7 +2436,7 @@ namespace ts {
/* @internal */
hasRestParameter: boolean; // True if last parameter is rest parameter
/* @internal */
hasStringLiterals: boolean; // True if specialized
hasLiteralTypes: boolean; // True if specialized
/* @internal */
target?: Signature; // Instantiation target
/* @internal */
@@ -2444,6 +2466,7 @@ namespace ts {
export interface TypeMapper {
(t: TypeParameter): Type;
mappedTypes?: Type[]; // Types mapped by this mapper
targetTypes?: Type[]; // Types substituted for mapped types
instantiations?: Type[]; // Cache of instantiations created using this type mapper.
context?: InferenceContext; // The inference context this mapper was created from.
// Only inference mappers have this set (in createInferenceMapper).
+1 -1
View File
@@ -1523,7 +1523,7 @@ namespace ts {
continue;
}
return parent.kind === SyntaxKind.BinaryExpression &&
(<BinaryExpression>parent).operatorToken.kind === SyntaxKind.EqualsToken &&
isAssignmentOperator((<BinaryExpression>parent).operatorToken.kind) &&
(<BinaryExpression>parent).left === node ||
(parent.kind === SyntaxKind.ForInStatement || parent.kind === SyntaxKind.ForOfStatement) &&
(<ForInStatement | ForOfStatement>parent).initializer === node;
+1 -12
View File
@@ -1216,18 +1216,7 @@ namespace Harness {
}
export function minimalDiagnosticsToString(diagnostics: ts.Diagnostic[]) {
// This is basically copied from tsc.ts's reportError to replicate what tsc does
let errorOutput = "";
ts.forEach(diagnostics, diagnostic => {
if (diagnostic.file) {
const lineAndCharacter = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
errorOutput += diagnostic.file.fileName + "(" + (lineAndCharacter.line + 1) + "," + (lineAndCharacter.character + 1) + "): ";
}
errorOutput += ts.DiagnosticCategory[diagnostic.category].toLowerCase() + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, Harness.IO.newLine()) + Harness.IO.newLine();
});
return errorOutput;
return ts.formatDiagnostics(diagnostics, { getCanonicalFileName, getCurrentDirectory: () => "", getNewLine: () => Harness.IO.newLine() });
}
export function getErrorBaseline(inputFiles: TestFile[], diagnostics: ts.Diagnostic[]) {
+1 -1
View File
@@ -209,7 +209,7 @@ namespace Playback {
memoize(path => findResultByFields(replayLog.pathsResolved, { path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path))));
wrapper.readFile = recordReplay(wrapper.readFile, underlying)(
path => {
(path: string) => {
const result = underlying.readFile(path);
const logEntry = { path, codepage: 0, result: { contents: result, codepage: 0 } };
recordLog.filesRead.push(logEntry);
+186
View File
@@ -23,6 +23,8 @@ namespace ts {
"c:/dev/x/y/b.ts",
"c:/dev/js/a.js",
"c:/dev/js/b.js",
"c:/dev/js/d.min.js",
"c:/dev/js/ab.min.js",
"c:/ext/ext.ts",
"c:/ext/b/a..b.ts"
]);
@@ -75,6 +77,17 @@ namespace ts {
"c:/dev/jspm_packages/a.ts"
]);
const caseInsensitiveDottedFoldersHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [
"c:/dev/x/d.ts",
"c:/dev/x/y/d.ts",
"c:/dev/x/y/.e.ts",
"c:/dev/x/.y/a.ts",
"c:/dev/.z/.b.ts",
"c:/dev/.z/c.ts",
"c:/dev/w/.u/e.ts",
"c:/dev/g.min.js/.g/g.ts"
]);
describe("matchFiles", () => {
describe("with literal file list", () => {
it("without exclusions", () => {
@@ -726,6 +739,33 @@ namespace ts {
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("include explicitly listed .min.js files when allowJs=true", () => {
const json = {
compilerOptions: {
allowJs: true
},
include: [
"js/*.min.js"
]
};
const expected: ts.ParsedCommandLine = {
options: {
allowJs: true
},
errors: [],
fileNames: [
"c:/dev/js/ab.min.js",
"c:/dev/js/d.min.js"
],
wildcardDirectories: {
"c:/dev/js": ts.WatchDirectoryFlags.None
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("include paths outside of the project", () => {
const json = {
include: [
@@ -951,6 +991,35 @@ namespace ts {
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("exclude .min.js files using wildcards", () => {
const json = {
compilerOptions: {
allowJs: true
},
include: [
"js/*.min.js"
],
exclude: [
"js/a*"
]
};
const expected: ts.ParsedCommandLine = {
options: {
allowJs: true
},
errors: [],
fileNames: [
"c:/dev/js/d.min.js"
],
wildcardDirectories: {
"c:/dev/js": ts.WatchDirectoryFlags.None
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
describe("with trailing recursive directory", () => {
it("in includes", () => {
const json = {
@@ -1145,5 +1214,122 @@ namespace ts {
});
});
});
describe("with files or folders that begin with a .", () => {
it("that are not explicitly included", () => {
const json = {
include: [
"x/**/*",
"w/*/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/x/d.ts",
"c:/dev/x/y/d.ts",
],
wildcardDirectories: {
"c:/dev/x": ts.WatchDirectoryFlags.Recursive,
"c:/dev/w": ts.WatchDirectoryFlags.Recursive
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
describe("that are explicitly included", () => {
it("without wildcards", () => {
const json = {
include: [
"x/.y/a.ts",
"c:/dev/.z/.b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/.z/.b.ts",
"c:/dev/x/.y/a.ts"
],
wildcardDirectories: {}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("with recursive wildcards that match directories", () => {
const json = {
include: [
"**/.*/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/.z/c.ts",
"c:/dev/g.min.js/.g/g.ts",
"c:/dev/w/.u/e.ts",
"c:/dev/x/.y/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("with recursive wildcards that match nothing", () => {
const json = {
include: [
"x/**/.y/*",
".z/**/.*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/.z/.b.ts",
"c:/dev/x/.y/a.ts"
],
wildcardDirectories: {
"c:/dev/.z": ts.WatchDirectoryFlags.Recursive,
"c:/dev/x": ts.WatchDirectoryFlags.Recursive
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("with wildcard excludes that implicitly exclude dotted files", () => {
const json = {
include: [
"**/.*/*"
],
exclude: [
"**/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [],
wildcardDirectories: {}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveDottedFoldersHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
});
});
});
}
+3 -18
View File
@@ -1,21 +1,6 @@
/// <reference path="..\harness.ts" />
namespace ts {
function diagnosticToString(diagnostic: Diagnostic) {
let output = "";
if (diagnostic.file) {
const loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
output += `${diagnostic.file.fileName}(${loc.line + 1},${loc.character + 1}): `;
}
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
output += `${category} TS${diagnostic.code}: ${flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine)}${sys.newLine}`;
return output;
}
interface File {
name: string;
content?: string;
@@ -322,9 +307,9 @@ namespace ts {
assert.equal(program.getSourceFiles().length, expectedFilesCount);
const syntacticDiagnostics = program.getSyntacticDiagnostics();
assert.equal(syntacticDiagnostics.length, 0, `expect no syntactic diagnostics, got: ${JSON.stringify(syntacticDiagnostics.map(diagnosticToString))}`);
assert.equal(syntacticDiagnostics.length, 0, `expect no syntactic diagnostics, got: ${JSON.stringify(Harness.Compiler.minimalDiagnosticsToString(syntacticDiagnostics))}`);
const semanticDiagnostics = program.getSemanticDiagnostics();
assert.equal(semanticDiagnostics.length, 0, `expect no semantic diagnostics, got: ${JSON.stringify(semanticDiagnostics.map(diagnosticToString))}`);
assert.equal(semanticDiagnostics.length, 0, `expect no semantic diagnostics, got: ${JSON.stringify(Harness.Compiler.minimalDiagnosticsToString(semanticDiagnostics))}`);
// try to get file using a relative name
for (const relativeFileName of relativeNamesToCheck) {
@@ -403,7 +388,7 @@ export = C;
};
const program = createProgram(rootFiles, options, host);
const diagnostics = sortAndDeduplicateDiagnostics(program.getSemanticDiagnostics().concat(program.getOptionsDiagnostics()));
assert.equal(diagnostics.length, diagnosticCodes.length, `Incorrect number of expected diagnostics, expected ${diagnosticCodes.length}, got '${map(diagnostics, diagnosticToString).join("\r\n")}'`);
assert.equal(diagnostics.length, diagnosticCodes.length, `Incorrect number of expected diagnostics, expected ${diagnosticCodes.length}, got '${Harness.Compiler.minimalDiagnosticsToString(diagnostics)}'`);
for (let i = 0; i < diagnosticCodes.length; i++) {
assert.equal(diagnostics[i].code, diagnosticCodes[i], `Expected diagnostic code ${diagnosticCodes[i]}, got '${diagnostics[i].code}': '${diagnostics[i].messageText}'`);
}
+185 -185
View File
@@ -1,185 +1,185 @@
/// <reference path="..\harness.ts" />
/// <reference path="..\..\compiler\commandLineParser.ts" />
namespace ts {
describe("parseConfigFileTextToJson", () => {
function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic }) {
const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
assert.equal(JSON.stringify(parsed), JSON.stringify(expectedConfigObject));
}
function assertParseError(jsonText: string) {
const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
assert.isTrue(undefined === parsed.config);
assert.isTrue(undefined !== parsed.error);
}
function assertParseErrorWithExcludesKeyword(jsonText: string) {
const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
const parsedCommand = ts.parseJsonConfigFileContent(parsed.config, ts.sys, "tests/cases/unittests");
assert.isTrue(parsedCommand.errors && parsedCommand.errors.length === 1 &&
parsedCommand.errors[0].code === ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude.code);
}
function assertParseFileList(jsonText: string, configFileName: string, basePath: string, allFileList: string[], expectedFileList: string[]) {
const json = JSON.parse(jsonText);
const host: ParseConfigHost = new Utils.MockParseConfigHost(basePath, true, allFileList);
const parsed = ts.parseJsonConfigFileContent(json, host, basePath, /*existingOptions*/ undefined, configFileName);
assert.isTrue(arrayIsEqualTo(parsed.fileNames.sort(), expectedFileList.sort()));
}
it("returns empty config for file with only whitespaces", () => {
assertParseResult("", { config : {} });
assertParseResult(" ", { config : {} });
});
it("returns empty config for file with comments only", () => {
assertParseResult("// Comment", { config: {} });
assertParseResult("/* Comment*/", { config: {} });
});
it("returns empty config when config is empty object", () => {
assertParseResult("{}", { config: {} });
});
it("returns config object without comments", () => {
assertParseResult(
`{ // Excluded files
"exclude": [
// Exclude d.ts
"file.d.ts"
]
}`, { config: { exclude: ["file.d.ts"] } });
assertParseResult(
`{
/* Excluded
Files
*/
"exclude": [
/* multiline comments can be in the middle of a line */"file.d.ts"
]
}`, { config: { exclude: ["file.d.ts"] } });
});
it("keeps string content untouched", () => {
assertParseResult(
`{
"exclude": [
"xx//file.d.ts"
]
}`, { config: { exclude: ["xx//file.d.ts"] } });
assertParseResult(
`{
"exclude": [
"xx/*file.d.ts*/"
]
}`, { config: { exclude: ["xx/*file.d.ts*/"] } });
});
it("handles escaped characters in strings correctly", () => {
assertParseResult(
`{
"exclude": [
"xx\\"//files"
]
}`, { config: { exclude: ["xx\"//files"] } });
assertParseResult(
`{
"exclude": [
"xx\\\\" // end of line comment
]
}`, { config: { exclude: ["xx\\"] } });
});
it("returns object with error when json is invalid", () => {
assertParseError("invalid");
});
it("returns object when users correctly specify library", () => {
assertParseResult(
`{
"compilerOptions": {
"lib": ["es5"]
}
}`, {
config: { compilerOptions: { lib: ["es5"] } }
});
assertParseResult(
`{
"compilerOptions": {
"lib": ["es5", "es6"]
}
}`, {
config: { compilerOptions: { lib: ["es5", "es6"] } }
});
});
it("returns error when tsconfig have excludes", () => {
assertParseErrorWithExcludesKeyword(
`{
"compilerOptions": {
"lib": ["es5"]
},
"excludes": [
"foge.ts"
]
}`);
});
it("ignore dotted files and folders", () => {
assertParseFileList(
`{}`,
"tsconfig.json",
"/apath",
["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
["/apath/test.ts"]
);
});
it("allow dotted files and folders when explicitly requested", () => {
assertParseFileList(
`{
"files": ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
}`,
"tsconfig.json",
"/apath",
["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
);
});
it("always exclude outDir", () => {
const tsconfigWithoutExclude =
`{
"compilerOptions": {
"outDir": "bin"
}
}`;
const tsconfigWithExclude =
`{
"compilerOptions": {
"outDir": "bin"
},
"exclude": [ "obj" ]
}`;
const rootDir = "/";
const allFiles = ["/bin/a.ts", "/b.ts"];
const expectedFiles = ["/b.ts"];
assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
});
it("implicitly exclude common package folders", () => {
assertParseFileList(
`{}`,
"tsconfig.json",
"/",
["/node_modules/a.ts", "/bower_components/b.ts", "/jspm_packages/c.ts", "/d.ts", "/folder/e.ts"],
["/d.ts", "/folder/e.ts"]
);
});
});
}
/// <reference path="..\harness.ts" />
/// <reference path="..\..\compiler\commandLineParser.ts" />
namespace ts {
describe("parseConfigFileTextToJson", () => {
function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic }) {
const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
assert.equal(JSON.stringify(parsed), JSON.stringify(expectedConfigObject));
}
function assertParseError(jsonText: string) {
const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
assert.isTrue(undefined === parsed.config);
assert.isTrue(undefined !== parsed.error);
}
function assertParseErrorWithExcludesKeyword(jsonText: string) {
const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
const parsedCommand = ts.parseJsonConfigFileContent(parsed.config, ts.sys, "tests/cases/unittests");
assert.isTrue(parsedCommand.errors && parsedCommand.errors.length === 1 &&
parsedCommand.errors[0].code === ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude.code);
}
function assertParseFileList(jsonText: string, configFileName: string, basePath: string, allFileList: string[], expectedFileList: string[]) {
const json = JSON.parse(jsonText);
const host: ParseConfigHost = new Utils.MockParseConfigHost(basePath, true, allFileList);
const parsed = ts.parseJsonConfigFileContent(json, host, basePath, /*existingOptions*/ undefined, configFileName);
assert.isTrue(arrayIsEqualTo(parsed.fileNames.sort(), expectedFileList.sort()));
}
it("returns empty config for file with only whitespaces", () => {
assertParseResult("", { config : {} });
assertParseResult(" ", { config : {} });
});
it("returns empty config for file with comments only", () => {
assertParseResult("// Comment", { config: {} });
assertParseResult("/* Comment*/", { config: {} });
});
it("returns empty config when config is empty object", () => {
assertParseResult("{}", { config: {} });
});
it("returns config object without comments", () => {
assertParseResult(
`{ // Excluded files
"exclude": [
// Exclude d.ts
"file.d.ts"
]
}`, { config: { exclude: ["file.d.ts"] } });
assertParseResult(
`{
/* Excluded
Files
*/
"exclude": [
/* multiline comments can be in the middle of a line */"file.d.ts"
]
}`, { config: { exclude: ["file.d.ts"] } });
});
it("keeps string content untouched", () => {
assertParseResult(
`{
"exclude": [
"xx//file.d.ts"
]
}`, { config: { exclude: ["xx//file.d.ts"] } });
assertParseResult(
`{
"exclude": [
"xx/*file.d.ts*/"
]
}`, { config: { exclude: ["xx/*file.d.ts*/"] } });
});
it("handles escaped characters in strings correctly", () => {
assertParseResult(
`{
"exclude": [
"xx\\"//files"
]
}`, { config: { exclude: ["xx\"//files"] } });
assertParseResult(
`{
"exclude": [
"xx\\\\" // end of line comment
]
}`, { config: { exclude: ["xx\\"] } });
});
it("returns object with error when json is invalid", () => {
assertParseError("invalid");
});
it("returns object when users correctly specify library", () => {
assertParseResult(
`{
"compilerOptions": {
"lib": ["es5"]
}
}`, {
config: { compilerOptions: { lib: ["es5"] } }
});
assertParseResult(
`{
"compilerOptions": {
"lib": ["es5", "es6"]
}
}`, {
config: { compilerOptions: { lib: ["es5", "es6"] } }
});
});
it("returns error when tsconfig have excludes", () => {
assertParseErrorWithExcludesKeyword(
`{
"compilerOptions": {
"lib": ["es5"]
},
"excludes": [
"foge.ts"
]
}`);
});
it("ignore dotted files and folders", () => {
assertParseFileList(
`{}`,
"tsconfig.json",
"/apath",
["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
["/apath/test.ts"]
);
});
it("allow dotted files and folders when explicitly requested", () => {
assertParseFileList(
`{
"files": ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
}`,
"tsconfig.json",
"/apath",
["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
);
});
it("always exclude outDir", () => {
const tsconfigWithoutExclude =
`{
"compilerOptions": {
"outDir": "bin"
}
}`;
const tsconfigWithExclude =
`{
"compilerOptions": {
"outDir": "bin"
},
"exclude": [ "obj" ]
}`;
const rootDir = "/";
const allFiles = ["/bin/a.ts", "/b.ts"];
const expectedFiles = ["/b.ts"];
assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
});
it("implicitly exclude common package folders", () => {
assertParseFileList(
`{}`,
"tsconfig.json",
"/",
["/node_modules/a.ts", "/bower_components/b.ts", "/jspm_packages/c.ts", "/d.ts", "/folder/e.ts"],
["/d.ts", "/folder/e.ts"]
);
});
});
}
+1 -1
View File
@@ -19,7 +19,7 @@ namespace ts.formatting {
public Initialize(rules: Rule[]) {
this.mapRowLength = SyntaxKind.LastToken + 1;
this.map = <any> new Array(this.mapRowLength * this.mapRowLength); // new Array<RulesBucket>(this.mapRowLength * this.mapRowLength);
this.map = <any>new Array(this.mapRowLength * this.mapRowLength); // new Array<RulesBucket>(this.mapRowLength * this.mapRowLength);
// This array is used only during construction of the rulesbucket in the map
const rulesBucketConstructionStateList: RulesBucketConstructionState[] = <any>new Array(this.map.length); // new Array<RulesBucketConstructionState>(this.map.length);
+54 -20
View File
@@ -887,7 +887,7 @@ namespace ts {
resolvedReturnType: Type;
minArgumentCount: number;
hasRestParameter: boolean;
hasStringLiterals: boolean;
hasLiteralTypes: boolean;
// Undefined is used to indicate the value has not been computed. If, after computing, the
// symbol has no doc comment, then the empty string will be returned.
@@ -1098,7 +1098,7 @@ namespace ts {
// fall through
case SyntaxKind.VariableDeclaration:
case SyntaxKind.BindingElement: {
const decl = <VariableDeclaration> node;
const decl = <VariableDeclaration>node;
if (isBindingPattern(decl.name)) {
forEachChild(decl.name, visit);
break;
@@ -2065,7 +2065,7 @@ namespace ts {
function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions {
// Lazily create this value to fix module loading errors.
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || <CommandLineOptionOfCustomType[]>filter(optionDeclarations, o =>
typeof o.type === "object" && !forEachValue(<Map<any>> o.type, v => typeof v !== "number"));
typeof o.type === "object" && !forEachValue(<Map<any>>o.type, v => typeof v !== "number"));
options = clone(options);
@@ -3818,7 +3818,6 @@ namespace ts {
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken: Node): boolean {
if (contextToken.kind === SyntaxKind.StringLiteral
|| contextToken.kind === SyntaxKind.StringLiteralType
|| contextToken.kind === SyntaxKind.RegularExpressionLiteral
|| isTemplateLiteralKind(contextToken.kind)) {
const start = contextToken.getStart();
@@ -4383,6 +4382,7 @@ namespace ts {
kindModifiers: getSymbolModifiers(symbol),
sortText: "0",
};
}
function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: CompletionEntry[], location: Node, performCharacterChecks: boolean): Map<string> {
@@ -4411,22 +4411,58 @@ namespace ts {
return undefined;
}
const argumentInfo = SignatureHelp.getContainingArgumentInfo(node, position, sourceFile);
if (argumentInfo) {
// Get string literal completions from specialized signatures of the target
return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo);
if (node.parent.kind === SyntaxKind.PropertyAssignment && node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
// 'jspm:dev': string
// }
// let files: ConfigFiles = {
// '/*completion position*/'
// }
//
// function foo(c: ConfigFiles) {}
// foo({
// '/*completion position*/'
// });
return getStringLiteralCompletionEntriesFromPropertyAssignment(<ObjectLiteralElement>node.parent);
}
else if (isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {
// Get all names of properties on the expression
// i.e. interface A {
// 'prop1': string
// }
// let a: A;
// a['/*completion position*/']
return getStringLiteralCompletionEntriesFromElementAccess(node.parent);
}
else {
// Otherwise, get the completions from the contextual type if one exists
const argumentInfo = SignatureHelp.getContainingArgumentInfo(node, position, sourceFile);
if (argumentInfo) {
// Get string literal completions from specialized signatures of the target
// i.e. declare function f(a: 'A');
// f("/*completion position*/")
return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, node);
}
// Get completion for string literal from string literal type
// i.e. var x: "hi" | "hello" = "/*completion position*/"
return getStringLiteralCompletionEntriesFromContextualType(<StringLiteral>node);
}
}
function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo) {
function getStringLiteralCompletionEntriesFromPropertyAssignment(element: ObjectLiteralElement) {
const typeChecker = program.getTypeChecker();
const type = typeChecker.getContextualType((<ObjectLiteralExpression>element.parent));
const entries: CompletionEntry[] = [];
if (type) {
getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/false);
if (entries.length) {
return { isMemberCompletion: true, isNewIdentifierLocation: true, entries };
}
}
}
function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo, location: Node) {
const typeChecker = program.getTypeChecker();
const candidates: Signature[] = [];
const entries: CompletionEntry[] = [];
@@ -4483,7 +4519,7 @@ namespace ts {
else {
if (type.flags & TypeFlags.StringLiteral) {
result.push({
name: (<StringLiteralType>type).text,
name: (<LiteralType>type).text,
kindModifiers: ScriptElementKindModifier.none,
kind: ScriptElementKind.variableElement,
sortText: "0"
@@ -4784,7 +4820,7 @@ namespace ts {
displayParts.push(spacePart());
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
displayParts.push(spacePart());
addRange(displayParts, typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration));
addRange(displayParts, typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, TypeFormatFlags.InTypeAlias));
}
if (symbolFlags & SymbolFlags.Enum) {
addNewLineIfDisplayPartsExist();
@@ -5271,7 +5307,7 @@ namespace ts {
return undefined;
}
if (type.flags & TypeFlags.Union) {
if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum)) {
const result: DefinitionInfo[] = [];
forEach((<UnionType>type).types, t => {
if (t.symbol) {
@@ -7185,7 +7221,6 @@ namespace ts {
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.QualifiedName:
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.NullKeyword:
@@ -7689,7 +7724,7 @@ namespace ts {
else if (tokenKind === SyntaxKind.NumericLiteral) {
return ClassificationType.numericLiteral;
}
else if (tokenKind === SyntaxKind.StringLiteral || tokenKind === SyntaxKind.StringLiteralType) {
else if (tokenKind === SyntaxKind.StringLiteral) {
return token.parent.kind === SyntaxKind.JsxAttribute ? ClassificationType.jsxAttributeStringLiteralValue : ClassificationType.stringLiteral;
}
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
@@ -8188,11 +8223,11 @@ namespace ts {
}
}
function getStringLiteralTypeForNode(node: StringLiteral | StringLiteralTypeNode, typeChecker: TypeChecker): StringLiteralType {
const searchNode = node.parent.kind === SyntaxKind.StringLiteralType ? <StringLiteralTypeNode>node.parent : node;
function getStringLiteralTypeForNode(node: StringLiteral | LiteralTypeNode, typeChecker: TypeChecker): LiteralType {
const searchNode = node.parent.kind === SyntaxKind.LiteralType ? <LiteralTypeNode>node.parent : node;
const type = typeChecker.getTypeAtLocation(searchNode);
if (type && type.flags & TypeFlags.StringLiteral) {
return <StringLiteralType>type;
return <LiteralType>type;
}
return undefined;
}
@@ -8679,7 +8714,7 @@ namespace ts {
addResult(start, end, classFromKind(token));
if (end >= text.length) {
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.StringLiteralType) {
if (token === SyntaxKind.StringLiteral) {
// Check to see if we finished up on a multiline string literal.
const tokenText = scanner.getTokenText();
if (scanner.isUnterminated()) {
@@ -8829,7 +8864,6 @@ namespace ts {
case SyntaxKind.NumericLiteral:
return ClassificationType.numericLiteral;
case SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteralType:
return ClassificationType.stringLiteral;
case SyntaxKind.RegularExpressionLiteral:
return ClassificationType.regularExpressionLiteral;
+2 -4
View File
@@ -434,8 +434,7 @@ namespace ts {
export function isInString(sourceFile: SourceFile, position: number): boolean {
const previousToken = findPrecedingToken(position, sourceFile);
if (previousToken &&
(previousToken.kind === SyntaxKind.StringLiteral || previousToken.kind === SyntaxKind.StringLiteralType)) {
if (previousToken && previousToken.kind === SyntaxKind.StringLiteral) {
const start = previousToken.getStart();
const end = previousToken.getEnd();
@@ -633,7 +632,6 @@ namespace ts {
export function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean {
if (kind === SyntaxKind.StringLiteral
|| kind === SyntaxKind.StringLiteralType
|| kind === SyntaxKind.RegularExpressionLiteral
|| isTemplateLiteralKind(kind)) {
return true;
@@ -922,7 +920,7 @@ namespace ts {
if (host && host.getScriptKind) {
scriptKind = host.getScriptKind(fileName);
}
if (!scriptKind || scriptKind === ScriptKind.Unknown) {
if (!scriptKind) {
scriptKind = getScriptKindFromFileName(fileName);
}
return ensureScriptKind(fileName, scriptKind);
@@ -1,4 +1,4 @@
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'number | string' is not an array type.
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type.
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'.
@@ -8,7 +8,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error
var tuple: [number, string] = [2, "3"];
for ([a = 1, b = ""] of tuple) {
~~~~~~~~~~~~~~~
!!! error TS2461: Type 'number | string' is not an array type.
!!! error TS2461: Type 'string | number' is not an array type.
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
~
@@ -1,4 +1,4 @@
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'number | string' is not assignable to type 'string'.
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
@@ -7,5 +7,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6)
var v: string;
for (v of union) { }
~
!!! error TS2322: Type 'number | string' is not assignable to type 'string'.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
@@ -3,6 +3,6 @@ var union: string | number[];
>union : string | number[]
for (var v of union) { }
>v : number | string
>v : string | number
>union : string | number[]
@@ -1,8 +1,8 @@
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'string[] | number | symbol' is not an array type.
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'number | symbol | string[]' is not an array type.
==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts (1 errors) ====
var union: string | string[] | number | symbol;
for (let v of union) { }
~~~~~
!!! error TS2461: Type 'string[] | number | symbol' is not an array type.
!!! error TS2461: Type 'number | symbol | string[]' is not an array type.
+1 -1
View File
@@ -18,7 +18,7 @@ for (let num of array) {
if (sum === 0) {
>sum === 0 : boolean
>sum : number
>0 : number
>0 : 0
array = [4,5,6]
>array = [4,5,6] : number[]
@@ -6,15 +6,15 @@ enum Color { R, G, B }
>B : Color
function f1(x: Color | string) {
>f1 : (x: Color | string) => void
>x : Color | string
>f1 : (x: string | Color) => void
>x : string | Color
>Color : Color
if (typeof x === "number") {
>typeof x === "number" : boolean
>typeof x : string
>x : Color | string
>"number" : string
>x : string | Color
>"number" : "number"
var y = x;
>y : Color
@@ -35,15 +35,15 @@ function f1(x: Color | string) {
}
function f2(x: Color | string | string[]) {
>f2 : (x: Color | string | string[]) => void
>x : Color | string | string[]
>f2 : (x: string | Color | string[]) => void
>x : string | Color | string[]
>Color : Color
if (typeof x === "object") {
>typeof x === "object" : boolean
>typeof x : string
>x : Color | string | string[]
>"object" : string
>x : string | Color | string[]
>"object" : "object"
var y = x;
>y : string[]
@@ -55,8 +55,8 @@ function f2(x: Color | string | string[]) {
if (typeof x === "number") {
>typeof x === "number" : boolean
>typeof x : string
>x : string[] | Color | string
>"number" : string
>x : string | Color | string[]
>"number" : "number"
var z = x;
>z : Color
@@ -68,17 +68,17 @@ function f2(x: Color | string | string[]) {
}
else {
var w = x;
>w : string[] | string
>x : string[] | string
>w : string | string[]
>x : string | string[]
var w: string | string[];
>w : string[] | string
>w : string | string[]
}
if (typeof x === "string") {
>typeof x === "string" : boolean
>typeof x : string
>x : Color | string[] | string
>"string" : string
>x : string | Color | string[]
>"string" : "string"
var a = x;
>a : string
@@ -34,7 +34,7 @@ var d2: IHasVisualizationModel = i || moduleA;
var d2: IHasVisualizationModel = moduleA || i;
>d2 : IHasVisualizationModel
>IHasVisualizationModel : IHasVisualizationModel
>moduleA || i : typeof moduleA
>moduleA || i : IHasVisualizationModel
>moduleA : typeof moduleA
>i : IHasVisualizationModel
@@ -4,12 +4,12 @@ import foo = require("./foo_0");
if(foo.E1.A === 0){
>foo.E1.A === 0 : boolean
>foo.E1.A : foo.E1
>foo.E1.A : foo.E1.A
>foo.E1 : typeof foo.E1
>foo : typeof foo
>E1 : typeof foo.E1
>A : foo.E1
>0 : number
>A : foo.E1.A
>0 : 0
// Should cause runtime import - interesting optimization possibility, as gets inlined to 0.
}
@@ -41,7 +41,7 @@ var e: number = <foo.E1>0;
><foo.E1>0 : foo.E1
>foo : any
>E1 : foo.E1
>0 : number
>0 : 0
=== tests/cases/conformance/externalModules/foo_0.ts ===
export class C1 {
@@ -6,5 +6,5 @@ function f() {
>typeof class {} === "function" : boolean
>typeof class {} : string
>class {} : typeof (Anonymous class)
>"function" : string
>"function" : "function"
}
@@ -366,22 +366,22 @@ module EmptyTypes {
>base2 : typeof base2
var b1 = [baseObj, base2Obj, ifaceObj];
>b1 : base[]
>[baseObj, base2Obj, ifaceObj] : base[]
>b1 : iface[]
>[baseObj, base2Obj, ifaceObj] : iface[]
>baseObj : base
>base2Obj : base2
>ifaceObj : iface
var b2 = [base2Obj, baseObj, ifaceObj];
>b2 : base2[]
>[base2Obj, baseObj, ifaceObj] : base2[]
>b2 : iface[]
>[base2Obj, baseObj, ifaceObj] : iface[]
>base2Obj : base2
>baseObj : base
>ifaceObj : iface
var b3 = [baseObj, ifaceObj, base2Obj];
>b3 : base[]
>[baseObj, ifaceObj, base2Obj] : base[]
>b3 : iface[]
>[baseObj, ifaceObj, base2Obj] : iface[]
>baseObj : base
>ifaceObj : iface
>base2Obj : base2
@@ -1,7 +1,7 @@
=== tests/cases/compiler/arrayLiteralComments.ts ===
var testArrayWithFunc = [
>testArrayWithFunc : ((() => void) | string | number | { a: number; } | number[])[]
>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : ((() => void) | string | number | { a: number; } | number[])[]
>testArrayWithFunc : (string | number | (() => void) | number[] | { a: number; })[]
>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : (string | number | (() => void) | number[] | { a: number; })[]
// Function comment
function() {
@@ -1,7 +1,7 @@
tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(8,5): error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'.
Types of property 'pop' are incompatible.
Type '() => number | string' is not assignable to type '() => number'.
Type 'number | string' is not assignable to type 'number'.
Type '() => string | number' is not assignable to type '() => number'.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(14,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'.
Property '0' is missing in type 'number[]'.
@@ -19,8 +19,8 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionConte
~~~~
!!! error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'.
!!! error TS2322: Type 'number | string' is not assignable to type 'number'.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
// In a contextually typed array literal expression containing one or more spread elements,
@@ -23,8 +23,8 @@ var as = [a, b]; // { x: number; y?: number };[]
>b : { x: number; z?: number; }
var bs = [b, a]; // { x: number; z?: number };[]
>bs : ({ x: number; z?: number; } | { x: number; y?: number; })[]
>[b, a] : ({ x: number; z?: number; } | { x: number; y?: number; })[]
>bs : ({ x: number; y?: number; } | { x: number; z?: number; })[]
>[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[]
>b : { x: number; z?: number; }
>a : { x: number; y?: number; }
@@ -24,8 +24,8 @@ var a1 = ["hello", "world"]
>"world" : string
var a2 = [, , , ...a0, "hello"];
>a2 : (number | string)[]
>[, , , ...a0, "hello"] : (number | string)[]
>a2 : (string | number)[]
>[, , , ...a0, "hello"] : (string | number)[]
> : undefined
> : undefined
> : undefined
@@ -151,8 +151,8 @@ interface myArray2 extends Array<Number|String> { }
>String : String
var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[]
>d0 : (number | boolean | string)[]
>[1, true, ...temp,] : (number | boolean | string)[]
>d0 : (string | number | boolean)[]
>[1, true, ...temp,] : (string | number | boolean)[]
>1 : number
>true : boolean
>...temp : string
@@ -214,8 +214,8 @@ var d8: number[][] = [[...temp1]]
>temp1 : number[]
var d9 = [[...temp1], ...["hello"]];
>d9 : (number[] | string)[]
>[[...temp1], ...["hello"]] : (number[] | string)[]
>d9 : (string | number[])[]
>[[...temp1], ...["hello"]] : (string | number[])[]
>[...temp1] : number[]
>...temp1 : number
>temp1 : number[]
@@ -24,8 +24,8 @@ var a1 = ["hello", "world"]
>"world" : string
var a2 = [, , , ...a0, "hello"];
>a2 : (number | string)[]
>[, , , ...a0, "hello"] : (number | string)[]
>a2 : (string | number)[]
>[, , , ...a0, "hello"] : (string | number)[]
> : undefined
> : undefined
> : undefined
@@ -140,8 +140,8 @@ interface myArray2 extends Array<Number|String> { }
>String : String
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
>d0 : (number | boolean | string)[]
>[1, true, ...temp, ] : (number | boolean | string)[]
>d0 : (string | number | boolean)[]
>[1, true, ...temp, ] : (string | number | boolean)[]
>1 : number
>true : boolean
>...temp : string
@@ -176,10 +176,10 @@ var d4: myArray2 = [...temp, ...temp1];
>temp1 : number[]
var d5 = [...a2];
>d5 : (number | string)[]
>[...a2] : (number | string)[]
>...a2 : number | string
>a2 : (number | string)[]
>d5 : (string | number)[]
>[...a2] : (string | number)[]
>...a2 : string | number
>a2 : (string | number)[]
var d6 = [...a3];
>d6 : number[]
@@ -201,8 +201,8 @@ var d8: number[][] = [[...temp1]]
>temp1 : number[]
var d9 = [[...temp1], ...["hello"]];
>d9 : (number[] | string)[]
>[[...temp1], ...["hello"]] : (number[] | string)[]
>d9 : (string | number[])[]
>[[...temp1], ...["hello"]] : (string | number[])[]
>[...temp1] : number[]
>...temp1 : number
>temp1 : number[]
@@ -5,19 +5,19 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error
Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
Types of property 'pop' are incompatible.
Type '() => number | string | boolean' is not assignable to type '() => number'.
Type 'number | string | boolean' is not assignable to type 'number'.
Type '() => string | number | boolean' is not assignable to type '() => number'.
Type 'string | number | boolean' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'.
Property '0' is missing in type '(number[] | string[])[]'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'.
Property '0' is missing in type 'number[]'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
Types of property 'push' are incompatible.
Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'.
Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
Types of parameters 'items' and 'items' are incompatible.
Type 'Number' is not assignable to type 'number | string'.
Type 'Number' is not assignable to type 'string'.
Type 'Number' is not assignable to type 'string | number'.
Type 'Number' is not assignable to type 'number'.
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ====
@@ -48,8 +48,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
~~~~~~~~
!!! error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number'.
!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number'.
!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => number'.
!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
// The resulting type an array literal expression is determined as follows:
@@ -75,10 +75,10 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
!!! error TS2322: Property '0' is missing in type 'number[]'.
var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[]
~~
!!! error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'.
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
!!! error TS2322: Types of property 'push' are incompatible.
!!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'.
!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
!!! error TS2322: Type 'Number' is not assignable to type 'number | string'.
!!! error TS2322: Type 'Number' is not assignable to type 'string'.
!!! error TS2322: Type 'Number' is not assignable to type 'string | number'.
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
+3 -3
View File
@@ -24,12 +24,12 @@ var z = Date as any as string;
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
>j : number | string
>32 as number|string : number | string
>j : string | number
>32 as number|string : string | number
>32 : number
j = '';
>j = '' : string
>j : number | string
>j : string | number
>'' : string
@@ -1,7 +1,7 @@
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
Types of property 'pop' are incompatible.
Type '() => number | string' is not assignable to type '() => number'.
Type 'number | string' is not assignable to type 'number'.
Type '() => string | number' is not assignable to type '() => number'.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]'.
Property '0' is missing in type '{}[]'.
@@ -28,8 +28,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
~~~~~~~~
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'.
!!! error TS2322: Type 'number | string' is not assignable to type 'number'.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
emptyObjTuple = emptyObjArray;
~~~~~~~~~~~~~
@@ -19,14 +19,14 @@ function foo<T extends number>(x: T) {
foo(5);
>foo(5) : void
>foo : <T extends number>(x: T) => void
>5 : number
>5 : 5
foo(E.A);
>foo(E.A) : void
>foo : <T extends number>(x: T) => void
>E.A : E
>E.A : E.A
>E : typeof E
>A : E
>A : E.A
class A { a }
>A : A
+16 -16
View File
@@ -1,6 +1,6 @@
=== tests/cases/conformance/async/es6/awaitUnion_es6.ts ===
declare let a: number | string;
>a : number | string
>a : string | number
declare let b: PromiseLike<number> | PromiseLike<string>;
>b : PromiseLike<number> | PromiseLike<string>
@@ -8,7 +8,7 @@ declare let b: PromiseLike<number> | PromiseLike<string>;
>PromiseLike : PromiseLike<T>
declare let c: PromiseLike<number | string>;
>c : PromiseLike<number | string>
>c : PromiseLike<string | number>
>PromiseLike : PromiseLike<T>
declare let d: number | PromiseLike<string>;
@@ -16,34 +16,34 @@ declare let d: number | PromiseLike<string>;
>PromiseLike : PromiseLike<T>
declare let e: number | PromiseLike<number | string>;
>e : number | PromiseLike<number | string>
>e : number | PromiseLike<string | number>
>PromiseLike : PromiseLike<T>
async function f() {
>f : () => Promise<void>
let await_a = await a;
>await_a : number | string
>await a : number | string
>a : number | string
>await_a : string | number
>await a : string | number
>a : string | number
let await_b = await b;
>await_b : number | string
>await b : number | string
>await_b : string | number
>await b : string | number
>b : PromiseLike<number> | PromiseLike<string>
let await_c = await c;
>await_c : number | string
>await c : number | string
>c : PromiseLike<number | string>
>await_c : string | number
>await c : string | number
>c : PromiseLike<string | number>
let await_d = await d;
>await_d : number | string
>await d : number | string
>await_d : string | number
>await d : string | number
>d : number | PromiseLike<string>
let await_e = await e;
>await_e : number | string
>await e : number | string
>e : number | PromiseLike<number | string>
>await_e : string | number
>await e : string | number
>e : number | PromiseLike<string | number>
}
@@ -60,8 +60,8 @@ var r4 = true ? a : b; // typeof a
>b : { x: number; z?: number; }
var r5 = true ? b : a; // typeof b
>r5 : { x: number; z?: number; } | { x: number; y?: number; }
>true ? b : a : { x: number; z?: number; } | { x: number; y?: number; }
>r5 : { x: number; y?: number; } | { x: number; z?: number; }
>true ? b : a : { x: number; y?: number; } | { x: number; z?: number; }
>true : boolean
>b : { x: number; z?: number; }
>a : { x: number; y?: number; }
@@ -29,8 +29,8 @@ var derived2: Derived2;
>Derived2 : Derived2
var r2 = true ? 1 : '';
>r2 : number | string
>true ? 1 : '' : number | string
>r2 : string | number
>true ? 1 : '' : string | number
>true : boolean
>1 : number
>'' : string
@@ -98,8 +98,8 @@ var e3 = t3[2]; // any
>2 : number
var e4 = t4[3]; // number
>e4 : E1 | E2 | number
>t4[3] : E1 | E2 | number
>e4 : number | E1 | E2
>t4[3] : number | E1 | E2
>t4 : [E1, E2, number]
>3 : number
@@ -66,8 +66,8 @@ var t5: [C1, F]
>F : F
var e11 = t1[4]; // base
>e11 : C | base
>t1[4] : C | base
>e11 : base | C
>t1[4] : base | C
>t1 : [C, base]
>4 : number
@@ -90,8 +90,8 @@ var e41 = t4[2]; // base1
>2 : number
var e51 = t5[2]; // {}
>e51 : C1 | F
>t5[2] : C1 | F
>e51 : F | C1
>t5[2] : F | C1
>t5 : [C1, F]
>2 : number
@@ -25,7 +25,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
@@ -63,7 +63,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
continue;
}
@@ -104,7 +104,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break loop;
>loop : any
@@ -146,7 +146,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
continue loop;
>loop : any
@@ -26,7 +26,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
@@ -96,7 +96,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
continue;
}
@@ -168,7 +168,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break loop2;
>loop2 : any
@@ -248,7 +248,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
continue loop2;
>loop2 : any
@@ -28,7 +28,7 @@ function f1() {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return 1;
>1 : number
@@ -25,7 +25,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) {
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
else
@@ -29,13 +29,13 @@ function f1() {
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
else if (y == 2)
>y == 2 : boolean
>y : number
>2 : number
>2 : 2
y = 5;
>y = 5 : number
@@ -85,13 +85,13 @@ function f2() {
if (x == 1)
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
else if (y == 2)
>y == 2 : boolean
>y : number
>2 : number
>2 : 2
y = 5;
>y = 5 : number
@@ -0,0 +1,171 @@
//// [booleanLiteralTypes1.ts]
type A1 = true | false;
type A2 = false | true;
function f1() {
var a: A1;
var a: A2;
var a: true | false;
var a: false | true;
}
function f2(a: true | false, b: boolean) {
a = b;
b = a;
}
function f3(a: true | false, b: true | false) {
var x = a || b;
var x = a && b;
var x = !a;
}
function f4(t: true, f: false) {
var x1 = t && f;
var x2 = f && t;
var x3 = t || f;
var x4 = f || t;
var x5 = !t;
var x6 = !f;
}
declare function g(x: true): string;
declare function g(x: false): boolean;
declare function g(x: boolean): number;
function f5(b: boolean) {
var z1 = g(true);
var z2 = g(false);
var z3 = g(b);
}
function assertNever(x: never): never {
throw new Error("Unexpected value");
}
function f10(x: true | false) {
switch (x) {
case true: return "true";
case false: return "false";
}
}
function f11(x: true | false) {
switch (x) {
case true: return "true";
case false: return "false";
}
return assertNever(x);
}
function f12(x: true | false) {
if (x) {
x;
}
else {
x;
}
}
function f13(x: true | false) {
if (x === true) {
x;
}
else {
x;
}
}
type Item =
{ kind: true, a: string } |
{ kind: false, b: string };
function f20(x: Item) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
}
function f21(x: Item) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
return assertNever(x);
}
//// [booleanLiteralTypes1.js]
function f1() {
var a;
var a;
var a;
var a;
}
function f2(a, b) {
a = b;
b = a;
}
function f3(a, b) {
var x = a || b;
var x = a && b;
var x = !a;
}
function f4(t, f) {
var x1 = t && f;
var x2 = f && t;
var x3 = t || f;
var x4 = f || t;
var x5 = !t;
var x6 = !f;
}
function f5(b) {
var z1 = g(true);
var z2 = g(false);
var z3 = g(b);
}
function assertNever(x) {
throw new Error("Unexpected value");
}
function f10(x) {
switch (x) {
case true: return "true";
case false: return "false";
}
}
function f11(x) {
switch (x) {
case true: return "true";
case false: return "false";
}
return assertNever(x);
}
function f12(x) {
if (x) {
x;
}
else {
x;
}
}
function f13(x) {
if (x === true) {
x;
}
else {
x;
}
}
function f20(x) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
}
function f21(x) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
return assertNever(x);
}
@@ -0,0 +1,247 @@
=== tests/cases/conformance/types/literal/booleanLiteralTypes1.ts ===
type A1 = true | false;
>A1 : Symbol(A1, Decl(booleanLiteralTypes1.ts, 0, 0))
type A2 = false | true;
>A2 : Symbol(A2, Decl(booleanLiteralTypes1.ts, 0, 23))
function f1() {
>f1 : Symbol(f1, Decl(booleanLiteralTypes1.ts, 1, 23))
var a: A1;
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 4, 7), Decl(booleanLiteralTypes1.ts, 5, 7), Decl(booleanLiteralTypes1.ts, 6, 7), Decl(booleanLiteralTypes1.ts, 7, 7))
>A1 : Symbol(A1, Decl(booleanLiteralTypes1.ts, 0, 0))
var a: A2;
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 4, 7), Decl(booleanLiteralTypes1.ts, 5, 7), Decl(booleanLiteralTypes1.ts, 6, 7), Decl(booleanLiteralTypes1.ts, 7, 7))
>A2 : Symbol(A2, Decl(booleanLiteralTypes1.ts, 0, 23))
var a: true | false;
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 4, 7), Decl(booleanLiteralTypes1.ts, 5, 7), Decl(booleanLiteralTypes1.ts, 6, 7), Decl(booleanLiteralTypes1.ts, 7, 7))
var a: false | true;
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 4, 7), Decl(booleanLiteralTypes1.ts, 5, 7), Decl(booleanLiteralTypes1.ts, 6, 7), Decl(booleanLiteralTypes1.ts, 7, 7))
}
function f2(a: true | false, b: boolean) {
>f2 : Symbol(f2, Decl(booleanLiteralTypes1.ts, 8, 1))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 10, 12))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 10, 28))
a = b;
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 10, 12))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 10, 28))
b = a;
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 10, 28))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 10, 12))
}
function f3(a: true | false, b: true | false) {
>f3 : Symbol(f3, Decl(booleanLiteralTypes1.ts, 13, 1))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 15, 12))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 15, 28))
var x = a || b;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 16, 7), Decl(booleanLiteralTypes1.ts, 17, 7), Decl(booleanLiteralTypes1.ts, 18, 7))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 15, 12))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 15, 28))
var x = a && b;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 16, 7), Decl(booleanLiteralTypes1.ts, 17, 7), Decl(booleanLiteralTypes1.ts, 18, 7))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 15, 12))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 15, 28))
var x = !a;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 16, 7), Decl(booleanLiteralTypes1.ts, 17, 7), Decl(booleanLiteralTypes1.ts, 18, 7))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 15, 12))
}
function f4(t: true, f: false) {
>f4 : Symbol(f4, Decl(booleanLiteralTypes1.ts, 19, 1))
>t : Symbol(t, Decl(booleanLiteralTypes1.ts, 21, 12))
>f : Symbol(f, Decl(booleanLiteralTypes1.ts, 21, 20))
var x1 = t && f;
>x1 : Symbol(x1, Decl(booleanLiteralTypes1.ts, 22, 7))
>t : Symbol(t, Decl(booleanLiteralTypes1.ts, 21, 12))
>f : Symbol(f, Decl(booleanLiteralTypes1.ts, 21, 20))
var x2 = f && t;
>x2 : Symbol(x2, Decl(booleanLiteralTypes1.ts, 23, 7))
>f : Symbol(f, Decl(booleanLiteralTypes1.ts, 21, 20))
>t : Symbol(t, Decl(booleanLiteralTypes1.ts, 21, 12))
var x3 = t || f;
>x3 : Symbol(x3, Decl(booleanLiteralTypes1.ts, 24, 7))
>t : Symbol(t, Decl(booleanLiteralTypes1.ts, 21, 12))
>f : Symbol(f, Decl(booleanLiteralTypes1.ts, 21, 20))
var x4 = f || t;
>x4 : Symbol(x4, Decl(booleanLiteralTypes1.ts, 25, 7))
>f : Symbol(f, Decl(booleanLiteralTypes1.ts, 21, 20))
>t : Symbol(t, Decl(booleanLiteralTypes1.ts, 21, 12))
var x5 = !t;
>x5 : Symbol(x5, Decl(booleanLiteralTypes1.ts, 26, 7))
>t : Symbol(t, Decl(booleanLiteralTypes1.ts, 21, 12))
var x6 = !f;
>x6 : Symbol(x6, Decl(booleanLiteralTypes1.ts, 27, 7))
>f : Symbol(f, Decl(booleanLiteralTypes1.ts, 21, 20))
}
declare function g(x: true): string;
>g : Symbol(g, Decl(booleanLiteralTypes1.ts, 28, 1), Decl(booleanLiteralTypes1.ts, 30, 36), Decl(booleanLiteralTypes1.ts, 31, 38))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 30, 19))
declare function g(x: false): boolean;
>g : Symbol(g, Decl(booleanLiteralTypes1.ts, 28, 1), Decl(booleanLiteralTypes1.ts, 30, 36), Decl(booleanLiteralTypes1.ts, 31, 38))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 31, 19))
declare function g(x: boolean): number;
>g : Symbol(g, Decl(booleanLiteralTypes1.ts, 28, 1), Decl(booleanLiteralTypes1.ts, 30, 36), Decl(booleanLiteralTypes1.ts, 31, 38))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 32, 19))
function f5(b: boolean) {
>f5 : Symbol(f5, Decl(booleanLiteralTypes1.ts, 32, 39))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 34, 12))
var z1 = g(true);
>z1 : Symbol(z1, Decl(booleanLiteralTypes1.ts, 35, 7))
>g : Symbol(g, Decl(booleanLiteralTypes1.ts, 28, 1), Decl(booleanLiteralTypes1.ts, 30, 36), Decl(booleanLiteralTypes1.ts, 31, 38))
var z2 = g(false);
>z2 : Symbol(z2, Decl(booleanLiteralTypes1.ts, 36, 7))
>g : Symbol(g, Decl(booleanLiteralTypes1.ts, 28, 1), Decl(booleanLiteralTypes1.ts, 30, 36), Decl(booleanLiteralTypes1.ts, 31, 38))
var z3 = g(b);
>z3 : Symbol(z3, Decl(booleanLiteralTypes1.ts, 37, 7))
>g : Symbol(g, Decl(booleanLiteralTypes1.ts, 28, 1), Decl(booleanLiteralTypes1.ts, 30, 36), Decl(booleanLiteralTypes1.ts, 31, 38))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 34, 12))
}
function assertNever(x: never): never {
>assertNever : Symbol(assertNever, Decl(booleanLiteralTypes1.ts, 38, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 40, 21))
throw new Error("Unexpected value");
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}
function f10(x: true | false) {
>f10 : Symbol(f10, Decl(booleanLiteralTypes1.ts, 42, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 44, 13))
switch (x) {
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 44, 13))
case true: return "true";
case false: return "false";
}
}
function f11(x: true | false) {
>f11 : Symbol(f11, Decl(booleanLiteralTypes1.ts, 49, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 51, 13))
switch (x) {
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 51, 13))
case true: return "true";
case false: return "false";
}
return assertNever(x);
>assertNever : Symbol(assertNever, Decl(booleanLiteralTypes1.ts, 38, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 51, 13))
}
function f12(x: true | false) {
>f12 : Symbol(f12, Decl(booleanLiteralTypes1.ts, 57, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 59, 13))
if (x) {
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 59, 13))
x;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 59, 13))
}
else {
x;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 59, 13))
}
}
function f13(x: true | false) {
>f13 : Symbol(f13, Decl(booleanLiteralTypes1.ts, 66, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 68, 13))
if (x === true) {
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 68, 13))
x;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 68, 13))
}
else {
x;
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 68, 13))
}
}
type Item =
>Item : Symbol(Item, Decl(booleanLiteralTypes1.ts, 75, 1))
{ kind: true, a: string } |
>kind : Symbol(kind, Decl(booleanLiteralTypes1.ts, 78, 5))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 78, 17))
{ kind: false, b: string };
>kind : Symbol(kind, Decl(booleanLiteralTypes1.ts, 79, 5))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 79, 18))
function f20(x: Item) {
>f20 : Symbol(f20, Decl(booleanLiteralTypes1.ts, 79, 31))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 81, 13))
>Item : Symbol(Item, Decl(booleanLiteralTypes1.ts, 75, 1))
switch (x.kind) {
>x.kind : Symbol(kind, Decl(booleanLiteralTypes1.ts, 78, 5), Decl(booleanLiteralTypes1.ts, 79, 5))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 81, 13))
>kind : Symbol(kind, Decl(booleanLiteralTypes1.ts, 78, 5), Decl(booleanLiteralTypes1.ts, 79, 5))
case true: return x.a;
>x.a : Symbol(a, Decl(booleanLiteralTypes1.ts, 78, 17))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 81, 13))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 78, 17))
case false: return x.b;
>x.b : Symbol(b, Decl(booleanLiteralTypes1.ts, 79, 18))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 81, 13))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 79, 18))
}
}
function f21(x: Item) {
>f21 : Symbol(f21, Decl(booleanLiteralTypes1.ts, 86, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 88, 13))
>Item : Symbol(Item, Decl(booleanLiteralTypes1.ts, 75, 1))
switch (x.kind) {
>x.kind : Symbol(kind, Decl(booleanLiteralTypes1.ts, 78, 5), Decl(booleanLiteralTypes1.ts, 79, 5))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 88, 13))
>kind : Symbol(kind, Decl(booleanLiteralTypes1.ts, 78, 5), Decl(booleanLiteralTypes1.ts, 79, 5))
case true: return x.a;
>x.a : Symbol(a, Decl(booleanLiteralTypes1.ts, 78, 17))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 88, 13))
>a : Symbol(a, Decl(booleanLiteralTypes1.ts, 78, 17))
case false: return x.b;
>x.b : Symbol(b, Decl(booleanLiteralTypes1.ts, 79, 18))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 88, 13))
>b : Symbol(b, Decl(booleanLiteralTypes1.ts, 79, 18))
}
return assertNever(x);
>assertNever : Symbol(assertNever, Decl(booleanLiteralTypes1.ts, 38, 1))
>x : Symbol(x, Decl(booleanLiteralTypes1.ts, 88, 13))
}
@@ -0,0 +1,311 @@
=== tests/cases/conformance/types/literal/booleanLiteralTypes1.ts ===
type A1 = true | false;
>A1 : boolean
>true : true
>false : false
type A2 = false | true;
>A2 : boolean
>false : false
>true : true
function f1() {
>f1 : () => void
var a: A1;
>a : boolean
>A1 : boolean
var a: A2;
>a : boolean
>A2 : boolean
var a: true | false;
>a : boolean
>true : true
>false : false
var a: false | true;
>a : boolean
>false : false
>true : true
}
function f2(a: true | false, b: boolean) {
>f2 : (a: boolean, b: boolean) => void
>a : boolean
>true : true
>false : false
>b : boolean
a = b;
>a = b : boolean
>a : boolean
>b : boolean
b = a;
>b = a : boolean
>b : boolean
>a : boolean
}
function f3(a: true | false, b: true | false) {
>f3 : (a: boolean, b: boolean) => void
>a : boolean
>true : true
>false : false
>b : boolean
>true : true
>false : false
var x = a || b;
>x : boolean
>a || b : boolean
>a : boolean
>b : boolean
var x = a && b;
>x : boolean
>a && b : boolean
>a : boolean
>b : boolean
var x = !a;
>x : boolean
>!a : boolean
>a : boolean
}
function f4(t: true, f: false) {
>f4 : (t: true, f: false) => void
>t : true
>true : true
>f : false
>false : false
var x1 = t && f;
>x1 : false
>t && f : false
>t : true
>f : false
var x2 = f && t;
>x2 : false
>f && t : false
>f : false
>t : true
var x3 = t || f;
>x3 : boolean
>t || f : boolean
>t : true
>f : false
var x4 = f || t;
>x4 : true
>f || t : true
>f : false
>t : true
var x5 = !t;
>x5 : boolean
>!t : boolean
>t : true
var x6 = !f;
>x6 : true
>!f : true
>f : false
}
declare function g(x: true): string;
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>x : true
>true : true
declare function g(x: false): boolean;
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>x : false
>false : false
declare function g(x: boolean): number;
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>x : boolean
function f5(b: boolean) {
>f5 : (b: boolean) => void
>b : boolean
var z1 = g(true);
>z1 : string
>g(true) : string
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>true : true
var z2 = g(false);
>z2 : boolean
>g(false) : boolean
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>false : false
var z3 = g(b);
>z3 : number
>g(b) : number
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>b : boolean
}
function assertNever(x: never): never {
>assertNever : (x: never) => never
>x : never
throw new Error("Unexpected value");
>new Error("Unexpected value") : Error
>Error : ErrorConstructor
>"Unexpected value" : string
}
function f10(x: true | false) {
>f10 : (x: boolean) => string
>x : boolean
>true : true
>false : false
switch (x) {
>x : boolean
case true: return "true";
>true : true
>"true" : string
case false: return "false";
>false : false
>"false" : string
}
}
function f11(x: true | false) {
>f11 : (x: boolean) => string
>x : boolean
>true : true
>false : false
switch (x) {
>x : boolean
case true: return "true";
>true : true
>"true" : string
case false: return "false";
>false : false
>"false" : string
}
return assertNever(x);
>assertNever(x) : never
>assertNever : (x: never) => never
>x : never
}
function f12(x: true | false) {
>f12 : (x: boolean) => void
>x : boolean
>true : true
>false : false
if (x) {
>x : boolean
x;
>x : true
}
else {
x;
>x : boolean
}
}
function f13(x: true | false) {
>f13 : (x: boolean) => void
>x : boolean
>true : true
>false : false
if (x === true) {
>x === true : boolean
>x : boolean
>true : true
x;
>x : true
}
else {
x;
>x : false
}
}
type Item =
>Item : Item
{ kind: true, a: string } |
>kind : true
>true : true
>a : string
{ kind: false, b: string };
>kind : false
>false : false
>b : string
function f20(x: Item) {
>f20 : (x: Item) => string
>x : Item
>Item : Item
switch (x.kind) {
>x.kind : boolean
>x : Item
>kind : boolean
case true: return x.a;
>true : true
>x.a : string
>x : { kind: true; a: string; }
>a : string
case false: return x.b;
>false : false
>x.b : string
>x : { kind: false; b: string; }
>b : string
}
}
function f21(x: Item) {
>f21 : (x: Item) => string
>x : Item
>Item : Item
switch (x.kind) {
>x.kind : boolean
>x : Item
>kind : boolean
case true: return x.a;
>true : true
>x.a : string
>x : { kind: true; a: string; }
>a : string
case false: return x.b;
>false : false
>x.b : string
>x : { kind: false; b: string; }
>b : string
}
return assertNever(x);
>assertNever(x) : never
>assertNever : (x: never) => never
>x : never
}
@@ -0,0 +1,172 @@
//// [booleanLiteralTypes2.ts]
type A1 = true | false;
type A2 = false | true;
function f1() {
var a: A1;
var a: A2;
var a: true | false;
var a: false | true;
}
function f2(a: true | false, b: boolean) {
a = b;
b = a;
}
function f3(a: true | false, b: true | false) {
var x = a || b;
var x = a && b;
var x = !a;
}
function f4(t: true, f: false) {
var x1 = t && f;
var x2 = f && t;
var x3 = t || f;
var x4 = f || t;
var x5 = !t;
var x6 = !f;
}
declare function g(x: true): string;
declare function g(x: false): boolean;
declare function g(x: boolean): number;
function f5(b: boolean) {
var z1 = g(true);
var z2 = g(false);
var z3 = g(b);
}
function assertNever(x: never): never {
throw new Error("Unexpected value");
}
function f10(x: true | false) {
switch (x) {
case true: return "true";
case false: return "false";
}
}
function f11(x: true | false) {
switch (x) {
case true: return "true";
case false: return "false";
}
return assertNever(x);
}
function f12(x: true | false) {
if (x) {
x;
}
else {
x;
}
}
function f13(x: true | false) {
if (x === true) {
x;
}
else {
x;
}
}
type Item =
{ kind: true, a: string } |
{ kind: false, b: string };
function f20(x: Item) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
}
function f21(x: Item) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
return assertNever(x);
}
//// [booleanLiteralTypes2.js]
function f1() {
var a;
var a;
var a;
var a;
}
function f2(a, b) {
a = b;
b = a;
}
function f3(a, b) {
var x = a || b;
var x = a && b;
var x = !a;
}
function f4(t, f) {
var x1 = t && f;
var x2 = f && t;
var x3 = t || f;
var x4 = f || t;
var x5 = !t;
var x6 = !f;
}
function f5(b) {
var z1 = g(true);
var z2 = g(false);
var z3 = g(b);
}
function assertNever(x) {
throw new Error("Unexpected value");
}
function f10(x) {
switch (x) {
case true: return "true";
case false: return "false";
}
}
function f11(x) {
switch (x) {
case true: return "true";
case false: return "false";
}
return assertNever(x);
}
function f12(x) {
if (x) {
x;
}
else {
x;
}
}
function f13(x) {
if (x === true) {
x;
}
else {
x;
}
}
function f20(x) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
}
function f21(x) {
switch (x.kind) {
case true: return x.a;
case false: return x.b;
}
return assertNever(x);
}
@@ -0,0 +1,248 @@
=== tests/cases/conformance/types/literal/booleanLiteralTypes2.ts ===
type A1 = true | false;
>A1 : Symbol(A1, Decl(booleanLiteralTypes2.ts, 0, 0))
type A2 = false | true;
>A2 : Symbol(A2, Decl(booleanLiteralTypes2.ts, 1, 23))
function f1() {
>f1 : Symbol(f1, Decl(booleanLiteralTypes2.ts, 2, 23))
var a: A1;
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 5, 7), Decl(booleanLiteralTypes2.ts, 6, 7), Decl(booleanLiteralTypes2.ts, 7, 7), Decl(booleanLiteralTypes2.ts, 8, 7))
>A1 : Symbol(A1, Decl(booleanLiteralTypes2.ts, 0, 0))
var a: A2;
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 5, 7), Decl(booleanLiteralTypes2.ts, 6, 7), Decl(booleanLiteralTypes2.ts, 7, 7), Decl(booleanLiteralTypes2.ts, 8, 7))
>A2 : Symbol(A2, Decl(booleanLiteralTypes2.ts, 1, 23))
var a: true | false;
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 5, 7), Decl(booleanLiteralTypes2.ts, 6, 7), Decl(booleanLiteralTypes2.ts, 7, 7), Decl(booleanLiteralTypes2.ts, 8, 7))
var a: false | true;
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 5, 7), Decl(booleanLiteralTypes2.ts, 6, 7), Decl(booleanLiteralTypes2.ts, 7, 7), Decl(booleanLiteralTypes2.ts, 8, 7))
}
function f2(a: true | false, b: boolean) {
>f2 : Symbol(f2, Decl(booleanLiteralTypes2.ts, 9, 1))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 11, 12))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 11, 28))
a = b;
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 11, 12))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 11, 28))
b = a;
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 11, 28))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 11, 12))
}
function f3(a: true | false, b: true | false) {
>f3 : Symbol(f3, Decl(booleanLiteralTypes2.ts, 14, 1))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 16, 12))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 16, 28))
var x = a || b;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 17, 7), Decl(booleanLiteralTypes2.ts, 18, 7), Decl(booleanLiteralTypes2.ts, 19, 7))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 16, 12))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 16, 28))
var x = a && b;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 17, 7), Decl(booleanLiteralTypes2.ts, 18, 7), Decl(booleanLiteralTypes2.ts, 19, 7))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 16, 12))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 16, 28))
var x = !a;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 17, 7), Decl(booleanLiteralTypes2.ts, 18, 7), Decl(booleanLiteralTypes2.ts, 19, 7))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 16, 12))
}
function f4(t: true, f: false) {
>f4 : Symbol(f4, Decl(booleanLiteralTypes2.ts, 20, 1))
>t : Symbol(t, Decl(booleanLiteralTypes2.ts, 22, 12))
>f : Symbol(f, Decl(booleanLiteralTypes2.ts, 22, 20))
var x1 = t && f;
>x1 : Symbol(x1, Decl(booleanLiteralTypes2.ts, 23, 7))
>t : Symbol(t, Decl(booleanLiteralTypes2.ts, 22, 12))
>f : Symbol(f, Decl(booleanLiteralTypes2.ts, 22, 20))
var x2 = f && t;
>x2 : Symbol(x2, Decl(booleanLiteralTypes2.ts, 24, 7))
>f : Symbol(f, Decl(booleanLiteralTypes2.ts, 22, 20))
>t : Symbol(t, Decl(booleanLiteralTypes2.ts, 22, 12))
var x3 = t || f;
>x3 : Symbol(x3, Decl(booleanLiteralTypes2.ts, 25, 7))
>t : Symbol(t, Decl(booleanLiteralTypes2.ts, 22, 12))
>f : Symbol(f, Decl(booleanLiteralTypes2.ts, 22, 20))
var x4 = f || t;
>x4 : Symbol(x4, Decl(booleanLiteralTypes2.ts, 26, 7))
>f : Symbol(f, Decl(booleanLiteralTypes2.ts, 22, 20))
>t : Symbol(t, Decl(booleanLiteralTypes2.ts, 22, 12))
var x5 = !t;
>x5 : Symbol(x5, Decl(booleanLiteralTypes2.ts, 27, 7))
>t : Symbol(t, Decl(booleanLiteralTypes2.ts, 22, 12))
var x6 = !f;
>x6 : Symbol(x6, Decl(booleanLiteralTypes2.ts, 28, 7))
>f : Symbol(f, Decl(booleanLiteralTypes2.ts, 22, 20))
}
declare function g(x: true): string;
>g : Symbol(g, Decl(booleanLiteralTypes2.ts, 29, 1), Decl(booleanLiteralTypes2.ts, 31, 36), Decl(booleanLiteralTypes2.ts, 32, 38))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 31, 19))
declare function g(x: false): boolean;
>g : Symbol(g, Decl(booleanLiteralTypes2.ts, 29, 1), Decl(booleanLiteralTypes2.ts, 31, 36), Decl(booleanLiteralTypes2.ts, 32, 38))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 32, 19))
declare function g(x: boolean): number;
>g : Symbol(g, Decl(booleanLiteralTypes2.ts, 29, 1), Decl(booleanLiteralTypes2.ts, 31, 36), Decl(booleanLiteralTypes2.ts, 32, 38))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 33, 19))
function f5(b: boolean) {
>f5 : Symbol(f5, Decl(booleanLiteralTypes2.ts, 33, 39))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 35, 12))
var z1 = g(true);
>z1 : Symbol(z1, Decl(booleanLiteralTypes2.ts, 36, 7))
>g : Symbol(g, Decl(booleanLiteralTypes2.ts, 29, 1), Decl(booleanLiteralTypes2.ts, 31, 36), Decl(booleanLiteralTypes2.ts, 32, 38))
var z2 = g(false);
>z2 : Symbol(z2, Decl(booleanLiteralTypes2.ts, 37, 7))
>g : Symbol(g, Decl(booleanLiteralTypes2.ts, 29, 1), Decl(booleanLiteralTypes2.ts, 31, 36), Decl(booleanLiteralTypes2.ts, 32, 38))
var z3 = g(b);
>z3 : Symbol(z3, Decl(booleanLiteralTypes2.ts, 38, 7))
>g : Symbol(g, Decl(booleanLiteralTypes2.ts, 29, 1), Decl(booleanLiteralTypes2.ts, 31, 36), Decl(booleanLiteralTypes2.ts, 32, 38))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 35, 12))
}
function assertNever(x: never): never {
>assertNever : Symbol(assertNever, Decl(booleanLiteralTypes2.ts, 39, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 41, 21))
throw new Error("Unexpected value");
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}
function f10(x: true | false) {
>f10 : Symbol(f10, Decl(booleanLiteralTypes2.ts, 43, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 45, 13))
switch (x) {
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 45, 13))
case true: return "true";
case false: return "false";
}
}
function f11(x: true | false) {
>f11 : Symbol(f11, Decl(booleanLiteralTypes2.ts, 50, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 52, 13))
switch (x) {
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 52, 13))
case true: return "true";
case false: return "false";
}
return assertNever(x);
>assertNever : Symbol(assertNever, Decl(booleanLiteralTypes2.ts, 39, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 52, 13))
}
function f12(x: true | false) {
>f12 : Symbol(f12, Decl(booleanLiteralTypes2.ts, 58, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 60, 13))
if (x) {
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 60, 13))
x;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 60, 13))
}
else {
x;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 60, 13))
}
}
function f13(x: true | false) {
>f13 : Symbol(f13, Decl(booleanLiteralTypes2.ts, 67, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 69, 13))
if (x === true) {
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 69, 13))
x;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 69, 13))
}
else {
x;
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 69, 13))
}
}
type Item =
>Item : Symbol(Item, Decl(booleanLiteralTypes2.ts, 76, 1))
{ kind: true, a: string } |
>kind : Symbol(kind, Decl(booleanLiteralTypes2.ts, 79, 5))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 79, 17))
{ kind: false, b: string };
>kind : Symbol(kind, Decl(booleanLiteralTypes2.ts, 80, 5))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 80, 18))
function f20(x: Item) {
>f20 : Symbol(f20, Decl(booleanLiteralTypes2.ts, 80, 31))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 82, 13))
>Item : Symbol(Item, Decl(booleanLiteralTypes2.ts, 76, 1))
switch (x.kind) {
>x.kind : Symbol(kind, Decl(booleanLiteralTypes2.ts, 79, 5), Decl(booleanLiteralTypes2.ts, 80, 5))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 82, 13))
>kind : Symbol(kind, Decl(booleanLiteralTypes2.ts, 79, 5), Decl(booleanLiteralTypes2.ts, 80, 5))
case true: return x.a;
>x.a : Symbol(a, Decl(booleanLiteralTypes2.ts, 79, 17))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 82, 13))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 79, 17))
case false: return x.b;
>x.b : Symbol(b, Decl(booleanLiteralTypes2.ts, 80, 18))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 82, 13))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 80, 18))
}
}
function f21(x: Item) {
>f21 : Symbol(f21, Decl(booleanLiteralTypes2.ts, 87, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 89, 13))
>Item : Symbol(Item, Decl(booleanLiteralTypes2.ts, 76, 1))
switch (x.kind) {
>x.kind : Symbol(kind, Decl(booleanLiteralTypes2.ts, 79, 5), Decl(booleanLiteralTypes2.ts, 80, 5))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 89, 13))
>kind : Symbol(kind, Decl(booleanLiteralTypes2.ts, 79, 5), Decl(booleanLiteralTypes2.ts, 80, 5))
case true: return x.a;
>x.a : Symbol(a, Decl(booleanLiteralTypes2.ts, 79, 17))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 89, 13))
>a : Symbol(a, Decl(booleanLiteralTypes2.ts, 79, 17))
case false: return x.b;
>x.b : Symbol(b, Decl(booleanLiteralTypes2.ts, 80, 18))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 89, 13))
>b : Symbol(b, Decl(booleanLiteralTypes2.ts, 80, 18))
}
return assertNever(x);
>assertNever : Symbol(assertNever, Decl(booleanLiteralTypes2.ts, 39, 1))
>x : Symbol(x, Decl(booleanLiteralTypes2.ts, 89, 13))
}
@@ -0,0 +1,312 @@
=== tests/cases/conformance/types/literal/booleanLiteralTypes2.ts ===
type A1 = true | false;
>A1 : boolean
>true : true
>false : false
type A2 = false | true;
>A2 : boolean
>false : false
>true : true
function f1() {
>f1 : () => void
var a: A1;
>a : boolean
>A1 : boolean
var a: A2;
>a : boolean
>A2 : boolean
var a: true | false;
>a : boolean
>true : true
>false : false
var a: false | true;
>a : boolean
>false : false
>true : true
}
function f2(a: true | false, b: boolean) {
>f2 : (a: boolean, b: boolean) => void
>a : boolean
>true : true
>false : false
>b : boolean
a = b;
>a = b : boolean
>a : boolean
>b : boolean
b = a;
>b = a : boolean
>b : boolean
>a : boolean
}
function f3(a: true | false, b: true | false) {
>f3 : (a: boolean, b: boolean) => void
>a : boolean
>true : true
>false : false
>b : boolean
>true : true
>false : false
var x = a || b;
>x : boolean
>a || b : boolean
>a : boolean
>b : boolean
var x = a && b;
>x : boolean
>a && b : boolean
>a : boolean
>b : boolean
var x = !a;
>x : boolean
>!a : boolean
>a : boolean
}
function f4(t: true, f: false) {
>f4 : (t: true, f: false) => void
>t : true
>true : true
>f : false
>false : false
var x1 = t && f;
>x1 : false
>t && f : false
>t : true
>f : false
var x2 = f && t;
>x2 : false
>f && t : false
>f : false
>t : true
var x3 = t || f;
>x3 : true
>t || f : true
>t : true
>f : false
var x4 = f || t;
>x4 : true
>f || t : true
>f : false
>t : true
var x5 = !t;
>x5 : false
>!t : false
>t : true
var x6 = !f;
>x6 : true
>!f : true
>f : false
}
declare function g(x: true): string;
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>x : true
>true : true
declare function g(x: false): boolean;
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>x : false
>false : false
declare function g(x: boolean): number;
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>x : boolean
function f5(b: boolean) {
>f5 : (b: boolean) => void
>b : boolean
var z1 = g(true);
>z1 : string
>g(true) : string
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>true : true
var z2 = g(false);
>z2 : boolean
>g(false) : boolean
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>false : false
var z3 = g(b);
>z3 : number
>g(b) : number
>g : { (x: true): string; (x: false): boolean; (x: boolean): number; }
>b : boolean
}
function assertNever(x: never): never {
>assertNever : (x: never) => never
>x : never
throw new Error("Unexpected value");
>new Error("Unexpected value") : Error
>Error : ErrorConstructor
>"Unexpected value" : string
}
function f10(x: true | false) {
>f10 : (x: boolean) => string
>x : boolean
>true : true
>false : false
switch (x) {
>x : boolean
case true: return "true";
>true : true
>"true" : string
case false: return "false";
>false : false
>"false" : string
}
}
function f11(x: true | false) {
>f11 : (x: boolean) => string
>x : boolean
>true : true
>false : false
switch (x) {
>x : boolean
case true: return "true";
>true : true
>"true" : string
case false: return "false";
>false : false
>"false" : string
}
return assertNever(x);
>assertNever(x) : never
>assertNever : (x: never) => never
>x : never
}
function f12(x: true | false) {
>f12 : (x: boolean) => void
>x : boolean
>true : true
>false : false
if (x) {
>x : boolean
x;
>x : true
}
else {
x;
>x : false
}
}
function f13(x: true | false) {
>f13 : (x: boolean) => void
>x : boolean
>true : true
>false : false
if (x === true) {
>x === true : boolean
>x : boolean
>true : true
x;
>x : true
}
else {
x;
>x : false
}
}
type Item =
>Item : Item
{ kind: true, a: string } |
>kind : true
>true : true
>a : string
{ kind: false, b: string };
>kind : false
>false : false
>b : string
function f20(x: Item) {
>f20 : (x: Item) => string
>x : Item
>Item : Item
switch (x.kind) {
>x.kind : boolean
>x : Item
>kind : boolean
case true: return x.a;
>true : true
>x.a : string
>x : { kind: true; a: string; }
>a : string
case false: return x.b;
>false : false
>x.b : string
>x : { kind: false; b: string; }
>b : string
}
}
function f21(x: Item) {
>f21 : (x: Item) => string
>x : Item
>Item : Item
switch (x.kind) {
>x.kind : boolean
>x : Item
>kind : boolean
case true: return x.a;
>true : true
>x.a : string
>x : { kind: true; a: string; }
>a : string
case false: return x.b;
>false : false
>x.b : string
>x : { kind: false; b: string; }
>b : string
}
return assertNever(x);
>assertNever(x) : never
>assertNever : (x: never) => never
>x : never
}
@@ -15,8 +15,8 @@ var i: I<string>;
>I : I<T>
var y = i(""); // y should be string
>y : string
>i("") : string
>y : ""
>i("") : ""
>i : I<string>
>"" : string
>"" : ""
@@ -163,8 +163,8 @@ xa[1].foo(1, 2, ...a, "abc");
>xa : X[]
>1 : number
>foo : (x: number, y: number, ...z: string[]) => any
>...[1, 2, "abc"] : number | string
>[1, 2, "abc"] : (number | string)[]
>...[1, 2, "abc"] : string | number
>[1, 2, "abc"] : (string | number)[]
>1 : number
>2 : number
>"abc" : string
@@ -164,8 +164,8 @@ xa[1].foo(1, 2, ...a, "abc");
>xa : X[]
>1 : number
>foo : (x: number, y: number, ...z: string[]) => any
>...[1, 2, "abc"] : number | string
>[1, 2, "abc"] : (number | string)[]
>...[1, 2, "abc"] : string | number
>[1, 2, "abc"] : (string | number)[]
>1 : number
>2 : number
>"abc" : string
@@ -52,8 +52,8 @@ for (let x = 0; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -85,8 +85,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -140,8 +140,8 @@ for (let x = 0, y = 1; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -183,8 +183,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -265,8 +265,8 @@ for (const x = 0; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -300,8 +300,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -351,8 +351,8 @@ for (const x = 0, y = 1; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -398,8 +398,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -21,7 +21,7 @@ function foo() {
>a : number
case 0: return () => a;
>0 : number
>0 : 0
>() => a : () => number
>a : number
}
@@ -21,7 +21,7 @@ function foo() {
>a : number
case 0: return () => a;
>0 : number
>0 : 0
>() => a : () => number
>a : number
}
@@ -52,8 +52,8 @@ for (let x = 0; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -85,8 +85,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -140,8 +140,8 @@ for (let x = 0, y = 1; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -183,8 +183,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -265,8 +265,8 @@ for (const x = 0; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -300,8 +300,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -351,8 +351,8 @@ for (const x = 0, y = 1; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -398,8 +398,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -103,8 +103,8 @@ function foo2(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let a = arguments.length;
>a : number
@@ -158,8 +158,8 @@ function foo3(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
function foo4(x) {
@@ -249,8 +249,8 @@ function foo6(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -317,8 +317,8 @@ function foo7(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
@@ -464,8 +464,8 @@ function foo2_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -520,8 +520,8 @@ function foo3_c(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
function foo4_c(x) {
@@ -607,8 +607,8 @@ function foo6_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y =1 ;
>x : number
@@ -679,8 +679,8 @@ function foo7_c(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
@@ -102,8 +102,8 @@ function foo2(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let a = arguments.length;
>a : number
@@ -157,8 +157,8 @@ function foo3(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
function foo4(x) {
@@ -248,8 +248,8 @@ function foo6(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -316,8 +316,8 @@ function foo7(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
@@ -463,8 +463,8 @@ function foo2_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -519,8 +519,8 @@ function foo3_c(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
function foo4_c(x) {
@@ -606,8 +606,8 @@ function foo6_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y =1 ;
>x : number
@@ -678,8 +678,8 @@ function foo7_c(x) {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
}
@@ -114,8 +114,8 @@ function foo2(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x = 1;
>x : number
@@ -173,8 +173,8 @@ function foo3(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -275,8 +275,8 @@ function foo6(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -344,8 +344,8 @@ function foo7(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -508,8 +508,8 @@ function foo2_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -568,8 +568,8 @@ function foo3_c(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -666,8 +666,8 @@ function foo6_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -739,8 +739,8 @@ function foo7_c(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -115,8 +115,8 @@ function foo2(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x = 1;
>x : number
@@ -174,8 +174,8 @@ function foo3(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -276,8 +276,8 @@ function foo6(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -345,8 +345,8 @@ function foo7(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -509,8 +509,8 @@ function foo2_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -569,8 +569,8 @@ function foo3_c(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -667,8 +667,8 @@ function foo6_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -740,8 +740,8 @@ function foo7_c(x) {
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -96,8 +96,8 @@ for (let x = 0; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -141,8 +141,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -208,8 +208,8 @@ for (let x = 0, y = 1; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -263,8 +263,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -394,8 +394,8 @@ for (const x = 0; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x =1;
>x : number
@@ -441,8 +441,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -504,8 +504,8 @@ for (const x = 0, y = 1; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -563,8 +563,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -96,8 +96,8 @@ for (let x = 0; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -141,8 +141,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -208,8 +208,8 @@ for (let x = 0, y = 1; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -263,8 +263,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -394,8 +394,8 @@ for (const x = 0; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x =1;
>x : number
@@ -441,8 +441,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -504,8 +504,8 @@ for (const x = 0, y = 1; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -563,8 +563,8 @@ do {
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -33,7 +33,7 @@ function foo0(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
@@ -74,7 +74,7 @@ function foo00(x) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
return;
}
@@ -120,7 +120,7 @@ function foo1(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -138,8 +138,8 @@ function foo2(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x = 1;
>x : number
@@ -166,7 +166,7 @@ function foo2(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -206,14 +206,14 @@ function foo3(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -259,7 +259,7 @@ function foo4(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -311,7 +311,7 @@ function foo5(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -330,8 +330,8 @@ function foo6(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -362,7 +362,7 @@ function foo6(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
@@ -408,14 +408,14 @@ function foo7(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -466,7 +466,7 @@ function foo8(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -508,7 +508,7 @@ function foo0_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
@@ -549,7 +549,7 @@ function foo00_c(x) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
return;
}
@@ -593,7 +593,7 @@ function foo1_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -611,8 +611,8 @@ function foo2_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -639,7 +639,7 @@ function foo2_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -680,14 +680,14 @@ function foo3_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -731,7 +731,7 @@ function foo4_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -781,7 +781,7 @@ function foo5_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -800,8 +800,8 @@ function foo6_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -834,7 +834,7 @@ function foo6_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -882,14 +882,14 @@ function foo7_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -938,7 +938,7 @@ function foo8_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -34,7 +34,7 @@ function foo0(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
@@ -75,7 +75,7 @@ function foo00(x) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
return;
}
@@ -121,7 +121,7 @@ function foo1(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -139,8 +139,8 @@ function foo2(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x = 1;
>x : number
@@ -167,7 +167,7 @@ function foo2(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -207,14 +207,14 @@ function foo3(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -260,7 +260,7 @@ function foo4(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -312,7 +312,7 @@ function foo5(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -331,8 +331,8 @@ function foo6(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -363,7 +363,7 @@ function foo6(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
@@ -409,14 +409,14 @@ function foo7(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
} while (1 === 1);
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -467,7 +467,7 @@ function foo8(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -509,7 +509,7 @@ function foo0_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
return;
}
@@ -550,7 +550,7 @@ function foo00_c(x) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
return;
}
@@ -594,7 +594,7 @@ function foo1_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -612,8 +612,8 @@ function foo2_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -640,7 +640,7 @@ function foo2_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -681,14 +681,14 @@ function foo3_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -732,7 +732,7 @@ function foo4_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -782,7 +782,7 @@ function foo5_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -801,8 +801,8 @@ function foo6_c(x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -835,7 +835,7 @@ function foo6_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -883,14 +883,14 @@ function foo7_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
use(v);
>use(v) : any
@@ -939,7 +939,7 @@ function foo8_c(x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
return;
}
@@ -17,14 +17,14 @@ for (let x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -47,14 +47,14 @@ for (let x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
@@ -83,14 +83,14 @@ for (let x = 0; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -98,8 +98,8 @@ for (let x = 0; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -117,14 +117,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -147,21 +147,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -189,14 +189,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -230,14 +230,14 @@ for (let x = 0, y = 1; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -245,8 +245,8 @@ for (let x = 0, y = 1; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -269,14 +269,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -304,21 +304,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -350,14 +350,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -382,14 +382,14 @@ for (const x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -412,14 +412,14 @@ for (const x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
@@ -446,14 +446,14 @@ for (const x = 0; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -461,8 +461,8 @@ for (const x = 0; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -481,14 +481,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -512,21 +512,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -552,14 +552,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -591,14 +591,14 @@ for (const x = 0, y = 1; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -606,8 +606,8 @@ for (const x = 0, y = 1; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -632,14 +632,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -669,21 +669,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -713,14 +713,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -17,14 +17,14 @@ for (let x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -47,14 +47,14 @@ for (let x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
@@ -83,14 +83,14 @@ for (let x = 0; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -98,8 +98,8 @@ for (let x = 0; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -117,14 +117,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -147,21 +147,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -189,14 +189,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -230,14 +230,14 @@ for (let x = 0, y = 1; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -245,8 +245,8 @@ for (let x = 0, y = 1; x < 1; ++x) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -269,14 +269,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -304,21 +304,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (let y = 0; y < 1; ++y) {
>y : number
@@ -350,14 +350,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -382,14 +382,14 @@ for (const x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
@@ -412,14 +412,14 @@ for (const x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
@@ -446,14 +446,14 @@ for (const x = 0; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -461,8 +461,8 @@ for (const x = 0; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -481,14 +481,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -512,21 +512,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -552,14 +552,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -591,14 +591,14 @@ for (const x = 0, y = 1; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -606,8 +606,8 @@ for (const x = 0, y = 1; x < 1;) {
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -632,14 +632,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -669,21 +669,21 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
for (const y = 0; y < 1;) {
>y : number
@@ -713,14 +713,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
@@ -20,14 +20,14 @@ for (let x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l0;
>l0 : any
@@ -35,14 +35,14 @@ for (let x of []) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l0;
>l0 : any
@@ -69,14 +69,14 @@ for (let x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break l00;
>l00 : any
@@ -84,14 +84,14 @@ for (let x in []) {
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue l00;
>l00 : any
@@ -123,14 +123,14 @@ for (let x = 0; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -138,14 +138,14 @@ for (let x = 0; x < 1; ++x) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -157,8 +157,8 @@ l2:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -176,14 +176,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l2;
>l2 : any
@@ -191,14 +191,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l2;
>l2 : any
@@ -225,14 +225,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l3;
>l3 : any
@@ -240,22 +240,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l3;
>l3 : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l4:
>l4 : any
@@ -286,14 +286,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l4;
>l4 : any
@@ -301,14 +301,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l4;
>l4 : any
@@ -346,14 +346,14 @@ for (let x = 0, y = 1; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l5;
>l5 : any
@@ -361,14 +361,14 @@ for (let x = 0, y = 1; x < 1; ++x) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l5;
>l5 : any
@@ -380,8 +380,8 @@ l6:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -404,14 +404,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l6;
>l6 : any
@@ -419,14 +419,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l6;
>l6 : any
@@ -459,14 +459,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l7;
>l7 : any
@@ -474,22 +474,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l7;
>l7 : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l8:
>l8 : any
@@ -524,14 +524,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l8;
>l8 : any
@@ -539,14 +539,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l8;
>l8 : any
@@ -574,14 +574,14 @@ for (const x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l0_c;
>l0_c : any
@@ -589,14 +589,14 @@ for (const x of []) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l0_c;
>l0_c : any
@@ -623,14 +623,14 @@ for (const x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break l00_c;
>l00_c : any
@@ -638,14 +638,14 @@ for (const x in []) {
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue l00_c;
>l00_c : any
@@ -675,14 +675,14 @@ for (const x = 0; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1_c;
>l1_c : any
@@ -690,14 +690,14 @@ for (const x = 0; x < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1_c;
>l1_c : any
@@ -709,8 +709,8 @@ l2_c:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -729,14 +729,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l2_c;
>l2_c : any
@@ -744,14 +744,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l2_c;
>l2_c : any
@@ -779,14 +779,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l3_c;
>l3_c : any
@@ -794,22 +794,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l3_c;
>l3_c : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l4_c:
>l4_c : any
@@ -838,14 +838,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l4_c;
>l4_c : any
@@ -853,14 +853,14 @@ for (const y = 0; y < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l4_c;
>l4_c : any
@@ -896,14 +896,14 @@ for (const x = 0, y = 1; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l5_c;
>l5_c : any
@@ -911,14 +911,14 @@ for (const x = 0, y = 1; x < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l5_c;
>l5_c : any
@@ -930,8 +930,8 @@ l6_c:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -956,14 +956,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l6_c;
>l6_c : any
@@ -971,14 +971,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l6_c;
>l6_c : any
@@ -1013,14 +1013,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l7_c;
>l7_c : any
@@ -1028,22 +1028,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l7_c;
>l7_c : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l8_c:
>l8_c : any
@@ -1076,14 +1076,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l8_c;
>l8_c : any
@@ -1091,14 +1091,14 @@ for (const y = 0; y < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l8_c;
>l8_c : any
@@ -20,14 +20,14 @@ for (let x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l0;
>l0 : any
@@ -35,14 +35,14 @@ for (let x of []) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l0;
>l0 : any
@@ -69,14 +69,14 @@ for (let x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break l00;
>l00 : any
@@ -84,14 +84,14 @@ for (let x in []) {
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue l00;
>l00 : any
@@ -123,14 +123,14 @@ for (let x = 0; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -138,14 +138,14 @@ for (let x = 0; x < 1; ++x) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -157,8 +157,8 @@ l2:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -176,14 +176,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l2;
>l2 : any
@@ -191,14 +191,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l2;
>l2 : any
@@ -225,14 +225,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l3;
>l3 : any
@@ -240,22 +240,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l3;
>l3 : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l4:
>l4 : any
@@ -286,14 +286,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l4;
>l4 : any
@@ -301,14 +301,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l4;
>l4 : any
@@ -346,14 +346,14 @@ for (let x = 0, y = 1; x < 1; ++x) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l5;
>l5 : any
@@ -361,14 +361,14 @@ for (let x = 0, y = 1; x < 1; ++x) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l5;
>l5 : any
@@ -380,8 +380,8 @@ l6:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x, y;
>x : any
@@ -404,14 +404,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l6;
>l6 : any
@@ -419,14 +419,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l6;
>l6 : any
@@ -459,14 +459,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l7;
>l7 : any
@@ -474,22 +474,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l7;
>l7 : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l8:
>l8 : any
@@ -524,14 +524,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l8;
>l8 : any
@@ -539,14 +539,14 @@ for (let y = 0; y < 1; ++y) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l8;
>l8 : any
@@ -574,14 +574,14 @@ for (const x of []) {
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : any
>1 : number
>1 : 1
break l0_c;
>l0_c : any
@@ -589,14 +589,14 @@ for (const x of []) {
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : any
>2 : number
>2 : 2
continue l0_c;
>l0_c : any
@@ -623,14 +623,14 @@ for (const x in []) {
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break;
}
if (x == "1") {
>x == "1" : boolean
>x : string
>"1" : string
>"1" : "1"
break l00_c;
>l00_c : any
@@ -638,14 +638,14 @@ for (const x in []) {
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue;
}
if (x == "2") {
>x == "2" : boolean
>x : string
>"2" : string
>"2" : "2"
continue l00_c;
>l00_c : any
@@ -675,14 +675,14 @@ for (const x = 0; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1_c;
>l1_c : any
@@ -690,14 +690,14 @@ for (const x = 0; x < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1_c;
>l1_c : any
@@ -709,8 +709,8 @@ l2_c:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1;
>x : number
@@ -729,14 +729,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l2_c;
>l2_c : any
@@ -744,14 +744,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l2_c;
>l2_c : any
@@ -779,14 +779,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l3_c;
>l3_c : any
@@ -794,22 +794,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l3_c;
>l3_c : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l4_c:
>l4_c : any
@@ -838,14 +838,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l4_c;
>l4_c : any
@@ -853,14 +853,14 @@ for (const y = 0; y < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l4_c;
>l4_c : any
@@ -896,14 +896,14 @@ for (const x = 0, y = 1; x < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l5_c;
>l5_c : any
@@ -911,14 +911,14 @@ for (const x = 0, y = 1; x < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l5_c;
>l5_c : any
@@ -930,8 +930,8 @@ l6_c:
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
const x = 1, y = 1;
>x : number
@@ -956,14 +956,14 @@ while (1 === 1) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l6_c;
>l6_c : any
@@ -971,14 +971,14 @@ while (1 === 1) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l6_c;
>l6_c : any
@@ -1013,14 +1013,14 @@ do {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l7_c;
>l7_c : any
@@ -1028,22 +1028,22 @@ do {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l7_c;
>l7_c : any
}
} while (1 === 1)
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
l8_c:
>l8_c : any
@@ -1076,14 +1076,14 @@ for (const y = 0; y < 1;) {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l8_c;
>l8_c : any
@@ -1091,14 +1091,14 @@ for (const y = 0; y < 1;) {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l8_c;
>l8_c : any
@@ -55,14 +55,14 @@ function foo() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break;
}
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -70,7 +70,7 @@ function foo() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break ll1;
>ll1 : any
@@ -78,7 +78,7 @@ function foo() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
continue l0;
>l0 : any
@@ -87,14 +87,14 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -102,7 +102,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue ll1;
>ll1 : any
@@ -110,7 +110,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "123"
>"123" : string
@@ -118,7 +118,7 @@ function foo() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -126,14 +126,14 @@ function foo() {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -141,14 +141,14 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -156,7 +156,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l0;
>l0 : any
@@ -164,7 +164,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "456";
>"456" : string
@@ -172,7 +172,7 @@ function foo() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -230,14 +230,14 @@ function foo_c() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break;
}
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -245,7 +245,7 @@ function foo_c() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break ll1;
>ll1 : any
@@ -253,7 +253,7 @@ function foo_c() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
continue l0;
>l0 : any
@@ -262,14 +262,14 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -277,7 +277,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue ll1;
>ll1 : any
@@ -285,7 +285,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "123"
>"123" : string
@@ -293,7 +293,7 @@ function foo_c() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -301,14 +301,14 @@ function foo_c() {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -316,14 +316,14 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -331,7 +331,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l0;
>l0 : any
@@ -339,7 +339,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "456";
>"456" : string
@@ -347,7 +347,7 @@ function foo_c() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -55,14 +55,14 @@ function foo() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break;
}
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -70,7 +70,7 @@ function foo() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break ll1;
>ll1 : any
@@ -78,7 +78,7 @@ function foo() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
continue l0;
>l0 : any
@@ -87,14 +87,14 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -102,7 +102,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue ll1;
>ll1 : any
@@ -110,7 +110,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "123"
>"123" : string
@@ -118,7 +118,7 @@ function foo() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -126,14 +126,14 @@ function foo() {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -141,14 +141,14 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -156,7 +156,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l0;
>l0 : any
@@ -164,7 +164,7 @@ function foo() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "456";
>"456" : string
@@ -172,7 +172,7 @@ function foo() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -230,14 +230,14 @@ function foo_c() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break;
}
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -245,7 +245,7 @@ function foo_c() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
break ll1;
>ll1 : any
@@ -253,7 +253,7 @@ function foo_c() {
if (y == 1) {
>y == 1 : boolean
>y : number
>1 : number
>1 : 1
continue l0;
>l0 : any
@@ -262,14 +262,14 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -277,7 +277,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue ll1;
>ll1 : any
@@ -285,7 +285,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "123"
>"123" : string
@@ -293,7 +293,7 @@ function foo_c() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -301,14 +301,14 @@ function foo_c() {
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break;
}
if (x == 1) {
>x == 1 : boolean
>x : number
>1 : number
>1 : 1
break l1;
>l1 : any
@@ -316,14 +316,14 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue;
}
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l1;
>l1 : any
@@ -331,7 +331,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
continue l0;
>l0 : any
@@ -339,7 +339,7 @@ function foo_c() {
if (x == 2) {
>x == 2 : boolean
>x : number
>2 : number
>2 : 2
return "456";
>"456" : string
@@ -347,7 +347,7 @@ function foo_c() {
if (x == 3) {
>x == 3 : boolean
>x : number
>3 : number
>3 : 3
return;
}
@@ -42,7 +42,7 @@ for (let x = 0; x < 1; ++x) {
>x : any
case 1:
>1 : number
>1 : 1
let x;
>x : any
@@ -57,8 +57,8 @@ for (let x = 0; x < 1; ++x) {
while (1 == 1) {
>1 == 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -100,7 +100,7 @@ function foo() {
if (a === 1) {
>a === 1 : boolean
>a : any
>1 : number
>1 : 1
break;
}
@@ -108,7 +108,7 @@ function foo() {
if (a === 2) {
>a === 2 : boolean
>a : any
>2 : number
>2 : 2
break l0;
>l0 : any
@@ -132,7 +132,7 @@ function foo() {
if (b === 1) {
>b === 1 : boolean
>b : any
>1 : number
>1 : 1
break;
}
@@ -141,7 +141,7 @@ function foo() {
if (b === 2) {
>b === 2 : boolean
>b : any
>2 : number
>2 : 2
break l0;
>l0 : any
@@ -153,7 +153,7 @@ function foo() {
if (b === 3) {
>b === 3 : boolean
>b : any
>3 : number
>3 : 3
break l1;
>l1 : any
@@ -183,7 +183,7 @@ function foo() {
if (b === 1) {
>b === 1 : boolean
>b : any
>1 : number
>1 : 1
break;
}
@@ -191,7 +191,7 @@ function foo() {
if (b === 2) {
>b === 2 : boolean
>b : any
>2 : number
>2 : 2
break l0;
>l0 : any
@@ -242,22 +242,22 @@ function foo2() {
if (x === 1) {
>x === 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
else if (x === 2) {
>x === 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
if (x) {
>x : any
@@ -273,10 +273,10 @@ function foo2() {
>x : any
case 1: break;
>1 : number
>1 : 1
case 2: continue;
>2 : number
>2 : 2
}
for (let y of []) {
@@ -287,10 +287,10 @@ function foo2() {
>y : any
case 1: break;
>1 : number
>1 : 1
case 2: continue;
>2 : number
>2 : 2
}
}
}
@@ -43,7 +43,7 @@ for (let x = 0; x < 1; ++x) {
>x : any
case 1:
>1 : number
>1 : 1
let x;
>x : any
@@ -58,8 +58,8 @@ for (let x = 0; x < 1; ++x) {
while (1 == 1) {
>1 == 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
let x;
>x : any
@@ -101,7 +101,7 @@ function foo() {
if (a === 1) {
>a === 1 : boolean
>a : any
>1 : number
>1 : 1
break;
}
@@ -109,7 +109,7 @@ function foo() {
if (a === 2) {
>a === 2 : boolean
>a : any
>2 : number
>2 : 2
break l0;
>l0 : any
@@ -133,7 +133,7 @@ function foo() {
if (b === 1) {
>b === 1 : boolean
>b : any
>1 : number
>1 : 1
break;
}
@@ -142,7 +142,7 @@ function foo() {
if (b === 2) {
>b === 2 : boolean
>b : any
>2 : number
>2 : 2
break l0;
>l0 : any
@@ -154,7 +154,7 @@ function foo() {
if (b === 3) {
>b === 3 : boolean
>b : any
>3 : number
>3 : 3
break l1;
>l1 : any
@@ -184,7 +184,7 @@ function foo() {
if (b === 1) {
>b === 1 : boolean
>b : any
>1 : number
>1 : 1
break;
}
@@ -192,7 +192,7 @@ function foo() {
if (b === 2) {
>b === 2 : boolean
>b : any
>2 : number
>2 : 2
break l0;
>l0 : any
@@ -242,22 +242,22 @@ function foo2() {
if (x === 1) {
>x === 1 : boolean
>x : any
>1 : number
>1 : 1
break;
}
else if (x === 2) {
>x === 2 : boolean
>x : any
>2 : number
>2 : 2
continue;
}
while (1 === 1) {
>1 === 1 : boolean
>1 : number
>1 : number
>1 : 1
>1 : 1
if (x) {
>x : any
@@ -273,10 +273,10 @@ function foo2() {
>x : any
case 1: break;
>1 : number
>1 : 1
case 2: continue;
>2 : number
>2 : 2
}
for (let y of []) {
@@ -287,10 +287,10 @@ function foo2() {
>y : any
case 1: break;
>1 : number
>1 : 1
case 2: continue;
>2 : number
>2 : 2
}
}
}
@@ -23,7 +23,7 @@ class A {
>v : string
case "test": use(this);
>"test" : string
>"test" : "test"
>use(this) : void
>use : (a: any) => void
>this : this
@@ -1,26 +1,26 @@
=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts ===
var v0: T0;
>v0 : string | I0
>T0 : string | I0
>v0 : T0
>T0 : T0
type T0 = string | I0;
>T0 : string | I0
>T0 : T0
>I0 : I0
class I0 {
>I0 : I0
x: T0;
>x : string | I0
>T0 : string | I0
>x : T0
>T0 : T0
}
var v3: T3;
>v3 : string | I3
>T3 : string | I3
>v3 : T3
>T3 : T3
type T3 = string | I3;
>T3 : string | I3
>T3 : T3
>I3 : I3
class I3 {
@@ -28,15 +28,15 @@ class I3 {
[x: number]: T3;
>x : number
>T3 : string | I3
>T3 : T3
}
var v4: T4;
>v4 : string | I4
>T4 : string | I4
>v4 : T4
>T4 : T4
type T4 = string | I4;
>T4 : string | I4
>T4 : T4
>I4 : I4
class I4 {
@@ -44,6 +44,6 @@ class I4 {
[x: string]: T4;
>x : string
>T4 : string | I4
>T4 : T4
}
@@ -1,56 +1,56 @@
=== tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithInterface.ts ===
var v0: T0;
>v0 : string | I0
>T0 : string | I0
>v0 : T0
>T0 : T0
type T0 = string | I0;
>T0 : string | I0
>T0 : T0
>I0 : I0
interface I0 {
>I0 : I0
x: T0;
>x : string | I0
>T0 : string | I0
>x : T0
>T0 : T0
}
var v1: T1;
>v1 : string | I1
>T1 : string | I1
>v1 : T1
>T1 : T1
type T1 = string | I1;
>T1 : string | I1
>T1 : T1
>I1 : I1
interface I1 {
>I1 : I1
(): T1;
>T1 : string | I1
>T1 : T1
}
var v2: T2;
>v2 : string | I2
>T2 : string | I2
>v2 : T2
>T2 : T2
type T2 = string | I2;
>T2 : string | I2
>T2 : T2
>I2 : I2
interface I2 {
>I2 : I2
new (): T2;
>T2 : string | I2
>T2 : T2
}
var v3: T3;
>v3 : string | I3
>T3 : string | I3
>v3 : T3
>T3 : T3
type T3 = string | I3;
>T3 : string | I3
>T3 : T3
>I3 : I3
interface I3 {
@@ -58,15 +58,15 @@ interface I3 {
[x: number]: T3;
>x : number
>T3 : string | I3
>T3 : T3
}
var v4: T4;
>v4 : string | I4
>T4 : string | I4
>v4 : T4
>T4 : T4
type T4 = string | I4;
>T4 : string | I4
>T4 : T4
>I4 : I4
interface I4 {
@@ -74,6 +74,6 @@ interface I4 {
[x: string]: T4;
>x : string
>T4 : string | I4
>T4 : T4
}
@@ -1,8 +1,8 @@
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(26,28): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(29,24): error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(32,28): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(36,10): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(37,10): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(32,24): error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(35,28): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(36,35): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(40,10): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(41,10): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts (5 errors) ====
@@ -14,35 +14,39 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib
class BaseB {
protected constructor(public x: number) { }
createInstance() { new BaseB(1); }
createInstance() { new BaseB(2); }
}
class BaseC {
private constructor(public x: number) { }
createInstance() { new BaseC(1); }
private constructor(public x: number) { }
createInstance() { new BaseC(3); }
static staticInstance() { new BaseC(4); }
}
class DerivedA extends BaseA {
constructor(public x: number) { super(x); }
createInstance() { new DerivedA(1); }
createBaseInstance() { new BaseA(1); }
createInstance() { new DerivedA(5); }
createBaseInstance() { new BaseA(6); }
static staticBaseInstance() { new BaseA(7); }
}
class DerivedB extends BaseB {
constructor(public x: number) { super(x); }
createInstance() { new DerivedB(1); }
createBaseInstance() { new BaseB(1); } // error
~~~~~~~~~~~~
!!! error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration.
createInstance() { new DerivedB(7); }
createBaseInstance() { new BaseB(8); } // ok
static staticBaseInstance() { new BaseB(9); } // ok
}
class DerivedC extends BaseC { // error
~~~~~
!!! error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private.
constructor(public x: number) { super(x); }
createInstance() { new DerivedC(1); }
createBaseInstance() { new BaseC(1); } // error
~~~~~~~~~~~~
createInstance() { new DerivedC(9); }
createBaseInstance() { new BaseC(10); } // error
~~~~~~~~~~~~~
!!! error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
static staticBaseInstance() { new BaseC(11); } // error
~~~~~~~~~~~~~
!!! error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration.
}
@@ -56,4 +60,5 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib
var da = new DerivedA(1);
var db = new DerivedB(1);
var dc = new DerivedC(1);
var dc = new DerivedC(1);
@@ -7,30 +7,34 @@ class BaseA {
class BaseB {
protected constructor(public x: number) { }
createInstance() { new BaseB(1); }
createInstance() { new BaseB(2); }
}
class BaseC {
private constructor(public x: number) { }
createInstance() { new BaseC(1); }
private constructor(public x: number) { }
createInstance() { new BaseC(3); }
static staticInstance() { new BaseC(4); }
}
class DerivedA extends BaseA {
constructor(public x: number) { super(x); }
createInstance() { new DerivedA(1); }
createBaseInstance() { new BaseA(1); }
createInstance() { new DerivedA(5); }
createBaseInstance() { new BaseA(6); }
static staticBaseInstance() { new BaseA(7); }
}
class DerivedB extends BaseB {
constructor(public x: number) { super(x); }
createInstance() { new DerivedB(1); }
createBaseInstance() { new BaseB(1); } // error
createInstance() { new DerivedB(7); }
createBaseInstance() { new BaseB(8); } // ok
static staticBaseInstance() { new BaseB(9); } // ok
}
class DerivedC extends BaseC { // error
constructor(public x: number) { super(x); }
createInstance() { new DerivedC(1); }
createBaseInstance() { new BaseC(1); } // error
createInstance() { new DerivedC(9); }
createBaseInstance() { new BaseC(10); } // error
static staticBaseInstance() { new BaseC(11); } // error
}
var ba = new BaseA(1);
@@ -39,7 +43,8 @@ var bc = new BaseC(1); // error
var da = new DerivedA(1);
var db = new DerivedB(1);
var dc = new DerivedC(1);
var dc = new DerivedC(1);
//// [classConstructorAccessibility2.js]
var __extends = (this && this.__extends) || function (d, b) {
@@ -58,14 +63,15 @@ var BaseB = (function () {
function BaseB(x) {
this.x = x;
}
BaseB.prototype.createInstance = function () { new BaseB(1); };
BaseB.prototype.createInstance = function () { new BaseB(2); };
return BaseB;
}());
var BaseC = (function () {
function BaseC(x) {
this.x = x;
}
BaseC.prototype.createInstance = function () { new BaseC(1); };
BaseC.prototype.createInstance = function () { new BaseC(3); };
BaseC.staticInstance = function () { new BaseC(4); };
return BaseC;
}());
var DerivedA = (function (_super) {
@@ -74,8 +80,9 @@ var DerivedA = (function (_super) {
_super.call(this, x);
this.x = x;
}
DerivedA.prototype.createInstance = function () { new DerivedA(1); };
DerivedA.prototype.createBaseInstance = function () { new BaseA(1); };
DerivedA.prototype.createInstance = function () { new DerivedA(5); };
DerivedA.prototype.createBaseInstance = function () { new BaseA(6); };
DerivedA.staticBaseInstance = function () { new BaseA(7); };
return DerivedA;
}(BaseA));
var DerivedB = (function (_super) {
@@ -84,8 +91,9 @@ var DerivedB = (function (_super) {
_super.call(this, x);
this.x = x;
}
DerivedB.prototype.createInstance = function () { new DerivedB(1); };
DerivedB.prototype.createBaseInstance = function () { new BaseB(1); }; // error
DerivedB.prototype.createInstance = function () { new DerivedB(7); };
DerivedB.prototype.createBaseInstance = function () { new BaseB(8); }; // ok
DerivedB.staticBaseInstance = function () { new BaseB(9); }; // ok
return DerivedB;
}(BaseB));
var DerivedC = (function (_super) {
@@ -94,8 +102,9 @@ var DerivedC = (function (_super) {
_super.call(this, x);
this.x = x;
}
DerivedC.prototype.createInstance = function () { new DerivedC(1); };
DerivedC.prototype.createBaseInstance = function () { new BaseC(1); }; // error
DerivedC.prototype.createInstance = function () { new DerivedC(9); };
DerivedC.prototype.createBaseInstance = function () { new BaseC(10); }; // error
DerivedC.staticBaseInstance = function () { new BaseC(11); }; // error
return DerivedC;
}(BaseC));
var ba = new BaseA(1);
@@ -121,24 +130,28 @@ declare class BaseC {
x: number;
private constructor(x);
createInstance(): void;
static staticInstance(): void;
}
declare class DerivedA extends BaseA {
x: number;
constructor(x: number);
createInstance(): void;
createBaseInstance(): void;
static staticBaseInstance(): void;
}
declare class DerivedB extends BaseB {
x: number;
constructor(x: number);
createInstance(): void;
createBaseInstance(): void;
static staticBaseInstance(): void;
}
declare class DerivedC extends BaseC {
x: number;
constructor(x: number);
createInstance(): void;
createBaseInstance(): void;
static staticBaseInstance(): void;
}
declare var ba: BaseA;
declare var bb: any;
@@ -0,0 +1,17 @@
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility5.ts(9,21): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility5.ts (1 errors) ====
class Base {
protected constructor() { }
}
class Derived extends Base {
static make() { new Base() } // ok
}
class Unrelated {
static fake() { new Base() } // error
~~~~~~~~~~
!!! error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
}
@@ -0,0 +1,38 @@
//// [classConstructorAccessibility5.ts]
class Base {
protected constructor() { }
}
class Derived extends Base {
static make() { new Base() } // ok
}
class Unrelated {
static fake() { new Base() } // error
}
//// [classConstructorAccessibility5.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 Base = (function () {
function Base() {
}
return Base;
}());
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
}
Derived.make = function () { new Base(); }; // ok
return Derived;
}(Base));
var Unrelated = (function () {
function Unrelated() {
}
Unrelated.fake = function () { new Base(); }; // error
return Unrelated;
}());
@@ -1,24 +1,24 @@
=== tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts ===
var x: StringTree;
>x : string | StringTreeCollection
>StringTree : string | StringTreeCollection
>x : StringTree
>StringTree : StringTree
if (typeof x !== "string") {
>typeof x !== "string" : boolean
>typeof x : string
>x : string | StringTreeCollection
>"string" : string
>x : StringTree
>"string" : "string"
x[0] = "";
>x[0] = "" : string
>x[0] : string | StringTreeCollection
>x[0] : StringTree
>x : StringTreeCollection
>0 : number
>"" : string
x[0] = new StringTreeCollection;
>x[0] = new StringTreeCollection : StringTreeCollection
>x[0] : string | StringTreeCollection
>x[0] : StringTree
>x : StringTreeCollection
>0 : number
>new StringTreeCollection : StringTreeCollection
@@ -26,7 +26,7 @@ if (typeof x !== "string") {
}
type StringTree = string | StringTreeCollection;
>StringTree : string | StringTreeCollection
>StringTree : StringTree
>StringTreeCollection : StringTreeCollection
class StringTreeCollectionBase {
@@ -34,7 +34,7 @@ class StringTreeCollectionBase {
[n: number]: StringTree;
>n : number
>StringTree : string | StringTreeCollection
>StringTree : StringTree
}
class StringTreeCollection extends StringTreeCollectionBase { }
@@ -0,0 +1,10 @@
//// [classExpressionWithStaticPropertiesES64.ts]
(class { static x = 0; });
//// [classExpressionWithStaticPropertiesES64.js]
((classExpression_1 = class {
},
classExpression_1.x = 0,
classExpression_1));
var classExpression_1;
@@ -0,0 +1,4 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES64.ts ===
(class { static x = 0; });
>x : Symbol((Anonymous class).x, Decl(classExpressionWithStaticPropertiesES64.ts, 0, 8))
@@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES64.ts ===
(class { static x = 0; });
>(class { static x = 0; }) : typeof (Anonymous class)
>class { static x = 0; } : typeof (Anonymous class)
>x : number
>0 : number
@@ -20,10 +20,10 @@ var x = Colors.Cornflower;
>Cornflower : Colors
x = Colors.FancyPink;
>x = Colors.FancyPink : Colors
>x = Colors.FancyPink : Colors.FancyPink
>x : Colors
>Colors.FancyPink : Colors
>Colors.FancyPink : Colors.FancyPink
>Colors : typeof Colors
>FancyPink : Colors
>FancyPink : Colors.FancyPink
@@ -165,7 +165,7 @@ const enum color { red, green, blue }
var shade: color = color.green;
>shade : color
>color : color
>color.green : color
>color.green : color.green
>color : typeof color
>green : color
>green : color.green
@@ -41,7 +41,7 @@ var e: number = <foo.E1>0;
><foo.E1>0 : foo.E1
>foo : any
>E1 : foo.E1
>0 : number
>0 : 0
=== tests/cases/conformance/externalModules/foo_0.ts ===
export class C1 {
@@ -208,34 +208,34 @@ var re2 = b == a;
var re3 = E.a == b;
>re3 : boolean
>E.a == b : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
>b : number
var re4 = b == E.a;
>re4 : boolean
>b == E.a : boolean
>b : number
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
var re5 = E.a == 0;
>re5 : boolean
>E.a == 0 : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>0 : number
>a : E.a
>0 : 0
var re6 = 0 == E.a;
>re6 : boolean
>0 == E.a : boolean
>0 : number
>E.a : E
>0 : 0
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
// operator !=
var rf1 = a != b;
@@ -253,34 +253,34 @@ var rf2 = b != a;
var rf3 = E.a != b;
>rf3 : boolean
>E.a != b : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
>b : number
var rf4 = b != E.a;
>rf4 : boolean
>b != E.a : boolean
>b : number
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
var rf5 = E.a != 0;
>rf5 : boolean
>E.a != 0 : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>0 : number
>a : E.a
>0 : 0
var rf6 = 0 != E.a;
>rf6 : boolean
>0 != E.a : boolean
>0 : number
>E.a : E
>0 : 0
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
// operator ===
var rg1 = a === b;
@@ -298,34 +298,34 @@ var rg2 = b === a;
var rg3 = E.a === b;
>rg3 : boolean
>E.a === b : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
>b : number
var rg4 = b === E.a;
>rg4 : boolean
>b === E.a : boolean
>b : number
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
var rg5 = E.a === 0;
>rg5 : boolean
>E.a === 0 : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>0 : number
>a : E.a
>0 : 0
var rg6 = 0 === E.a;
>rg6 : boolean
>0 === E.a : boolean
>0 : number
>E.a : E
>0 : 0
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
// operator !==
var rh1 = a !== b;
@@ -343,32 +343,32 @@ var rh2 = b !== a;
var rh3 = E.a !== b;
>rh3 : boolean
>E.a !== b : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
>b : number
var rh4 = b !== E.a;
>rh4 : boolean
>b !== E.a : boolean
>b : number
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
var rh5 = E.a !== 0;
>rh5 : boolean
>E.a !== 0 : boolean
>E.a : E
>E.a : E.a
>E : typeof E
>a : E
>0 : number
>a : E.a
>0 : 0
var rh6 = 0 !== E.a;
>rh6 : boolean
>0 !== E.a : boolean
>0 : number
>E.a : E
>0 : 0
>E.a : E.a
>E : typeof E
>a : E
>a : E.a
Loaded 100 of 486 files, more files were not shown because too many files have changed in this diff. Show more