mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Resolve diagnostics conflict
This commit is contained in:
@@ -216,6 +216,7 @@ var harnessSources = harnessCoreSources.concat([
|
||||
"moduleResolution.ts",
|
||||
"tsconfigParsing.ts",
|
||||
"commandLineParsing.ts",
|
||||
"configurationExtension.ts",
|
||||
"convertCompilerOptionsFromJson.ts",
|
||||
"convertTypingOptionsFromJson.ts",
|
||||
"tsserverProjectSystem.ts",
|
||||
|
||||
Vendored
+2
-2
@@ -19,7 +19,7 @@ interface ProxyHandler<T> {
|
||||
setPrototypeOf? (target: T, v: any): boolean;
|
||||
isExtensible? (target: T): boolean;
|
||||
preventExtensions? (target: T): boolean;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
|
||||
has? (target: T, p: PropertyKey): boolean;
|
||||
get? (target: T, p: PropertyKey, receiver: any): any;
|
||||
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
|
||||
@@ -35,4 +35,4 @@ interface ProxyConstructor {
|
||||
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T>(target: T, handler: ProxyHandler<T>): T
|
||||
}
|
||||
declare var Proxy: ProxyConstructor;
|
||||
declare var Proxy: ProxyConstructor;
|
||||
|
||||
+27
-2
@@ -877,7 +877,8 @@ namespace ts {
|
||||
if (nameNotFoundMessage) {
|
||||
if (!errorLocation ||
|
||||
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
|
||||
!checkAndReportErrorForExtendingInterface(errorLocation)) {
|
||||
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
||||
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {
|
||||
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
|
||||
}
|
||||
}
|
||||
@@ -987,6 +988,16 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkAndReportErrorForUsingTypeAsValue(errorLocation: Node, name: string, meaning: SymbolFlags): boolean {
|
||||
if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule)) {
|
||||
const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined));
|
||||
if (symbol && !(symbol.flags & SymbolFlags.NamespaceModule)) {
|
||||
error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void {
|
||||
Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0);
|
||||
@@ -10869,7 +10880,7 @@ namespace ts {
|
||||
const prop = getPropertyOfType(apparentType, right.text);
|
||||
if (!prop) {
|
||||
if (right.text && !checkAndReportErrorForExtendingInterface(node)) {
|
||||
error(right, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(right), typeToString(type.flags & TypeFlags.ThisType ? apparentType : type));
|
||||
reportNonexistentProperty(right, type.flags & TypeFlags.ThisType ? apparentType : type);
|
||||
}
|
||||
return unknownType;
|
||||
}
|
||||
@@ -10903,6 +10914,20 @@ namespace ts {
|
||||
return propType;
|
||||
}
|
||||
return getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined);
|
||||
|
||||
function reportNonexistentProperty(propNode: Identifier, containingType: Type) {
|
||||
let errorInfo: DiagnosticMessageChain;
|
||||
if (containingType.flags & TypeFlags.Union && !(containingType.flags & TypeFlags.Primitive)) {
|
||||
for (const subtype of (containingType as UnionType).types) {
|
||||
if (!getPropertyOfType(subtype, propNode.text)) {
|
||||
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType));
|
||||
diagnostics.add(createDiagnosticForNodeFromMessageChain(propNode, errorInfo));
|
||||
}
|
||||
}
|
||||
|
||||
function isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean {
|
||||
|
||||
@@ -806,12 +806,45 @@ namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string): ParsedCommandLine {
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = []): ParsedCommandLine {
|
||||
const errors: Diagnostic[] = [];
|
||||
const compilerOptions: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
|
||||
const options = extend(existingOptions, compilerOptions);
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName);
|
||||
if (resolutionStack.indexOf(resolvedPath) >= 0) {
|
||||
return {
|
||||
options: {},
|
||||
fileNames: [],
|
||||
typingOptions: {},
|
||||
raw: json,
|
||||
errors: [createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> "))],
|
||||
wildcardDirectories: {}
|
||||
};
|
||||
}
|
||||
|
||||
let options: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
|
||||
const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
|
||||
|
||||
if (json["extends"]) {
|
||||
let [include, exclude, files, baseOptions]: [string[], string[], string[], CompilerOptions] = [undefined, undefined, undefined, {}];
|
||||
if (typeof json["extends"] === "string") {
|
||||
[include, exclude, files, baseOptions] = (tryExtendsName(json["extends"]) || [include, exclude, files, baseOptions]);
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string"));
|
||||
}
|
||||
if (include && !json["include"]) {
|
||||
json["include"] = include;
|
||||
}
|
||||
if (exclude && !json["exclude"]) {
|
||||
json["exclude"] = exclude;
|
||||
}
|
||||
if (files && !json["files"]) {
|
||||
json["files"] = files;
|
||||
}
|
||||
options = assign({}, baseOptions, options);
|
||||
}
|
||||
|
||||
options = extend(existingOptions, options);
|
||||
options.configFilePath = configFileName;
|
||||
|
||||
const { fileNames, wildcardDirectories } = getFileNames(errors);
|
||||
@@ -825,6 +858,39 @@ namespace ts {
|
||||
wildcardDirectories
|
||||
};
|
||||
|
||||
function tryExtendsName(extendedConfig: string): [string[], string[], string[], CompilerOptions] {
|
||||
// If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future)
|
||||
if (!(isRootedDiskPath(extendedConfig) || startsWith(normalizeSlashes(extendedConfig), "./") || startsWith(normalizeSlashes(extendedConfig), "../"))) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
|
||||
return;
|
||||
}
|
||||
let extendedConfigPath = toPath(extendedConfig, basePath, getCanonicalFileName);
|
||||
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json")) {
|
||||
extendedConfigPath = `${extendedConfigPath}.json` as Path;
|
||||
if (!host.fileExists(extendedConfigPath)) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig));
|
||||
return;
|
||||
}
|
||||
}
|
||||
const extendedResult = readConfigFile(extendedConfigPath, path => host.readFile(path));
|
||||
if (extendedResult.error) {
|
||||
errors.push(extendedResult.error);
|
||||
return;
|
||||
}
|
||||
const extendedDirname = getDirectoryPath(extendedConfigPath);
|
||||
const relativeDifference = convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);
|
||||
const updatePath: (path: string) => string = path => isRootedDiskPath(path) ? path : combinePaths(relativeDifference, path);
|
||||
// Merge configs (copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios)
|
||||
const result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, /*existingOptions*/undefined, getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath]));
|
||||
errors.push(...result.errors);
|
||||
const [include, exclude, files] = map(["include", "exclude", "files"], key => {
|
||||
if (!json[key] && extendedResult.config[key]) {
|
||||
return map(extendedResult.config[key], updatePath);
|
||||
}
|
||||
});
|
||||
return [include, exclude, files, result.options];
|
||||
}
|
||||
|
||||
function getFileNames(errors: Diagnostic[]): ExpandResult {
|
||||
let fileNames: string[];
|
||||
if (hasProperty(json, "files")) {
|
||||
|
||||
@@ -377,6 +377,20 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function mapObject<T, U>(object: MapLike<T>, f: (key: string, x: T) => [string, U]): MapLike<U> {
|
||||
let result: MapLike<U>;
|
||||
if (object) {
|
||||
result = {};
|
||||
for (const v of getOwnKeys(object)) {
|
||||
const [key, value]: [string, U] = f(v, object[v]) || [undefined, undefined];
|
||||
if (key !== undefined) {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function concatenate<T>(array1: T[], array2: T[]): T[] {
|
||||
if (!array2 || !array2.length) return array1;
|
||||
if (!array1 || !array1.length) return array2;
|
||||
@@ -639,6 +653,18 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function assign<T1 extends MapLike<{}>, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3;
|
||||
export function assign<T1 extends MapLike<{}>, T2>(t: T1, arg1: T2): T1 & T2;
|
||||
export function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]): any;
|
||||
export function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]) {
|
||||
for (const arg of args) {
|
||||
for (const p of getOwnKeys(arg)) {
|
||||
t[p] = arg[p];
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce the properties of a map.
|
||||
*
|
||||
|
||||
@@ -1947,10 +1947,14 @@
|
||||
"category": "Error",
|
||||
"code": 2692
|
||||
},
|
||||
"Left side of comma operator is unused and has no side effects.": {
|
||||
"'{0}' only refers to a type, but is being used as a value here.": {
|
||||
"category": "Error",
|
||||
"code": 2693
|
||||
},
|
||||
"Left side of comma operator is unused and has no side effects.": {
|
||||
"category": "Error",
|
||||
"code": 2694
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
@@ -3047,5 +3051,14 @@
|
||||
"Unknown typing option '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 17010
|
||||
},
|
||||
|
||||
"Circularity detected while resolving configuration: {0}": {
|
||||
"category": "Error",
|
||||
"code": 18000
|
||||
},
|
||||
"The path in an 'extends' options must be relative or rooted.": {
|
||||
"category": "Error",
|
||||
"code": 18001
|
||||
}
|
||||
}
|
||||
|
||||
+80
-31
@@ -71,43 +71,92 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};`;
|
||||
|
||||
// The __generator helper is used by down-level transformations to emulate the runtime
|
||||
// semantics of an ES2015 generator function. When called, this helper returns an
|
||||
// object that implements the Iterator protocol, in that it has `next`, `return`, and
|
||||
// `throw` methods that step through the generator when invoked.
|
||||
//
|
||||
// parameters:
|
||||
// thisArg The value to use as the `this` binding for the transformed generator body.
|
||||
// body A function that acts as the transformed generator body.
|
||||
//
|
||||
// variables:
|
||||
// _ Persistent state for the generator that is shared between the helper and the
|
||||
// generator body. The state object has the following members:
|
||||
// sent() - A method that returns or throws the current completion value.
|
||||
// label - The next point at which to resume evaluation of the generator body.
|
||||
// trys - A stack of protected regions (try/catch/finally blocks).
|
||||
// ops - A stack of pending instructions when inside of a finally block.
|
||||
// f A value indicating whether the generator is executing.
|
||||
// y An iterator to delegate for a yield*.
|
||||
// t A temporary variable that holds one of the following values (note that these
|
||||
// cases do not overlap):
|
||||
// - The completion value when resuming from a `yield` or `yield*`.
|
||||
// - The error value for a catch block.
|
||||
// - The current protected region (array of try/catch/finally/end labels).
|
||||
// - The verb (`next`, `throw`, or `return` method) to delegate to the expression
|
||||
// of a `yield*`.
|
||||
// - The result of evaluating the verb delegated to the expression of a `yield*`.
|
||||
//
|
||||
// functions:
|
||||
// verb(n) Creates a bound callback to the `step` function for opcode `n`.
|
||||
// step(op) Evaluates opcodes in a generator body until execution is suspended or
|
||||
// completed.
|
||||
//
|
||||
// The __generator helper understands a limited set of instructions:
|
||||
// 0: next(value?) - Start or resume the generator with the specified value.
|
||||
// 1: throw(error) - Resume the generator with an exception. If the generator is
|
||||
// suspended inside of one or more protected regions, evaluates
|
||||
// any intervening finally blocks between the current label and
|
||||
// the nearest catch block or function boundary. If uncaught, the
|
||||
// exception is thrown to the caller.
|
||||
// 2: return(value?) - Resume the generator as if with a return. If the generator is
|
||||
// suspended inside of one or more protected regions, evaluates any
|
||||
// intervening finally blocks.
|
||||
// 3: break(label) - Jump to the specified label. If the label is outside of the
|
||||
// current protected region, evaluates any intervening finally
|
||||
// blocks.
|
||||
// 4: yield(value?) - Yield execution to the caller with an optional value. When
|
||||
// resumed, the generator will continue at the next label.
|
||||
// 5: yield*(value) - Delegates evaluation to the supplied iterator. When
|
||||
// delegation completes, the generator will continue at the next
|
||||
// label.
|
||||
// 6: catch(error) - Handles an exception thrown from within the generator body. If
|
||||
// the current label is inside of one or more protected regions,
|
||||
// evaluates any intervening finally blocks between the current
|
||||
// label and the nearest catch block or function boundary. If
|
||||
// uncaught, the exception is thrown to the caller.
|
||||
// 7: endfinally - Ends a finally block, resuming the last instruction prior to
|
||||
// entering a finally block.
|
||||
//
|
||||
// For examples of how these are used, see the comments in ./transformers/generators.ts
|
||||
const generatorHelper = `
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};`;
|
||||
|
||||
// emit output for the __export helper function
|
||||
|
||||
@@ -2055,9 +2055,24 @@ namespace ts {
|
||||
if (!isBlock(loopBody)) {
|
||||
loopBody = createBlock([loopBody], /*location*/ undefined, /*multiline*/ true);
|
||||
}
|
||||
|
||||
const isAsyncBlockContainingAwait =
|
||||
containingNonArrowFunction
|
||||
&& (containingNonArrowFunction.emitFlags & NodeEmitFlags.AsyncFunctionBody) !== 0
|
||||
&& (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0;
|
||||
|
||||
let loopBodyFlags: NodeEmitFlags = 0;
|
||||
if (currentState.containsLexicalThis) {
|
||||
loopBodyFlags |= NodeEmitFlags.CapturesThis;
|
||||
}
|
||||
|
||||
if (isAsyncBlockContainingAwait) {
|
||||
loopBodyFlags |= NodeEmitFlags.AsyncFunctionBody;
|
||||
}
|
||||
|
||||
const convertedLoopVariable =
|
||||
createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList(
|
||||
[
|
||||
createVariableDeclaration(
|
||||
@@ -2065,16 +2080,14 @@ namespace ts {
|
||||
/*type*/ undefined,
|
||||
setNodeEmitFlags(
|
||||
createFunctionExpression(
|
||||
/*asteriskToken*/ undefined,
|
||||
isAsyncBlockContainingAwait ? createToken(SyntaxKind.AsteriskToken) : undefined,
|
||||
/*name*/ undefined,
|
||||
/*typeParameters*/ undefined,
|
||||
loopParameters,
|
||||
/*type*/ undefined,
|
||||
<Block>loopBody
|
||||
),
|
||||
currentState.containsLexicalThis
|
||||
? NodeEmitFlags.CapturesThis
|
||||
: 0
|
||||
loopBodyFlags
|
||||
)
|
||||
)
|
||||
]
|
||||
@@ -2160,7 +2173,7 @@ namespace ts {
|
||||
));
|
||||
}
|
||||
|
||||
const convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState);
|
||||
const convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait);
|
||||
let loop: IterationStatement;
|
||||
if (convert) {
|
||||
loop = convert(node, convertedLoopBodyStatements);
|
||||
@@ -2173,12 +2186,17 @@ namespace ts {
|
||||
loop = visitEachChild(loop, visitor, context);
|
||||
// set loop statement
|
||||
loop.statement = createBlock(
|
||||
generateCallToConvertedLoop(functionName, loopParameters, currentState),
|
||||
convertedLoopBodyStatements,
|
||||
/*location*/ undefined,
|
||||
/*multiline*/ true
|
||||
);
|
||||
|
||||
// reset and re-aggregate the transform flags
|
||||
loop.transformFlags = 0;
|
||||
aggregateTransformFlags(loop);
|
||||
}
|
||||
|
||||
|
||||
statements.push(
|
||||
currentParent.kind === SyntaxKind.LabeledStatement
|
||||
? createLabel((<LabeledStatement>currentParent).label, loop)
|
||||
@@ -2199,7 +2217,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function generateCallToConvertedLoop(loopFunctionExpressionName: Identifier, parameters: ParameterDeclaration[], state: ConvertedLoopState): Statement[] {
|
||||
function generateCallToConvertedLoop(loopFunctionExpressionName: Identifier, parameters: ParameterDeclaration[], state: ConvertedLoopState, isAsyncBlockContainingAwait: boolean): Statement[] {
|
||||
const outerConvertedLoopState = convertedLoopState;
|
||||
|
||||
const statements: Statement[] = [];
|
||||
@@ -2212,8 +2230,9 @@ namespace ts {
|
||||
!state.labeledNonLocalContinues;
|
||||
|
||||
const call = createCall(loopFunctionExpressionName, /*typeArguments*/ undefined, map(parameters, p => <Identifier>p.name));
|
||||
const callResult = isAsyncBlockContainingAwait ? createYield(createToken(SyntaxKind.AsteriskToken), call) : call;
|
||||
if (isSimpleLoop) {
|
||||
statements.push(createStatement(call));
|
||||
statements.push(createStatement(callResult));
|
||||
copyOutParameters(state.loopOutParameters, CopyDirection.ToOriginal, statements);
|
||||
}
|
||||
else {
|
||||
@@ -2221,7 +2240,7 @@ namespace ts {
|
||||
const stateVariable = createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList(
|
||||
[createVariableDeclaration(loopResultName, /*type*/ undefined, call)]
|
||||
[createVariableDeclaration(loopResultName, /*type*/ undefined, callResult)]
|
||||
)
|
||||
);
|
||||
statements.push(stateVariable);
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
// .brfalse LABEL, (x) - Jump to a label IIF the expression `x` is falsey.
|
||||
// If jumping out of a protected region, all .finally
|
||||
// blocks are executed.
|
||||
// .yield RESUME, (x) - Yield the value of the optional expression `x`.
|
||||
// Resume at the label RESUME.
|
||||
// .yieldstar RESUME, (x) - Delegate yield to the value of the optional
|
||||
// expression `x`. Resume at the label RESUME.
|
||||
// .yield (x) - Yield the value of the optional expression `x`.
|
||||
// Resume at the next label.
|
||||
// .yieldstar (x) - Delegate yield to the value of the optional
|
||||
// expression `x`. Resume at the next label.
|
||||
// NOTE: `x` must be an Iterator, not an Iterable.
|
||||
// .loop CONTINUE, BREAK - Marks the beginning of a loop. Any "continue" or
|
||||
// "break" abrupt completions jump to the CONTINUE or
|
||||
// BREAK labels, respectively.
|
||||
@@ -80,13 +81,13 @@
|
||||
// -------------------------------|----------------------------------------------
|
||||
// .brfalse LABEL, (x) | if (!(x)) return [3, /*break*/, LABEL];
|
||||
// -------------------------------|----------------------------------------------
|
||||
// .yield RESUME, (x) | return [4 /*yield*/, x];
|
||||
// .yield (x) | return [4 /*yield*/, x];
|
||||
// .mark RESUME | case RESUME:
|
||||
// a = %sent%; | a = state.sent();
|
||||
// a = %sent%; | a = state.sent();
|
||||
// -------------------------------|----------------------------------------------
|
||||
// .yieldstar RESUME, (X) | return [5 /*yield**/, x];
|
||||
// .yieldstar (x) | return [5 /*yield**/, x];
|
||||
// .mark RESUME | case RESUME:
|
||||
// a = %sent%; | a = state.sent();
|
||||
// a = %sent%; | a = state.sent();
|
||||
// -------------------------------|----------------------------------------------
|
||||
// .with (_a) | with (_a) {
|
||||
// a(); | a();
|
||||
@@ -109,7 +110,7 @@
|
||||
// .br END | return [3 /*break*/, END];
|
||||
// .catch (e) |
|
||||
// .mark CATCH | case CATCH:
|
||||
// | e = state.error;
|
||||
// | e = state.sent();
|
||||
// b(); | b();
|
||||
// .br END | return [3 /*break*/, END];
|
||||
// .finally |
|
||||
@@ -906,7 +907,7 @@ namespace ts {
|
||||
*
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitYieldExpression(node: YieldExpression) {
|
||||
function visitYieldExpression(node: YieldExpression): LeftHandSideExpression {
|
||||
// [source]
|
||||
// x = yield a();
|
||||
//
|
||||
@@ -917,7 +918,14 @@ namespace ts {
|
||||
|
||||
// NOTE: we are explicitly not handling YieldStar at this time.
|
||||
const resumeLabel = defineLabel();
|
||||
emitYield(visitNode(node.expression, visitor, isExpression), /*location*/ node);
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
if (node.asteriskToken) {
|
||||
emitYieldStar(expression, /*location*/ node);
|
||||
}
|
||||
else {
|
||||
emitYield(expression, /*location*/ node);
|
||||
}
|
||||
|
||||
markLabel(resumeLabel);
|
||||
return createGeneratorResume();
|
||||
}
|
||||
@@ -2480,6 +2488,16 @@ namespace ts {
|
||||
emitWorker(OpCode.BreakWhenFalse, [label, condition], location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits a YieldStar operation for the provided expression.
|
||||
*
|
||||
* @param expression An optional value for the yield operation.
|
||||
* @param location An optional source map location for the assignment.
|
||||
*/
|
||||
function emitYieldStar(expression?: Expression, location?: TextRange): void {
|
||||
emitWorker(OpCode.YieldStar, [expression], location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits a Yield operation for the provided expression.
|
||||
*
|
||||
|
||||
@@ -1807,6 +1807,8 @@ namespace ts {
|
||||
* @param path The path to test.
|
||||
*/
|
||||
fileExists(path: string): boolean;
|
||||
|
||||
readFile(path: string): string;
|
||||
}
|
||||
|
||||
export interface WriteFileCallback {
|
||||
|
||||
@@ -1844,7 +1844,8 @@ namespace Harness {
|
||||
const parseConfigHost: ts.ParseConfigHost = {
|
||||
useCaseSensitiveFileNames: false,
|
||||
readDirectory: (name) => [],
|
||||
fileExists: (name) => true
|
||||
fileExists: (name) => true,
|
||||
readFile: (name) => ts.forEach(testUnitData, data => data.name.toLowerCase() === name.toLowerCase() ? data.content : undefined)
|
||||
};
|
||||
|
||||
// check if project has tsconfig.json in the list of files
|
||||
|
||||
@@ -222,6 +222,7 @@ class ProjectRunner extends RunnerBase {
|
||||
useCaseSensitiveFileNames: Harness.IO.useCaseSensitiveFileNames(),
|
||||
fileExists,
|
||||
readDirectory,
|
||||
readFile
|
||||
};
|
||||
const configParseResult = ts.parseJsonConfigFileContent(configObject, configParseHost, ts.getDirectoryPath(configFileName), compilerOptions);
|
||||
if (configParseResult.errors.length > 0) {
|
||||
@@ -292,6 +293,10 @@ class ProjectRunner extends RunnerBase {
|
||||
return Harness.IO.fileExists(getFileNameInTheProjectTest(fileName));
|
||||
}
|
||||
|
||||
function readFile(fileName: string): string {
|
||||
return Harness.IO.readFile(getFileNameInTheProjectTest(fileName));
|
||||
}
|
||||
|
||||
function getSourceFileText(fileName: string): string {
|
||||
let text: string = undefined;
|
||||
try {
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace RWC {
|
||||
useCaseSensitiveFileNames: Harness.IO.useCaseSensitiveFileNames(),
|
||||
fileExists: Harness.IO.fileExists,
|
||||
readDirectory: Harness.IO.readDirectory,
|
||||
readFile: Harness.IO.readFile
|
||||
};
|
||||
const configParseResult = ts.parseJsonConfigFileContent(parsedTsconfigFileContents.config, configParseHost, ts.getDirectoryPath(tsconfigFile.path));
|
||||
fileNames = configParseResult.fileNames;
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
"./unittests/moduleResolution.ts",
|
||||
"./unittests/tsconfigParsing.ts",
|
||||
"./unittests/commandLineParsing.ts",
|
||||
"./unittests/configurationExtension.ts",
|
||||
"./unittests/convertCompilerOptionsFromJson.ts",
|
||||
"./unittests/convertTypingOptionsFromJson.ts",
|
||||
"./unittests/tsserverProjectSystem.ts",
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
/// <reference path="..\harness.ts" />
|
||||
/// <reference path="..\virtualFileSystem.ts" />
|
||||
|
||||
namespace ts {
|
||||
const testContents = {
|
||||
"/dev/tsconfig.json": `{
|
||||
"extends": "./configs/base",
|
||||
"files": [
|
||||
"main.ts",
|
||||
"supplemental.ts"
|
||||
]
|
||||
}`,
|
||||
"/dev/tsconfig.nostrictnull.json": `{
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": false
|
||||
}
|
||||
}`,
|
||||
"/dev/configs/base.json": `{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true
|
||||
}
|
||||
}`,
|
||||
"/dev/configs/tests.json": `{
|
||||
"compilerOptions": {
|
||||
"preserveConstEnums": true,
|
||||
"removeComments": false,
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"../tests/baselines",
|
||||
"../tests/scenarios"
|
||||
],
|
||||
"include": [
|
||||
"../tests/**/*.ts"
|
||||
]
|
||||
}`,
|
||||
"/dev/circular.json": `{
|
||||
"extends": "./circular2",
|
||||
"compilerOptions": {
|
||||
"module": "amd"
|
||||
}
|
||||
}`,
|
||||
"/dev/circular2.json": `{
|
||||
"extends": "./circular",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
}
|
||||
}`,
|
||||
"/dev/missing.json": `{
|
||||
"extends": "./missing2",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
}
|
||||
}`,
|
||||
"/dev/failure.json": `{
|
||||
"extends": "./failure2.json",
|
||||
"compilerOptions": {
|
||||
"typeRoots": []
|
||||
}
|
||||
}`,
|
||||
"/dev/failure2.json": `{
|
||||
"excludes": ["*.js"]
|
||||
}`,
|
||||
"/dev/configs/first.json": `{
|
||||
"extends": "./base",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
},
|
||||
"files": ["../main.ts"]
|
||||
}`,
|
||||
"/dev/configs/second.json": `{
|
||||
"extends": "./base",
|
||||
"compilerOptions": {
|
||||
"module": "amd"
|
||||
},
|
||||
"include": ["../supplemental.*"]
|
||||
}`,
|
||||
"/dev/extends.json": `{ "extends": 42 }`,
|
||||
"/dev/extends2.json": `{ "extends": "configs/base" }`,
|
||||
"/dev/main.ts": "",
|
||||
"/dev/supplemental.ts": "",
|
||||
"/dev/tests/unit/spec.ts": "",
|
||||
"/dev/tests/utils.ts": "",
|
||||
"/dev/tests/scenarios/first.json": "",
|
||||
"/dev/tests/baselines/first/output.ts": ""
|
||||
};
|
||||
|
||||
const caseInsensitiveBasePath = "c:/dev/";
|
||||
const caseInsensitiveHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, mapObject(testContents, (key, content) => [`c:${key}`, content]));
|
||||
|
||||
const caseSensitiveBasePath = "/dev/";
|
||||
const caseSensitiveHost = new Utils.MockParseConfigHost(caseSensitiveBasePath, /*useCaseSensitiveFileNames*/ true, testContents);
|
||||
|
||||
function verifyDiagnostics(actual: Diagnostic[], expected: {code: number, category: DiagnosticCategory, messageText: string}[]) {
|
||||
assert.isTrue(expected.length === actual.length, `Expected error: ${JSON.stringify(expected)}. Actual error: ${JSON.stringify(actual)}.`);
|
||||
for (let i = 0; i < actual.length; i++) {
|
||||
const actualError = actual[i];
|
||||
const expectedError = expected[i];
|
||||
assert.equal(actualError.code, expectedError.code, "Error code mismatch");
|
||||
assert.equal(actualError.category, expectedError.category, "Category mismatch");
|
||||
assert.equal(flattenDiagnosticMessageText(actualError.messageText, "\n"), expectedError.messageText);
|
||||
}
|
||||
}
|
||||
|
||||
describe("Configuration Extension", () => {
|
||||
forEach<[string, string, Utils.MockParseConfigHost], void>([
|
||||
["under a case insensitive host", caseInsensitiveBasePath, caseInsensitiveHost],
|
||||
["under a case sensitive host", caseSensitiveBasePath, caseSensitiveHost]
|
||||
], ([testName, basePath, host]) => {
|
||||
function testSuccess(name: string, entry: string, expected: CompilerOptions, expectedFiles: string[]) {
|
||||
it(name, () => {
|
||||
const {config, error} = ts.readConfigFile(entry, name => host.readFile(name));
|
||||
assert(config && !error, flattenDiagnosticMessageText(error && error.messageText, "\n"));
|
||||
const parsed = ts.parseJsonConfigFileContent(config, host, basePath, {}, entry);
|
||||
assert(!parsed.errors.length, flattenDiagnosticMessageText(parsed.errors[0] && parsed.errors[0].messageText, "\n"));
|
||||
expected.configFilePath = entry;
|
||||
assert.deepEqual(parsed.options, expected);
|
||||
assert.deepEqual(parsed.fileNames, expectedFiles);
|
||||
});
|
||||
}
|
||||
|
||||
function testFailure(name: string, entry: string, expectedDiagnostics: {code: number, category: DiagnosticCategory, messageText: string}[]) {
|
||||
it(name, () => {
|
||||
const {config, error} = ts.readConfigFile(entry, name => host.readFile(name));
|
||||
assert(config && !error, flattenDiagnosticMessageText(error && error.messageText, "\n"));
|
||||
const parsed = ts.parseJsonConfigFileContent(config, host, basePath, {}, entry);
|
||||
verifyDiagnostics(parsed.errors, expectedDiagnostics);
|
||||
});
|
||||
}
|
||||
|
||||
describe(testName, () => {
|
||||
testSuccess("can resolve an extension with a base extension", "tsconfig.json", {
|
||||
allowJs: true,
|
||||
noImplicitAny: true,
|
||||
strictNullChecks: true,
|
||||
}, [
|
||||
combinePaths(basePath, "main.ts"),
|
||||
combinePaths(basePath, "supplemental.ts"),
|
||||
]);
|
||||
|
||||
testSuccess("can resolve an extension with a base extension that overrides options", "tsconfig.nostrictnull.json", {
|
||||
allowJs: true,
|
||||
noImplicitAny: true,
|
||||
strictNullChecks: false,
|
||||
}, [
|
||||
combinePaths(basePath, "main.ts"),
|
||||
combinePaths(basePath, "supplemental.ts"),
|
||||
]);
|
||||
|
||||
testFailure("can report errors on circular imports", "circular.json", [
|
||||
{
|
||||
code: 18000,
|
||||
category: DiagnosticCategory.Error,
|
||||
messageText: `Circularity detected while resolving configuration: ${[combinePaths(basePath, "circular.json"), combinePaths(basePath, "circular2.json"), combinePaths(basePath, "circular.json")].join(" -> ")}`
|
||||
}
|
||||
]);
|
||||
|
||||
testFailure("can report missing configurations", "missing.json", [{
|
||||
code: 6096,
|
||||
category: DiagnosticCategory.Message,
|
||||
messageText: `File './missing2' does not exist.`
|
||||
}]);
|
||||
|
||||
testFailure("can report errors in extended configs", "failure.json", [{
|
||||
code: 6114,
|
||||
category: DiagnosticCategory.Error,
|
||||
messageText: `Unknown option 'excludes'. Did you mean 'exclude'?`
|
||||
}]);
|
||||
|
||||
testFailure("can error when 'extends' is not a string", "extends.json", [{
|
||||
code: 5024,
|
||||
category: DiagnosticCategory.Error,
|
||||
messageText: `Compiler option 'extends' requires a value of type string.`
|
||||
}]);
|
||||
|
||||
testFailure("can error when 'extends' is neither relative nor rooted.", "extends2.json", [{
|
||||
code: 18001,
|
||||
category: DiagnosticCategory.Error,
|
||||
messageText: `The path in an 'extends' options must be relative or rooted.`
|
||||
}]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -10,9 +10,9 @@ namespace Utils {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
isDirectory() { return false; }
|
||||
isFile() { return false; }
|
||||
isFileSystem() { return false; }
|
||||
isDirectory(): this is VirtualDirectory { return false; }
|
||||
isFile(): this is VirtualFile { return false; }
|
||||
isFileSystem(): this is VirtualFileSystem { return false; }
|
||||
}
|
||||
|
||||
export class VirtualFile extends VirtualFileSystemEntry {
|
||||
@@ -82,9 +82,8 @@ namespace Utils {
|
||||
return file;
|
||||
}
|
||||
else if (entry.isFile()) {
|
||||
const file = <VirtualFile>entry;
|
||||
file.content = content;
|
||||
return file;
|
||||
entry.content = content;
|
||||
return entry;
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
@@ -196,10 +195,18 @@ namespace Utils {
|
||||
}
|
||||
|
||||
export class MockParseConfigHost extends VirtualFileSystem implements ts.ParseConfigHost {
|
||||
constructor(currentDirectory: string, ignoreCase: boolean, files: string[]) {
|
||||
constructor(currentDirectory: string, ignoreCase: boolean, files: ts.MapLike<string> | string[]) {
|
||||
super(currentDirectory, ignoreCase);
|
||||
for (const file of files) {
|
||||
this.addFile(file);
|
||||
const fileNames = (files instanceof Array) ? files : ts.getOwnKeys(files);
|
||||
for (const file of fileNames) {
|
||||
this.addFile(file, (files as any)[file]);
|
||||
}
|
||||
}
|
||||
|
||||
readFile(path: string): string {
|
||||
const value = this.traversePath(path);
|
||||
if (value && value.isFile()) {
|
||||
return value.content;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+20
-65
@@ -3949,12 +3949,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedCollatorOptions;
|
||||
}
|
||||
var Collator: {
|
||||
new (locales?: string[], options?: CollatorOptions): Collator;
|
||||
new (locale?: string, options?: CollatorOptions): Collator;
|
||||
(locales?: string[], options?: CollatorOptions): Collator;
|
||||
(locale?: string, options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
|
||||
new (locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
(locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];
|
||||
}
|
||||
|
||||
interface NumberFormatOptions {
|
||||
@@ -3989,12 +3986,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
|
||||
}
|
||||
|
||||
interface DateTimeFormatOptions {
|
||||
@@ -4035,88 +4029,49 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* Determines whether two strings are equivalent in the current or specified locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
|
||||
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
|
||||
localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;
|
||||
}
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
public getText(sourceFile?: SourceFile): string {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
if (!sourceFile) {
|
||||
sourceFile = this.getSourceFile();
|
||||
}
|
||||
return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());
|
||||
}
|
||||
|
||||
private addSyntheticNodes(nodes: Node[], pos: number, end: number, useJSDocScanner?: boolean): number {
|
||||
|
||||
@@ -3,7 +3,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(14,1): er
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(17,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): error TS2304: Cannot find name 'I'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/valuesAndReferences/assignments.ts (6 errors) ====
|
||||
@@ -49,4 +49,4 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): er
|
||||
interface I { }
|
||||
I = null; // Error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'I'.
|
||||
!!! error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
@@ -50,41 +50,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
var _this = this;
|
||||
function f0() {
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
//// [asyncAwaitWithCapturedBlockScopeVar.ts]
|
||||
async function fn1() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
}
|
||||
}
|
||||
|
||||
async function fn2() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn3() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn4(): Promise<number> {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [asyncAwaitWithCapturedBlockScopeVar.js]
|
||||
function fn1() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var ar, _loop_1, i;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
ar = [];
|
||||
_loop_1 = function (i) {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, 1];
|
||||
case 1:
|
||||
_a.sent();
|
||||
ar.push(function () { return i; });
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
};
|
||||
i = 0;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
if (!(i < 1))
|
||||
return [3 /*break*/, 4];
|
||||
return [5 /*yield**/, _loop_1(i)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
i++;
|
||||
return [3 /*break*/, 1];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function fn2() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var ar, _loop_2, i, state_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
ar = [];
|
||||
_loop_2 = function (i) {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, 1];
|
||||
case 1:
|
||||
_a.sent();
|
||||
ar.push(function () { return i; });
|
||||
return [2 /*return*/, "break"];
|
||||
}
|
||||
});
|
||||
};
|
||||
i = 0;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
if (!(i < 1))
|
||||
return [3 /*break*/, 4];
|
||||
return [5 /*yield**/, _loop_2(i)];
|
||||
case 2:
|
||||
state_1 = _a.sent();
|
||||
if (state_1 === "break")
|
||||
return [3 /*break*/, 4];
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
i++;
|
||||
return [3 /*break*/, 1];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function fn3() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var ar, _loop_3, i;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
ar = [];
|
||||
_loop_3 = function (i) {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, 1];
|
||||
case 1:
|
||||
_a.sent();
|
||||
ar.push(function () { return i; });
|
||||
return [2 /*return*/, "continue"];
|
||||
}
|
||||
});
|
||||
};
|
||||
i = 0;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
if (!(i < 1))
|
||||
return [3 /*break*/, 4];
|
||||
return [5 /*yield**/, _loop_3(i)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
i++;
|
||||
return [3 /*break*/, 1];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function fn4() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var ar, _loop_4, i, state_2;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
ar = [];
|
||||
_loop_4 = function (i) {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, 1];
|
||||
case 1:
|
||||
_a.sent();
|
||||
ar.push(function () { return i; });
|
||||
return [2 /*return*/, { value: 1 }];
|
||||
}
|
||||
});
|
||||
};
|
||||
i = 0;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
if (!(i < 1))
|
||||
return [3 /*break*/, 4];
|
||||
return [5 /*yield**/, _loop_4(i)];
|
||||
case 2:
|
||||
state_2 = _a.sent();
|
||||
if (typeof state_2 === "object")
|
||||
return [2 /*return*/, state_2.value];
|
||||
_a.label = 3;
|
||||
case 3:
|
||||
i++;
|
||||
return [3 /*break*/, 1];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
=== tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts ===
|
||||
async function fn1() {
|
||||
>fn1 : Symbol(fn1, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 0, 0))
|
||||
|
||||
let ar = [];
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 1, 7))
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12))
|
||||
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 1, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12))
|
||||
}
|
||||
}
|
||||
|
||||
async function fn2() {
|
||||
>fn2 : Symbol(fn2, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 6, 1))
|
||||
|
||||
let ar = [];
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 9, 7))
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12))
|
||||
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 9, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12))
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn3() {
|
||||
>fn3 : Symbol(fn3, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 15, 1))
|
||||
|
||||
let ar = [];
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 18, 7))
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12))
|
||||
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 18, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12))
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn4(): Promise<number> {
|
||||
>fn4 : Symbol(fn4, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 24, 1))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
|
||||
let ar = [];
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 27, 7))
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12))
|
||||
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 27, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||||
>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12))
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
=== tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts ===
|
||||
async function fn1() {
|
||||
>fn1 : () => Promise<void>
|
||||
|
||||
let ar = [];
|
||||
>ar : any[]
|
||||
>[] : undefined[]
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
>i : number
|
||||
>1 : 1
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
await 1;
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
|
||||
ar.push(() => i);
|
||||
>ar.push(() => i) : number
|
||||
>ar.push : (...items: any[]) => number
|
||||
>ar : any[]
|
||||
>push : (...items: any[]) => number
|
||||
>() => i : () => number
|
||||
>i : number
|
||||
}
|
||||
}
|
||||
|
||||
async function fn2() {
|
||||
>fn2 : () => Promise<void>
|
||||
|
||||
let ar = [];
|
||||
>ar : any[]
|
||||
>[] : undefined[]
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
>i : number
|
||||
>1 : 1
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
await 1;
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
|
||||
ar.push(() => i);
|
||||
>ar.push(() => i) : number
|
||||
>ar.push : (...items: any[]) => number
|
||||
>ar : any[]
|
||||
>push : (...items: any[]) => number
|
||||
>() => i : () => number
|
||||
>i : number
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn3() {
|
||||
>fn3 : () => Promise<void>
|
||||
|
||||
let ar = [];
|
||||
>ar : any[]
|
||||
>[] : undefined[]
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
>i : number
|
||||
>1 : 1
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
await 1;
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
|
||||
ar.push(() => i);
|
||||
>ar.push(() => i) : number
|
||||
>ar.push : (...items: any[]) => number
|
||||
>ar : any[]
|
||||
>push : (...items: any[]) => number
|
||||
>() => i : () => number
|
||||
>i : number
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn4(): Promise<number> {
|
||||
>fn4 : () => Promise<number>
|
||||
>Promise : Promise<T>
|
||||
|
||||
let ar = [];
|
||||
>ar : any[]
|
||||
>[] : undefined[]
|
||||
|
||||
for (let i = 0; i < 1; i++) {
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
>i : number
|
||||
>1 : 1
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
await 1;
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
|
||||
ar.push(() => i);
|
||||
>ar.push(() => i) : number
|
||||
>ar.push : (...items: any[]) => number
|
||||
>ar : any[]
|
||||
>push : (...items: any[]) => number
|
||||
>() => i : () => number
|
||||
>i : number
|
||||
|
||||
return 1;
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,41 +49,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
var _this = this;
|
||||
function f0() {
|
||||
|
||||
@@ -15,41 +15,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
var _this = this;
|
||||
(function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
|
||||
@@ -35,41 +35,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
var task_1 = require("./task");
|
||||
var Test = (function () {
|
||||
|
||||
@@ -15,41 +15,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
function f() {
|
||||
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/classExtendsInterfaceInExpression.ts(7,25): error TS2304: Cannot find name 'A'.
|
||||
tests/cases/compiler/classExtendsInterfaceInExpression.ts(7,25): error TS2693: 'A' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classExtendsInterfaceInExpression.ts (1 errors) ====
|
||||
@@ -10,5 +10,5 @@ tests/cases/compiler/classExtendsInterfaceInExpression.ts(7,25): error TS2304: C
|
||||
|
||||
class C extends factory(A) {}
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'A'.
|
||||
!!! error TS2693: 'A' only refers to a type, but is being used as a value here.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
tests/cases/compiler/errorsOnImportedSymbol_1.ts(2,13): error TS2304: Cannot find name 'Sammy'.
|
||||
tests/cases/compiler/errorsOnImportedSymbol_1.ts(3,9): error TS2304: Cannot find name 'Sammy'.
|
||||
tests/cases/compiler/errorsOnImportedSymbol_1.ts(2,13): error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/errorsOnImportedSymbol_1.ts(3,9): error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorsOnImportedSymbol_1.ts (2 errors) ====
|
||||
import Sammy = require("./errorsOnImportedSymbol_0");
|
||||
var x = new Sammy.Sammy();
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'Sammy'.
|
||||
!!! error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
var y = Sammy.Sammy();
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'Sammy'.
|
||||
!!! error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorsOnImportedSymbol_0.ts (0 errors) ====
|
||||
|
||||
@@ -18,41 +18,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
function empty() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
|
||||
@@ -38,41 +38,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f;
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;
|
||||
return { next: verb(0), "throw": verb(1), "return": verb(2) };
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (1) {
|
||||
if (_.done) switch (op[0]) {
|
||||
case 0: return { value: void 0, done: true };
|
||||
case 1: case 6: throw op[1];
|
||||
case 2: return { value: op[1], done: true };
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [0, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
try {
|
||||
switch (f = 1, op[0]) {
|
||||
case 0: case 1: sent = op; break;
|
||||
case 4: return _.label++, { value: op[1], done: false };
|
||||
case 7: op = _.stack.pop(), _.trys.pop(); continue;
|
||||
default:
|
||||
var r = _.trys.length > 0 && _.trys[_.trys.length - 1];
|
||||
if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; }
|
||||
if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; }
|
||||
if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; }
|
||||
if (r[2]) { _.stack.pop(); }
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
}
|
||||
catch (e) { op = [6, e]; }
|
||||
finally { f = 0, sent = void 0; }
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
return {
|
||||
next: function (v) { return step([0, v]); },
|
||||
"throw": function (v) { return step([1, v]); },
|
||||
"return": function (v) { return step([2, v]); }
|
||||
};
|
||||
};
|
||||
function foo() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/main.ts(15,1): error TS2304: Cannot find name 'z1'.
|
||||
tests/cases/compiler/main.ts(15,1): error TS2693: 'z1' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/main.ts(21,4): error TS2339: Property 'a' does not exist on type '() => any'.
|
||||
tests/cases/compiler/main.ts(23,4): error TS2339: Property 'a' does not exist on type 'typeof Foo'.
|
||||
tests/cases/compiler/main.ts(27,8): error TS1192: Module '"interface"' has no default export.
|
||||
@@ -49,7 +49,7 @@ tests/cases/compiler/main.ts(106,15): error TS2498: Module '"class-module"' uses
|
||||
|
||||
z1.a;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'z1'.
|
||||
!!! error TS2693: 'z1' only refers to a type, but is being used as a value here.
|
||||
z2.a;
|
||||
z3.a;
|
||||
z4.a;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(3,13): error TS2304: Cannot find name 'Sammy'.
|
||||
tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(4,9): error TS2304: Cannot find name 'Sammy'.
|
||||
tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(3,13): error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(4,9): error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts (2 errors) ====
|
||||
@@ -7,10 +7,10 @@ tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(4,9): error T
|
||||
import Sammy = require('./exportAssignmentOfDeclaredExternalModule_0');
|
||||
var x = new Sammy(); // error to use as constructor as there is not constructor symbol
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'Sammy'.
|
||||
!!! error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
var y = Sammy(); // error to use interface name as call target
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'Sammy'.
|
||||
!!! error TS2693: 'Sammy' only refers to a type, but is being used as a value here.
|
||||
var z: Sammy; // no error - z is of type interface Sammy from module 'M'
|
||||
var a = new z(); // constructor - no error
|
||||
var b = z(); // call signature - no error
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/genericConstructInvocationWithNoTypeArg.ts(4,27): error TS2304: Cannot find name 'Foo'.
|
||||
tests/cases/compiler/genericConstructInvocationWithNoTypeArg.ts(4,27): error TS2693: 'Foo' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericConstructInvocationWithNoTypeArg.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/compiler/genericConstructInvocationWithNoTypeArg.ts(4,27): error TS2
|
||||
}
|
||||
var f2: Foo<number> = new Foo(3);
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
!!! error TS2693: 'Foo' only refers to a type, but is being used as a value here.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/inheritFromGenericTypeParameter.ts(1,20): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/inheritFromGenericTypeParameter.ts(1,20): error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface may only extend a class or another interface.
|
||||
|
||||
|
||||
==== tests/cases/compiler/inheritFromGenericTypeParameter.ts (2 errors) ====
|
||||
class C<T> extends T { }
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
!!! error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
interface I<T> extends T { }
|
||||
~
|
||||
!!! error TS2312: An interface may only extend a class or another interface.
|
||||
@@ -10,7 +10,7 @@ tests/cases/compiler/intTypeCheck.ts(103,5): error TS2322: Type '() => void' is
|
||||
Property 'p' is missing in type '() => void'.
|
||||
tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'.
|
||||
tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'.
|
||||
tests/cases/compiler/intTypeCheck.ts(106,21): error TS2693: 'i1' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'.
|
||||
Type '{}' provides no match for the signature '(): any'
|
||||
@@ -21,7 +21,7 @@ tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not as
|
||||
Type 'Base' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(120,22): error TS2693: 'i2' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'.
|
||||
Type '{}' provides no match for the signature 'new (): any'
|
||||
@@ -33,12 +33,12 @@ tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2693: 'i3' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,22): error TS2304: Cannot find name 'i4'.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,22): error TS2693: 'i4' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(154,5): error TS2322: Type '{}' is not assignable to type 'i5'.
|
||||
Property 'p' is missing in type '{}'.
|
||||
@@ -51,7 +51,7 @@ tests/cases/compiler/intTypeCheck.ts(159,5): error TS2322: Type '() => void' is
|
||||
Property 'p' is missing in type '() => void'.
|
||||
tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'.
|
||||
tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'.
|
||||
tests/cases/compiler/intTypeCheck.ts(162,22): error TS2693: 'i5' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'.
|
||||
Type '{}' provides no match for the signature '(): any'
|
||||
@@ -64,7 +64,7 @@ tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is
|
||||
Type 'void' is not assignable to type 'number'.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,22): error TS2693: 'i6' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'.
|
||||
Type '{}' provides no match for the signature 'new (): any'
|
||||
@@ -76,12 +76,12 @@ tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2693: 'i7' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,22): error TS2304: Cannot find name 'i8'.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,22): error TS2693: 'i8' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i1'.
|
||||
!!! error TS2693: 'i1' only refers to a type, but is being used as a value here.
|
||||
var obj10: i1 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -247,7 +247,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i2'.
|
||||
!!! error TS2693: 'i2' only refers to a type, but is being used as a value here.
|
||||
var obj21: i2 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -281,7 +281,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i3'.
|
||||
!!! error TS2693: 'i3' only refers to a type, but is being used as a value here.
|
||||
var obj32: i3 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -305,7 +305,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i4'.
|
||||
!!! error TS2693: 'i4' only refers to a type, but is being used as a value here.
|
||||
var obj43: i4 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -341,7 +341,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i5'.
|
||||
!!! error TS2693: 'i5' only refers to a type, but is being used as a value here.
|
||||
var obj54: i5 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -377,7 +377,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i6'.
|
||||
!!! error TS2693: 'i6' only refers to a type, but is being used as a value here.
|
||||
var obj65: i6 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -411,7 +411,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i7'.
|
||||
!!! error TS2693: 'i7' only refers to a type, but is being used as a value here.
|
||||
var obj76: i7 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -435,7 +435,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'i8'.
|
||||
!!! error TS2693: 'i8' only refers to a type, but is being used as a value here.
|
||||
var obj87: i8 = new {};
|
||||
~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/interfaceNameAsIdentifier.ts(4,1): error TS2304: Cannot find name 'C'.
|
||||
tests/cases/compiler/interfaceNameAsIdentifier.ts(4,1): error TS2693: 'C' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/interfaceNameAsIdentifier.ts(12,1): error TS2304: Cannot find name 'm2'.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ tests/cases/compiler/interfaceNameAsIdentifier.ts(12,1): error TS2304: Cannot fi
|
||||
}
|
||||
C();
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'C'.
|
||||
!!! error TS2693: 'C' only refers to a type, but is being used as a value here.
|
||||
|
||||
module m2 {
|
||||
export interface C {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
tests/cases/compiler/interfaceNaming1.ts(1,1): error TS2304: Cannot find name 'interface'.
|
||||
tests/cases/compiler/interfaceNaming1.ts(1,1): error TS2693: 'interface' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/interfaceNaming1.ts(1,11): error TS1005: ';' expected.
|
||||
tests/cases/compiler/interfaceNaming1.ts(3,1): error TS2304: Cannot find name 'interface'.
|
||||
tests/cases/compiler/interfaceNaming1.ts(3,1): error TS2693: 'interface' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/interfaceNaming1.ts(3,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/interfaceNaming1.ts (4 errors) ====
|
||||
interface { }
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'interface'.
|
||||
!!! error TS2693: 'interface' only refers to a type, but is being used as a value here.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
interface interface{ }
|
||||
interface & { }
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'interface'.
|
||||
!!! error TS2693: 'interface' only refers to a type, but is being used as a value here.
|
||||
~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2503: Cannot find namespace 'V'.
|
||||
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2503: Cannot find namespace 'C'.
|
||||
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2503: Cannot find namespace 'I'.
|
||||
tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (3 errors) ====
|
||||
@@ -32,5 +32,5 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde
|
||||
|
||||
import i = I;
|
||||
~
|
||||
!!! error TS2503: Cannot find namespace 'I'.
|
||||
!!! error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(4,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(9,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(14,1): error TS2304: Cannot find name 'I'.
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(14,1): error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(17,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
@@ -28,7 +28,7 @@ tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.t
|
||||
g = x;
|
||||
I = x;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'I'.
|
||||
!!! error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
|
||||
module M { export var x = 1; }
|
||||
M = x;
|
||||
|
||||
@@ -30,25 +30,25 @@ Date.prototype.toTimeString();
|
||||
>toTimeString : Symbol(Date.toTimeString, Decl(lib.d.ts, --, --))
|
||||
|
||||
Date.prototype.toLocaleString();
|
||||
>Date.prototype.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Date.prototype.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
Date.prototype.toLocaleDateString();
|
||||
>Date.prototype.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Date.prototype.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
Date.prototype.toLocaleTimeString();
|
||||
>Date.prototype.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Date.prototype.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
Date.prototype.valueOf();
|
||||
>Date.prototype.valueOf : Symbol(Date.valueOf, Decl(lib.d.ts, --, --))
|
||||
|
||||
@@ -34,27 +34,27 @@ Date.prototype.toTimeString();
|
||||
|
||||
Date.prototype.toLocaleString();
|
||||
>Date.prototype.toLocaleString() : string
|
||||
>Date.prototype.toLocaleString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; }
|
||||
>Date.prototype.toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; }
|
||||
>Date.prototype : Date
|
||||
>Date : DateConstructor
|
||||
>prototype : Date
|
||||
>toLocaleString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; }
|
||||
>toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; }
|
||||
|
||||
Date.prototype.toLocaleDateString();
|
||||
>Date.prototype.toLocaleDateString() : string
|
||||
>Date.prototype.toLocaleDateString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; }
|
||||
>Date.prototype.toLocaleDateString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; }
|
||||
>Date.prototype : Date
|
||||
>Date : DateConstructor
|
||||
>prototype : Date
|
||||
>toLocaleDateString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; }
|
||||
>toLocaleDateString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; }
|
||||
|
||||
Date.prototype.toLocaleTimeString();
|
||||
>Date.prototype.toLocaleTimeString() : string
|
||||
>Date.prototype.toLocaleTimeString : { (): string; (locale?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; }
|
||||
>Date.prototype.toLocaleTimeString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; }
|
||||
>Date.prototype : Date
|
||||
>Date : DateConstructor
|
||||
>prototype : Date
|
||||
>toLocaleTimeString : { (): string; (locale?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; }
|
||||
>toLocaleTimeString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; }
|
||||
|
||||
Date.prototype.valueOf();
|
||||
>Date.prototype.valueOf() : number
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
error TS2318: Cannot find global type 'Boolean'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'Number'.
|
||||
tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts(4,12): error TS2304: Cannot find name 'Array'.
|
||||
tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts(4,12): error TS2693: 'Array' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'Boolean'.
|
||||
@@ -13,7 +13,7 @@ tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib
|
||||
function f(x: number, y: number, z: number) {
|
||||
return Array.from(arguments);
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'Array'.
|
||||
!!! error TS2693: 'Array' only refers to a type, but is being used as a value here.
|
||||
}
|
||||
|
||||
f(1, 2, 3);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/newOperator.ts(3,13): error TS2304: Cannot find name 'ifc'.
|
||||
tests/cases/compiler/newOperator.ts(3,13): error TS2693: 'ifc' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/newOperator.ts(10,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/newOperator.ts(11,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/newOperator.ts(12,5): error TS2304: Cannot find name 'string'.
|
||||
@@ -17,7 +17,7 @@ tests/cases/compiler/newOperator.ts(45,23): error TS1150: 'new T[]' cannot be us
|
||||
// Attempting to 'new' an interface yields poor error
|
||||
var i = new ifc();
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'ifc'.
|
||||
!!! error TS2693: 'ifc' only refers to a type, but is being used as a value here.
|
||||
|
||||
// Parens are optional
|
||||
var x = new Date;
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(5,6): error
|
||||
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,1): error TS2304: Cannot find name 'type'.
|
||||
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,6): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,11): error TS1109: Expression expected.
|
||||
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error TS2304: Cannot find name 'I'.
|
||||
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts (8 errors) ====
|
||||
@@ -30,4 +30,4 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'I'.
|
||||
!!! error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/returnTypeParameter.ts(1,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/compiler/returnTypeParameter.ts(2,34): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/returnTypeParameter.ts(2,34): error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/returnTypeParameter.ts (2 errors) ====
|
||||
@@ -8,4 +8,4 @@ tests/cases/compiler/returnTypeParameter.ts(2,34): error TS2304: Cannot find nam
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
function f2<T>(a: T): T { return T; } // bug was that this satisfied the return statement requirement
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
!!! error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
@@ -16,9 +16,9 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,9): error TS
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(23,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2503: Cannot find namespace 'public'.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2693: 'public' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2503: Cannot find namespace 'public'.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2693: 'public' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS2304: Cannot find name 'package'.
|
||||
tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
@@ -88,12 +88,12 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T
|
||||
~~~~~~
|
||||
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'public'.
|
||||
!!! error TS2693: 'public' only refers to a type, but is being used as a value here.
|
||||
class F1 implements public.private.implements { }
|
||||
~~~~~~
|
||||
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'public'.
|
||||
!!! error TS2693: 'public' only refers to a type, but is being used as a value here.
|
||||
class G extends package { }
|
||||
~~~~~~~
|
||||
!!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
|
||||
@@ -5,14 +5,20 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(41,10): error TS2339: Property 'bar' does not exist on type 'B<any>'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(72,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'.
|
||||
Property 'bar1' does not exist on type 'C2'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(73,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'.
|
||||
Property 'bar2' does not exist on type 'C1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(91,10): error TS2339: Property 'bar' does not exist on type 'D'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(118,11): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'.
|
||||
Property 'bar1' does not exist on type 'E2'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(119,11): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'.
|
||||
Property 'bar2' does not exist on type 'E1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'.
|
||||
Property 'foo' does not exist on type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'.
|
||||
Property 'bar' does not exist on type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(166,11): error TS2339: Property 'foo2' does not exist on type 'G1'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'.
|
||||
@@ -107,9 +113,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
|
||||
obj6.bar1;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar1' does not exist on type 'C1 | C2'.
|
||||
!!! error TS2339: Property 'bar1' does not exist on type 'C2'.
|
||||
obj6.bar2;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar2' does not exist on type 'C1 | C2'.
|
||||
!!! error TS2339: Property 'bar2' does not exist on type 'C1'.
|
||||
}
|
||||
|
||||
// with object type literal
|
||||
@@ -163,9 +171,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
|
||||
obj10.bar1;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar1' does not exist on type 'E1 | E2'.
|
||||
!!! error TS2339: Property 'bar1' does not exist on type 'E2'.
|
||||
obj10.bar2;
|
||||
~~~~
|
||||
!!! error TS2339: Property 'bar2' does not exist on type 'E1 | E2'.
|
||||
!!! error TS2339: Property 'bar2' does not exist on type 'E1'.
|
||||
}
|
||||
|
||||
// a construct signature that returns any
|
||||
@@ -183,9 +193,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
|
||||
obj11.foo;
|
||||
~~~
|
||||
!!! error TS2339: Property 'foo' does not exist on type 'string | F'.
|
||||
!!! error TS2339: Property 'foo' does not exist on type 'string'.
|
||||
obj11.bar;
|
||||
~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'string | F'.
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'string'.
|
||||
}
|
||||
|
||||
var obj12: any;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/typeParameterAsBaseClass.ts(1,20): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/typeParameterAsBaseClass.ts(1,20): error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class may only implement another class or interface.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeParameterAsBaseClass.ts (2 errors) ====
|
||||
class C<T> extends T {}
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
!!! error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
class C2<T> implements T {}
|
||||
~
|
||||
!!! error TS2422: A class may only implement another class or interface.
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(4,20): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(5,24): error TS2304: Cannot find name 'U'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(4,20): error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(5,24): error TS2693: 'U' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface may only extend a class or another interface.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface may only extend a class or another interface.
|
||||
|
||||
@@ -10,10 +10,10 @@ tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): e
|
||||
|
||||
class C<T> extends T { }
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
!!! error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
class C2<T, U> extends U { }
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'U'.
|
||||
!!! error TS2693: 'U' only refers to a type, but is being used as a value here.
|
||||
|
||||
interface I<T> extends T { }
|
||||
~
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(16,11): error TS2693: 'Interface' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(17,11): error TS2304: Cannot find name 'InterfaceNotFound'.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(18,13): error TS2693: 'TypeAliasForSomeClass' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(19,16): error TS2693: 'TypeAliasForSomeClass' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(20,16): error TS2304: Cannot find name 'TypeAliasForSomeClassNotFound'.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(21,11): error TS2693: 'someType' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(22,17): error TS2693: 'someType' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/typeUsedAsValueError.ts(23,17): error TS2304: Cannot find name 'someTypeNotFound'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeUsedAsValueError.ts (8 errors) ====
|
||||
interface Interface {
|
||||
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
|
||||
}
|
||||
|
||||
type TypeAliasForSomeClass = SomeClass;
|
||||
type someType = { x: number };
|
||||
|
||||
function acceptsSomeType(a: someType) {
|
||||
|
||||
}
|
||||
|
||||
let one = Interface;
|
||||
~~~~~~~~~
|
||||
!!! error TS2693: 'Interface' only refers to a type, but is being used as a value here.
|
||||
let two = InterfaceNotFound;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'InterfaceNotFound'.
|
||||
let three = TypeAliasForSomeClass;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2693: 'TypeAliasForSomeClass' only refers to a type, but is being used as a value here.
|
||||
let four = new TypeAliasForSomeClass();
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2693: 'TypeAliasForSomeClass' only refers to a type, but is being used as a value here.
|
||||
let five = new TypeAliasForSomeClassNotFound();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'TypeAliasForSomeClassNotFound'.
|
||||
let six = someType;
|
||||
~~~~~~~~
|
||||
!!! error TS2693: 'someType' only refers to a type, but is being used as a value here.
|
||||
acceptsSomeType(someType);
|
||||
~~~~~~~~
|
||||
!!! error TS2693: 'someType' only refers to a type, but is being used as a value here.
|
||||
acceptsSomeType(someTypeNotFound);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'someTypeNotFound'.
|
||||
@@ -0,0 +1,41 @@
|
||||
//// [typeUsedAsValueError.ts]
|
||||
interface Interface {
|
||||
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
|
||||
}
|
||||
|
||||
type TypeAliasForSomeClass = SomeClass;
|
||||
type someType = { x: number };
|
||||
|
||||
function acceptsSomeType(a: someType) {
|
||||
|
||||
}
|
||||
|
||||
let one = Interface;
|
||||
let two = InterfaceNotFound;
|
||||
let three = TypeAliasForSomeClass;
|
||||
let four = new TypeAliasForSomeClass();
|
||||
let five = new TypeAliasForSomeClassNotFound();
|
||||
let six = someType;
|
||||
acceptsSomeType(someType);
|
||||
acceptsSomeType(someTypeNotFound);
|
||||
|
||||
//// [typeUsedAsValueError.js]
|
||||
var SomeClass = (function () {
|
||||
function SomeClass() {
|
||||
}
|
||||
return SomeClass;
|
||||
}());
|
||||
function acceptsSomeType(a) {
|
||||
}
|
||||
var one = Interface;
|
||||
var two = InterfaceNotFound;
|
||||
var three = TypeAliasForSomeClass;
|
||||
var four = new TypeAliasForSomeClass();
|
||||
var five = new TypeAliasForSomeClassNotFound();
|
||||
var six = someType;
|
||||
acceptsSomeType(someType);
|
||||
acceptsSomeType(someTypeNotFound);
|
||||
@@ -0,0 +1,28 @@
|
||||
tests/cases/compiler/world.ts(4,1): error TS2693: 'HelloInterface' only refers to a type, but is being used as a value here.
|
||||
tests/cases/compiler/world.ts(5,1): error TS2304: Cannot find name 'HelloNamespace'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/world.ts (2 errors) ====
|
||||
import HelloInterface = require("helloInterface");
|
||||
import HelloNamespace = require("helloNamespace");
|
||||
|
||||
HelloInterface.world;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2693: 'HelloInterface' only refers to a type, but is being used as a value here.
|
||||
HelloNamespace.world;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'HelloNamespace'.
|
||||
==== tests/cases/compiler/helloInterface.ts (0 errors) ====
|
||||
interface HelloInterface {
|
||||
world: any;
|
||||
}
|
||||
|
||||
export = HelloInterface;
|
||||
|
||||
==== tests/cases/compiler/helloNamespace.ts (0 errors) ====
|
||||
namespace HelloNamespace {
|
||||
export type world = any;
|
||||
}
|
||||
|
||||
export = HelloNamespace;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//// [tests/cases/compiler/typeUsedAsValueError2.ts] ////
|
||||
|
||||
//// [helloInterface.ts]
|
||||
interface HelloInterface {
|
||||
world: any;
|
||||
}
|
||||
|
||||
export = HelloInterface;
|
||||
|
||||
//// [helloNamespace.ts]
|
||||
namespace HelloNamespace {
|
||||
export type world = any;
|
||||
}
|
||||
|
||||
export = HelloNamespace;
|
||||
|
||||
//// [world.ts]
|
||||
import HelloInterface = require("helloInterface");
|
||||
import HelloNamespace = require("helloNamespace");
|
||||
|
||||
HelloInterface.world;
|
||||
HelloNamespace.world;
|
||||
|
||||
//// [helloInterface.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
//// [helloNamespace.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
});
|
||||
//// [world.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
HelloInterface.world;
|
||||
HelloNamespace.world;
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/typeofSimple.ts(3,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/typeofSimple.ts(8,21): error TS2304: Cannot find name 'J'.
|
||||
tests/cases/compiler/typeofSimple.ts(8,21): error TS2693: 'J' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeofSimple.ts (2 errors) ====
|
||||
@@ -14,7 +14,7 @@ tests/cases/compiler/typeofSimple.ts(8,21): error TS2304: Cannot find name 'J'.
|
||||
|
||||
var numberJ: typeof J; //Error, cannot reference type in typeof
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'J'.
|
||||
!!! error TS2693: 'J' only refers to a type, but is being used as a value here.
|
||||
var numberI: I<typeof v2>;
|
||||
|
||||
var fun: () => I<number>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofTypeParameter.ts(3,19): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofTypeParameter.ts(3,19): error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofTypeParameter.ts (1 errors) ====
|
||||
@@ -6,6 +6,6 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofTypeParameter.ts
|
||||
var a: typeof x;
|
||||
var y: typeof T;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
!!! error TS2693: 'T' only refers to a type, but is being used as a value here.
|
||||
return a;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
tests/cases/compiler/unionPropertyExistence.ts(27,3): error TS2339: Property 'nope' does not exist on type '"foo" | "bar"'.
|
||||
Property 'nope' does not exist on type '"foo"'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(28,6): error TS2339: Property 'onlyInB' does not exist on type 'B | "foo"'.
|
||||
Property 'onlyInB' does not exist on type '"foo"'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(30,6): error TS2339: Property 'length' does not exist on type 'B | "foo"'.
|
||||
Property 'length' does not exist on type 'B'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(32,4): error TS2339: Property 'onlyInB' does not exist on type 'AB'.
|
||||
Property 'onlyInB' does not exist on type 'A'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(35,5): error TS2339: Property 'notInC' does not exist on type 'ABC'.
|
||||
Property 'notInC' does not exist on type 'C'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(36,4): error TS2339: Property 'notInB' does not exist on type 'AB'.
|
||||
Property 'notInB' does not exist on type 'B'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(37,5): error TS2339: Property 'notInB' does not exist on type 'ABC'.
|
||||
Property 'notInB' does not exist on type 'B'.
|
||||
tests/cases/compiler/unionPropertyExistence.ts(40,5): error TS2339: Property 'inNone' does not exist on type 'ABC'.
|
||||
Property 'inNone' does not exist on type 'A'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/unionPropertyExistence.ts (8 errors) ====
|
||||
interface A {
|
||||
inAll: string;
|
||||
notInB: string;
|
||||
notInC: string;
|
||||
}
|
||||
|
||||
interface B {
|
||||
inAll: boolean;
|
||||
onlyInB: number;
|
||||
notInC: string;
|
||||
}
|
||||
|
||||
interface C {
|
||||
inAll: number;
|
||||
notInB: string;
|
||||
}
|
||||
|
||||
type AB = A | B;
|
||||
type ABC = C | AB;
|
||||
|
||||
var ab: AB;
|
||||
var abc: ABC;
|
||||
|
||||
declare const x: "foo" | "bar";
|
||||
declare const bFoo: B | "foo";
|
||||
|
||||
x.nope();
|
||||
~~~~
|
||||
!!! error TS2339: Property 'nope' does not exist on type '"foo" | "bar"'.
|
||||
!!! error TS2339: Property 'nope' does not exist on type '"foo"'.
|
||||
bFoo.onlyInB;
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'onlyInB' does not exist on type 'B | "foo"'.
|
||||
!!! error TS2339: Property 'onlyInB' does not exist on type '"foo"'.
|
||||
x.length; // Ok
|
||||
bFoo.length;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'length' does not exist on type 'B | "foo"'.
|
||||
!!! error TS2339: Property 'length' does not exist on type 'B'.
|
||||
|
||||
ab.onlyInB;
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'onlyInB' does not exist on type 'AB'.
|
||||
!!! error TS2339: Property 'onlyInB' does not exist on type 'A'.
|
||||
|
||||
ab.notInC; // Ok
|
||||
abc.notInC;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'notInC' does not exist on type 'ABC'.
|
||||
!!! error TS2339: Property 'notInC' does not exist on type 'C'.
|
||||
ab.notInB;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'notInB' does not exist on type 'AB'.
|
||||
!!! error TS2339: Property 'notInB' does not exist on type 'B'.
|
||||
abc.notInB;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'notInB' does not exist on type 'ABC'.
|
||||
!!! error TS2339: Property 'notInB' does not exist on type 'B'.
|
||||
|
||||
abc.inAll; // Ok
|
||||
abc.inNone;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'inNone' does not exist on type 'ABC'.
|
||||
!!! error TS2339: Property 'inNone' does not exist on type 'A'.
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//// [unionPropertyExistence.ts]
|
||||
interface A {
|
||||
inAll: string;
|
||||
notInB: string;
|
||||
notInC: string;
|
||||
}
|
||||
|
||||
interface B {
|
||||
inAll: boolean;
|
||||
onlyInB: number;
|
||||
notInC: string;
|
||||
}
|
||||
|
||||
interface C {
|
||||
inAll: number;
|
||||
notInB: string;
|
||||
}
|
||||
|
||||
type AB = A | B;
|
||||
type ABC = C | AB;
|
||||
|
||||
var ab: AB;
|
||||
var abc: ABC;
|
||||
|
||||
declare const x: "foo" | "bar";
|
||||
declare const bFoo: B | "foo";
|
||||
|
||||
x.nope();
|
||||
bFoo.onlyInB;
|
||||
x.length; // Ok
|
||||
bFoo.length;
|
||||
|
||||
ab.onlyInB;
|
||||
|
||||
ab.notInC; // Ok
|
||||
abc.notInC;
|
||||
ab.notInB;
|
||||
abc.notInB;
|
||||
|
||||
abc.inAll; // Ok
|
||||
abc.inNone;
|
||||
|
||||
|
||||
//// [unionPropertyExistence.js]
|
||||
var ab;
|
||||
var abc;
|
||||
x.nope();
|
||||
bFoo.onlyInB;
|
||||
x.length; // Ok
|
||||
bFoo.length;
|
||||
ab.onlyInB;
|
||||
ab.notInC; // Ok
|
||||
abc.notInC;
|
||||
ab.notInB;
|
||||
abc.notInB;
|
||||
abc.inAll; // Ok
|
||||
abc.inNone;
|
||||
@@ -1,8 +1,12 @@
|
||||
tests/cases/conformance/types/union/unionTypeMembers.ts(44,1): error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
tests/cases/conformance/types/union/unionTypeMembers.ts(51,3): error TS2339: Property 'propertyOnlyInI1' does not exist on type 'I1<number> | I2<number>'.
|
||||
Property 'propertyOnlyInI1' does not exist on type 'I2<number>'.
|
||||
tests/cases/conformance/types/union/unionTypeMembers.ts(52,3): error TS2339: Property 'propertyOnlyInI2' does not exist on type 'I1<number> | I2<number>'.
|
||||
Property 'propertyOnlyInI2' does not exist on type 'I1<number>'.
|
||||
tests/cases/conformance/types/union/unionTypeMembers.ts(53,3): error TS2339: Property 'methodOnlyInI1' does not exist on type 'I1<number> | I2<number>'.
|
||||
Property 'methodOnlyInI1' does not exist on type 'I2<number>'.
|
||||
tests/cases/conformance/types/union/unionTypeMembers.ts(54,3): error TS2339: Property 'methodOnlyInI2' does not exist on type 'I1<number> | I2<number>'.
|
||||
Property 'methodOnlyInI2' does not exist on type 'I1<number>'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/union/unionTypeMembers.ts (5 errors) ====
|
||||
@@ -61,12 +65,16 @@ tests/cases/conformance/types/union/unionTypeMembers.ts(54,3): error TS2339: Pro
|
||||
x.propertyOnlyInI1; // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'propertyOnlyInI1' does not exist on type 'I1<number> | I2<number>'.
|
||||
!!! error TS2339: Property 'propertyOnlyInI1' does not exist on type 'I2<number>'.
|
||||
x.propertyOnlyInI2; // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'propertyOnlyInI2' does not exist on type 'I1<number> | I2<number>'.
|
||||
!!! error TS2339: Property 'propertyOnlyInI2' does not exist on type 'I1<number>'.
|
||||
x.methodOnlyInI1("hello"); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'methodOnlyInI1' does not exist on type 'I1<number> | I2<number>'.
|
||||
!!! error TS2339: Property 'methodOnlyInI1' does not exist on type 'I2<number>'.
|
||||
x.methodOnlyInI2(10); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'methodOnlyInI2' does not exist on type 'I1<number> | I2<number>'.
|
||||
!!! error TS2339: Property 'methodOnlyInI2' does not exist on type 'I1<number> | I2<number>'.
|
||||
!!! error TS2339: Property 'methodOnlyInI2' does not exist on type 'I1<number>'.
|
||||
@@ -3,6 +3,7 @@ tests/cases/conformance/types/union/unionTypeReadonly.ts(19,1): error TS2450: Le
|
||||
tests/cases/conformance/types/union/unionTypeReadonly.ts(21,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
tests/cases/conformance/types/union/unionTypeReadonly.ts(23,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
tests/cases/conformance/types/union/unionTypeReadonly.ts(25,15): error TS2339: Property 'value' does not exist on type 'Base | DifferentName'.
|
||||
Property 'value' does not exist on type 'DifferentName'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/union/unionTypeReadonly.ts (5 errors) ====
|
||||
@@ -41,5 +42,6 @@ tests/cases/conformance/types/union/unionTypeReadonly.ts(25,15): error TS2339: P
|
||||
differentName.value = 12; // error, property 'value' doesn't exist
|
||||
~~~~~
|
||||
!!! error TS2339: Property 'value' does not exist on type 'Base | DifferentName'.
|
||||
!!! error TS2339: Property 'value' does not exist on type 'DifferentName'.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
|
||||
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(15,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(20,1): error TS2304: Cannot find name 'I'.
|
||||
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(20,1): error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/null/validNullAssignments.ts(30,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/types/primitives/null/validNullAssignments.ts(30,1): err
|
||||
g = null; // ok
|
||||
I = null; // error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'I'.
|
||||
!!! error TS2693: 'I' only refers to a type, but is being used as a value here.
|
||||
|
||||
module M { export var x = 1; }
|
||||
M = null; // error
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// @target: es5
|
||||
// @lib: es6
|
||||
// @noEmitHelpers: true
|
||||
async function fn1() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
}
|
||||
}
|
||||
|
||||
async function fn2() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn3() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn4(): Promise<number> {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
interface Interface {
|
||||
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
|
||||
}
|
||||
|
||||
type TypeAliasForSomeClass = SomeClass;
|
||||
type someType = { x: number };
|
||||
|
||||
function acceptsSomeType(a: someType) {
|
||||
|
||||
}
|
||||
|
||||
let one = Interface;
|
||||
let two = InterfaceNotFound;
|
||||
let three = TypeAliasForSomeClass;
|
||||
let four = new TypeAliasForSomeClass();
|
||||
let five = new TypeAliasForSomeClassNotFound();
|
||||
let six = someType;
|
||||
acceptsSomeType(someType);
|
||||
acceptsSomeType(someTypeNotFound);
|
||||
@@ -0,0 +1,21 @@
|
||||
// @module: amd
|
||||
// @filename: helloInterface.ts
|
||||
interface HelloInterface {
|
||||
world: any;
|
||||
}
|
||||
|
||||
export = HelloInterface;
|
||||
|
||||
// @filename: helloNamespace.ts
|
||||
namespace HelloNamespace {
|
||||
export type world = any;
|
||||
}
|
||||
|
||||
export = HelloNamespace;
|
||||
|
||||
// @filename: world.ts
|
||||
import HelloInterface = require("helloInterface");
|
||||
import HelloNamespace = require("helloNamespace");
|
||||
|
||||
HelloInterface.world;
|
||||
HelloNamespace.world;
|
||||
@@ -0,0 +1,40 @@
|
||||
interface A {
|
||||
inAll: string;
|
||||
notInB: string;
|
||||
notInC: string;
|
||||
}
|
||||
|
||||
interface B {
|
||||
inAll: boolean;
|
||||
onlyInB: number;
|
||||
notInC: string;
|
||||
}
|
||||
|
||||
interface C {
|
||||
inAll: number;
|
||||
notInB: string;
|
||||
}
|
||||
|
||||
type AB = A | B;
|
||||
type ABC = C | AB;
|
||||
|
||||
var ab: AB;
|
||||
var abc: ABC;
|
||||
|
||||
declare const x: "foo" | "bar";
|
||||
declare const bFoo: B | "foo";
|
||||
|
||||
x.nope();
|
||||
bFoo.onlyInB;
|
||||
x.length; // Ok
|
||||
bFoo.length;
|
||||
|
||||
ab.onlyInB;
|
||||
|
||||
ab.notInC; // Ok
|
||||
abc.notInC;
|
||||
ab.notInB;
|
||||
abc.notInB;
|
||||
|
||||
abc.inAll; // Ok
|
||||
abc.inNone;
|
||||
Reference in New Issue
Block a user