mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Merge branch 'master' into fixUnionReduction
Conflicts: tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts
This commit is contained in:
commit
a8732d756a
@ -24992,7 +24992,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
|
||||
@ -25376,7 +25376,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@ -31202,8 +31202,9 @@ var ts;
|
||||
})();
|
||||
ts.CancellationTokenObject = CancellationTokenObject;
|
||||
var HostCache = (function () {
|
||||
function HostCache(host) {
|
||||
function HostCache(host, getCanonicalFileName) {
|
||||
this.host = host;
|
||||
this.getCanonicalFileName = getCanonicalFileName;
|
||||
this.fileNameToEntry = {};
|
||||
var rootFileNames = host.getScriptFileNames();
|
||||
for (var _i = 0; _i < rootFileNames.length; _i++) {
|
||||
@ -31215,6 +31216,9 @@ var ts;
|
||||
HostCache.prototype.compilationSettings = function () {
|
||||
return this._compilationSettings;
|
||||
};
|
||||
HostCache.prototype.normalizeFileName = function (fileName) {
|
||||
return this.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
};
|
||||
HostCache.prototype.createEntry = function (fileName) {
|
||||
var entry;
|
||||
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@ -31225,13 +31229,13 @@ var ts;
|
||||
scriptSnapshot: scriptSnapshot
|
||||
};
|
||||
}
|
||||
return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
};
|
||||
HostCache.prototype.getEntry = function (fileName) {
|
||||
return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.contains = function (fileName) {
|
||||
return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.getOrCreateEntry = function (fileName) {
|
||||
if (this.contains(fileName)) {
|
||||
@ -31243,8 +31247,10 @@ var ts;
|
||||
var _this = this;
|
||||
var fileNames = [];
|
||||
ts.forEachKey(this.fileNameToEntry, function (key) {
|
||||
if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
var entry = _this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
return fileNames;
|
||||
};
|
||||
@ -31774,7 +31780,7 @@ var ts;
|
||||
return ruleProvider;
|
||||
}
|
||||
function synchronizeHostData() {
|
||||
var hostCache = new HostCache(host);
|
||||
var hostCache = new HostCache(host, getCanonicalFileName);
|
||||
if (programUpToDate()) {
|
||||
return;
|
||||
}
|
||||
@ -31784,7 +31790,7 @@ var ts;
|
||||
var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: function () { return cancellationToken; },
|
||||
getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); },
|
||||
getCanonicalFileName: getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
|
||||
getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; },
|
||||
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
||||
|
||||
@ -29571,7 +29571,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@ -36487,8 +36487,9 @@ var ts;
|
||||
// at each language service public entry point, since we don't know when
|
||||
// set of scripts handled by the host changes.
|
||||
var HostCache = (function () {
|
||||
function HostCache(host) {
|
||||
function HostCache(host, getCanonicalFileName) {
|
||||
this.host = host;
|
||||
this.getCanonicalFileName = getCanonicalFileName;
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
// Initialize the list with the root file names
|
||||
@ -36503,6 +36504,9 @@ var ts;
|
||||
HostCache.prototype.compilationSettings = function () {
|
||||
return this._compilationSettings;
|
||||
};
|
||||
HostCache.prototype.normalizeFileName = function (fileName) {
|
||||
return this.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
};
|
||||
HostCache.prototype.createEntry = function (fileName) {
|
||||
var entry;
|
||||
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@ -36513,13 +36517,13 @@ var ts;
|
||||
scriptSnapshot: scriptSnapshot
|
||||
};
|
||||
}
|
||||
return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
};
|
||||
HostCache.prototype.getEntry = function (fileName) {
|
||||
return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.contains = function (fileName) {
|
||||
return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.getOrCreateEntry = function (fileName) {
|
||||
if (this.contains(fileName)) {
|
||||
@ -36531,8 +36535,10 @@ var ts;
|
||||
var _this = this;
|
||||
var fileNames = [];
|
||||
ts.forEachKey(this.fileNameToEntry, function (key) {
|
||||
if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
var entry = _this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
return fileNames;
|
||||
};
|
||||
@ -37151,7 +37157,7 @@ var ts;
|
||||
}
|
||||
function synchronizeHostData() {
|
||||
// Get a fresh cache of the host information
|
||||
var hostCache = new HostCache(host);
|
||||
var hostCache = new HostCache(host, getCanonicalFileName);
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
return;
|
||||
@ -37168,7 +37174,7 @@ var ts;
|
||||
var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: function () { return cancellationToken; },
|
||||
getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); },
|
||||
getCanonicalFileName: getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
|
||||
getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; },
|
||||
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
||||
|
||||
@ -29571,7 +29571,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@ -36487,8 +36487,9 @@ var ts;
|
||||
// at each language service public entry point, since we don't know when
|
||||
// set of scripts handled by the host changes.
|
||||
var HostCache = (function () {
|
||||
function HostCache(host) {
|
||||
function HostCache(host, getCanonicalFileName) {
|
||||
this.host = host;
|
||||
this.getCanonicalFileName = getCanonicalFileName;
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
// Initialize the list with the root file names
|
||||
@ -36503,6 +36504,9 @@ var ts;
|
||||
HostCache.prototype.compilationSettings = function () {
|
||||
return this._compilationSettings;
|
||||
};
|
||||
HostCache.prototype.normalizeFileName = function (fileName) {
|
||||
return this.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
};
|
||||
HostCache.prototype.createEntry = function (fileName) {
|
||||
var entry;
|
||||
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@ -36513,13 +36517,13 @@ var ts;
|
||||
scriptSnapshot: scriptSnapshot
|
||||
};
|
||||
}
|
||||
return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
};
|
||||
HostCache.prototype.getEntry = function (fileName) {
|
||||
return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.contains = function (fileName) {
|
||||
return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
};
|
||||
HostCache.prototype.getOrCreateEntry = function (fileName) {
|
||||
if (this.contains(fileName)) {
|
||||
@ -36531,8 +36535,10 @@ var ts;
|
||||
var _this = this;
|
||||
var fileNames = [];
|
||||
ts.forEachKey(this.fileNameToEntry, function (key) {
|
||||
if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
var entry = _this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
return fileNames;
|
||||
};
|
||||
@ -37151,7 +37157,7 @@ var ts;
|
||||
}
|
||||
function synchronizeHostData() {
|
||||
// Get a fresh cache of the host information
|
||||
var hostCache = new HostCache(host);
|
||||
var hostCache = new HostCache(host, getCanonicalFileName);
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
return;
|
||||
@ -37168,7 +37174,7 @@ var ts;
|
||||
var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: function () { return cancellationToken; },
|
||||
getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); },
|
||||
getCanonicalFileName: getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },
|
||||
getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; },
|
||||
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.2",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
|
||||
@ -3567,7 +3567,19 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Since removeSubtypes checks the subtype relation, and the subtype relation on a union
|
||||
// may attempt to reduce a union, it is possible that removeSubtypes could be called
|
||||
// recursively on the same set of types. The removeSubtypesStack is used to track which
|
||||
// sets of types are currently undergoing subtype reduction.
|
||||
let removeSubtypesStack: string[] = [];
|
||||
function removeSubtypes(types: Type[]) {
|
||||
let typeListId = getTypeListId(types);
|
||||
if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeSubtypesStack.push(typeListId);
|
||||
|
||||
let i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@ -3575,6 +3587,8 @@ module ts {
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
removeSubtypesStack.pop();
|
||||
}
|
||||
|
||||
function containsAnyType(types: Type[]) {
|
||||
|
||||
@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "1.5.0";
|
||||
export const version = "1.5.2";
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
|
||||
@ -3039,46 +3039,47 @@ module ts {
|
||||
let containingNodeKind = previousToken.parent.kind;
|
||||
switch (previousToken.kind) {
|
||||
case SyntaxKind.CommaToken:
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a, |
|
||||
|| containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, |
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // let x = (a, |
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a, |
|
||||
|| containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, |
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression // let x = (a, |
|
||||
|| containingNodeKind === SyntaxKind.FunctionType; // var x: (s: string, list|
|
||||
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( |
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedExpression // let x = (a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedType; // function F(pred: (a| this can become an arrow function, where 'a' is the argument
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
return true;
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.|
|
||||
return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.|
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ |
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ |
|
||||
|
||||
case SyntaxKind.EqualsToken:
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a|
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // x = a|
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a|
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // x = a|
|
||||
|
||||
case SyntaxKind.TemplateHead:
|
||||
return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${|
|
||||
return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${|
|
||||
|
||||
case SyntaxKind.TemplateMiddle:
|
||||
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
|
||||
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
|
||||
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
|
||||
}
|
||||
|
||||
// Previous token may have been a keyword that was converted to an identifier.
|
||||
@ -3157,40 +3158,43 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration ||
|
||||
containingNodeKind === SyntaxKind.VariableDeclarationList ||
|
||||
containingNodeKind === SyntaxKind.VariableStatement ||
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
isFunction(containingNodeKind) ||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
||||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
case SyntaxKind.ColonToken:
|
||||
return containingNodeKind === SyntaxKind.BindingElement; // var {x :html|
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CatchClause ||
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
||||
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||
previousToken.parent && previousToken.parent.parent &&
|
||||
(previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
|
||||
case SyntaxKind.LessThanToken:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.StaticKeyword:
|
||||
@ -3200,7 +3204,7 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.Parameter ||
|
||||
containingNodeKind === SyntaxKind.Constructor ||
|
||||
(previousToken.parent && previousToken.parent.parent &&
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [...z|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
@ -3218,6 +3222,7 @@ module ts {
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
case SyntaxKind.YieldKeyword:
|
||||
case SyntaxKind.TypeKeyword: // type htm|
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts]
|
||||
module Q {
|
||||
function P() {
|
||||
// Test this
|
||||
var a = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js]
|
||||
var Q;
|
||||
(function (Q) {
|
||||
function P() {
|
||||
// Test this
|
||||
var a = 1;
|
||||
}
|
||||
})(Q || (Q = {}));
|
||||
//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map
|
||||
@ -0,0 +1,2 @@
|
||||
//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map]
|
||||
{"version":3,"file":"sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"],"names":["Q","Q.P"],"mappings":"AAAA,IAAO,CAAC,CAKP;AALD,WAAO,CAAC,EAAC,CAAC;IACNA;QAEIC,AADAA,YAAYA;YACRA,CAACA,GAAGA,CAACA,CAACA;IACdA,CAACA;AACLD,CAACA,EALM,CAAC,KAAD,CAAC,QAKP"}
|
||||
@ -0,0 +1,127 @@
|
||||
===================================================================
|
||||
JsFile: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js
|
||||
mapUrl: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map
|
||||
sourceRoot:
|
||||
sources: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js
|
||||
sourceFile:sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var Q;
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^->
|
||||
1 >
|
||||
2 >module
|
||||
3 > Q
|
||||
4 > {
|
||||
> function P() {
|
||||
> // Test this
|
||||
> var a = 1;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(1, 9) + SourceIndex(0)
|
||||
4 >Emitted(1, 7) Source(6, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>(function (Q) {
|
||||
1->
|
||||
2 >^^^^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
6 > ^^^^->
|
||||
1->
|
||||
2 >module
|
||||
3 > Q
|
||||
4 >
|
||||
5 > {
|
||||
1->Emitted(2, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 12) Source(1, 8) + SourceIndex(0)
|
||||
3 >Emitted(2, 13) Source(1, 9) + SourceIndex(0)
|
||||
4 >Emitted(2, 15) Source(1, 10) + SourceIndex(0)
|
||||
5 >Emitted(2, 16) Source(1, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> function P() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) name (Q)
|
||||
---
|
||||
>>> // Test this
|
||||
1->^^^^^^^^
|
||||
2 >
|
||||
3 > ^^^^^^^^^^^^
|
||||
1->function P() {
|
||||
> // Test this
|
||||
>
|
||||
2 >
|
||||
3 > // Test this
|
||||
1->Emitted(4, 9) Source(4, 9) + SourceIndex(0) name (Q.P)
|
||||
2 >Emitted(4, 9) Source(3, 9) + SourceIndex(0) name (Q.P)
|
||||
3 >Emitted(4, 21) Source(3, 21) + SourceIndex(0) name (Q.P)
|
||||
---
|
||||
>>> var a = 1;
|
||||
1 >^^^^^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^
|
||||
1 >
|
||||
> var
|
||||
2 > a
|
||||
3 > =
|
||||
4 > 1
|
||||
5 > ;
|
||||
1 >Emitted(5, 13) Source(4, 13) + SourceIndex(0) name (Q.P)
|
||||
2 >Emitted(5, 14) Source(4, 14) + SourceIndex(0) name (Q.P)
|
||||
3 >Emitted(5, 17) Source(4, 17) + SourceIndex(0) name (Q.P)
|
||||
4 >Emitted(5, 18) Source(4, 18) + SourceIndex(0) name (Q.P)
|
||||
5 >Emitted(5, 19) Source(4, 19) + SourceIndex(0) name (Q.P)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(5, 5) + SourceIndex(0) name (Q.P)
|
||||
2 >Emitted(6, 6) Source(5, 6) + SourceIndex(0) name (Q.P)
|
||||
---
|
||||
>>>})(Q || (Q = {}));
|
||||
1->
|
||||
2 >^
|
||||
3 > ^^
|
||||
4 > ^
|
||||
5 > ^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^
|
||||
8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >}
|
||||
3 >
|
||||
4 > Q
|
||||
5 >
|
||||
6 > Q
|
||||
7 > {
|
||||
> function P() {
|
||||
> // Test this
|
||||
> var a = 1;
|
||||
> }
|
||||
> }
|
||||
1->Emitted(7, 1) Source(6, 1) + SourceIndex(0) name (Q)
|
||||
2 >Emitted(7, 2) Source(6, 2) + SourceIndex(0) name (Q)
|
||||
3 >Emitted(7, 4) Source(1, 8) + SourceIndex(0)
|
||||
4 >Emitted(7, 5) Source(1, 9) + SourceIndex(0)
|
||||
5 >Emitted(7, 10) Source(1, 8) + SourceIndex(0)
|
||||
6 >Emitted(7, 11) Source(1, 9) + SourceIndex(0)
|
||||
7 >Emitted(7, 19) Source(6, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map
|
||||
@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts ===
|
||||
module Q {
|
||||
>Q : Symbol(Q, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 0))
|
||||
|
||||
function P() {
|
||||
>P : Symbol(P, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 10))
|
||||
|
||||
// Test this
|
||||
var a = 1;
|
||||
>a : Symbol(a, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 3, 11))
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts ===
|
||||
module Q {
|
||||
>Q : typeof Q
|
||||
|
||||
function P() {
|
||||
>P : () => void
|
||||
|
||||
// Test this
|
||||
var a = 1;
|
||||
>a : number
|
||||
>1 : number
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
//// [sourceMapForFunctionWithCommentPrecedingStatement01.ts]
|
||||
function P() {
|
||||
// Test this
|
||||
var a = 1;
|
||||
}
|
||||
|
||||
//// [sourceMapForFunctionWithCommentPrecedingStatement01.js]
|
||||
function P() {
|
||||
// Test this
|
||||
var a = 1;
|
||||
}
|
||||
//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map
|
||||
@ -0,0 +1,2 @@
|
||||
//// [sourceMapForFunctionWithCommentPrecedingStatement01.js.map]
|
||||
{"version":3,"file":"sourceMapForFunctionWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionWithCommentPrecedingStatement01.ts"],"names":["P"],"mappings":"AAAA;IAEIA,AADAA,YAAYA;QACRA,CAACA,GAAGA,CAACA,CAACA;AACdA,CAACA"}
|
||||
@ -0,0 +1,58 @@
|
||||
===================================================================
|
||||
JsFile: sourceMapForFunctionWithCommentPrecedingStatement01.js
|
||||
mapUrl: sourceMapForFunctionWithCommentPrecedingStatement01.js.map
|
||||
sourceRoot:
|
||||
sources: sourceMapForFunctionWithCommentPrecedingStatement01.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.js
|
||||
sourceFile:sourceMapForFunctionWithCommentPrecedingStatement01.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>function P() {
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> // Test this
|
||||
1->^^^^
|
||||
2 >
|
||||
3 > ^^^^^^^^^^^^
|
||||
1->function P() {
|
||||
> // Test this
|
||||
>
|
||||
2 >
|
||||
3 > // Test this
|
||||
1->Emitted(2, 5) Source(3, 5) + SourceIndex(0) name (P)
|
||||
2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (P)
|
||||
3 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (P)
|
||||
---
|
||||
>>> var a = 1;
|
||||
1 >^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^
|
||||
1 >
|
||||
> var
|
||||
2 > a
|
||||
3 > =
|
||||
4 > 1
|
||||
5 > ;
|
||||
1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (P)
|
||||
2 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) name (P)
|
||||
3 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) name (P)
|
||||
4 >Emitted(3, 14) Source(3, 14) + SourceIndex(0) name (P)
|
||||
5 >Emitted(3, 15) Source(3, 15) + SourceIndex(0) name (P)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) name (P)
|
||||
2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) name (P)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts ===
|
||||
function P() {
|
||||
>P : Symbol(P, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 0, 0))
|
||||
|
||||
// Test this
|
||||
var a = 1;
|
||||
>a : Symbol(a, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 2, 7))
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts ===
|
||||
function P() {
|
||||
>P : () => void
|
||||
|
||||
// Test this
|
||||
var a = 1;
|
||||
>a : number
|
||||
>1 : number
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
//// [unionTypeWithRecursiveSubtypeReduction.ts]
|
||||
class Module {
|
||||
public members: Class[];
|
||||
}
|
||||
|
||||
class Namespace {
|
||||
public members: (Class | Property)[];
|
||||
}
|
||||
|
||||
class Class {
|
||||
public parent: Namespace;
|
||||
}
|
||||
|
||||
class Property {
|
||||
public parent: Module | Class;
|
||||
}
|
||||
|
||||
var t: Class | Property;
|
||||
t.parent;
|
||||
|
||||
//// [unionTypeWithRecursiveSubtypeReduction.js]
|
||||
var Module = (function () {
|
||||
function Module() {
|
||||
}
|
||||
return Module;
|
||||
})();
|
||||
var Namespace = (function () {
|
||||
function Namespace() {
|
||||
}
|
||||
return Namespace;
|
||||
})();
|
||||
var Class = (function () {
|
||||
function Class() {
|
||||
}
|
||||
return Class;
|
||||
})();
|
||||
var Property = (function () {
|
||||
function Property() {
|
||||
}
|
||||
return Property;
|
||||
})();
|
||||
var t;
|
||||
t.parent;
|
||||
@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction.ts ===
|
||||
class Module {
|
||||
>Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 0, 0))
|
||||
|
||||
public members: Class[];
|
||||
>members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 0, 14))
|
||||
>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 6, 1))
|
||||
}
|
||||
|
||||
class Namespace {
|
||||
>Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 2, 1))
|
||||
|
||||
public members: (Class | Property)[];
|
||||
>members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 4, 17))
|
||||
>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 6, 1))
|
||||
>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 10, 1))
|
||||
}
|
||||
|
||||
class Class {
|
||||
>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 6, 1))
|
||||
|
||||
public parent: Namespace;
|
||||
>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 8, 13))
|
||||
>Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 2, 1))
|
||||
}
|
||||
|
||||
class Property {
|
||||
>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 10, 1))
|
||||
|
||||
public parent: Module | Class;
|
||||
>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 12, 16))
|
||||
>Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 0, 0))
|
||||
>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 6, 1))
|
||||
}
|
||||
|
||||
var t: Class | Property;
|
||||
>t : Symbol(t, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 16, 3))
|
||||
>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 6, 1))
|
||||
>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 10, 1))
|
||||
|
||||
t.parent;
|
||||
>t.parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 8, 13), Decl(unionTypeWithRecursiveSubtypeReduction.ts, 12, 16))
|
||||
>t : Symbol(t, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 16, 3))
|
||||
>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction.ts, 8, 13), Decl(unionTypeWithRecursiveSubtypeReduction.ts, 12, 16))
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction.ts ===
|
||||
class Module {
|
||||
>Module : Module
|
||||
|
||||
public members: Class[];
|
||||
>members : Class[]
|
||||
>Class : Class
|
||||
}
|
||||
|
||||
class Namespace {
|
||||
>Namespace : Namespace
|
||||
|
||||
public members: (Class | Property)[];
|
||||
>members : (Class | Property)[]
|
||||
>Class : Class
|
||||
>Property : Property
|
||||
}
|
||||
|
||||
class Class {
|
||||
>Class : Class
|
||||
|
||||
public parent: Namespace;
|
||||
>parent : Namespace
|
||||
>Namespace : Namespace
|
||||
}
|
||||
|
||||
class Property {
|
||||
>Property : Property
|
||||
|
||||
public parent: Module | Class;
|
||||
>parent : Module | Class
|
||||
>Module : Module
|
||||
>Class : Class
|
||||
}
|
||||
|
||||
var t: Class | Property;
|
||||
>t : Class | Property
|
||||
>Class : Class
|
||||
>Property : Property
|
||||
|
||||
t.parent;
|
||||
>t.parent : Class | Namespace
|
||||
>t : Class | Property
|
||||
>parent : Class | Namespace
|
||||
|
||||
@ -42,5 +42,9 @@ tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2
|
||||
!!! error TS2322: Types of property 'parent' are incompatible.
|
||||
!!! error TS2322: Type 'Namespace' is not assignable to type 'Module | Class'.
|
||||
!!! error TS2322: Type 'Namespace' is not assignable to type 'Class'.
|
||||
<<<<<<< HEAD
|
||||
!!! error TS2322: Property 'parent' is missing in type 'Namespace'.
|
||||
|
||||
|
||||
=======
|
||||
!!! error TS2322: Property 'parent' is missing in type 'Namespace'.
|
||||
>>>>>>> master
|
||||
|
||||
@ -18,8 +18,12 @@ class Property {
|
||||
var c: Class;
|
||||
var p: Property;
|
||||
c = p;
|
||||
<<<<<<< HEAD
|
||||
p = c;
|
||||
|
||||
=======
|
||||
p = c;
|
||||
>>>>>>> master
|
||||
|
||||
//// [unionTypeWithRecursiveSubtypeReduction2.js]
|
||||
var Module = (function () {
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
//@sourceMap: true
|
||||
module Q {
|
||||
function P() {
|
||||
// Test this
|
||||
var a = 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
//@sourceMap: true
|
||||
function P() {
|
||||
// Test this
|
||||
var a = 1;
|
||||
}
|
||||
@ -18,7 +18,8 @@
|
||||
/////* /*inComment5*/
|
||||
////var v11 = '';
|
||||
//// // /*inComment6*/
|
||||
////
|
||||
////var v12 = '';
|
||||
////type htm/*inTypeAlias*/
|
||||
///
|
||||
////// /*inComment7*/
|
||||
////foo;
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var { x:html/*1*/
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListIsEmpty();
|
||||
@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function F(pref: (a/*1*/
|
||||
|
||||
test.markers().forEach((m) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.completionListIsEmpty();
|
||||
verify.completionListAllowsNewIdentifier();
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var x : (s/*1*/
|
||||
|
||||
////var y : (s:string, list/*2*/
|
||||
|
||||
test.markers().forEach((m) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.completionListIsEmpty();
|
||||
verify.completionListAllowsNewIdentifier();
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user