Merge branch 'master' into exportDefaultType
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json
This commit is contained in:
commit
696b688987
|
@ -448,7 +448,7 @@ module ts {
|
|||
let declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined);
|
||||
|
||||
Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
|
||||
|
||||
// first check if usage is lexically located after the declaration
|
||||
let isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
|
||||
if (!isUsedBeforeDeclaration) {
|
||||
|
@ -465,7 +465,7 @@ module ts {
|
|||
|
||||
if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement ||
|
||||
variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) {
|
||||
// variable statement/for statement case,
|
||||
// variable statement/for statement case,
|
||||
// use site should not be inside variable declaration (initializer of declaration or binding element)
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
|
||||
}
|
||||
|
@ -4421,7 +4421,7 @@ module ts {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a Type was written as a tuple type literal.
|
||||
* Check if a Type was written as a tuple type literal.
|
||||
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
|
||||
*/
|
||||
function isTupleType(type: Type) : boolean {
|
||||
|
@ -9101,7 +9101,7 @@ module ts {
|
|||
*/
|
||||
function checkElementTypeOfArrayOrString(arrayOrStringType: Type, expressionForError: Expression): Type {
|
||||
Debug.assert(languageVersion < ScriptTarget.ES6);
|
||||
|
||||
|
||||
// After we remove all types that are StringLike, we will know if there was a string constituent
|
||||
// based on whether the remaining type is the same as the initial type.
|
||||
let arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true);
|
||||
|
@ -11103,26 +11103,11 @@ module ts {
|
|||
function getBlockScopedVariableId(n: Identifier): number {
|
||||
Debug.assert(!nodeIsSynthesized(n));
|
||||
|
||||
// ignore name parts of property access expressions
|
||||
if (n.parent.kind === SyntaxKind.PropertyAccessExpression &&
|
||||
(<PropertyAccessExpression>n.parent).name === n) {
|
||||
return undefined;
|
||||
}
|
||||
let isVariableDeclarationOrBindingElement =
|
||||
n.parent.kind === SyntaxKind.BindingElement || (n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n);
|
||||
|
||||
// ignore property names in object binding patterns
|
||||
if (n.parent.kind === SyntaxKind.BindingElement &&
|
||||
(<BindingElement>n.parent).propertyName === n) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// for names in variable declarations and binding elements try to short circuit and fetch symbol from the node
|
||||
let declarationSymbol: Symbol =
|
||||
(n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n) ||
|
||||
n.parent.kind === SyntaxKind.BindingElement
|
||||
? getSymbolOfNode(n.parent)
|
||||
: undefined;
|
||||
|
||||
let symbol = declarationSymbol ||
|
||||
let symbol =
|
||||
(isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) ||
|
||||
getNodeLinks(n).resolvedSymbol ||
|
||||
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
|
@ -11354,16 +11339,15 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray<TypeParameterDeclaration>): boolean {
|
||||
function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray<TypeParameterDeclaration>, file: SourceFile): boolean {
|
||||
if (checkGrammarForDisallowedTrailingComma(typeParameters)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeParameters && typeParameters.length === 0) {
|
||||
let start = typeParameters.pos - "<".length;
|
||||
let sourceFile = getSourceFileOfNode(node);
|
||||
let end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length;
|
||||
return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty);
|
||||
let end = skipTrivia(file.text, typeParameters.end) + ">".length;
|
||||
return grammarErrorAtPos(file, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11407,7 +11391,21 @@ module ts {
|
|||
|
||||
function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
|
||||
// Prevent cascading error by short-circuit
|
||||
return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters);
|
||||
let file = getSourceFileOfNode(node);
|
||||
return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) ||
|
||||
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
|
||||
}
|
||||
|
||||
function checkGrammarArrowFunction(node: FunctionLikeDeclaration, file: SourceFile): boolean {
|
||||
if (node.kind === SyntaxKind.ArrowFunction) {
|
||||
let arrowFunction = <ArrowFunction>node;
|
||||
let startLine = getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;
|
||||
let endLine = getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;
|
||||
if (startLine !== endLine) {
|
||||
return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, Diagnostics.Line_terminator_not_permitted_before_arrow);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean {
|
||||
|
|
|
@ -157,7 +157,8 @@ module ts {
|
|||
Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." },
|
||||
An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." },
|
||||
Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." },
|
||||
A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1200, category: DiagnosticCategory.Error, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." },
|
||||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
|
||||
A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1201, category: DiagnosticCategory.Error, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
|
|
|
@ -619,10 +619,14 @@
|
|||
"category": "Error",
|
||||
"code": 1199
|
||||
},
|
||||
"A type annotation on an export statement is only allowed in an ambient external module declaration.": {
|
||||
"Line terminator not permitted before arrow.": {
|
||||
"category": "Error",
|
||||
"code": 1200
|
||||
},
|
||||
"A type annotation on an export statement is only allowed in an ambient external module declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1201
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
|
|
|
@ -2074,19 +2074,19 @@ module ts {
|
|||
sourceMapDir = getDirectoryPath(normalizePath(jsFilePath));
|
||||
}
|
||||
|
||||
function emitNodeWithSourceMap(node: Node) {
|
||||
function emitNodeWithSourceMap(node: Node, allowGeneratedIdentifiers?: boolean) {
|
||||
if (node) {
|
||||
if (nodeIsSynthesized(node)) {
|
||||
return emitNodeWithoutSourceMap(node);
|
||||
return emitNodeWithoutSourceMap(node, /*allowGeneratedIdentifiers*/ false);
|
||||
}
|
||||
if (node.kind != SyntaxKind.SourceFile) {
|
||||
recordEmitNodeStartSpan(node);
|
||||
emitNodeWithoutSourceMap(node);
|
||||
emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers);
|
||||
recordEmitNodeEndSpan(node);
|
||||
}
|
||||
else {
|
||||
recordNewSourceFileStart(<SourceFile>node);
|
||||
emitNodeWithoutSourceMap(node);
|
||||
emitNodeWithoutSourceMap(node, /*allowGeneratedIdentifiers*/ false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2623,17 +2623,24 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function getBlockScopedVariableId(node: Identifier): number {
|
||||
// return undefined for synthesized nodes
|
||||
return !nodeIsSynthesized(node) && resolver.getBlockScopedVariableId(node);
|
||||
function getGeneratedNameForIdentifier(node: Identifier): string {
|
||||
if (nodeIsSynthesized(node) || !generatedBlockScopeNames) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var variableId = resolver.getBlockScopedVariableId(node)
|
||||
if (variableId === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return generatedBlockScopeNames[variableId];
|
||||
}
|
||||
|
||||
function emitIdentifier(node: Identifier) {
|
||||
let variableId = getBlockScopedVariableId(node);
|
||||
if (variableId !== undefined && generatedBlockScopeNames) {
|
||||
let text = generatedBlockScopeNames[variableId];
|
||||
if (text) {
|
||||
write(text);
|
||||
function emitIdentifier(node: Identifier, allowGeneratedIdentifiers: boolean) {
|
||||
if (allowGeneratedIdentifiers) {
|
||||
let generatedName = getGeneratedNameForIdentifier(node);
|
||||
if (generatedName) {
|
||||
write(generatedName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2686,7 +2693,7 @@ module ts {
|
|||
|
||||
function emitBindingElement(node: BindingElement) {
|
||||
if (node.propertyName) {
|
||||
emit(node.propertyName);
|
||||
emit(node.propertyName, /*allowGeneratedIdentifiers*/ false);
|
||||
write(": ");
|
||||
}
|
||||
if (node.dotDotDotToken) {
|
||||
|
@ -3030,7 +3037,7 @@ module ts {
|
|||
}
|
||||
|
||||
function emitMethod(node: MethodDeclaration) {
|
||||
emit(node.name);
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write(": function ");
|
||||
}
|
||||
|
@ -3038,13 +3045,13 @@ module ts {
|
|||
}
|
||||
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emit(node.name);
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
write(": ");
|
||||
emit(node.initializer);
|
||||
}
|
||||
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
emit(node.name);
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
// If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example:
|
||||
// module m {
|
||||
// export let y;
|
||||
|
@ -3053,7 +3060,20 @@ module ts {
|
|||
// export let obj = { y };
|
||||
// }
|
||||
// The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version
|
||||
if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNameSubstitution(node.name)) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
// Emit identifier as an identifier
|
||||
write(": ");
|
||||
var generatedName = getGeneratedNameForIdentifier(node.name);
|
||||
if (generatedName) {
|
||||
write(generatedName);
|
||||
}
|
||||
else {
|
||||
// Even though this is stored as identifier treat it as an expression
|
||||
// Short-hand, { x }, is equivalent of normal form { x: x }
|
||||
emitExpressionIdentifier(node.name);
|
||||
}
|
||||
}
|
||||
else if (resolver.getExpressionNameSubstitution(node.name)) {
|
||||
// Emit identifier as an identifier
|
||||
write(": ");
|
||||
// Even though this is stored as identifier treat it as an expression
|
||||
|
@ -3106,7 +3126,7 @@ module ts {
|
|||
let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
|
||||
write(".");
|
||||
let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name);
|
||||
emit(node.name);
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
decreaseIndentIf(indentedBeforeDot, indentedAfterDot);
|
||||
}
|
||||
|
||||
|
@ -4294,7 +4314,7 @@ module ts {
|
|||
|
||||
function emitAccessor(node: AccessorDeclaration) {
|
||||
write(node.kind === SyntaxKind.GetAccessor ? "get " : "set ");
|
||||
emit(node.name);
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
emitSignatureAndBody(node);
|
||||
}
|
||||
|
||||
|
@ -5340,7 +5360,7 @@ module ts {
|
|||
emitLeadingComments(node.endOfFileToken);
|
||||
}
|
||||
|
||||
function emitNodeWithoutSourceMapWithComments(node: Node): void {
|
||||
function emitNodeWithoutSourceMapWithComments(node: Node, allowGeneratedIdentifiers?: boolean): void {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
@ -5354,14 +5374,14 @@ module ts {
|
|||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
emitJavaScriptWorker(node);
|
||||
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
|
||||
function emitNodeWithoutSourceMapWithoutComments(node: Node): void {
|
||||
function emitNodeWithoutSourceMapWithoutComments(node: Node, allowGeneratedIdentifiers?: boolean): void {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
@ -5370,7 +5390,7 @@ module ts {
|
|||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
emitJavaScriptWorker(node);
|
||||
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
|
@ -5400,11 +5420,11 @@ module ts {
|
|||
return true;
|
||||
}
|
||||
|
||||
function emitJavaScriptWorker(node: Node) {
|
||||
function emitJavaScriptWorker(node: Node, allowGeneratedIdentifiers: boolean = true) {
|
||||
// Check if the node can be emitted regardless of the ScriptTarget
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
return emitIdentifier(<Identifier>node);
|
||||
return emitIdentifier(<Identifier>node, allowGeneratedIdentifiers);
|
||||
case SyntaxKind.Parameter:
|
||||
return emitParameter(<ParameterDeclaration>node);
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -329,7 +329,7 @@ module ts {
|
|||
|
||||
// If the parser encountered an error when parsing the code that created this node. Note
|
||||
// the parser only sets this directly on the node it creates right after encountering the
|
||||
// error.
|
||||
// error.
|
||||
ThisNodeHasError = 1 << 4,
|
||||
|
||||
// Context flags set directly by the parser.
|
||||
|
@ -337,7 +337,7 @@ module ts {
|
|||
|
||||
// Context flags computed by aggregating child flags upwards.
|
||||
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// error. Computed only once and then cached.
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 5,
|
||||
|
||||
|
@ -354,7 +354,7 @@ module ts {
|
|||
export interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Only set when the parser was in some interesting context (like async/yield).
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
|
@ -524,7 +524,7 @@ module ts {
|
|||
body?: Block;
|
||||
}
|
||||
|
||||
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
|
||||
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
|
||||
// ClassElement and an ObjectLiteralElement.
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
_accessorDeclarationBrand: any;
|
||||
|
@ -575,12 +575,12 @@ module ts {
|
|||
|
||||
export interface StringLiteralTypeNode extends LiteralExpression, TypeNode { }
|
||||
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
// Consider 'Expression'. Without the brand, 'Expression' is actually no different
|
||||
// (structurally) than 'Node'. Because of this you can pass any Node to a function that
|
||||
// takes an Expression without any error. By using the 'brands' we ensure that the type
|
||||
// checker actually thinks you have something of the right type. Note: the brands are
|
||||
// never actually given values. At runtime they have zero cost.
|
||||
// checker actually thinks you have something of the right type. Note: the brands are
|
||||
// never actually given values. At runtime they have zero cost.
|
||||
|
||||
export interface Expression extends Node {
|
||||
_expressionBrand: any;
|
||||
|
@ -653,6 +653,10 @@ module ts {
|
|||
body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional
|
||||
}
|
||||
|
||||
export interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
|
||||
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
|
||||
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
|
||||
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
|
||||
|
@ -735,7 +739,7 @@ module ts {
|
|||
}
|
||||
|
||||
export interface VariableStatement extends Statement {
|
||||
declarationList: VariableDeclarationList;
|
||||
declarationList: VariableDeclarationList;
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends Statement {
|
||||
|
@ -903,7 +907,7 @@ module ts {
|
|||
moduleSpecifier: Expression;
|
||||
}
|
||||
|
||||
// In case of:
|
||||
// In case of:
|
||||
// import d from "mod" => name = d, namedBinding = undefined
|
||||
// import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns }
|
||||
// import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns }
|
||||
|
@ -970,7 +974,7 @@ module ts {
|
|||
externalModuleIndicator: Node;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
|
||||
|
||||
/* @internal */ nodeCount: number;
|
||||
/* @internal */ identifierCount: number;
|
||||
/* @internal */ symbolCount: number;
|
||||
|
@ -978,10 +982,10 @@ module ts {
|
|||
// File level diagnostics reported by the parser (includes diagnostics about /// references
|
||||
// as well as code diagnostics).
|
||||
/* @internal */ parseDiagnostics: Diagnostic[];
|
||||
|
||||
|
||||
// File level diagnostics reported by the binder.
|
||||
/* @internal */ bindDiagnostics: Diagnostic[];
|
||||
|
||||
|
||||
// Stores a line map for the file.
|
||||
// This field should never be used directly to obtain line map, use getLineMap function instead.
|
||||
/* @internal */ lineMap: number[];
|
||||
|
@ -1001,10 +1005,10 @@ module ts {
|
|||
getSourceFiles(): SourceFile[];
|
||||
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* specific file will be generated.
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
|
@ -1022,7 +1026,7 @@ module ts {
|
|||
|
||||
getCommonSourceDirectory(): string;
|
||||
|
||||
// For testing purposes only. Should not be used by any other consumers (including the
|
||||
// For testing purposes only. Should not be used by any other consumers (including the
|
||||
// language service).
|
||||
/* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker;
|
||||
|
||||
|
@ -1059,7 +1063,7 @@ module ts {
|
|||
// when -version or -help was provided, or this was a normal compilation, no diagnostics
|
||||
// were produced, and all outputs were generated successfully.
|
||||
Success = 0,
|
||||
|
||||
|
||||
// Diagnostics were produced and because of them no code was generated.
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
|
||||
|
@ -1169,12 +1173,12 @@ module ts {
|
|||
|
||||
// Write symbols's type argument if it is instantiated symbol
|
||||
// eg. class C<T> { p: T } <-- Show p as C<T>.p here
|
||||
// var a: C<number>;
|
||||
// var a: C<number>;
|
||||
// var p = a.p; <--- Here p is property of C<number> so show it as C<number>.p instead of just C.p
|
||||
WriteTypeParametersOrArguments = 0x00000001,
|
||||
WriteTypeParametersOrArguments = 0x00000001,
|
||||
|
||||
// Use only external alias information to get the symbol name in the given context
|
||||
// eg. module m { export class c { } } import x = m.c;
|
||||
// eg. module m { export class c { } } import x = m.c;
|
||||
// When this flag is specified m.c will be used to refer to the class instead of alias symbol x
|
||||
UseOnlyExternalAliasing = 0x00000002,
|
||||
}
|
||||
|
@ -1779,7 +1783,7 @@ module ts {
|
|||
// Gets a count of how many times this collection has been modified. This value changes
|
||||
// each time 'add' is called (regardless of whether or not an equivalent diagnostic was
|
||||
// already in the collection). As such, it can be used as a simple way to tell if any
|
||||
// operation caused diagnostics to be returned by storing and comparing the return value
|
||||
// operation caused diagnostics to be returned by storing and comparing the return value
|
||||
// of this method before/after the operation is performed.
|
||||
getModificationCount(): number;
|
||||
}
|
||||
|
|
|
@ -553,6 +553,9 @@ declare module "typescript" {
|
|||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
|
|
|
@ -1668,6 +1668,15 @@ declare module "typescript" {
|
|||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
|
|
|
@ -584,6 +584,9 @@ declare module "typescript" {
|
|||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
|
|
|
@ -1814,6 +1814,15 @@ declare module "typescript" {
|
|||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
|
|
|
@ -585,6 +585,9 @@ declare module "typescript" {
|
|||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
|
|
|
@ -1764,6 +1764,15 @@ declare module "typescript" {
|
|||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
|
|
|
@ -622,6 +622,9 @@ declare module "typescript" {
|
|||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
|
|
|
@ -1937,6 +1937,15 @@ declare module "typescript" {
|
|||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(4,7): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(6,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(8,7): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(10,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(12,7): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(14,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(16,7): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(18,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(23,8): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(26,8): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(52,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(54,5): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(59,13): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(63,13): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(68,13): error TS1200: Line terminator not permitted before arrow.
|
||||
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(72,9): error TS1200: Line terminator not permitted before arrow.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (18 errors) ====
|
||||
var f1 = ()
|
||||
=> { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f2 = (x: string, y: string) /*
|
||||
*/ => { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f3 = (x: string, y: number, ...rest)
|
||||
=> { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f4 = (x: string, y: number, ...rest) /*
|
||||
*/ => { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f5 = (...rest)
|
||||
=> { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f6 = (...rest) /*
|
||||
*/ => { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f7 = (x: string, y: number, z = 10)
|
||||
=> { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f8 = (x: string, y: number, z = 10) /*
|
||||
*/ => { }
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f9 = (a: number): number
|
||||
=> a;
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f10 = (a: number) :
|
||||
number
|
||||
=> a
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f11 = (a: number): number /*
|
||||
*/ => a;
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
var f12 = (a: number) :
|
||||
number /*
|
||||
*/ => a
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
|
||||
// Should be valid.
|
||||
var f11 = (a: number
|
||||
) => a;
|
||||
|
||||
// Should be valid.
|
||||
var f12 = (a: number)
|
||||
: number => a;
|
||||
|
||||
// Should be valid.
|
||||
var f13 = (a: number):
|
||||
number => a;
|
||||
|
||||
// Should be valid.
|
||||
var f14 = () /* */ => {}
|
||||
|
||||
// Should be valid.
|
||||
var f15 = (a: number): number /* */ => a
|
||||
|
||||
// Should be valid.
|
||||
var f16 = (a: number, b = 10):
|
||||
number /* */ => a + b;
|
||||
|
||||
function foo(func: () => boolean) { }
|
||||
foo(()
|
||||
=> true);
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
foo(()
|
||||
=> { return false; });
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
|
||||
module m {
|
||||
class City {
|
||||
constructor(x: number, thing = ()
|
||||
=> 100) {
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
}
|
||||
|
||||
public m = ()
|
||||
=> 2 * 2 * 2
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
}
|
||||
|
||||
export enum Enum {
|
||||
claw = (()
|
||||
=> 10)()
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
}
|
||||
|
||||
export var v = x
|
||||
=> new City(Enum.claw);
|
||||
~~
|
||||
!!! error TS1200: Line terminator not permitted before arrow.
|
||||
}
|
||||
|
178
tests/baselines/reference/disallowLineTerminatorBeforeArrow.js
Normal file
178
tests/baselines/reference/disallowLineTerminatorBeforeArrow.js
Normal file
|
@ -0,0 +1,178 @@
|
|||
//// [disallowLineTerminatorBeforeArrow.ts]
|
||||
var f1 = ()
|
||||
=> { }
|
||||
var f2 = (x: string, y: string) /*
|
||||
*/ => { }
|
||||
var f3 = (x: string, y: number, ...rest)
|
||||
=> { }
|
||||
var f4 = (x: string, y: number, ...rest) /*
|
||||
*/ => { }
|
||||
var f5 = (...rest)
|
||||
=> { }
|
||||
var f6 = (...rest) /*
|
||||
*/ => { }
|
||||
var f7 = (x: string, y: number, z = 10)
|
||||
=> { }
|
||||
var f8 = (x: string, y: number, z = 10) /*
|
||||
*/ => { }
|
||||
var f9 = (a: number): number
|
||||
=> a;
|
||||
var f10 = (a: number) :
|
||||
number
|
||||
=> a
|
||||
var f11 = (a: number): number /*
|
||||
*/ => a;
|
||||
var f12 = (a: number) :
|
||||
number /*
|
||||
*/ => a
|
||||
|
||||
// Should be valid.
|
||||
var f11 = (a: number
|
||||
) => a;
|
||||
|
||||
// Should be valid.
|
||||
var f12 = (a: number)
|
||||
: number => a;
|
||||
|
||||
// Should be valid.
|
||||
var f13 = (a: number):
|
||||
number => a;
|
||||
|
||||
// Should be valid.
|
||||
var f14 = () /* */ => {}
|
||||
|
||||
// Should be valid.
|
||||
var f15 = (a: number): number /* */ => a
|
||||
|
||||
// Should be valid.
|
||||
var f16 = (a: number, b = 10):
|
||||
number /* */ => a + b;
|
||||
|
||||
function foo(func: () => boolean) { }
|
||||
foo(()
|
||||
=> true);
|
||||
foo(()
|
||||
=> { return false; });
|
||||
|
||||
module m {
|
||||
class City {
|
||||
constructor(x: number, thing = ()
|
||||
=> 100) {
|
||||
}
|
||||
|
||||
public m = ()
|
||||
=> 2 * 2 * 2
|
||||
}
|
||||
|
||||
export enum Enum {
|
||||
claw = (()
|
||||
=> 10)()
|
||||
}
|
||||
|
||||
export var v = x
|
||||
=> new City(Enum.claw);
|
||||
}
|
||||
|
||||
|
||||
//// [disallowLineTerminatorBeforeArrow.js]
|
||||
var f1 = function () {
|
||||
};
|
||||
var f2 = function (x, y) {
|
||||
};
|
||||
var f3 = function (x, y) {
|
||||
var rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
};
|
||||
var f4 = function (x, y) {
|
||||
var rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
};
|
||||
var f5 = function () {
|
||||
var rest = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
rest[_i - 0] = arguments[_i];
|
||||
}
|
||||
};
|
||||
var f6 = function () {
|
||||
var rest = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
rest[_i - 0] = arguments[_i];
|
||||
}
|
||||
};
|
||||
var f7 = function (x, y, z) {
|
||||
if (z === void 0) { z = 10; }
|
||||
};
|
||||
var f8 = function (x, y, z) {
|
||||
if (z === void 0) { z = 10; }
|
||||
};
|
||||
var f9 = function (a) {
|
||||
return a;
|
||||
};
|
||||
var f10 = function (a) {
|
||||
return a;
|
||||
};
|
||||
var f11 = function (a) {
|
||||
return a;
|
||||
};
|
||||
var f12 = function (a) {
|
||||
return a;
|
||||
};
|
||||
// Should be valid.
|
||||
var f11 = function (a) {
|
||||
return a;
|
||||
};
|
||||
// Should be valid.
|
||||
var f12 = function (a) {
|
||||
return a;
|
||||
};
|
||||
// Should be valid.
|
||||
var f13 = function (a) {
|
||||
return a;
|
||||
};
|
||||
// Should be valid.
|
||||
var f14 = function () {
|
||||
};
|
||||
// Should be valid.
|
||||
var f15 = function (a) {
|
||||
return a;
|
||||
};
|
||||
// Should be valid.
|
||||
var f16 = function (a, b) {
|
||||
if (b === void 0) { b = 10; }
|
||||
return a + b;
|
||||
};
|
||||
function foo(func) {
|
||||
}
|
||||
foo(function () {
|
||||
return true;
|
||||
});
|
||||
foo(function () {
|
||||
return false;
|
||||
});
|
||||
var m;
|
||||
(function (m) {
|
||||
var City = (function () {
|
||||
function City(x, thing) {
|
||||
if (thing === void 0) { thing = function () {
|
||||
return 100;
|
||||
}; }
|
||||
this.m = function () {
|
||||
return 2 * 2 * 2;
|
||||
};
|
||||
}
|
||||
return City;
|
||||
})();
|
||||
(function (Enum) {
|
||||
Enum[Enum["claw"] = (function () {
|
||||
return 10;
|
||||
})()] = "claw";
|
||||
})(m.Enum || (m.Enum = {}));
|
||||
var Enum = m.Enum;
|
||||
m.v = function (x) {
|
||||
return new City(Enum.claw);
|
||||
};
|
||||
})(m || (m = {}));
|
|
@ -1,8 +1,8 @@
|
|||
tests/cases/compiler/exportDefaultTypeAnnoation.ts(2,18): error TS1200: A type annotation on an export statement is only allowed in an ambient external module declaration.
|
||||
tests/cases/compiler/exportDefaultTypeAnnoation.ts(2,18): error TS1201: A type annotation on an export statement is only allowed in an ambient external module declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportDefaultTypeAnnoation.ts (1 errors) ====
|
||||
|
||||
export default : number;
|
||||
~~~~~~
|
||||
!!! error TS1200: A type annotation on an export statement is only allowed in an ambient external module declaration.
|
||||
!!! error TS1201: A type annotation on an export statement is only allowed in an ambient external module declaration.
|
|
@ -0,0 +1,46 @@
|
|||
//// [initializePropertiesWithRenamedLet.ts]
|
||||
|
||||
var x0;
|
||||
if (true) {
|
||||
let x0;
|
||||
var obj1 = { x0: x0 };
|
||||
var obj2 = { x0 };
|
||||
}
|
||||
|
||||
var x, y, z;
|
||||
if (true) {
|
||||
let { x: x } = { x: 0 };
|
||||
let { y } = { y: 0 };
|
||||
let z;
|
||||
({ z: z } = { z: 0 });
|
||||
({ z } = { z: 0 });
|
||||
}
|
||||
|
||||
//// [initializePropertiesWithRenamedLet.js]
|
||||
var x0;
|
||||
if (true) {
|
||||
var _x0;
|
||||
var obj1 = {
|
||||
x0: _x0
|
||||
};
|
||||
var obj2 = {
|
||||
x0: _x0
|
||||
};
|
||||
}
|
||||
var x, y, z;
|
||||
if (true) {
|
||||
var _x = ({
|
||||
x: 0
|
||||
}).x;
|
||||
var _y = ({
|
||||
y: 0
|
||||
}).y;
|
||||
var _z;
|
||||
(_a = {
|
||||
z: 0
|
||||
}, _z = _a.z, _a);
|
||||
(_b = {
|
||||
z: 0
|
||||
}, _z = _b.z, _b);
|
||||
}
|
||||
var _a, _b;
|
|
@ -0,0 +1,58 @@
|
|||
=== tests/cases/compiler/initializePropertiesWithRenamedLet.ts ===
|
||||
|
||||
var x0;
|
||||
>x0 : any
|
||||
|
||||
if (true) {
|
||||
let x0;
|
||||
>x0 : any
|
||||
|
||||
var obj1 = { x0: x0 };
|
||||
>obj1 : { x0: any; }
|
||||
>{ x0: x0 } : { x0: any; }
|
||||
>x0 : any
|
||||
>x0 : any
|
||||
|
||||
var obj2 = { x0 };
|
||||
>obj2 : { x0: any; }
|
||||
>{ x0 } : { x0: any; }
|
||||
>x0 : any
|
||||
}
|
||||
|
||||
var x, y, z;
|
||||
>x : any
|
||||
>y : any
|
||||
>z : any
|
||||
|
||||
if (true) {
|
||||
let { x: x } = { x: 0 };
|
||||
>x : unknown
|
||||
>x : number
|
||||
>{ x: 0 } : { x: number; }
|
||||
>x : number
|
||||
|
||||
let { y } = { y: 0 };
|
||||
>y : number
|
||||
>{ y: 0 } : { y: number; }
|
||||
>y : number
|
||||
|
||||
let z;
|
||||
>z : any
|
||||
|
||||
({ z: z } = { z: 0 });
|
||||
>({ z: z } = { z: 0 }) : { z: number; }
|
||||
>{ z: z } = { z: 0 } : { z: number; }
|
||||
>{ z: z } : { z: any; }
|
||||
>z : any
|
||||
>z : any
|
||||
>{ z: 0 } : { z: number; }
|
||||
>z : number
|
||||
|
||||
({ z } = { z: 0 });
|
||||
>({ z } = { z: 0 }) : { z: number; }
|
||||
>{ z } = { z: 0 } : { z: number; }
|
||||
>{ z } : { z: any; }
|
||||
>z : any
|
||||
>{ z: 0 } : { z: number; }
|
||||
>z : number
|
||||
}
|
|
@ -16,16 +16,16 @@ if (true) {
|
|||
if (true) {
|
||||
var x = 0; // Error
|
||||
var _a = ({
|
||||
_x: 0
|
||||
x: 0
|
||||
}).x, x = _a === void 0 ? 0 : _a; // Error
|
||||
var _b = ({
|
||||
_x: 0
|
||||
x: 0
|
||||
}).x, x = _b === void 0 ? 0 : _b; // Error
|
||||
var x = ({
|
||||
_x: 0
|
||||
x: 0
|
||||
}).x; // Error
|
||||
var x = ({
|
||||
_x: 0
|
||||
x: 0
|
||||
}).x; // Error
|
||||
}
|
||||
}
|
||||
|
|
17
tests/cases/compiler/initializePropertiesWithRenamedLet.ts
Normal file
17
tests/cases/compiler/initializePropertiesWithRenamedLet.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
// @target: es5
|
||||
|
||||
var x0;
|
||||
if (true) {
|
||||
let x0;
|
||||
var obj1 = { x0: x0 };
|
||||
var obj2 = { x0 };
|
||||
}
|
||||
|
||||
var x, y, z;
|
||||
if (true) {
|
||||
let { x: x } = { x: 0 };
|
||||
let { y } = { y: 0 };
|
||||
let z;
|
||||
({ z: z } = { z: 0 });
|
||||
({ z } = { z: 0 });
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
var f1 = ()
|
||||
=> { }
|
||||
var f2 = (x: string, y: string) /*
|
||||
*/ => { }
|
||||
var f3 = (x: string, y: number, ...rest)
|
||||
=> { }
|
||||
var f4 = (x: string, y: number, ...rest) /*
|
||||
*/ => { }
|
||||
var f5 = (...rest)
|
||||
=> { }
|
||||
var f6 = (...rest) /*
|
||||
*/ => { }
|
||||
var f7 = (x: string, y: number, z = 10)
|
||||
=> { }
|
||||
var f8 = (x: string, y: number, z = 10) /*
|
||||
*/ => { }
|
||||
var f9 = (a: number): number
|
||||
=> a;
|
||||
var f10 = (a: number) :
|
||||
number
|
||||
=> a
|
||||
var f11 = (a: number): number /*
|
||||
*/ => a;
|
||||
var f12 = (a: number) :
|
||||
number /*
|
||||
*/ => a
|
||||
|
||||
// Should be valid.
|
||||
var f11 = (a: number
|
||||
) => a;
|
||||
|
||||
// Should be valid.
|
||||
var f12 = (a: number)
|
||||
: number => a;
|
||||
|
||||
// Should be valid.
|
||||
var f13 = (a: number):
|
||||
number => a;
|
||||
|
||||
// Should be valid.
|
||||
var f14 = () /* */ => {}
|
||||
|
||||
// Should be valid.
|
||||
var f15 = (a: number): number /* */ => a
|
||||
|
||||
// Should be valid.
|
||||
var f16 = (a: number, b = 10):
|
||||
number /* */ => a + b;
|
||||
|
||||
function foo(func: () => boolean) { }
|
||||
foo(()
|
||||
=> true);
|
||||
foo(()
|
||||
=> { return false; });
|
||||
|
||||
module m {
|
||||
class City {
|
||||
constructor(x: number, thing = ()
|
||||
=> 100) {
|
||||
}
|
||||
|
||||
public m = ()
|
||||
=> 2 * 2 * 2
|
||||
}
|
||||
|
||||
export enum Enum {
|
||||
claw = (()
|
||||
=> 10)()
|
||||
}
|
||||
|
||||
export var v = x
|
||||
=> new City(Enum.claw);
|
||||
}
|
Loading…
Reference in a new issue