mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into addUndefinedCheckToCollectLinkedAliases
This commit is contained in:
@@ -1,3 +1,45 @@
|
||||
# Instructions for Logging Issues
|
||||
|
||||
## 1. Read the FAQ
|
||||
|
||||
Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug.
|
||||
|
||||
Issues that ask questions answered in the FAQ will be closed without elaboration.
|
||||
|
||||
## 2. Search for Duplicates
|
||||
|
||||
[Search the existing issues](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) before logging a new one.
|
||||
|
||||
## 3. Do you have a question?
|
||||
|
||||
The issue tracker is for **issues**, in other words, bugs and suggestions.
|
||||
If you have a *question*, please use [http://stackoverflow.com/questions/tagged/typescript](Stack Overflow), [https://gitter.im/Microsoft/TypeScript](Gitter), your favorite search engine, or other resources.
|
||||
Due to increased traffic, we can no longer answer questions in the issue tracker.
|
||||
|
||||
## 4. Did you find a bug?
|
||||
|
||||
When logging a bug, please be sure to include the following:
|
||||
* What version of TypeScript you're using (run `tsc --v`)
|
||||
* If at all possible, an *isolated* way to reproduce the behavior
|
||||
* The behavior you expect to see, and the actual behavior
|
||||
|
||||
You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed.
|
||||
|
||||
## 5. Do you have a suggestion?
|
||||
|
||||
We also accept suggestions in the issue tracker.
|
||||
Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first.
|
||||
|
||||
In general, things we find useful when reviewing suggestins are:
|
||||
* A description of the problem you're trying to solve
|
||||
* An overview of the suggested solution
|
||||
* Examples of how the suggestion would work in various places
|
||||
* Code examples showing e.g. "this would be an error, this wouldn't"
|
||||
* Code examples showing the generated JavaScript (if applicable)
|
||||
* If relevant, precedent in other languages can be useful for establishing context and expected behavior
|
||||
|
||||
# Instructions for Contributing Code
|
||||
|
||||
## Contributing bug fixes
|
||||
|
||||
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
|
||||
|
||||
@@ -893,6 +893,7 @@ function getLinterOptions() {
|
||||
|
||||
function lintFileContents(options, path, contents) {
|
||||
var ll = new Linter(path, contents, options);
|
||||
console.log("Linting '" + path + "'.")
|
||||
return ll.lint();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
"istanbul": "latest",
|
||||
"mocha-fivemat-progress-reporter": "latest",
|
||||
"tslint": "next",
|
||||
"typescript": "next",
|
||||
"typescript": "1.8.0-dev.20160113",
|
||||
"tsd": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
+44
-5
@@ -741,7 +741,9 @@ namespace ts {
|
||||
|
||||
if (!result) {
|
||||
if (nameNotFoundMessage) {
|
||||
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
|
||||
if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) {
|
||||
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -778,6 +780,43 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function checkAndReportErrorForMissingPrefix(errorLocation: Node, name: string, nameArg: string | Identifier): boolean {
|
||||
if (!errorLocation || (errorLocation.kind === SyntaxKind.Identifier && (isTypeReferenceIdentifier(<Identifier>errorLocation)) || isInTypeQuery(errorLocation))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const container = getThisContainer(errorLocation, /* includeArrowFunctions */ true);
|
||||
let location = container;
|
||||
while (location) {
|
||||
if (isClassLike(location.parent)) {
|
||||
const classSymbol = getSymbolOfNode(location.parent);
|
||||
if (!classSymbol) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Check to see if a static member exists.
|
||||
const constructorType = getTypeOfSymbol(classSymbol);
|
||||
if (getPropertyOfType(constructorType, name)) {
|
||||
error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg), symbolToString(classSymbol));
|
||||
return true;
|
||||
}
|
||||
|
||||
// No static member is present.
|
||||
// Check if we're in an instance method and look for a relevant instance member.
|
||||
if (location === container && !(location.flags & NodeFlags.Static)) {
|
||||
const instanceType = (<InterfaceType>getDeclaredTypeOfSymbol(classSymbol)).thisType;
|
||||
if (getPropertyOfType(instanceType, name)) {
|
||||
error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
location = location.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void {
|
||||
Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0);
|
||||
// Block-scoped variables cannot be used before their definition
|
||||
@@ -6688,10 +6727,6 @@ namespace ts {
|
||||
if (typeInfo && typeInfo.type === undefinedType) {
|
||||
return type;
|
||||
}
|
||||
// If the type to be narrowed is any and we're checking a primitive with assumeTrue=true, return the primitive
|
||||
if (!!(type.flags & TypeFlags.Any) && typeInfo && assumeTrue) {
|
||||
return typeInfo.type;
|
||||
}
|
||||
let flags: TypeFlags;
|
||||
if (typeInfo) {
|
||||
flags = typeInfo.flags;
|
||||
@@ -6702,6 +6737,10 @@ namespace ts {
|
||||
}
|
||||
// At this point we can bail if it's not a union
|
||||
if (!(type.flags & TypeFlags.Union)) {
|
||||
// If we're on the true branch and the type is a subtype, we should return the primitive type
|
||||
if (assumeTrue && typeInfo && isTypeSubtypeOf(typeInfo.type, type)) {
|
||||
return typeInfo.type;
|
||||
}
|
||||
// If the active non-union type would be removed from a union by this type guard, return an empty union
|
||||
return filterUnion(type) ? type : emptyUnionType;
|
||||
}
|
||||
|
||||
+10
-1
@@ -616,7 +616,9 @@ namespace ts {
|
||||
return path.substr(0, rootLength) + normalized.join(directorySeparator);
|
||||
}
|
||||
|
||||
export function getDirectoryPath(path: string) {
|
||||
export function getDirectoryPath(path: Path): Path;
|
||||
export function getDirectoryPath(path: string): string;
|
||||
export function getDirectoryPath(path: string): any {
|
||||
return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(directorySeparator)));
|
||||
}
|
||||
|
||||
@@ -874,4 +876,11 @@ namespace ts {
|
||||
}
|
||||
return copiedList;
|
||||
}
|
||||
|
||||
export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string {
|
||||
return useCaseSensitivefileNames
|
||||
? ((fileName) => fileName)
|
||||
: ((fileName) => fileName.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1767,6 +1767,14 @@
|
||||
"category": "Error",
|
||||
"code": 2661
|
||||
},
|
||||
"Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?": {
|
||||
"category": "Error",
|
||||
"code": 2662
|
||||
},
|
||||
"Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?": {
|
||||
"category": "Error",
|
||||
"code": 2663
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
|
||||
@@ -2886,7 +2886,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
if ((<ForStatement | ForInStatement | ForOfStatement>node).initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
const initializer = (<ForStatement | ForInStatement | ForOfStatement>node).initializer;
|
||||
if (initializer && initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
loopInitializer = <VariableDeclarationList>(<ForStatement | ForInStatement | ForOfStatement>node).initializer;
|
||||
}
|
||||
break;
|
||||
|
||||
+124
-22
@@ -1,6 +1,9 @@
|
||||
/// <reference path="core.ts"/>
|
||||
|
||||
namespace ts {
|
||||
export type FileWatcherCallback = (path: string, removed?: boolean) => void;
|
||||
export type DirectoryWatcherCallback = (path: string) => void;
|
||||
|
||||
export interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -8,8 +11,8 @@ namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -22,15 +25,20 @@ namespace ts {
|
||||
}
|
||||
|
||||
interface WatchedFile {
|
||||
fileName: string;
|
||||
callback: (fileName: string, removed?: boolean) => void;
|
||||
mtime: Date;
|
||||
filePath: Path;
|
||||
callback: FileWatcherCallback;
|
||||
mtime?: Date;
|
||||
}
|
||||
|
||||
export interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export interface DirectoryWatcher extends FileWatcher {
|
||||
directoryPath: Path;
|
||||
referenceCount: number;
|
||||
}
|
||||
|
||||
declare var require: any;
|
||||
declare var module: any;
|
||||
declare var process: any;
|
||||
@@ -62,8 +70,8 @@ namespace ts {
|
||||
readFile(path: string): string;
|
||||
writeFile(path: string, contents: string): void;
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
};
|
||||
|
||||
export var sys: System = (function () {
|
||||
@@ -221,7 +229,7 @@ namespace ts {
|
||||
|
||||
// average async stat takes about 30 microseconds
|
||||
// set chunk size to do 30 files in < 1 millisecond
|
||||
function createWatchedFileSet(interval = 2500, chunkSize = 30) {
|
||||
function createPollingWatchedFileSet(interval = 2500, chunkSize = 30) {
|
||||
let watchedFiles: WatchedFile[] = [];
|
||||
let nextFileToCheck = 0;
|
||||
let watchTimer: any;
|
||||
@@ -236,13 +244,13 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
_fs.stat(watchedFile.fileName, (err: any, stats: any) => {
|
||||
_fs.stat(watchedFile.filePath, (err: any, stats: any) => {
|
||||
if (err) {
|
||||
watchedFile.callback(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.filePath);
|
||||
}
|
||||
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
|
||||
watchedFile.mtime = getModifiedTime(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
|
||||
watchedFile.mtime = getModifiedTime(watchedFile.filePath);
|
||||
watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -270,11 +278,11 @@ namespace ts {
|
||||
}, interval);
|
||||
}
|
||||
|
||||
function addFile(fileName: string, callback: (fileName: string, removed?: boolean) => void): WatchedFile {
|
||||
function addFile(filePath: Path, callback: FileWatcherCallback): WatchedFile {
|
||||
const file: WatchedFile = {
|
||||
fileName,
|
||||
filePath,
|
||||
callback,
|
||||
mtime: getModifiedTime(fileName)
|
||||
mtime: getModifiedTime(filePath)
|
||||
};
|
||||
|
||||
watchedFiles.push(file);
|
||||
@@ -297,6 +305,88 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
function createWatchedFileSet() {
|
||||
const dirWatchers = createFileMap<DirectoryWatcher>();
|
||||
// One file can have multiple watchers
|
||||
const fileWatcherCallbacks = createFileMap<FileWatcherCallback[]>();
|
||||
return { addFile, removeFile };
|
||||
|
||||
function reduceDirWatcherRefCountForFile(filePath: Path) {
|
||||
const dirPath = getDirectoryPath(filePath);
|
||||
if (dirWatchers.contains(dirPath)) {
|
||||
const watcher = dirWatchers.get(dirPath);
|
||||
watcher.referenceCount -= 1;
|
||||
if (watcher.referenceCount <= 0) {
|
||||
watcher.close();
|
||||
dirWatchers.remove(dirPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addDirWatcher(dirPath: Path): void {
|
||||
if (dirWatchers.contains(dirPath)) {
|
||||
const watcher = dirWatchers.get(dirPath);
|
||||
watcher.referenceCount += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
const watcher: DirectoryWatcher = _fs.watch(
|
||||
dirPath,
|
||||
{ persistent: true },
|
||||
(eventName: string, relativeFileName: string) => fileEventHandler(eventName, relativeFileName, dirPath)
|
||||
);
|
||||
watcher.referenceCount = 1;
|
||||
dirWatchers.set(dirPath, watcher);
|
||||
return;
|
||||
}
|
||||
|
||||
function addFileWatcherCallback(filePath: Path, callback: FileWatcherCallback): void {
|
||||
if (fileWatcherCallbacks.contains(filePath)) {
|
||||
fileWatcherCallbacks.get(filePath).push(callback);
|
||||
}
|
||||
else {
|
||||
fileWatcherCallbacks.set(filePath, [callback]);
|
||||
}
|
||||
}
|
||||
|
||||
function addFile(filePath: Path, callback: FileWatcherCallback): WatchedFile {
|
||||
addFileWatcherCallback(filePath, callback);
|
||||
addDirWatcher(getDirectoryPath(filePath));
|
||||
|
||||
return { filePath, callback };
|
||||
}
|
||||
|
||||
function removeFile(watchedFile: WatchedFile) {
|
||||
removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback);
|
||||
reduceDirWatcherRefCountForFile(watchedFile.filePath);
|
||||
}
|
||||
|
||||
function removeFileWatcherCallback(filePath: Path, callback: FileWatcherCallback) {
|
||||
if (fileWatcherCallbacks.contains(filePath)) {
|
||||
const newCallbacks = copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath));
|
||||
if (newCallbacks.length === 0) {
|
||||
fileWatcherCallbacks.remove(filePath);
|
||||
}
|
||||
else {
|
||||
fileWatcherCallbacks.set(filePath, newCallbacks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param watcherPath is the path from which the watcher is triggered.
|
||||
*/
|
||||
function fileEventHandler(eventName: string, relativefileName: string, baseDirPath: Path) {
|
||||
// When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
|
||||
const filePath = relativefileName === undefined ? undefined : toPath(relativefileName, baseDirPath, getCanonicalPath);
|
||||
if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) {
|
||||
for (const fileCallback of fileWatcherCallbacks.get(filePath)) {
|
||||
fileCallback(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// REVIEW: for now this implementation uses polling.
|
||||
// The advantage of polling is that it works reliably
|
||||
// on all os and with network mounted files.
|
||||
@@ -310,8 +400,13 @@ namespace ts {
|
||||
// changes for large reference sets? If so, do we want
|
||||
// to increase the chunk size or decrease the interval
|
||||
// time dynamically to match the large reference set?
|
||||
const pollingWatchedFileSet = createPollingWatchedFileSet();
|
||||
const watchedFileSet = createWatchedFileSet();
|
||||
|
||||
function isNode4OrLater(): boolean {
|
||||
return parseInt(process.version.charAt(1)) >= 4;
|
||||
}
|
||||
|
||||
const platform: string = _os.platform();
|
||||
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
|
||||
const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
|
||||
@@ -405,29 +500,38 @@ namespace ts {
|
||||
},
|
||||
readFile,
|
||||
writeFile,
|
||||
watchFile: (fileName, callback) => {
|
||||
watchFile: (filePath, callback) => {
|
||||
// Node 4.0 stablized the `fs.watch` function on Windows which avoids polling
|
||||
// and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649
|
||||
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
|
||||
// if the current node.js version is newer than 4, use `fs.watch` instead.
|
||||
const watchedFile = watchedFileSet.addFile(fileName, callback);
|
||||
const watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet;
|
||||
const watchedFile = watchSet.addFile(filePath, callback);
|
||||
return {
|
||||
close: () => watchedFileSet.removeFile(watchedFile)
|
||||
close: () => watchSet.removeFile(watchedFile)
|
||||
};
|
||||
},
|
||||
watchDirectory: (path, callback, recursive) => {
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
let options: any;
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
else {
|
||||
options = { persistent: true };
|
||||
}
|
||||
|
||||
return _fs.watch(
|
||||
path,
|
||||
{ persistent: true, recursive: !!recursive },
|
||||
options,
|
||||
(eventName: string, relativeFileName: string) => {
|
||||
// In watchDirectory we only care about adding and removing files (when event name is
|
||||
// "rename"); changes made within files are handled by corresponding fileWatchers (when
|
||||
// event name is "change")
|
||||
if (eventName === "rename") {
|
||||
// When deleting a file, the passed baseFileName is null
|
||||
callback(!relativeFileName ? relativeFileName : normalizePath(ts.combinePaths(path, relativeFileName)));
|
||||
callback(!relativeFileName ? relativeFileName : normalizePath(combinePaths(path, relativeFileName)));
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -511,5 +615,3 @@ namespace ts {
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -334,7 +334,8 @@ namespace ts {
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
if (configFileName) {
|
||||
configFileWatcher = sys.watchFile(configFileName, configFileChanged);
|
||||
const configFilePath = toPath(configFileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
|
||||
configFileWatcher = sys.watchFile(configFilePath, configFileChanged);
|
||||
}
|
||||
if (sys.watchDirectory && configFileName) {
|
||||
const directory = ts.getDirectoryPath(configFileName);
|
||||
@@ -442,7 +443,8 @@ namespace ts {
|
||||
const sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
|
||||
if (sourceFile && compilerOptions.watch) {
|
||||
// Attach a file watcher
|
||||
sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));
|
||||
const filePath = toPath(sourceFile.fileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
|
||||
sourceFile.fileWatcher = sys.watchFile(filePath, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));
|
||||
}
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
@@ -1002,7 +1002,7 @@ namespace ts.server {
|
||||
info.setFormatOptions(this.getFormatCodeOptions());
|
||||
this.filenameToScriptInfo[fileName] = info;
|
||||
if (!info.isOpen) {
|
||||
info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); });
|
||||
info.fileWatcher = this.host.watchFile(<Path>fileName, _ => { this.watchedFileChanged(fileName); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
project.finishGraph();
|
||||
project.projectFileWatcher = this.host.watchFile(configFilename, _ => this.watchedProjectConfigFileChanged(project));
|
||||
project.projectFileWatcher = this.host.watchFile(<Path>configFilename, _ => this.watchedProjectConfigFileChanged(project));
|
||||
this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename));
|
||||
project.directoryWatcher = this.host.watchDirectory(
|
||||
ts.getDirectoryPath(configFilename),
|
||||
|
||||
+29
-11
@@ -2018,13 +2018,6 @@ namespace ts {
|
||||
return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true);
|
||||
}
|
||||
|
||||
export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string {
|
||||
return useCaseSensitivefileNames
|
||||
? ((fileName) => fileName)
|
||||
: ((fileName) => fileName.toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
export function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory = ""): DocumentRegistry {
|
||||
// Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have
|
||||
// for those settings.
|
||||
@@ -6018,14 +6011,38 @@ namespace ts {
|
||||
|
||||
// Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions
|
||||
if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result);
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {});
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[]): void {
|
||||
/**
|
||||
* Find symbol of the given property-name and add the symbol to the given result array
|
||||
* @param symbol a symbol to start searching for the given propertyName
|
||||
* @param propertyName a name of property to serach for
|
||||
* @param result an array of symbol of found property symbols
|
||||
* @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisitng of the same symbol.
|
||||
* The value of previousIterationSymbol is undefined when the function is first called.
|
||||
*/
|
||||
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[],
|
||||
previousIterationSymbolsCache: SymbolTable): void {
|
||||
// If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited
|
||||
// This is particularly important for the following cases, so that we do not infinitely visit the same symbol.
|
||||
// For example:
|
||||
// interface C extends C {
|
||||
// /*findRef*/propName: string;
|
||||
// }
|
||||
// The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName,
|
||||
// the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined,
|
||||
// the function will add any found symbol of the property-name, then its sub-routine will call
|
||||
// getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already
|
||||
// visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol.
|
||||
if (hasProperty(previousIterationSymbolsCache, symbol.name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
forEach(symbol.getDeclarations(), declaration => {
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration) {
|
||||
@@ -6049,7 +6066,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Visit the typeReference as well to see if it directly or indirectly use that property
|
||||
getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result);
|
||||
previousIterationSymbolsCache[symbol.name] = symbol;
|
||||
getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6101,7 +6119,7 @@ namespace ts {
|
||||
// see if any is in the list
|
||||
if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
const result: Symbol[] = [];
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result);
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {});
|
||||
return forEach(result, s => searchSymbols.indexOf(s) >= 0 ? s : undefined);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ====
|
||||
@@ -9,6 +9,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): err
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
!!! error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'?
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts(5,17): error TS2662: Cannot find name 'foo'. Did you mean the static member 'C.foo'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts (1 errors) ====
|
||||
class C {
|
||||
static foo: string;
|
||||
|
||||
bar() {
|
||||
let k = foo;
|
||||
~~~
|
||||
!!! error TS2662: Cannot find name 'foo'. Did you mean the static member 'C.foo'?
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [accessInstanceMemberFromStaticMethod01.ts]
|
||||
class C {
|
||||
static foo: string;
|
||||
|
||||
bar() {
|
||||
let k = foo;
|
||||
}
|
||||
}
|
||||
|
||||
//// [accessInstanceMemberFromStaticMethod01.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var k = foo;
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts(5,17): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts (1 errors) ====
|
||||
class C {
|
||||
foo: string;
|
||||
|
||||
static bar() {
|
||||
let k = foo;
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [accessStaticMemberFromInstanceMethod01.ts]
|
||||
class C {
|
||||
foo: string;
|
||||
|
||||
static bar() {
|
||||
let k = foo;
|
||||
}
|
||||
}
|
||||
|
||||
//// [accessStaticMemberFromInstanceMethod01.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.bar = function () {
|
||||
var k = foo;
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [capturedLetConstInLoop11.ts]
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
() => x;
|
||||
}
|
||||
|
||||
function foo() {
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
switch(a) {
|
||||
case 0: return () => a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [capturedLetConstInLoop11.js]
|
||||
var _loop_1 = function() {
|
||||
var x = 1;
|
||||
(function () { return x; });
|
||||
};
|
||||
for (;;) {
|
||||
_loop_1();
|
||||
}
|
||||
function foo() {
|
||||
var _loop_2 = function() {
|
||||
var a = 0;
|
||||
switch (a) {
|
||||
case 0: return { value: function () { return a; } };
|
||||
}
|
||||
};
|
||||
for (;;) {
|
||||
var state_2 = _loop_2();
|
||||
if (typeof state_2 === "object") return state_2.value
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/capturedLetConstInLoop11.ts ===
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
>x : Symbol(x, Decl(capturedLetConstInLoop11.ts, 1, 7))
|
||||
|
||||
() => x;
|
||||
>x : Symbol(x, Decl(capturedLetConstInLoop11.ts, 1, 7))
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(capturedLetConstInLoop11.ts, 3, 1))
|
||||
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
>a : Symbol(a, Decl(capturedLetConstInLoop11.ts, 7, 13))
|
||||
|
||||
switch(a) {
|
||||
>a : Symbol(a, Decl(capturedLetConstInLoop11.ts, 7, 13))
|
||||
|
||||
case 0: return () => a;
|
||||
>a : Symbol(a, Decl(capturedLetConstInLoop11.ts, 7, 13))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/capturedLetConstInLoop11.ts ===
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
() => x;
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : () => () => number
|
||||
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
>a : number
|
||||
>0 : number
|
||||
|
||||
switch(a) {
|
||||
>a : number
|
||||
|
||||
case 0: return () => a;
|
||||
>0 : number
|
||||
>() => a : () => number
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [capturedLetConstInLoop11_ES6.ts]
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
() => x;
|
||||
}
|
||||
|
||||
function foo() {
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
switch(a) {
|
||||
case 0: return () => a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [capturedLetConstInLoop11_ES6.js]
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
(() => x);
|
||||
}
|
||||
function foo() {
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
switch (a) {
|
||||
case 0: return () => a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/capturedLetConstInLoop11_ES6.ts ===
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
>x : Symbol(x, Decl(capturedLetConstInLoop11_ES6.ts, 1, 7))
|
||||
|
||||
() => x;
|
||||
>x : Symbol(x, Decl(capturedLetConstInLoop11_ES6.ts, 1, 7))
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(capturedLetConstInLoop11_ES6.ts, 3, 1))
|
||||
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
>a : Symbol(a, Decl(capturedLetConstInLoop11_ES6.ts, 7, 13))
|
||||
|
||||
switch(a) {
|
||||
>a : Symbol(a, Decl(capturedLetConstInLoop11_ES6.ts, 7, 13))
|
||||
|
||||
case 0: return () => a;
|
||||
>a : Symbol(a, Decl(capturedLetConstInLoop11_ES6.ts, 7, 13))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/capturedLetConstInLoop11_ES6.ts ===
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
() => x;
|
||||
>() => x : () => number
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : () => () => number
|
||||
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
>a : number
|
||||
>0 : number
|
||||
|
||||
switch(a) {
|
||||
>a : number
|
||||
|
||||
case 0: return () => a;
|
||||
>0 : number
|
||||
>() => a : () => number
|
||||
>a : number
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(4,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(5,15): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'?
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(11,15): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts (6 errors) ====
|
||||
@@ -22,7 +22,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencin
|
||||
class D {
|
||||
a = x; // error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
!!! error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'?
|
||||
b: typeof x; // error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
@@ -41,6 +41,6 @@ tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencin
|
||||
a = this.x; // ok
|
||||
b = x; // error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
!!! error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'?
|
||||
constructor(public x: T) { }
|
||||
}
|
||||
@@ -7,11 +7,11 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(25,17): er
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(41,12): error TS2304: Cannot find name 'ActiveXObject'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(43,19): error TS2304: Cannot find name 'require'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(44,14): error TS2304: Cannot find name 'require'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(341,13): error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(347,13): error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(351,17): error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,17): error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,35): error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(341,13): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(347,13): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(351,17): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,17): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,35): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(691,50): error TS2304: Cannot find name 'ITextWriter'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(716,47): error TS2503: Cannot find namespace 'TypeScript'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(721,62): error TS2304: Cannot find name 'ITextWriter'.
|
||||
@@ -471,7 +471,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32):
|
||||
static pushGlobalErrorHandler(done: IDone) {
|
||||
errorHandlerStack.push(function (e) {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
done(e);
|
||||
});
|
||||
}
|
||||
@@ -479,20 +479,20 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32):
|
||||
static popGlobalErrorHandler() {
|
||||
errorHandlerStack.pop();
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
}
|
||||
|
||||
static handleError(e: Error) {
|
||||
if (errorHandlerStack.length === 0) {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
IO.printLine('Global error: ' + e);
|
||||
} else {
|
||||
errorHandlerStack[errorHandlerStack.length - 1](e);
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'errorHandlerStack'.
|
||||
!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(152,63):
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(153,30): error TS2304: Cannot find name 'List_TextEditInfo'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(155,32): error TS2304: Cannot find name 'AuthorTokenKind'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(182,79): error TS2503: Cannot find namespace 'Services'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(183,20): error TS2304: Cannot find name 'GetIndentSizeFromText'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(183,20): error TS2662: Cannot find name 'GetIndentSizeFromText'. Did you mean the static member 'Indenter.GetIndentSizeFromText'?
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(186,67): error TS2503: Cannot find namespace 'Services'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,50): error TS2304: Cannot find name 'TokenSpan'.
|
||||
tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,67): error TS2304: Cannot find name 'ParseNode'.
|
||||
@@ -373,7 +373,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38):
|
||||
!!! error TS2503: Cannot find namespace 'Services'.
|
||||
return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false);
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'GetIndentSizeFromText'.
|
||||
!!! error TS2662: Cannot find name 'GetIndentSizeFromText'. Did you mean the static member 'Indenter.GetIndentSizeFromText'?
|
||||
}
|
||||
|
||||
static GetIndentSizeFromText(text: string, editorOptions: Services.EditorOptions, includeNonIndentChars: boolean): number {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(16,19): error TS2304: Cannot find name 'Element'.
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2304: Cannot find name 'domNode'.
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2304: Cannot find name 'mode'.
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2663: Cannot find name 'domNode'. Did you mean the instance member 'this.domNode'?
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2663: Cannot find name 'mode'. Did you mean the instance member 'this.mode'?
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
|
||||
Property 'getInitialState' is missing in type 'Window'.
|
||||
|
||||
@@ -65,7 +65,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argume
|
||||
public getDomNode() {
|
||||
return domNode;
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'domNode'.
|
||||
!!! error TS2663: Cannot find name 'domNode'. Did you mean the instance member 'this.domNode'?
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
@@ -99,7 +99,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argume
|
||||
|
||||
public getMode(): IMode { return mode; }
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'mode'.
|
||||
!!! error TS2663: Cannot find name 'mode'. Did you mean the instance member 'this.mode'?
|
||||
}
|
||||
|
||||
export class Mode extends AbstractMode {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(1,1): error TS6053: File 'tests/cases/conformance/scanner/ecmascript5/References.ts' not found.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,21): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,47): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(9,16): error TS2304: Cannot find name 'isDecimalDigit'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(9,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'?
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,22): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,47): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,22): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,47): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,9): error TS2304: Cannot find name 'Debug'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,22): error TS2304: Cannot find name 'isHexDigit'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(16,16): error TS2304: Cannot find name 'isDecimalDigit'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,22): error TS2662: Cannot find name 'isHexDigit'. Did you mean the static member 'CharacterInfo.isHexDigit'?
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(16,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'?
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(17,20): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,21): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,46): error TS2304: Cannot find name 'CharacterCodes'.
|
||||
@@ -33,7 +33,7 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304
|
||||
public static isHexDigit(c: number): boolean {
|
||||
return isDecimalDigit(c) ||
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'isDecimalDigit'.
|
||||
!!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'?
|
||||
(c >= CharacterCodes.A && c <= CharacterCodes.F) ||
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'CharacterCodes'.
|
||||
@@ -51,10 +51,10 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'Debug'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'isHexDigit'.
|
||||
!!! error TS2662: Cannot find name 'isHexDigit'. Did you mean the static member 'CharacterInfo.isHexDigit'?
|
||||
return isDecimalDigit(c)
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'isDecimalDigit'.
|
||||
!!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'?
|
||||
? (c - CharacterCodes._0)
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'CharacterCodes'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(4,7): error TS2304: Cannot find name 'v'.
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(6,7): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(4,7): error TS2663: Cannot find name 'v'. Did you mean the instance member 'this.v'?
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(6,7): error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts (2 errors) ====
|
||||
@@ -8,10 +8,10 @@ tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(6,7): error T
|
||||
public c() {
|
||||
v = 1;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'v'.
|
||||
!!! error TS2663: Cannot find name 'v'. Did you mean the instance member 'this.v'?
|
||||
this.p = 1;
|
||||
s = 1;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 's'.
|
||||
!!! error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'?
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(4,7): error TS2304: Cannot find name 'v'.
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(5,12): error TS2339: Property 'p' does not exist on type 'typeof D'.
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(6,7): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(6,7): error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts (3 errors) ====
|
||||
@@ -15,6 +15,6 @@ tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(6,7): error T
|
||||
!!! error TS2339: Property 'p' does not exist on type 'typeof D'.
|
||||
s = 1;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 's'.
|
||||
!!! error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'?
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/scopeCheckInsidePublicMethod1.ts(4,7): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/scopeCheckInsidePublicMethod1.ts(4,7): error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/scopeCheckInsidePublicMethod1.ts (1 errors) ====
|
||||
@@ -7,6 +7,6 @@ tests/cases/compiler/scopeCheckInsidePublicMethod1.ts(4,7): error TS2304: Cannot
|
||||
public a() {
|
||||
s = 1; // ERR
|
||||
~
|
||||
!!! error TS2304: Cannot find name 's'.
|
||||
!!! error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'?
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/staticClassMemberError.ts(4,3): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/staticClassMemberError.ts(4,3): error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'?
|
||||
tests/cases/compiler/staticClassMemberError.ts(9,10): error TS2300: Duplicate identifier 'Foo'.
|
||||
tests/cases/compiler/staticClassMemberError.ts(9,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/staticClassMemberError.ts(10,7): error TS2300: Duplicate identifier 'Foo'.
|
||||
@@ -10,7 +10,7 @@ tests/cases/compiler/staticClassMemberError.ts(10,7): error TS2300: Duplicate id
|
||||
public a() {
|
||||
s = 1;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 's'.
|
||||
!!! error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/staticVisibility.ts(10,9): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/staticVisibility.ts(13,9): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/compiler/staticVisibility.ts(10,9): error TS2662: Cannot find name 's'. Did you mean the static member 'C1.s'?
|
||||
tests/cases/compiler/staticVisibility.ts(13,9): error TS2662: Cannot find name 'b'. Did you mean the static member 'C1.b'?
|
||||
tests/cases/compiler/staticVisibility.ts(18,9): error TS2304: Cannot find name 'v'.
|
||||
tests/cases/compiler/staticVisibility.ts(19,14): error TS2339: Property 'p' does not exist on type 'typeof C1'.
|
||||
tests/cases/compiler/staticVisibility.ts(31,12): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -19,12 +19,12 @@ tests/cases/compiler/staticVisibility.ts(33,29): error TS2304: Cannot find name
|
||||
|
||||
s = 1; // should be error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 's'.
|
||||
!!! error TS2662: Cannot find name 's'. Did you mean the static member 'C1.s'?
|
||||
C1.s = 1; // should be ok
|
||||
|
||||
b(); // should be error
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'b'.
|
||||
!!! error TS2662: Cannot find name 'b'. Did you mean the static member 'C1.b'?
|
||||
C1.b(); // should be ok
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//// [typeGuardOfFormTypeOfPrimitiveSubtype.ts]
|
||||
let a: {};
|
||||
let b: {toString(): string};
|
||||
if (typeof a === "number") {
|
||||
let c: number = a;
|
||||
}
|
||||
if (typeof a === "string") {
|
||||
let c: string = a;
|
||||
}
|
||||
if (typeof a === "boolean") {
|
||||
let c: boolean = a;
|
||||
}
|
||||
|
||||
if (typeof b === "number") {
|
||||
let c: number = b;
|
||||
}
|
||||
if (typeof b === "string") {
|
||||
let c: string = b;
|
||||
}
|
||||
if (typeof b === "boolean") {
|
||||
let c: boolean = b;
|
||||
}
|
||||
|
||||
|
||||
//// [typeGuardOfFormTypeOfPrimitiveSubtype.js]
|
||||
var a;
|
||||
var b;
|
||||
if (typeof a === "number") {
|
||||
var c = a;
|
||||
}
|
||||
if (typeof a === "string") {
|
||||
var c = a;
|
||||
}
|
||||
if (typeof a === "boolean") {
|
||||
var c = a;
|
||||
}
|
||||
if (typeof b === "number") {
|
||||
var c = b;
|
||||
}
|
||||
if (typeof b === "string") {
|
||||
var c = b;
|
||||
}
|
||||
if (typeof b === "boolean") {
|
||||
var c = b;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts ===
|
||||
let a: {};
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
|
||||
let b: {toString(): string};
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
>toString : Symbol(toString, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 8))
|
||||
|
||||
if (typeof a === "number") {
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
|
||||
let c: number = a;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 3, 7))
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
}
|
||||
if (typeof a === "string") {
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
|
||||
let c: string = a;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 6, 7))
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
}
|
||||
if (typeof a === "boolean") {
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
|
||||
let c: boolean = a;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 9, 7))
|
||||
>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3))
|
||||
}
|
||||
|
||||
if (typeof b === "number") {
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
|
||||
let c: number = b;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 13, 7))
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
}
|
||||
if (typeof b === "string") {
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
|
||||
let c: string = b;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 16, 7))
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
}
|
||||
if (typeof b === "boolean") {
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
|
||||
let c: boolean = b;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 19, 7))
|
||||
>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts ===
|
||||
let a: {};
|
||||
>a : {}
|
||||
|
||||
let b: {toString(): string};
|
||||
>b : { toString(): string; }
|
||||
>toString : () => string
|
||||
|
||||
if (typeof a === "number") {
|
||||
>typeof a === "number" : boolean
|
||||
>typeof a : string
|
||||
>a : {}
|
||||
>"number" : string
|
||||
|
||||
let c: number = a;
|
||||
>c : number
|
||||
>a : number
|
||||
}
|
||||
if (typeof a === "string") {
|
||||
>typeof a === "string" : boolean
|
||||
>typeof a : string
|
||||
>a : {}
|
||||
>"string" : string
|
||||
|
||||
let c: string = a;
|
||||
>c : string
|
||||
>a : string
|
||||
}
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>a : {}
|
||||
>"boolean" : string
|
||||
|
||||
let c: boolean = a;
|
||||
>c : boolean
|
||||
>a : boolean
|
||||
}
|
||||
|
||||
if (typeof b === "number") {
|
||||
>typeof b === "number" : boolean
|
||||
>typeof b : string
|
||||
>b : { toString(): string; }
|
||||
>"number" : string
|
||||
|
||||
let c: number = b;
|
||||
>c : number
|
||||
>b : number
|
||||
}
|
||||
if (typeof b === "string") {
|
||||
>typeof b === "string" : boolean
|
||||
>typeof b : string
|
||||
>b : { toString(): string; }
|
||||
>"string" : string
|
||||
|
||||
let c: string = b;
|
||||
>c : string
|
||||
>b : string
|
||||
}
|
||||
if (typeof b === "boolean") {
|
||||
>typeof b === "boolean" : boolean
|
||||
>typeof b : string
|
||||
>b : { toString(): string; }
|
||||
>"boolean" : string
|
||||
|
||||
let c: boolean = b;
|
||||
>c : boolean
|
||||
>b : boolean
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/unqualifiedCallToClassStatic1.ts(4,3): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/compiler/unqualifiedCallToClassStatic1.ts(4,3): error TS2662: Cannot find name 'foo'. Did you mean the static member 'Vector.foo'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/unqualifiedCallToClassStatic1.ts (1 errors) ====
|
||||
@@ -7,6 +7,6 @@ tests/cases/compiler/unqualifiedCallToClassStatic1.ts(4,3): error TS2304: Cannot
|
||||
// 'foo' cannot be called in an unqualified manner.
|
||||
foo();
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
!!! error TS2662: Cannot find name 'foo'. Did you mean the static member 'Vector.foo'?
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
static foo: string;
|
||||
|
||||
bar() {
|
||||
let k = foo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
foo: string;
|
||||
|
||||
static bar() {
|
||||
let k = foo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
() => x;
|
||||
}
|
||||
|
||||
function foo() {
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
switch(a) {
|
||||
case 0: return () => a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// @target: ES6
|
||||
for (;;) {
|
||||
let x = 1;
|
||||
() => x;
|
||||
}
|
||||
|
||||
function foo() {
|
||||
for (;;) {
|
||||
const a = 0;
|
||||
switch(a) {
|
||||
case 0: return () => a;
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
let a: {};
|
||||
let b: {toString(): string};
|
||||
if (typeof a === "number") {
|
||||
let c: number = a;
|
||||
}
|
||||
if (typeof a === "string") {
|
||||
let c: string = a;
|
||||
}
|
||||
if (typeof a === "boolean") {
|
||||
let c: boolean = a;
|
||||
}
|
||||
|
||||
if (typeof b === "number") {
|
||||
let c: number = b;
|
||||
}
|
||||
if (typeof b === "string") {
|
||||
let c: string = b;
|
||||
}
|
||||
if (typeof b === "boolean") {
|
||||
let c: boolean = b;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// interface interface1 extends interface1 {
|
||||
//// /*1*/doStuff(): void;
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
|
||||
let markers = test.markers()
|
||||
for (let marker of markers) {
|
||||
goTo.position(marker.position);
|
||||
verify.documentHighlightsAtPositionCount(1, ["file1.ts"]);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// class class1 extends class1 {
|
||||
//// /*1*/doStuff() { }
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
|
||||
let markers = test.markers()
|
||||
for (let marker of markers) {
|
||||
goTo.position(marker.position);
|
||||
verify.documentHighlightsAtPositionCount(1, ["file1.ts"]);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// interface interface1 extends interface1 {
|
||||
//// /*1*/doStuff(): void;
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v./*3*/propName;
|
||||
//// v./*4*/doStuff();
|
||||
|
||||
let markers = test.markers()
|
||||
for (let marker of markers) {
|
||||
goTo.position(marker.position);
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// class class1 extends class1 {
|
||||
//// /*1*/doStuff() { }
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var c: class1;
|
||||
//// c./*3*/doStuff();
|
||||
//// c./*4*/propName;
|
||||
|
||||
let markers = test.markers()
|
||||
for (let marker of markers) {
|
||||
goTo.position(marker.position);
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// interface C extends D {
|
||||
//// /*0*/prop0: string;
|
||||
//// /*1*/prop1: number;
|
||||
//// }
|
||||
////
|
||||
//// interface D extends C {
|
||||
//// /*2*/prop0: string;
|
||||
//// /*3*/prop1: number;
|
||||
//// }
|
||||
////
|
||||
//// var d: D;
|
||||
//// d./*4*/prop1;
|
||||
|
||||
goTo.marker("0");
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.documentHighlightsAtPositionCount(3, ["file1.ts"]);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.documentHighlightsAtPositionCount(3, ["file1.ts"]);
|
||||
|
||||
goTo.marker("4");
|
||||
verify.documentHighlightsAtPositionCount(3, ["file1.ts"]);
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// class C extends D {
|
||||
//// /*0*/prop0: string;
|
||||
//// /*1*/prop1: string;
|
||||
//// }
|
||||
////
|
||||
//// class D extends C {
|
||||
//// /*2*/prop0: string;
|
||||
//// /*3*/prop1: string;
|
||||
//// }
|
||||
////
|
||||
//// var d: D;
|
||||
//// d./*4*/prop1;
|
||||
|
||||
goTo.marker("0");
|
||||
verify.documentHighlightsAtPositionCount(1, ["file1.ts"]);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.documentHighlightsAtPositionCount(1, ["file1.ts"]);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.documentHighlightsAtPositionCount(1, ["file1.ts"]);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
|
||||
goTo.marker("4");
|
||||
verify.documentHighlightsAtPositionCount(2, ["file1.ts"]);
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// [|doStuff|]() { }
|
||||
//// [|propName|]: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: class1;
|
||||
//// v.[|doStuff|]();
|
||||
//// v.[|propName|];
|
||||
|
||||
function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) {
|
||||
goTo.position(query.start);
|
||||
for (const ref of references) {
|
||||
verify.referencesAtPositionContains(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
const [r0, r1, r2, r3] = ranges;
|
||||
verifyReferences(r0, [r0, r2]);
|
||||
verifyReferences(r1, [r1, r3]);
|
||||
verifyReferences(r2, [r0, r2]);
|
||||
verifyReferences(r3, [r1, r3]);
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface interface1 extends interface1 {
|
||||
//// [|doStuff|](): void; // r0
|
||||
//// [|propName|]: string; // r1
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v.[|doStuff|](); // r2
|
||||
//// v.[|propName|]; // r3
|
||||
|
||||
function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) {
|
||||
goTo.position(query.start);
|
||||
for (const ref of references) {
|
||||
verify.referencesAtPositionContains(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
const [r0, r1, r2, r3] = ranges;
|
||||
verifyReferences(r0, [r0, r2]);
|
||||
verifyReferences(r1, [r1, r3]);
|
||||
verifyReferences(r2, [r0, r2]);
|
||||
verifyReferences(r3, [r1, r3]);
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// [|doStuff|]() { } // r0
|
||||
//// [|propName|]: string; // r1
|
||||
//// }
|
||||
//// interface interface1 extends interface1 {
|
||||
//// [|doStuff|](): void; // r2
|
||||
//// [|propName|]: string; // r3
|
||||
//// }
|
||||
//// class class2 extends class1 implements interface1 {
|
||||
//// [|doStuff|]() { } // r4
|
||||
//// [|propName|]: string; // r5
|
||||
//// }
|
||||
////
|
||||
//// var v: class2;
|
||||
//// v.[|propName|]; // r6
|
||||
//// v.[|doStuff|](); // r7
|
||||
|
||||
function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) {
|
||||
goTo.position(query.start);
|
||||
for (const ref of references) {
|
||||
verify.referencesAtPositionContains(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
const [r0, r1, r2, r3, r4, r5, r6, r7] = ranges;
|
||||
verifyReferences(r0, [r0]);
|
||||
verifyReferences(r1, [r1, r5, r6]);
|
||||
verifyReferences(r2, [r2, r4, r7]);
|
||||
verifyReferences(r3, [r3, r5, r6]);
|
||||
verifyReferences(r4, [r2, r4, r7]);
|
||||
verifyReferences(r5, [r1, r3, r5, r6]);
|
||||
verifyReferences(r6, [r1, r3, r5, r6]);
|
||||
verifyReferences(r7, [r2, r4, r7]);
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface C extends D {
|
||||
//// [|prop0|]: string; // r0
|
||||
//// [|prop1|]: number; // r1
|
||||
//// }
|
||||
////
|
||||
//// interface D extends C {
|
||||
//// [|prop0|]: string; // r2
|
||||
//// }
|
||||
////
|
||||
//// var d: D;
|
||||
//// d.[|prop0|]; // r3
|
||||
//// d.[|prop1|]; // r4
|
||||
|
||||
function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) {
|
||||
goTo.position(query.start);
|
||||
for (const ref of references) {
|
||||
verify.referencesAtPositionContains(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
const [r0, r1, r2, r3, r4] = ranges;
|
||||
verifyReferences(r0, [r0, r2, r3]);
|
||||
verifyReferences(r1, [r1]);
|
||||
verifyReferences(r2, [r0, r2, r3]);
|
||||
verifyReferences(r3, [r0, r2, r3]);
|
||||
verifyReferences(r4, []);
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class C extends D {
|
||||
//// [|prop0|]: string; // r0
|
||||
//// [|prop1|]: number; // r1
|
||||
//// }
|
||||
////
|
||||
//// class D extends C {
|
||||
//// [|prop0|]: string; // r2
|
||||
//// }
|
||||
////
|
||||
//// var d: D;
|
||||
//// d.[|prop0|]; // r3
|
||||
//// d.[|prop1|]; // r4
|
||||
|
||||
function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) {
|
||||
goTo.position(query.start);
|
||||
for (const ref of references) {
|
||||
verify.referencesAtPositionContains(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
const [r0, r1, r2, r3, r4] = ranges;
|
||||
verifyReferences(r0, [r0]);
|
||||
verifyReferences(r1, [r1]);
|
||||
verifyReferences(r2, [r2, r3]);
|
||||
verifyReferences(r3, [r2, r3]);
|
||||
verifyReferences(r4, []);
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface interface1 extends interface1 {
|
||||
//// /*1*/doStuff(): void;
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v./*3*/propName;
|
||||
//// v./*4*/doStuff();
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.referencesCountIs(2);
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// /*1*/doStuff() { }
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var c: class1;
|
||||
//// c./*3*/doStuff();
|
||||
//// c./*4*/propName;
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.referencesCountIs(2);
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface interface1 extends interface1 {
|
||||
//// /*1*/doStuff(): void;
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
//// interface interface2 extends interface1 {
|
||||
//// /*3*/doStuff(): void;
|
||||
//// /*4*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v./*5*/propName;
|
||||
//// v./*6*/doStuff();
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.referencesCountIs(3);
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// /*1*/doStuff() { }
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
//// class class2 extends class1 {
|
||||
//// /*3*/doStuff() { }
|
||||
//// /*4*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: class2;
|
||||
//// v./*5*/propName;
|
||||
//// v./*6*/doStuff();
|
||||
|
||||
goTo.marker("1");
|
||||
verify.referencesCountIs(1);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.referencesCountIs(2);
|
||||
|
||||
goTo.marker("4");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("5");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("6");
|
||||
verify.referencesCountIs(2);
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// /*1*/doStuff() { }
|
||||
//// /*2*/propName: string;
|
||||
//// }
|
||||
//// interface interface1 extends interface1 {
|
||||
//// /*3*/doStuff(): void;
|
||||
//// /*4*/propName: string;
|
||||
//// }
|
||||
//// class class2 extends class1 implements interface1 {
|
||||
//// /*5*/doStuff() { }
|
||||
//// /*6*/propName: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: class2;
|
||||
//// v./*7*/propName;
|
||||
//// v./*8*/doStuff();
|
||||
|
||||
goTo.marker("1");
|
||||
verify.referencesCountIs(1);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("4");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("5");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("6");
|
||||
verify.referencesCountIs(4);
|
||||
|
||||
goTo.marker("7");
|
||||
verify.referencesCountIs(4);
|
||||
|
||||
goTo.marker("8");
|
||||
verify.referencesCountIs(3);
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface C extends D {
|
||||
//// /*0*/propD: number;
|
||||
//// }
|
||||
//// interface D extends C {
|
||||
//// /*1*/propD: string;
|
||||
//// /*3*/propC: number;
|
||||
//// }
|
||||
//// var d: D;
|
||||
//// d./*2*/propD;
|
||||
//// d./*4*/propC;
|
||||
|
||||
goTo.marker("0");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker("3");
|
||||
verify.referencesCountIs(2);
|
||||
|
||||
goTo.marker("4");
|
||||
verify.referencesCountIs(2);
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class D extends C {
|
||||
//// /*0*/prop1: string;
|
||||
//// }
|
||||
////
|
||||
//// class C extends D {
|
||||
//// /*1*/prop1: string;
|
||||
//// }
|
||||
////
|
||||
//// var c: C;
|
||||
//// c./*2*/prop1;
|
||||
|
||||
goTo.marker("0");
|
||||
verify.referencesCountIs(1);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.referencesCountIs(2)
|
||||
|
||||
goTo.marker("2");
|
||||
verify.referencesCountIs(2)
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// [|propName|]: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: class1;
|
||||
//// v.[|propName|];
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (const range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// [|doStuff|]() { }
|
||||
//// }
|
||||
////
|
||||
//// var v: class1;
|
||||
//// v.[|doStuff|]();
|
||||
|
||||
let ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface interface1 extends interface1 {
|
||||
//// [|propName|]: string;
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v.[|propName|];
|
||||
|
||||
let ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface interface1 extends interface1 {
|
||||
//// [|doStuff|](): string;
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v.[|doStuff|]();
|
||||
|
||||
let ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface C extends D {
|
||||
//// propC: number;
|
||||
//// }
|
||||
//// interface D extends C {
|
||||
//// [|propD|]: string;
|
||||
//// }
|
||||
//// var d: D;
|
||||
//// d.[|propD|];
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (const range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface C extends D {
|
||||
//// propD: number;
|
||||
//// }
|
||||
//// interface D extends C {
|
||||
//// [|propC|]: number;
|
||||
//// }
|
||||
//// var d: D;
|
||||
//// d.[|propC|];
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (const range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class C extends D {
|
||||
//// [|prop1|]: string;
|
||||
//// }
|
||||
////
|
||||
//// class D extends C {
|
||||
//// prop1: string;
|
||||
//// }
|
||||
////
|
||||
//// var c: C;
|
||||
//// c.[|prop1|];
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (const range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class C implements D {
|
||||
//// [|prop1|]: string;
|
||||
//// }
|
||||
////
|
||||
//// interface D extends C {
|
||||
//// [|prop1|]: string;
|
||||
//// }
|
||||
////
|
||||
//// var c: C;
|
||||
//// c.[|prop1|];
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.assertHasRanges(ranges);
|
||||
for (const range of ranges) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
Reference in New Issue
Block a user