mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merge with origin/master
This commit is contained in:
@@ -34,6 +34,7 @@ if (process.env.path !== undefined) {
|
||||
|
||||
var compilerSources = [
|
||||
"core.ts",
|
||||
"performance.ts",
|
||||
"sys.ts",
|
||||
"types.ts",
|
||||
"scanner.ts",
|
||||
@@ -54,6 +55,7 @@ var compilerSources = [
|
||||
|
||||
var servicesSources = [
|
||||
"core.ts",
|
||||
"performance.ts",
|
||||
"sys.ts",
|
||||
"types.ts",
|
||||
"scanner.ts",
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
export let bindTime = 0;
|
||||
|
||||
export const enum ModuleInstanceState {
|
||||
NonInstantiated = 0,
|
||||
Instantiated = 1,
|
||||
@@ -91,9 +89,9 @@ namespace ts {
|
||||
const binder = createBinder();
|
||||
|
||||
export function bindSourceFile(file: SourceFile, options: CompilerOptions) {
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
binder(file, options);
|
||||
bindTime += new Date().getTime() - start;
|
||||
performance.measure("Bind", start);
|
||||
}
|
||||
|
||||
function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
|
||||
|
||||
@@ -15,8 +15,6 @@ namespace ts {
|
||||
return node.id;
|
||||
}
|
||||
|
||||
export let checkTime = 0;
|
||||
|
||||
export function getSymbolId(symbol: Symbol): number {
|
||||
if (!symbol.id) {
|
||||
symbol.id = nextSymbolId;
|
||||
@@ -976,7 +974,7 @@ namespace ts {
|
||||
|
||||
Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(<Declaration>getAncestor(declaration, SyntaxKind.VariableDeclaration), errorLocation)) {
|
||||
if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(<Declaration>getAncestor(declaration, SyntaxKind.VariableDeclaration), errorLocation)) {
|
||||
error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name));
|
||||
}
|
||||
}
|
||||
@@ -17026,11 +17024,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkSourceFile(node: SourceFile) {
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
|
||||
checkSourceFileWorker(node);
|
||||
|
||||
checkTime += new Date().getTime() - start;
|
||||
performance.measure("Check", start);
|
||||
}
|
||||
|
||||
// Fully type check a source file and collect the relevant diagnostics.
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace ts {
|
||||
name: "diagnostics",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "extendedDiagnostics",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "emitBOM",
|
||||
type: "boolean"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/// <reference path="types.ts"/>
|
||||
/// <reference path="performance.ts" />
|
||||
|
||||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
|
||||
@@ -4571,14 +4571,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
|
||||
function emitRestParameter(node: FunctionLikeDeclaration) {
|
||||
if (languageVersion < ScriptTarget.ES6 && hasDeclaredRestParameter(node)) {
|
||||
const restIndex = node.parameters.length - 1;
|
||||
const restParam = node.parameters[restIndex];
|
||||
const restParam = node.parameters[node.parameters.length - 1];
|
||||
|
||||
// A rest parameter cannot have a binding pattern, so let's just ignore it if it does.
|
||||
if (isBindingPattern(restParam.name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const skipThisCount = node.parameters.length && (<Identifier>node.parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword ? 1 : 0;
|
||||
const restIndex = node.parameters.length - 1 - skipThisCount;
|
||||
const tempName = createTempVariable(TempFlags._i).text;
|
||||
writeLine();
|
||||
emitLeadingComments(restParam);
|
||||
@@ -4726,7 +4727,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
write("(");
|
||||
if (node) {
|
||||
const parameters = node.parameters;
|
||||
const skipCount = node.parameters.length && (<Identifier>node.parameters[0].name).text === "this" ? 1 : 0;
|
||||
const skipCount = node.parameters.length && (<Identifier>node.parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword ? 1 : 0;
|
||||
const omitCount = languageVersion < ScriptTarget.ES6 && hasDeclaredRestParameter(node) ? 1 : 0;
|
||||
emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false);
|
||||
}
|
||||
@@ -6156,10 +6157,11 @@ const _super = (function (geti, seti) {
|
||||
|
||||
if (valueDeclaration) {
|
||||
const parameters = valueDeclaration.parameters;
|
||||
const skipThisCount = parameters.length && (<Identifier>parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword ? 1 : 0;
|
||||
const parameterCount = parameters.length;
|
||||
if (parameterCount > 0) {
|
||||
for (let i = 0; i < parameterCount; i++) {
|
||||
if (i > 0) {
|
||||
if (parameterCount > skipThisCount) {
|
||||
for (let i = skipThisCount; i < parameterCount; i++) {
|
||||
if (i > skipThisCount) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
/// <reference path="scanner.ts"/>
|
||||
|
||||
namespace ts {
|
||||
/* @internal */ export let parseTime = 0;
|
||||
|
||||
let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
@@ -421,10 +419,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile {
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
const result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
|
||||
|
||||
parseTime += new Date().getTime() - start;
|
||||
performance.measure("Parse", start);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*@internal*/
|
||||
namespace ts {
|
||||
declare const performance: { now?(): number } | undefined;
|
||||
/** Gets a timestamp with (at least) ms resolution */
|
||||
export const timestamp = typeof performance !== "undefined" && performance.now ? performance.now : Date.now ? Date.now : () => +(new Date());
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
namespace ts.performance {
|
||||
/** Performance measurements for the compiler. */
|
||||
declare const onProfilerEvent: { (markName: string): void; profiler: boolean; };
|
||||
let profilerEvent: (markName: string) => void;
|
||||
let counters: Map<number>;
|
||||
let measures: Map<number>;
|
||||
|
||||
/**
|
||||
* Emit a performance event if ts-profiler is connected. This is primarily used
|
||||
* to generate heap snapshots.
|
||||
*
|
||||
* @param eventName A name for the event.
|
||||
*/
|
||||
export function emit(eventName: string) {
|
||||
if (profilerEvent) {
|
||||
profilerEvent(eventName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments a counter with the specified name.
|
||||
*
|
||||
* @param counterName The name of the counter.
|
||||
*/
|
||||
export function increment(counterName: string) {
|
||||
if (counters) {
|
||||
counters[counterName] = (getProperty(counters, counterName) || 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the counter with the specified name.
|
||||
*
|
||||
* @param counterName The name of the counter.
|
||||
*/
|
||||
export function getCount(counterName: string) {
|
||||
return counters && getProperty(counters, counterName) || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the start of a performance measurement.
|
||||
*/
|
||||
export function mark() {
|
||||
return measures ? timestamp() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a performance measurement with the specified name.
|
||||
*
|
||||
* @param measureName The name of the performance measurement.
|
||||
* @param marker The timestamp of the starting mark.
|
||||
*/
|
||||
export function measure(measureName: string, marker: number) {
|
||||
if (measures) {
|
||||
measures[measureName] = (getProperty(measures, measureName) || 0) + (timestamp() - marker);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over each measure, performing some action
|
||||
*
|
||||
* @param cb The action to perform for each measure
|
||||
*/
|
||||
export function forEachMeasure(cb: (measureName: string, duration: number) => void) {
|
||||
return forEachKey(measures, key => cb(key, measures[key]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total duration of all measurements with the supplied name.
|
||||
*
|
||||
* @param measureName The name of the measure whose durations should be accumulated.
|
||||
*/
|
||||
export function getDuration(measureName: string) {
|
||||
return measures && getProperty(measures, measureName) || 0;
|
||||
}
|
||||
|
||||
/** Enables (and resets) performance measurements for the compiler. */
|
||||
export function enable() {
|
||||
counters = { };
|
||||
measures = {
|
||||
"I/O Read": 0,
|
||||
"I/O Write": 0,
|
||||
"Program": 0,
|
||||
"Parse": 0,
|
||||
"Bind": 0,
|
||||
"Check": 0,
|
||||
"Emit": 0,
|
||||
};
|
||||
|
||||
profilerEvent = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true
|
||||
? onProfilerEvent
|
||||
: undefined;
|
||||
}
|
||||
|
||||
/** Disables (and clears) performance measurements for the compiler. */
|
||||
export function disable() {
|
||||
counters = undefined;
|
||||
measures = undefined;
|
||||
profilerEvent = undefined;
|
||||
}
|
||||
}
|
||||
+8
-13
@@ -3,11 +3,6 @@
|
||||
/// <reference path="core.ts" />
|
||||
|
||||
namespace ts {
|
||||
/* @internal */ export let programTime = 0;
|
||||
/* @internal */ export let emitTime = 0;
|
||||
/* @internal */ export let ioReadTime = 0;
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "2.1.0";
|
||||
|
||||
@@ -865,9 +860,9 @@ namespace ts {
|
||||
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile {
|
||||
let text: string;
|
||||
try {
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
text = sys.readFile(fileName, options.charset);
|
||||
ioReadTime += new Date().getTime() - start;
|
||||
performance.measure("I/O Read", start);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
@@ -934,7 +929,7 @@ namespace ts {
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) {
|
||||
try {
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName)));
|
||||
|
||||
if (isWatchSet(options) && sys.createHash && sys.getModifiedTime) {
|
||||
@@ -944,7 +939,7 @@ namespace ts {
|
||||
sys.writeFile(fileName, data, writeByteOrderMark);
|
||||
}
|
||||
|
||||
ioWriteTime += new Date().getTime() - start;
|
||||
performance.measure("I/O Write", start);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
@@ -1121,7 +1116,7 @@ namespace ts {
|
||||
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
|
||||
const sourceFilesFoundSearchingNodeModules: Map<boolean> = {};
|
||||
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
|
||||
host = host || createCompilerHost(options);
|
||||
|
||||
@@ -1221,7 +1216,7 @@ namespace ts {
|
||||
|
||||
verifyCompilerOptions();
|
||||
|
||||
programTime += new Date().getTime() - start;
|
||||
performance.measure("Program", start);
|
||||
|
||||
return program;
|
||||
|
||||
@@ -1468,14 +1463,14 @@ namespace ts {
|
||||
// checked is to not pass the file to getEmitResolver.
|
||||
const emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile);
|
||||
|
||||
const start = new Date().getTime();
|
||||
const start = performance.mark();
|
||||
|
||||
const emitResult = emitFiles(
|
||||
emitResolver,
|
||||
getEmitHost(writeFileCallback),
|
||||
sourceFile);
|
||||
|
||||
emitTime += new Date().getTime() - start;
|
||||
performance.measure("Emit", start);
|
||||
return emitResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,6 +240,8 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
const start = performance.mark();
|
||||
|
||||
const sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos);
|
||||
|
||||
// Convert the location to be one-based.
|
||||
@@ -279,6 +281,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
updateLastEncodedAndRecordedSpans();
|
||||
|
||||
performance.measure("Source Map", start);
|
||||
}
|
||||
|
||||
function getStartPos(range: TextRange) {
|
||||
|
||||
+24
-17
@@ -550,12 +550,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
function compile(fileNames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) {
|
||||
ioReadTime = 0;
|
||||
ioWriteTime = 0;
|
||||
programTime = 0;
|
||||
bindTime = 0;
|
||||
checkTime = 0;
|
||||
emitTime = 0;
|
||||
const hasDiagnostics = compilerOptions.diagnostics || compilerOptions.extendedDiagnostics;
|
||||
if (hasDiagnostics) performance.enable();
|
||||
|
||||
const program = createProgram(fileNames, compilerOptions, compilerHost);
|
||||
const exitStatus = compileProgram();
|
||||
@@ -566,7 +562,7 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
if (compilerOptions.diagnostics) {
|
||||
if (hasDiagnostics) {
|
||||
const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
|
||||
reportCountStatistic("Files", program.getSourceFiles().length);
|
||||
reportCountStatistic("Lines", countLines(program));
|
||||
@@ -579,17 +575,28 @@ namespace ts {
|
||||
reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
|
||||
}
|
||||
|
||||
// Individual component times.
|
||||
// Note: To match the behavior of previous versions of the compiler, the reported parse time includes
|
||||
// I/O read time and processing time for triple-slash references and module imports, and the reported
|
||||
// emit time includes I/O write time. We preserve this behavior so we can accurately compare times.
|
||||
reportTimeStatistic("I/O read", ioReadTime);
|
||||
reportTimeStatistic("I/O write", ioWriteTime);
|
||||
reportTimeStatistic("Parse time", programTime);
|
||||
reportTimeStatistic("Bind time", bindTime);
|
||||
reportTimeStatistic("Check time", checkTime);
|
||||
reportTimeStatistic("Emit time", emitTime);
|
||||
const programTime = performance.getDuration("Program");
|
||||
const bindTime = performance.getDuration("Bind");
|
||||
const checkTime = performance.getDuration("Check");
|
||||
const emitTime = performance.getDuration("Emit");
|
||||
if (compilerOptions.extendedDiagnostics) {
|
||||
performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration));
|
||||
}
|
||||
else {
|
||||
// Individual component times.
|
||||
// Note: To match the behavior of previous versions of the compiler, the reported parse time includes
|
||||
// I/O read time and processing time for triple-slash references and module imports, and the reported
|
||||
// emit time includes I/O write time. We preserve this behavior so we can accurately compare times.
|
||||
reportTimeStatistic("I/O read", performance.getDuration("I/O Read"));
|
||||
reportTimeStatistic("I/O write", performance.getDuration("I/O Write"));
|
||||
reportTimeStatistic("Parse time", programTime);
|
||||
reportTimeStatistic("Bind time", bindTime);
|
||||
reportTimeStatistic("Check time", checkTime);
|
||||
reportTimeStatistic("Emit time", emitTime);
|
||||
}
|
||||
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
|
||||
|
||||
performance.disable();
|
||||
}
|
||||
|
||||
return { program, exitStatus };
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
},
|
||||
"files": [
|
||||
"core.ts",
|
||||
"performance.ts",
|
||||
"sys.ts",
|
||||
"types.ts",
|
||||
"scanner.ts",
|
||||
|
||||
@@ -2540,6 +2540,7 @@ namespace ts {
|
||||
declaration?: boolean;
|
||||
declarationDir?: string;
|
||||
/* @internal */ diagnostics?: boolean;
|
||||
/* @internal */ extendedDiagnostics?: boolean;
|
||||
disableSizeLimit?: boolean;
|
||||
emitBOM?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
},
|
||||
"files": [
|
||||
"../compiler/core.ts",
|
||||
"../compiler/performance.ts",
|
||||
"../compiler/sys.ts",
|
||||
"../compiler/types.ts",
|
||||
"../compiler/scanner.ts",
|
||||
|
||||
Vendored
+2
-2
@@ -513,8 +513,8 @@ interface NumberConstructor {
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare const Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
readonly raw: string[];
|
||||
interface TemplateStringsArray extends ReadonlyArray<string> {
|
||||
readonly raw: ReadonlyArray<string>
|
||||
}
|
||||
|
||||
interface Math {
|
||||
|
||||
+20
-20
@@ -94,7 +94,7 @@ namespace ts {
|
||||
* change range cannot be determined. However, in that case, incremental parsing will
|
||||
* not happen and the entire document will be re - parsed.
|
||||
*/
|
||||
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
|
||||
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
|
||||
|
||||
/** Releases all resources held by this script snapshot */
|
||||
dispose?(): void;
|
||||
@@ -450,7 +450,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
IdentifierObject.prototype.kind = SyntaxKind.Identifier;
|
||||
|
||||
|
||||
class SymbolObject implements Symbol {
|
||||
flags: SymbolFlags;
|
||||
name: string;
|
||||
@@ -3436,14 +3436,14 @@ namespace ts {
|
||||
|
||||
let isJsDocTagName = false;
|
||||
|
||||
let start = new Date().getTime();
|
||||
let start = timestamp();
|
||||
const currentToken = getTokenAtPosition(sourceFile, position);
|
||||
log("getCompletionData: Get current token: " + (new Date().getTime() - start));
|
||||
log("getCompletionData: Get current token: " + (timestamp() - start));
|
||||
|
||||
start = new Date().getTime();
|
||||
start = timestamp();
|
||||
// Completion not allowed inside comments, bail out if this is the case
|
||||
const insideComment = isInsideComment(sourceFile, currentToken, position);
|
||||
log("getCompletionData: Is inside comment: " + (new Date().getTime() - start));
|
||||
log("getCompletionData: Is inside comment: " + (timestamp() - start));
|
||||
|
||||
if (insideComment) {
|
||||
// The current position is next to the '@' sign, when no tag name being provided yet.
|
||||
@@ -3486,9 +3486,9 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
start = new Date().getTime();
|
||||
start = timestamp();
|
||||
const previousToken = findPrecedingToken(position, sourceFile);
|
||||
log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start));
|
||||
log("getCompletionData: Get previous token 1: " + (timestamp() - start));
|
||||
|
||||
// The decision to provide completion depends on the contextToken, which is determined through the previousToken.
|
||||
// Note: 'previousToken' (and thus 'contextToken') can be undefined if we are the beginning of the file
|
||||
@@ -3497,9 +3497,9 @@ namespace ts {
|
||||
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
|
||||
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
|
||||
if (contextToken && position <= contextToken.end && isWord(contextToken.kind)) {
|
||||
const start = new Date().getTime();
|
||||
const start = timestamp();
|
||||
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile);
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start));
|
||||
log("getCompletionData: Get previous token 2: " + (timestamp() - start));
|
||||
}
|
||||
|
||||
// Find the node where completion is requested on.
|
||||
@@ -3546,7 +3546,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const semanticStart = new Date().getTime();
|
||||
const semanticStart = timestamp();
|
||||
let isMemberCompletion: boolean;
|
||||
let isNewIdentifierLocation: boolean;
|
||||
let symbols: Symbol[] = [];
|
||||
@@ -3584,7 +3584,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
log("getCompletionData: Semantic work: " + (new Date().getTime() - semanticStart));
|
||||
log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
|
||||
|
||||
return { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName };
|
||||
|
||||
@@ -3728,12 +3728,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isCompletionListBlocker(contextToken: Node): boolean {
|
||||
const start = new Date().getTime();
|
||||
const start = timestamp();
|
||||
const result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
|
||||
isSolelyIdentifierDefinitionLocation(contextToken) ||
|
||||
isDotOfNumericLiteral(contextToken) ||
|
||||
isInJsxText(contextToken);
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (timestamp() - start));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4386,7 +4386,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: CompletionEntry[], location: Node, performCharacterChecks: boolean): Map<string> {
|
||||
const start = new Date().getTime();
|
||||
const start = timestamp();
|
||||
const uniqueNames: Map<string> = {};
|
||||
if (symbols) {
|
||||
for (const symbol of symbols) {
|
||||
@@ -4401,7 +4401,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start));
|
||||
log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp() - start));
|
||||
return uniqueNames;
|
||||
}
|
||||
|
||||
@@ -7822,15 +7822,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getIndentationAtPosition(fileName: string, position: number, optionsOrSettings: EditorOptions | EditorSettings) {
|
||||
let start = new Date().getTime();
|
||||
let start = timestamp();
|
||||
const settings = toEditorSettings(optionsOrSettings);
|
||||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start));
|
||||
log("getIndentationAtPosition: getCurrentSourceFile: " + (timestamp() - start));
|
||||
|
||||
start = new Date().getTime();
|
||||
start = timestamp();
|
||||
|
||||
const result = formatting.SmartIndenter.getIndentation(position, sourceFile, settings);
|
||||
log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start));
|
||||
log("getIndentationAtPosition: computeIndentation : " + (timestamp() - start));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
public isCancellationRequested(): boolean {
|
||||
const time = Date.now();
|
||||
const time = timestamp();
|
||||
const duration = Math.abs(time - this.lastCancellationCheckTime);
|
||||
if (duration > 10) {
|
||||
// Check no more than once every 10 ms.
|
||||
@@ -498,13 +498,13 @@ namespace ts {
|
||||
let start: number;
|
||||
if (logPerformance) {
|
||||
logger.log(actionDescription);
|
||||
start = Date.now();
|
||||
start = timestamp();
|
||||
}
|
||||
|
||||
const result = action();
|
||||
|
||||
if (logPerformance) {
|
||||
const end = Date.now();
|
||||
const end = timestamp();
|
||||
logger.log(`${actionDescription} completed in ${end - start} msec`);
|
||||
if (typeof result === "string") {
|
||||
let str = result;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"files": [
|
||||
"../compiler/core.ts",
|
||||
"../compiler/performance.ts",
|
||||
"../compiler/sys.ts",
|
||||
"../compiler/types.ts",
|
||||
"../compiler/scanner.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@ class A {
|
||||
class B {
|
||||
constructor(...args: number[]) {}
|
||||
@MyMethodDecorator
|
||||
method(...args: string[]) {}
|
||||
method(this: this, ...args: string[]) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ class B {
|
||||
@MyMethodDecorator
|
||||
>MyMethodDecorator : Symbol(MyMethodDecorator, Decl(emitDecoratorMetadata_restArgs.ts, 2, 13))
|
||||
|
||||
method(...args: string[]) {}
|
||||
method(this: this, ...args: string[]) {}
|
||||
>method : Symbol(B.method, Decl(emitDecoratorMetadata_restArgs.ts, 13, 37))
|
||||
>args : Symbol(args, Decl(emitDecoratorMetadata_restArgs.ts, 15, 11))
|
||||
>this : Symbol(this, Decl(emitDecoratorMetadata_restArgs.ts, 15, 11))
|
||||
>args : Symbol(args, Decl(emitDecoratorMetadata_restArgs.ts, 15, 22))
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ class B {
|
||||
@MyMethodDecorator
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
|
||||
method(...args: string[]) {}
|
||||
>method : (...args: string[]) => void
|
||||
method(this: this, ...args: string[]) {}
|
||||
>method : (this: this, ...args: string[]) => void
|
||||
>this : this
|
||||
>args : string[]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitSkipsThisWithRestParameter.ts]
|
||||
function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any {
|
||||
return function(this: any, ...args: any[]) {
|
||||
return fn.apply(this, [ this ].concat(args));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//// [emitSkipsThisWithRestParameter.js]
|
||||
function rebase(fn) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
return fn.apply(this, [this].concat(args));
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/emitSkipsThisWithRestParameter.ts ===
|
||||
function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any {
|
||||
>rebase : Symbol(rebase, Decl(emitSkipsThisWithRestParameter.ts, 0, 0))
|
||||
>fn : Symbol(fn, Decl(emitSkipsThisWithRestParameter.ts, 0, 16))
|
||||
>base : Symbol(base, Decl(emitSkipsThisWithRestParameter.ts, 0, 21))
|
||||
>args : Symbol(args, Decl(emitSkipsThisWithRestParameter.ts, 0, 31))
|
||||
>args : Symbol(args, Decl(emitSkipsThisWithRestParameter.ts, 0, 58))
|
||||
|
||||
return function(this: any, ...args: any[]) {
|
||||
>this : Symbol(this, Decl(emitSkipsThisWithRestParameter.ts, 1, 20))
|
||||
>args : Symbol(args, Decl(emitSkipsThisWithRestParameter.ts, 1, 30))
|
||||
|
||||
return fn.apply(this, [ this ].concat(args));
|
||||
>fn.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>fn : Symbol(fn, Decl(emitSkipsThisWithRestParameter.ts, 0, 16))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>this : Symbol(this, Decl(emitSkipsThisWithRestParameter.ts, 1, 20))
|
||||
>[ this ].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
|
||||
>this : Symbol(this, Decl(emitSkipsThisWithRestParameter.ts, 1, 20))
|
||||
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --))
|
||||
>args : Symbol(args, Decl(emitSkipsThisWithRestParameter.ts, 1, 30))
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/emitSkipsThisWithRestParameter.ts ===
|
||||
function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any {
|
||||
>rebase : (fn: (base: any, ...args: any[]) => any) => (...args: any[]) => any
|
||||
>fn : (base: any, ...args: any[]) => any
|
||||
>base : any
|
||||
>args : any[]
|
||||
>args : any[]
|
||||
|
||||
return function(this: any, ...args: any[]) {
|
||||
>function(this: any, ...args: any[]) { return fn.apply(this, [ this ].concat(args)); } : (this: any, ...args: any[]) => any
|
||||
>this : any
|
||||
>args : any[]
|
||||
|
||||
return fn.apply(this, [ this ].concat(args));
|
||||
>fn.apply(this, [ this ].concat(args)) : any
|
||||
>fn.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>fn : (base: any, ...args: any[]) => any
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>this : any
|
||||
>[ this ].concat(args) : any[]
|
||||
>[ this ].concat : (...items: any[]) => any[]
|
||||
>[ this ] : any[]
|
||||
>this : any
|
||||
>concat : (...items: any[]) => any[]
|
||||
>args : any[]
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/test.d.ts ===
|
||||
|
||||
declare var S: typeof A; // no error
|
||||
>S : Symbol(S, Decl(test.d.ts, 1, 11))
|
||||
>A : Symbol(A, Decl(test.d.ts, 2, 13))
|
||||
|
||||
declare const A: number;
|
||||
>A : Symbol(A, Decl(test.d.ts, 2, 13))
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/test.d.ts ===
|
||||
|
||||
declare var S: typeof A; // no error
|
||||
>S : number
|
||||
>A : number
|
||||
|
||||
declare const A: number;
|
||||
>A : number
|
||||
|
||||
@@ -13,60 +13,60 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
|
||||
noParams ``;
|
||||
|
||||
// Generic tag with parameter which does not use type parameter
|
||||
function noGenericParams<T>(n: string[]) { }
|
||||
function noGenericParams<T>(n: TemplateStringsArray) { }
|
||||
noGenericParams ``;
|
||||
|
||||
// Generic tag with multiple type parameters and only one used in parameter type annotation
|
||||
function someGenerics1a<T, U>(n: T, m: number) { }
|
||||
someGenerics1a `${3}`;
|
||||
|
||||
function someGenerics1b<T, U>(n: string[], m: U) { }
|
||||
function someGenerics1b<T, U>(n: TemplateStringsArray, m: U) { }
|
||||
someGenerics1b `${3}`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is of type parameter type
|
||||
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
|
||||
function someGenerics2a<T>(strs: TemplateStringsArray, n: (x: T) => void) { }
|
||||
someGenerics2a `${(n: string) => n}`;
|
||||
|
||||
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
|
||||
function someGenerics2b<T, U>(strs: TemplateStringsArray, n: (x: T, y: U) => void) { }
|
||||
someGenerics2b `${ (n: string, x: number) => n }`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
|
||||
function someGenerics3<T>(strs: string[], producer: () => T) { }
|
||||
function someGenerics3<T>(strs: TemplateStringsArray, producer: () => T) { }
|
||||
someGenerics3 `${() => ''}`;
|
||||
someGenerics3 `${() => undefined}`;
|
||||
someGenerics3 `${() => 3}`;
|
||||
|
||||
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
|
||||
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics4<T, U>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics4 `${4}${ () => null }`;
|
||||
someGenerics4 `${''}${ () => 3 }`;
|
||||
someGenerics4 `${ null }${ null }`;
|
||||
|
||||
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics5<U, T>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics5 `${ 4 } ${ () => null }`;
|
||||
someGenerics5 `${ '' }${ () => 3 }`;
|
||||
someGenerics5 `${null}${null}`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
|
||||
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
function someGenerics6<A>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of different generic type
|
||||
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
function someGenerics7<A, B, C>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
|
||||
|
||||
// Generic tag with argument of generic function type
|
||||
function someGenerics8<T>(strs: string[], n: T): T { return n; }
|
||||
function someGenerics8<T>(strs: TemplateStringsArray, n: T): T { return n; }
|
||||
var x = someGenerics8 `${ someGenerics7 }`;
|
||||
x `${null}${null}${null}`;
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with no best common type
|
||||
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
|
||||
function someGenerics9<T>(strs: TemplateStringsArray, a: T, b: T, c: T): T {
|
||||
return null;
|
||||
}
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
|
||||
@@ -6,60 +6,60 @@ function noParams<T>(n: T) { }
|
||||
noParams ``;
|
||||
|
||||
// Generic tag with parameter which does not use type parameter
|
||||
function noGenericParams<T>(n: string[]) { }
|
||||
function noGenericParams<T>(n: TemplateStringsArray) { }
|
||||
noGenericParams ``;
|
||||
|
||||
// Generic tag with multiple type parameters and only one used in parameter type annotation
|
||||
function someGenerics1a<T, U>(n: T, m: number) { }
|
||||
someGenerics1a `${3}`;
|
||||
|
||||
function someGenerics1b<T, U>(n: string[], m: U) { }
|
||||
function someGenerics1b<T, U>(n: TemplateStringsArray, m: U) { }
|
||||
someGenerics1b `${3}`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is of type parameter type
|
||||
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
|
||||
function someGenerics2a<T>(strs: TemplateStringsArray, n: (x: T) => void) { }
|
||||
someGenerics2a `${(n: string) => n}`;
|
||||
|
||||
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
|
||||
function someGenerics2b<T, U>(strs: TemplateStringsArray, n: (x: T, y: U) => void) { }
|
||||
someGenerics2b `${ (n: string, x: number) => n }`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
|
||||
function someGenerics3<T>(strs: string[], producer: () => T) { }
|
||||
function someGenerics3<T>(strs: TemplateStringsArray, producer: () => T) { }
|
||||
someGenerics3 `${() => ''}`;
|
||||
someGenerics3 `${() => undefined}`;
|
||||
someGenerics3 `${() => 3}`;
|
||||
|
||||
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
|
||||
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics4<T, U>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics4 `${4}${ () => null }`;
|
||||
someGenerics4 `${''}${ () => 3 }`;
|
||||
someGenerics4 `${ null }${ null }`;
|
||||
|
||||
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics5<U, T>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics5 `${ 4 } ${ () => null }`;
|
||||
someGenerics5 `${ '' }${ () => 3 }`;
|
||||
someGenerics5 `${null}${null}`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
|
||||
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
function someGenerics6<A>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of different generic type
|
||||
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
function someGenerics7<A, B, C>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
|
||||
|
||||
// Generic tag with argument of generic function type
|
||||
function someGenerics8<T>(strs: string[], n: T): T { return n; }
|
||||
function someGenerics8<T>(strs: TemplateStringsArray, n: T): T { return n; }
|
||||
var x = someGenerics8 `${ someGenerics7 }`;
|
||||
x `${null}${null}${null}`;
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with no best common type
|
||||
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
|
||||
function someGenerics9<T>(strs: TemplateStringsArray, a: T, b: T, c: T): T {
|
||||
return null;
|
||||
}
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
|
||||
+11
-11
@@ -12,60 +12,60 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
|
||||
noParams ``;
|
||||
|
||||
// Generic tag with parameter which does not use type parameter
|
||||
function noGenericParams<T>(n: string[]) { }
|
||||
function noGenericParams<T>(n: TemplateStringsArray) { }
|
||||
noGenericParams ``;
|
||||
|
||||
// Generic tag with multiple type parameters and only one used in parameter type annotation
|
||||
function someGenerics1a<T, U>(n: T, m: number) { }
|
||||
someGenerics1a `${3}`;
|
||||
|
||||
function someGenerics1b<T, U>(n: string[], m: U) { }
|
||||
function someGenerics1b<T, U>(n: TemplateStringsArray, m: U) { }
|
||||
someGenerics1b `${3}`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is of type parameter type
|
||||
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
|
||||
function someGenerics2a<T>(strs: TemplateStringsArray, n: (x: T) => void) { }
|
||||
someGenerics2a `${(n: string) => n}`;
|
||||
|
||||
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
|
||||
function someGenerics2b<T, U>(strs: TemplateStringsArray, n: (x: T, y: U) => void) { }
|
||||
someGenerics2b `${ (n: string, x: number) => n }`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
|
||||
function someGenerics3<T>(strs: string[], producer: () => T) { }
|
||||
function someGenerics3<T>(strs: TemplateStringsArray, producer: () => T) { }
|
||||
someGenerics3 `${() => ''}`;
|
||||
someGenerics3 `${() => undefined}`;
|
||||
someGenerics3 `${() => 3}`;
|
||||
|
||||
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
|
||||
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics4<T, U>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics4 `${4}${ () => null }`;
|
||||
someGenerics4 `${''}${ () => 3 }`;
|
||||
someGenerics4 `${ null }${ null }`;
|
||||
|
||||
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics5<U, T>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics5 `${ 4 } ${ () => null }`;
|
||||
someGenerics5 `${ '' }${ () => 3 }`;
|
||||
someGenerics5 `${null}${null}`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
|
||||
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
function someGenerics6<A>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of different generic type
|
||||
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
function someGenerics7<A, B, C>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
|
||||
|
||||
// Generic tag with argument of generic function type
|
||||
function someGenerics8<T>(strs: string[], n: T): T { return n; }
|
||||
function someGenerics8<T>(strs: TemplateStringsArray, n: T): T { return n; }
|
||||
var x = someGenerics8 `${ someGenerics7 }`;
|
||||
x `${null}${null}${null}`;
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with no best common type
|
||||
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
|
||||
function someGenerics9<T>(strs: TemplateStringsArray, a: T, b: T, c: T): T {
|
||||
return null;
|
||||
}
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
|
||||
@@ -5,60 +5,60 @@ function noParams<T>(n: T) { }
|
||||
noParams ``;
|
||||
|
||||
// Generic tag with parameter which does not use type parameter
|
||||
function noGenericParams<T>(n: string[]) { }
|
||||
function noGenericParams<T>(n: TemplateStringsArray) { }
|
||||
noGenericParams ``;
|
||||
|
||||
// Generic tag with multiple type parameters and only one used in parameter type annotation
|
||||
function someGenerics1a<T, U>(n: T, m: number) { }
|
||||
someGenerics1a `${3}`;
|
||||
|
||||
function someGenerics1b<T, U>(n: string[], m: U) { }
|
||||
function someGenerics1b<T, U>(n: TemplateStringsArray, m: U) { }
|
||||
someGenerics1b `${3}`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is of type parameter type
|
||||
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
|
||||
function someGenerics2a<T>(strs: TemplateStringsArray, n: (x: T) => void) { }
|
||||
someGenerics2a `${(n: string) => n}`;
|
||||
|
||||
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
|
||||
function someGenerics2b<T, U>(strs: TemplateStringsArray, n: (x: T, y: U) => void) { }
|
||||
someGenerics2b `${ (n: string, x: number) => n }`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
|
||||
function someGenerics3<T>(strs: string[], producer: () => T) { }
|
||||
function someGenerics3<T>(strs: TemplateStringsArray, producer: () => T) { }
|
||||
someGenerics3 `${() => ''}`;
|
||||
someGenerics3 `${() => undefined}`;
|
||||
someGenerics3 `${() => 3}`;
|
||||
|
||||
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
|
||||
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics4<T, U>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics4 `${4}${ () => null }`;
|
||||
someGenerics4 `${''}${ () => 3 }`;
|
||||
someGenerics4 `${ null }${ null }`;
|
||||
|
||||
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics5<U, T>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics5 `${ 4 } ${ () => null }`;
|
||||
someGenerics5 `${ '' }${ () => 3 }`;
|
||||
someGenerics5 `${null}${null}`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
|
||||
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
function someGenerics6<A>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of different generic type
|
||||
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
function someGenerics7<A, B, C>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
|
||||
|
||||
// Generic tag with argument of generic function type
|
||||
function someGenerics8<T>(strs: string[], n: T): T { return n; }
|
||||
function someGenerics8<T>(strs: TemplateStringsArray, n: T): T { return n; }
|
||||
var x = someGenerics8 `${ someGenerics7 }`;
|
||||
x `${null}${null}${null}`;
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with no best common type
|
||||
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
|
||||
function someGenerics9<T>(strs: TemplateStringsArray, a: T, b: T, c: T): T {
|
||||
return null;
|
||||
}
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
|
||||
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTyped
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts (6 errors) ====
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: boolean[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: boolean[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//// [taggedTemplateStringsWithIncompatibleTypedTags.ts]
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: boolean[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: boolean[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTyped
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTagsES6.ts (6 errors) ====
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: boolean[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: boolean[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//// [taggedTemplateStringsWithIncompatibleTypedTagsES6.ts]
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: boolean[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: boolean[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//// [taggedTemplateStringsWithManyCallAndMemberExpressions.ts]
|
||||
interface I {
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
member: {
|
||||
new (s: string): {
|
||||
new (n: number): {
|
||||
|
||||
+6
-5
@@ -2,13 +2,14 @@
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 0, 0))
|
||||
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
>strs : Symbol(strs, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 5))
|
||||
>subs : Symbol(subs, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 20))
|
||||
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --))
|
||||
>subs : Symbol(subs, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 32))
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 0, 0))
|
||||
|
||||
member: {
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 43))
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 55))
|
||||
|
||||
new (s: string): {
|
||||
>s : Symbol(s, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 3, 13))
|
||||
@@ -27,8 +28,8 @@ var f: I;
|
||||
|
||||
var x = new new new f `abc${ 0 }def`.member("hello")(42) === true;
|
||||
>x : Symbol(x, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 12, 3))
|
||||
>f `abc${ 0 }def`.member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 43))
|
||||
>f `abc${ 0 }def`.member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 55))
|
||||
>f : Symbol(f, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 10, 3))
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 43))
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 55))
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -2,8 +2,9 @@
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
>strs : string[]
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
>strs : TemplateStringsArray
|
||||
>TemplateStringsArray : TemplateStringsArray
|
||||
>subs : number[]
|
||||
>I : I
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//// [taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts]
|
||||
interface I {
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
member: {
|
||||
new (s: string): {
|
||||
new (n: number): {
|
||||
|
||||
+6
-5
@@ -2,13 +2,14 @@
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 0, 0))
|
||||
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
>strs : Symbol(strs, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 5))
|
||||
>subs : Symbol(subs, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 20))
|
||||
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --))
|
||||
>subs : Symbol(subs, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 32))
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 0, 0))
|
||||
|
||||
member: {
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 43))
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 55))
|
||||
|
||||
new (s: string): {
|
||||
>s : Symbol(s, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 3, 13))
|
||||
@@ -27,8 +28,8 @@ var f: I;
|
||||
|
||||
var x = new new new f `abc${ 0 }def`.member("hello")(42) === true;
|
||||
>x : Symbol(x, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 12, 3))
|
||||
>f `abc${ 0 }def`.member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 43))
|
||||
>f `abc${ 0 }def`.member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 55))
|
||||
>f : Symbol(f, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 10, 3))
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 43))
|
||||
>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 55))
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -2,8 +2,9 @@
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
>strs : string[]
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
>strs : TemplateStringsArray
|
||||
>TemplateStringsArray : TemplateStringsArray
|
||||
>subs : number[]
|
||||
>I : I
|
||||
|
||||
|
||||
@@ -1,25 +1,39 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(9,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type 'undefined[]'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(10,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(11,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(13,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,9): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (4 errors) ====
|
||||
function foo(strs: string[]): number;
|
||||
function foo(strs: string[], x: number): string;
|
||||
function foo(strs: string[], x: number, y: number): boolean;
|
||||
function foo(strs: string[], x: number, y: string): {};
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (8 errors) ====
|
||||
function foo(strs: TemplateStringsArray): number;
|
||||
function foo(strs: TemplateStringsArray, x: number): string;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: number): boolean;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: string): {};
|
||||
function foo(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var a = foo([]); // number
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type 'undefined[]'.
|
||||
var b = foo([], 1); // string
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var c = foo([], 1, 2); // boolean
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var d = foo([], 1, true); // boolean (with error)
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var e = foo([], 1, "2"); // {}
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var f = foo([], 1, 2, 3); // any (with error)
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//// [taggedTemplateStringsWithOverloadResolution1.ts]
|
||||
function foo(strs: string[]): number;
|
||||
function foo(strs: string[], x: number): string;
|
||||
function foo(strs: string[], x: number, y: number): boolean;
|
||||
function foo(strs: string[], x: number, y: string): {};
|
||||
function foo(strs: TemplateStringsArray): number;
|
||||
function foo(strs: TemplateStringsArray, x: number): string;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: number): boolean;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: string): {};
|
||||
function foo(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+22
-8
@@ -1,25 +1,39 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(9,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type 'undefined[]'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(10,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(11,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(12,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(13,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(19,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(21,9): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts (4 errors) ====
|
||||
function foo(strs: string[]): number;
|
||||
function foo(strs: string[], x: number): string;
|
||||
function foo(strs: string[], x: number, y: number): boolean;
|
||||
function foo(strs: string[], x: number, y: string): {};
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts (8 errors) ====
|
||||
function foo(strs: TemplateStringsArray): number;
|
||||
function foo(strs: TemplateStringsArray, x: number): string;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: number): boolean;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: string): {};
|
||||
function foo(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var a = foo([]); // number
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type 'undefined[]'.
|
||||
var b = foo([], 1); // string
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var c = foo([], 1, 2); // boolean
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var d = foo([], 1, true); // boolean (with error)
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var e = foo([], 1, "2"); // {}
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
var f = foo([], 1, 2, 3); // any (with error)
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//// [taggedTemplateStringsWithOverloadResolution1_ES6.ts]
|
||||
function foo(strs: string[]): number;
|
||||
function foo(strs: string[], x: number): string;
|
||||
function foo(strs: string[], x: number, y: number): boolean;
|
||||
function foo(strs: string[], x: number, y: string): {};
|
||||
function foo(strs: TemplateStringsArray): number;
|
||||
function foo(strs: TemplateStringsArray, x: number): string;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: number): boolean;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: string): {};
|
||||
function foo(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ function foo1(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var b = foo1([], 1); // number
|
||||
var a = foo1 `${1}`;
|
||||
var b = foo1([], 1);
|
||||
|
||||
function foo2(strs: string[], x: number): number;
|
||||
function foo2(strs: TemplateStringsArray, x: number): string;
|
||||
@@ -15,8 +15,8 @@ function foo2(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
var d = foo2([], 1); // number
|
||||
var c = foo2 `${1}`;
|
||||
var d = foo2([], 1);
|
||||
|
||||
//// [taggedTemplateStringsWithOverloadResolution2.js]
|
||||
function foo1() {
|
||||
@@ -26,8 +26,8 @@ function foo1() {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
var a = (_a = ["", ""], _a.raw = ["", ""], foo1(_a, 1)); // string
|
||||
var b = foo1([], 1); // number
|
||||
var a = (_a = ["", ""], _a.raw = ["", ""], foo1(_a, 1));
|
||||
var b = foo1([], 1);
|
||||
function foo2() {
|
||||
var stuff = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
@@ -35,6 +35,6 @@ function foo2() {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
var c = (_b = ["", ""], _b.raw = ["", ""], foo2(_b, 1)); // number
|
||||
var d = foo2([], 1); // number
|
||||
var c = (_b = ["", ""], _b.raw = ["", ""], foo2(_b, 1));
|
||||
var d = foo2([], 1);
|
||||
var _a, _b;
|
||||
|
||||
@@ -19,11 +19,11 @@ function foo1(...stuff: any[]): any {
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var a = foo1 `${1}`;
|
||||
>a : Symbol(a, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 7, 3))
|
||||
>foo1 : Symbol(foo1, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 0, 0), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 1, 61), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 2, 49))
|
||||
|
||||
var b = foo1([], 1); // number
|
||||
var b = foo1([], 1);
|
||||
>b : Symbol(b, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 8, 3))
|
||||
>foo1 : Symbol(foo1, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 0, 0), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 1, 61), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 2, 49))
|
||||
|
||||
@@ -46,11 +46,11 @@ function foo2(...stuff: any[]): any {
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
var c = foo2 `${1}`;
|
||||
>c : Symbol(c, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 16, 3))
|
||||
>foo2 : Symbol(foo2, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 8, 20), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 10, 49), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 11, 61))
|
||||
|
||||
var d = foo2([], 1); // number
|
||||
var d = foo2([], 1);
|
||||
>d : Symbol(d, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 17, 3))
|
||||
>foo2 : Symbol(foo2, Decl(taggedTemplateStringsWithOverloadResolution2.ts, 8, 20), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 10, 49), Decl(taggedTemplateStringsWithOverloadResolution2.ts, 11, 61))
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ function foo1(...stuff: any[]): any {
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var a = foo1 `${1}`;
|
||||
>a : string
|
||||
>foo1 `${1}` : string
|
||||
>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; }
|
||||
>`${1}` : string
|
||||
>1 : number
|
||||
|
||||
var b = foo1([], 1); // number
|
||||
var b = foo1([], 1);
|
||||
>b : number
|
||||
>foo1([], 1) : number
|
||||
>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; }
|
||||
@@ -52,14 +52,14 @@ function foo2(...stuff: any[]): any {
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
>c : number
|
||||
>foo2 `${1}` : number
|
||||
var c = foo2 `${1}`;
|
||||
>c : string
|
||||
>foo2 `${1}` : string
|
||||
>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; }
|
||||
>`${1}` : string
|
||||
>1 : number
|
||||
|
||||
var d = foo2([], 1); // number
|
||||
var d = foo2([], 1);
|
||||
>d : number
|
||||
>foo2([], 1) : number
|
||||
>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; }
|
||||
|
||||
@@ -5,8 +5,8 @@ function foo1(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var b = foo1([], 1); // number
|
||||
var a = foo1 `${1}`;
|
||||
var b = foo1([], 1);
|
||||
|
||||
function foo2(strs: string[], x: number): number;
|
||||
function foo2(strs: TemplateStringsArray, x: number): string;
|
||||
@@ -14,17 +14,17 @@ function foo2(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
var d = foo2([], 1); // number
|
||||
var c = foo2 `${1}`;
|
||||
var d = foo2([], 1);
|
||||
|
||||
//// [taggedTemplateStringsWithOverloadResolution2_ES6.js]
|
||||
function foo1(...stuff) {
|
||||
return undefined;
|
||||
}
|
||||
var a = foo1 `${1}`; // string
|
||||
var b = foo1([], 1); // number
|
||||
var a = foo1 `${1}`;
|
||||
var b = foo1([], 1);
|
||||
function foo2(...stuff) {
|
||||
return undefined;
|
||||
}
|
||||
var c = foo2 `${1}`; // number
|
||||
var d = foo2([], 1); // number
|
||||
var c = foo2 `${1}`;
|
||||
var d = foo2([], 1);
|
||||
|
||||
@@ -18,11 +18,11 @@ function foo1(...stuff: any[]): any {
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var a = foo1 `${1}`;
|
||||
>a : Symbol(a, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 6, 3))
|
||||
>foo1 : Symbol(foo1, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 0), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 61), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 1, 49))
|
||||
|
||||
var b = foo1([], 1); // number
|
||||
var b = foo1([], 1);
|
||||
>b : Symbol(b, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 7, 3))
|
||||
>foo1 : Symbol(foo1, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 0), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 61), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 1, 49))
|
||||
|
||||
@@ -45,11 +45,11 @@ function foo2(...stuff: any[]): any {
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
var c = foo2 `${1}`;
|
||||
>c : Symbol(c, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 15, 3))
|
||||
>foo2 : Symbol(foo2, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 7, 20), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 9, 49), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 61))
|
||||
|
||||
var d = foo2([], 1); // number
|
||||
var d = foo2([], 1);
|
||||
>d : Symbol(d, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 16, 3))
|
||||
>foo2 : Symbol(foo2, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 7, 20), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 9, 49), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 61))
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ function foo1(...stuff: any[]): any {
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var a = foo1 `${1}`;
|
||||
>a : string
|
||||
>foo1 `${1}` : string
|
||||
>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; }
|
||||
>`${1}` : string
|
||||
>1 : number
|
||||
|
||||
var b = foo1([], 1); // number
|
||||
var b = foo1([], 1);
|
||||
>b : number
|
||||
>foo1([], 1) : number
|
||||
>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; }
|
||||
@@ -51,14 +51,14 @@ function foo2(...stuff: any[]): any {
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
>c : number
|
||||
>foo2 `${1}` : number
|
||||
var c = foo2 `${1}`;
|
||||
>c : string
|
||||
>foo2 `${1}` : string
|
||||
>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; }
|
||||
>`${1}` : string
|
||||
>1 : number
|
||||
|
||||
var d = foo2([], 1); // number
|
||||
var d = foo2([], 1);
|
||||
>d : number
|
||||
>foo2([], 1) : number
|
||||
>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//// [taggedTemplateStringsWithTypedTags.ts]
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0))
|
||||
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
>stringParts : Symbol(stringParts, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 5))
|
||||
>rest : Symbol(rest, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 27))
|
||||
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --))
|
||||
>rest : Symbol(rest, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 39))
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0))
|
||||
|
||||
g: I;
|
||||
>g : Symbol(I.g, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 50))
|
||||
>g : Symbol(I.g, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 62))
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0))
|
||||
|
||||
h: I;
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
>stringParts : string[]
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
>stringParts : TemplateStringsArray
|
||||
>TemplateStringsArray : TemplateStringsArray
|
||||
>rest : number[]
|
||||
>I : I
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//// [taggedTemplateStringsWithTypedTagsES6.ts]
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0))
|
||||
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
>stringParts : Symbol(stringParts, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 5))
|
||||
>rest : Symbol(rest, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 27))
|
||||
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --))
|
||||
>rest : Symbol(rest, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 39))
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0))
|
||||
|
||||
g: I;
|
||||
>g : Symbol(I.g, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 50))
|
||||
>g : Symbol(I.g, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 62))
|
||||
>I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0))
|
||||
|
||||
h: I;
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
>stringParts : string[]
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
>stringParts : TemplateStringsArray
|
||||
>TemplateStringsArray : TemplateStringsArray
|
||||
>rest : number[]
|
||||
>I : I
|
||||
|
||||
|
||||
@@ -16,5 +16,5 @@ class A {
|
||||
class B {
|
||||
constructor(...args: number[]) {}
|
||||
@MyMethodDecorator
|
||||
method(...args: string[]) {}
|
||||
method(this: this, ...args: string[]) {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any {
|
||||
return function(this: any, ...args: any[]) {
|
||||
return fn.apply(this, [ this ].concat(args));
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// @filename: test.d.ts
|
||||
|
||||
declare var S: typeof A; // no error
|
||||
declare const A: number;
|
||||
+11
-11
@@ -5,60 +5,60 @@ function noParams<T>(n: T) { }
|
||||
noParams ``;
|
||||
|
||||
// Generic tag with parameter which does not use type parameter
|
||||
function noGenericParams<T>(n: string[]) { }
|
||||
function noGenericParams<T>(n: TemplateStringsArray) { }
|
||||
noGenericParams ``;
|
||||
|
||||
// Generic tag with multiple type parameters and only one used in parameter type annotation
|
||||
function someGenerics1a<T, U>(n: T, m: number) { }
|
||||
someGenerics1a `${3}`;
|
||||
|
||||
function someGenerics1b<T, U>(n: string[], m: U) { }
|
||||
function someGenerics1b<T, U>(n: TemplateStringsArray, m: U) { }
|
||||
someGenerics1b `${3}`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is of type parameter type
|
||||
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
|
||||
function someGenerics2a<T>(strs: TemplateStringsArray, n: (x: T) => void) { }
|
||||
someGenerics2a `${(n: string) => n}`;
|
||||
|
||||
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
|
||||
function someGenerics2b<T, U>(strs: TemplateStringsArray, n: (x: T, y: U) => void) { }
|
||||
someGenerics2b `${ (n: string, x: number) => n }`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
|
||||
function someGenerics3<T>(strs: string[], producer: () => T) { }
|
||||
function someGenerics3<T>(strs: TemplateStringsArray, producer: () => T) { }
|
||||
someGenerics3 `${() => ''}`;
|
||||
someGenerics3 `${() => undefined}`;
|
||||
someGenerics3 `${() => 3}`;
|
||||
|
||||
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
|
||||
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics4<T, U>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics4 `${4}${ () => null }`;
|
||||
someGenerics4 `${''}${ () => 3 }`;
|
||||
someGenerics4 `${ null }${ null }`;
|
||||
|
||||
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics5<U, T>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics5 `${ 4 } ${ () => null }`;
|
||||
someGenerics5 `${ '' }${ () => 3 }`;
|
||||
someGenerics5 `${null}${null}`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
|
||||
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
function someGenerics6<A>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of different generic type
|
||||
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
function someGenerics7<A, B, C>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
|
||||
|
||||
// Generic tag with argument of generic function type
|
||||
function someGenerics8<T>(strs: string[], n: T): T { return n; }
|
||||
function someGenerics8<T>(strs: TemplateStringsArray, n: T): T { return n; }
|
||||
var x = someGenerics8 `${ someGenerics7 }`;
|
||||
x `${null}${null}${null}`;
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with no best common type
|
||||
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
|
||||
function someGenerics9<T>(strs: TemplateStringsArray, a: T, b: T, c: T): T {
|
||||
return null;
|
||||
}
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
|
||||
+11
-11
@@ -5,60 +5,60 @@ function noParams<T>(n: T) { }
|
||||
noParams ``;
|
||||
|
||||
// Generic tag with parameter which does not use type parameter
|
||||
function noGenericParams<T>(n: string[]) { }
|
||||
function noGenericParams<T>(n: TemplateStringsArray) { }
|
||||
noGenericParams ``;
|
||||
|
||||
// Generic tag with multiple type parameters and only one used in parameter type annotation
|
||||
function someGenerics1a<T, U>(n: T, m: number) { }
|
||||
someGenerics1a `${3}`;
|
||||
|
||||
function someGenerics1b<T, U>(n: string[], m: U) { }
|
||||
function someGenerics1b<T, U>(n: TemplateStringsArray, m: U) { }
|
||||
someGenerics1b `${3}`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is of type parameter type
|
||||
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
|
||||
function someGenerics2a<T>(strs: TemplateStringsArray, n: (x: T) => void) { }
|
||||
someGenerics2a `${(n: string) => n}`;
|
||||
|
||||
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
|
||||
function someGenerics2b<T, U>(strs: TemplateStringsArray, n: (x: T, y: U) => void) { }
|
||||
someGenerics2b `${ (n: string, x: number) => n }`;
|
||||
|
||||
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
|
||||
function someGenerics3<T>(strs: string[], producer: () => T) { }
|
||||
function someGenerics3<T>(strs: TemplateStringsArray, producer: () => T) { }
|
||||
someGenerics3 `${() => ''}`;
|
||||
someGenerics3 `${() => undefined}`;
|
||||
someGenerics3 `${() => 3}`;
|
||||
|
||||
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
|
||||
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics4<T, U>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics4 `${4}${ () => null }`;
|
||||
someGenerics4 `${''}${ () => 3 }`;
|
||||
someGenerics4 `${ null }${ null }`;
|
||||
|
||||
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
|
||||
function someGenerics5<U, T>(strs: TemplateStringsArray, n: T, f: (x: U) => void) { }
|
||||
someGenerics5 `${ 4 } ${ () => null }`;
|
||||
someGenerics5 `${ '' }${ () => 3 }`;
|
||||
someGenerics5 `${null}${null}`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
|
||||
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
function someGenerics6<A>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
|
||||
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
|
||||
|
||||
// Generic tag with multiple arguments of function types that each have parameters of different generic type
|
||||
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
function someGenerics7<A, B, C>(strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
|
||||
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
|
||||
|
||||
// Generic tag with argument of generic function type
|
||||
function someGenerics8<T>(strs: string[], n: T): T { return n; }
|
||||
function someGenerics8<T>(strs: TemplateStringsArray, n: T): T { return n; }
|
||||
var x = someGenerics8 `${ someGenerics7 }`;
|
||||
x `${null}${null}${null}`;
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with no best common type
|
||||
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
|
||||
function someGenerics9<T>(strs: TemplateStringsArray, a: T, b: T, c: T): T {
|
||||
return null;
|
||||
}
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: boolean[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: boolean[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// @target: ES6
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: boolean[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: boolean[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface I {
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
member: {
|
||||
new (s: string): {
|
||||
new (n: number): {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// @target: ES6
|
||||
interface I {
|
||||
(strs: string[], ...subs: number[]): I;
|
||||
(strs: TemplateStringsArray, ...subs: number[]): I;
|
||||
member: {
|
||||
new (s: string): {
|
||||
new (n: number): {
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
function foo(strs: string[]): number;
|
||||
function foo(strs: string[], x: number): string;
|
||||
function foo(strs: string[], x: number, y: number): boolean;
|
||||
function foo(strs: string[], x: number, y: string): {};
|
||||
function foo(strs: TemplateStringsArray): number;
|
||||
function foo(strs: TemplateStringsArray, x: number): string;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: number): boolean;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: string): {};
|
||||
function foo(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
//@target: es6
|
||||
function foo(strs: string[]): number;
|
||||
function foo(strs: string[], x: number): string;
|
||||
function foo(strs: string[], x: number, y: number): boolean;
|
||||
function foo(strs: string[], x: number, y: string): {};
|
||||
function foo(strs: TemplateStringsArray): number;
|
||||
function foo(strs: TemplateStringsArray, x: number): string;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: number): boolean;
|
||||
function foo(strs: TemplateStringsArray, x: number, y: string): {};
|
||||
function foo(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+4
-4
@@ -5,8 +5,8 @@ function foo1(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var b = foo1([], 1); // number
|
||||
var a = foo1 `${1}`;
|
||||
var b = foo1([], 1);
|
||||
|
||||
function foo2(strs: string[], x: number): number;
|
||||
function foo2(strs: TemplateStringsArray, x: number): string;
|
||||
@@ -14,5 +14,5 @@ function foo2(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
var d = foo2([], 1); // number
|
||||
var c = foo2 `${1}`;
|
||||
var d = foo2([], 1);
|
||||
+4
-4
@@ -5,8 +5,8 @@ function foo1(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var a = foo1 `${1}`; // string
|
||||
var b = foo1([], 1); // number
|
||||
var a = foo1 `${1}`;
|
||||
var b = foo1([], 1);
|
||||
|
||||
function foo2(strs: string[], x: number): number;
|
||||
function foo2(strs: TemplateStringsArray, x: number): string;
|
||||
@@ -14,5 +14,5 @@ function foo2(...stuff: any[]): any {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var c = foo2 `${1}`; // number
|
||||
var d = foo2([], 1); // number
|
||||
var c = foo2 `${1}`;
|
||||
var d = foo2([], 1);
|
||||
@@ -1,5 +1,5 @@
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @target: ES6
|
||||
interface I {
|
||||
(stringParts: string[], ...rest: number[]): I;
|
||||
(stringParts: TemplateStringsArray, ...rest: number[]): I;
|
||||
g: I;
|
||||
h: I;
|
||||
member: I;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function f(templateStrings: string[], p1_o1: string): number;
|
||||
//// function f(templateStrings: string[], p1_o2: number, p2_o2: number, p3_o2: number): string;
|
||||
//// function f(templateStrings: string[], p1_o3: string, p2_o3: boolean, p3_o3: number): boolean;
|
||||
//// function f(templateStrings: TemplateStringsArray, p1_o1: string): number;
|
||||
//// function f(templateStrings: TemplateStringsArray, p1_o2: number, p2_o2: number, p3_o2: number): string;
|
||||
//// function f(templateStrings: TemplateStringsArray, p1_o3: string, p2_o3: boolean, p3_o3: number): boolean;
|
||||
//// function f(...foo[]: any) { return ""; }
|
||||
////
|
||||
//// f `${/*1*/ "s/*2*/tring" /*3*/ } ${
|
||||
@@ -14,7 +14,7 @@ test.markers().forEach(m => {
|
||||
verify.signatureHelpArgumentCountIs(3);
|
||||
|
||||
verify.currentSignatureParameterCountIs(4);
|
||||
verify.currentSignatureHelpIs('f(templateStrings: string[], p1_o3: string, p2_o3: boolean, p3_o3: number): boolean');
|
||||
verify.currentSignatureHelpIs('f(templateStrings: TemplateStringsArray, p1_o3: string, p2_o3: boolean, p3_o3: number): boolean');
|
||||
verify.currentParameterHelpArgumentNameIs("p1_o3");
|
||||
verify.currentParameterSpanIs("p1_o3: string");
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function f(templateStrings: string[], p1_o1: string): number;
|
||||
//// function f(templateStrings: string[], p1_o2: number, p2_o2: number, p3_o2: number): string;
|
||||
//// function f(templateStrings: string[], p1_o3: string, p2_o3: boolean, p3_o3: number): boolean;
|
||||
//// function f(templateStrings: TemplateStringsArray, p1_o1: string): number;
|
||||
//// function f(templateStrings: TemplateStringsArray, p1_o2: number, p2_o2: number, p3_o2: number): string;
|
||||
//// function f(templateStrings: TemplateStringsArray, p1_o3: string, p2_o3: boolean, p3_o3: number): boolean;
|
||||
//// function f(...foo[]: any) { return ""; }
|
||||
////
|
||||
//// f `${ } ${/*1*/ fa/*2*/lse /*3*/}
|
||||
@@ -14,7 +14,7 @@ test.markers().forEach(m => {
|
||||
verify.signatureHelpArgumentCountIs(3);
|
||||
|
||||
verify.currentSignatureParameterCountIs(4);
|
||||
verify.currentSignatureHelpIs('f(templateStrings: string[], p1_o3: string, p2_o3: boolean, p3_o3: number): boolean');
|
||||
verify.currentSignatureHelpIs('f(templateStrings: TemplateStringsArray, p1_o3: string, p2_o3: boolean, p3_o3: number): boolean');
|
||||
verify.currentParameterHelpArgumentNameIs("p2_o3");
|
||||
verify.currentParameterSpanIs("p2_o3: boolean");
|
||||
});
|
||||
Reference in New Issue
Block a user