Merge branch 'master' into FixTripleSlashCompletions

This commit is contained in:
Arthur Ozga 2016-10-05 14:34:31 -07:00
commit 77a2d0e11a
26 changed files with 23441 additions and 45 deletions

View File

@ -725,16 +725,16 @@ declare module "convert-source-map" {
}
gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => {
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "built/local/bundle.js" }, /*useBuiltCompiler*/ true));
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "../../built/local/bundle.js" }, /*useBuiltCompiler*/ true));
return testProject.src()
.pipe(newer("built/local/bundle.js"))
.pipe(sourcemaps.init())
.pipe(testProject)
.pipe(testProject())
.pipe(through2.obj((file, enc, next) => {
const originalMap = file.sourceMap;
const prebundledContent = file.contents.toString();
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
originalMap.sources = originalMap.sources.map(s => path.resolve("src", s));
originalMap.sources = originalMap.sources.map(s => path.resolve(s));
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
originalMap.file = "built/local/_stream_0.js";

View File

@ -2432,8 +2432,7 @@ namespace ts {
}
// If the parameter's name is 'this', then it is TypeScript syntax.
if (subtreeFlags & TransformFlags.ContainsDecorators
|| (name && isIdentifier(name) && name.originalKeywordKind === SyntaxKind.ThisKeyword)) {
if (subtreeFlags & TransformFlags.ContainsDecorators || isThisIdentifier(name)) {
transformFlags |= TransformFlags.AssertTypeScript;
}

View File

@ -2183,9 +2183,14 @@ namespace ts {
// The specified symbol flags need to be reinterpreted as type flags
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, nextFlags);
}
else if (!(flags & TypeFormatFlags.InTypeAlias) && type.flags & (TypeFlags.Anonymous | TypeFlags.UnionOrIntersection) && type.aliasSymbol &&
else if (!(flags & TypeFormatFlags.InTypeAlias) && ((type.flags & TypeFlags.Anonymous && !(<AnonymousType>type).target) || type.flags & TypeFlags.UnionOrIntersection) && type.aliasSymbol &&
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible) {
// Only write out inferred type with its corresponding type-alias if type-alias is visible
// We emit inferred type as type-alias at the current localtion if all the following is true
// the input type is has alias symbol that is accessible
// the input type is a union, intersection or anonymous type that is fully instantiated (if not we want to keep dive into)
// e.g.: export type Bar<X, Y> = () => [X, Y];
// export type Foo<Y> = Bar<any, Y>;
// export const y = (x: Foo<string>) => 1 // we want to emit as ...x: () => [any, string])
const typeArguments = type.aliasTypeArguments;
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
}
@ -5446,7 +5451,26 @@ namespace ts {
return false;
}
function isSetOfLiteralsFromSameEnum(types: TypeSet): boolean {
const first = types[0];
if (first.flags & TypeFlags.EnumLiteral) {
const firstEnum = getParentOfSymbol(first.symbol);
for (let i = 1; i < types.length; i++) {
const other = types[i];
if (!(other.flags & TypeFlags.EnumLiteral) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types: TypeSet) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
let i = types.length;
while (i > 0) {
i--;
@ -9354,7 +9378,7 @@ namespace ts {
captureLexicalThis(node, container);
}
if (isFunctionLike(container) &&
(!isInParameterInitializerBeforeContainingFunction(node) || getFunctionLikeThisParameter(container))) {
(!isInParameterInitializerBeforeContainingFunction(node) || getThisParameter(container))) {
// Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated.
// If this is a function in a JS file, it might be a class method. Check if it's the RHS
@ -15538,10 +15562,6 @@ namespace ts {
}
}
function parameterIsThisKeyword(parameter: ParameterDeclaration) {
return parameter.name && (<Identifier>parameter.name).originalKeywordKind === SyntaxKind.ThisKeyword;
}
function parameterNameStartsWithUnderscore(parameter: ParameterDeclaration) {
return parameter.name && parameter.name.kind === SyntaxKind.Identifier && (<Identifier>parameter.name).text.charCodeAt(0) === CharacterCodes._;
}
@ -20122,18 +20142,8 @@ namespace ts {
}
function getAccessorThisParameter(accessor: AccessorDeclaration): ParameterDeclaration {
if (accessor.parameters.length === (accessor.kind === SyntaxKind.GetAccessor ? 1 : 2) &&
accessor.parameters[0].name.kind === SyntaxKind.Identifier &&
(<Identifier>accessor.parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword) {
return accessor.parameters[0];
}
}
function getFunctionLikeThisParameter(func: FunctionLikeDeclaration) {
if (func.parameters.length &&
func.parameters[0].name.kind === SyntaxKind.Identifier &&
(<Identifier>func.parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword) {
return func.parameters[0];
if (accessor.parameters.length === (accessor.kind === SyntaxKind.GetAccessor ? 1 : 2)) {
return getThisParameter(accessor);
}
}

View File

@ -1394,8 +1394,8 @@ namespace ts {
// Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery
return token() === SyntaxKind.CloseParenToken || token() === SyntaxKind.CloseBracketToken /*|| token === SyntaxKind.OpenBraceToken*/;
case ParsingContext.TypeArguments:
// Tokens other than '>' are here for better error recovery
return token() === SyntaxKind.GreaterThanToken || token() === SyntaxKind.OpenParenToken;
// All other tokens should cause the type-argument to terminate except comma token
return token() !== SyntaxKind.CommaToken;
case ParsingContext.HeritageClauses:
return token() === SyntaxKind.OpenBraceToken || token() === SyntaxKind.CloseBraceToken;
case ParsingContext.JsxAttributes:

View File

@ -2374,7 +2374,7 @@ namespace ts {
* @param node The parameter declaration node.
*/
function visitParameter(node: ParameterDeclaration) {
if (node.name && isIdentifier(node.name) && node.name.originalKeywordKind === SyntaxKind.ThisKeyword) {
if (parameterIsThisKeyword(node)) {
return undefined;
}

View File

@ -2707,15 +2707,35 @@ namespace ts {
});
}
export function getSetAccessorTypeAnnotationNode(accessor: AccessorDeclaration): TypeNode {
/** Get the type annotaion for the value parameter. */
export function getSetAccessorTypeAnnotationNode(accessor: SetAccessorDeclaration): TypeNode {
if (accessor && accessor.parameters.length > 0) {
const hasThis = accessor.parameters.length === 2 &&
accessor.parameters[0].name.kind === SyntaxKind.Identifier &&
(accessor.parameters[0].name as Identifier).originalKeywordKind === SyntaxKind.ThisKeyword;
const hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);
return accessor.parameters[hasThis ? 1 : 0].type;
}
}
export function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined {
if (signature.parameters.length) {
const thisParameter = signature.parameters[0];
if (parameterIsThisKeyword(thisParameter)) {
return thisParameter;
}
}
}
export function parameterIsThisKeyword(parameter: ParameterDeclaration): boolean {
return isThisIdentifier(parameter.name);
}
export function isThisIdentifier(node: Node | undefined): boolean {
return node && node.kind === SyntaxKind.Identifier && identifierIsThisKeyword(node as Identifier);
}
export function identifierIsThisKeyword(id: Identifier): boolean {
return id.originalKeywordKind === SyntaxKind.ThisKeyword;
}
export interface AllAccessorDeclarations {
firstAccessor: AccessorDeclaration;
secondAccessor: AccessorDeclaration;

View File

@ -954,8 +954,7 @@ namespace ts {
return;
case SyntaxKind.Parameter:
if ((<ParameterDeclaration>token.parent).name === token) {
const isThis = token.kind === SyntaxKind.Identifier && (<Identifier>token).originalKeywordKind === SyntaxKind.ThisKeyword;
return isThis ? ClassificationType.keyword : ClassificationType.parameterName;
return isThisIdentifier(token) ? ClassificationType.keyword : ClassificationType.parameterName;
}
return;
}

View File

@ -376,7 +376,7 @@ namespace ts {
return true;
case SyntaxKind.Identifier:
// 'this' as a parameter
return (node as Identifier).originalKeywordKind === SyntaxKind.ThisKeyword && node.parent.kind === SyntaxKind.Parameter;
return identifierIsThisKeyword(node as Identifier) && node.parent.kind === SyntaxKind.Parameter;
default:
return false;
}

View File

@ -1,10 +1,31 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2304: Cannot find name 'Foo'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,5): error TS2304: Cannot find name 'A'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,7): error TS2304: Cannot find name 'B'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,11): error TS2304: Cannot find name 'C'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,14): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,14): error TS2695: Left side of comma operator is unused and has no side effects.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts (2 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts (9 errors) ====
Foo<A,B,\ C>(4, 5, 6);
~~~
!!! error TS2304: Cannot find name 'Foo'.
~~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~~~~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~
!!! error TS2304: Cannot find name 'A'.
~
!!! error TS2304: Cannot find name 'B'.
!!! error TS1127: Invalid character.
!!! error TS1127: Invalid character.
~
!!! error TS2304: Cannot find name 'C'.
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.

View File

@ -2,4 +2,5 @@
Foo<A,B,\ C>(4, 5, 6);
//// [TypeArgumentList1.js]
Foo(4, 5, 6);
Foo < A, B, ;
C > (4, 5, 6);

View File

@ -0,0 +1,15 @@
//// [declarationEmitTypeAliasWithTypeParameters1.ts]
export type Bar<X, Y> = () => [X, Y];
export type Foo<Y> = Bar<any, Y>;
export const y = (x: Foo<string>) => 1
//// [declarationEmitTypeAliasWithTypeParameters1.js]
"use strict";
exports.y = function (x) { return 1; };
//// [declarationEmitTypeAliasWithTypeParameters1.d.ts]
export declare type Bar<X, Y> = () => [X, Y];
export declare type Foo<Y> = Bar<any, Y>;
export declare const y: (x: () => [any, string]) => number;

View File

@ -0,0 +1,20 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters1.ts ===
export type Bar<X, Y> = () => [X, Y];
>Bar : Symbol(Bar, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 0, 0))
>X : Symbol(X, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 16))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 18))
>X : Symbol(X, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 16))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 18))
export type Foo<Y> = Bar<any, Y>;
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 37))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 2, 16))
>Bar : Symbol(Bar, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 0, 0))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 2, 16))
export const y = (x: Foo<string>) => 1
>y : Symbol(y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 3, 12))
>x : Symbol(x, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 3, 18))
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 37))

View File

@ -0,0 +1,22 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters1.ts ===
export type Bar<X, Y> = () => [X, Y];
>Bar : Bar<X, Y>
>X : X
>Y : Y
>X : X
>Y : Y
export type Foo<Y> = Bar<any, Y>;
>Foo : () => [any, Y]
>Y : Y
>Bar : Bar<X, Y>
>Y : Y
export const y = (x: Foo<string>) => 1
>y : (x: () => [any, string]) => number
>(x: Foo<string>) => 1 : (x: () => [any, string]) => number
>x : () => [any, string]
>Foo : () => [any, Y]
>1 : 1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,10 @@
tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts(1,8): error TS2304: Cannot find name 'X'.
tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts(1,12): error TS1127: Invalid character.
tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts(1,13): error TS1005: '>' expected.
==== tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts (3 errors) ====
==== tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts (2 errors) ====
var v: X<T \
~
!!! error TS2304: Cannot find name 'X'.
!!! error TS1127: Invalid character.
!!! error TS1005: '>' expected.
!!! error TS1127: Invalid character.

View File

@ -1,10 +1,31 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,1): error TS2304: Cannot find name 'Foo'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,1): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,1): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,5): error TS2304: Cannot find name 'A'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,7): error TS2304: Cannot find name 'B'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,9): error TS1127: Invalid character.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,11): error TS2304: Cannot find name 'C'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,14): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts(1,14): error TS2695: Left side of comma operator is unused and has no side effects.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts (2 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/parserX_TypeArgumentList1.ts (9 errors) ====
Foo<A,B,\ C>(4, 5, 6);
~~~
!!! error TS2304: Cannot find name 'Foo'.
~~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~~~~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~
!!! error TS2304: Cannot find name 'A'.
~
!!! error TS2304: Cannot find name 'B'.
!!! error TS1127: Invalid character.
!!! error TS1127: Invalid character.
~
!!! error TS2304: Cannot find name 'C'.
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.

View File

@ -2,4 +2,5 @@
Foo<A,B,\ C>(4, 5, 6);
//// [parserX_TypeArgumentList1.js]
Foo(4, 5, 6);
Foo < A, B, ;
C > (4, 5, 6);

View File

@ -0,0 +1,41 @@
//// [tsxCorrectlyParseLessThanComparison1.tsx]
declare module JSX {
interface Element {
div: string;
}
}
declare namespace React {
class Component<P, S> {
constructor(props?: P, context?: any);
props: P;
}
}
export class ShortDetails extends React.Component<{ id: number }, {}> {
public render(): JSX.Element {
if (this.props.id < 1) {
return (<div></div>);
}
}
}
//// [tsxCorrectlyParseLessThanComparison1.js]
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var ShortDetails = (function (_super) {
__extends(ShortDetails, _super);
function ShortDetails() {
return _super.apply(this, arguments) || this;
}
ShortDetails.prototype.render = function () {
if (this.props.id < 1) {
return (React.createElement("div", null));
}
};
return ShortDetails;
}(React.Component));
exports.ShortDetails = ShortDetails;

View File

@ -0,0 +1,55 @@
=== tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 0))
interface Element {
>Element : Symbol(Element, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 20))
div: string;
>div : Symbol(Element.div, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 1, 23))
}
}
declare namespace React {
>React : Symbol(React, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 4, 1))
class Component<P, S> {
>Component : Symbol(Component, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 5, 25))
>P : Symbol(P, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 20))
>S : Symbol(S, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 22))
constructor(props?: P, context?: any);
>props : Symbol(props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 20))
>P : Symbol(P, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 20))
>context : Symbol(context, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 30))
props: P;
>props : Symbol(Component.props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 46))
>P : Symbol(P, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 20))
}
}
export class ShortDetails extends React.Component<{ id: number }, {}> {
>ShortDetails : Symbol(ShortDetails, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 10, 1))
>React.Component : Symbol(React.Component, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 5, 25))
>React : Symbol(React, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 4, 1))
>Component : Symbol(React.Component, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 5, 25))
>id : Symbol(id, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 51))
public render(): JSX.Element {
>render : Symbol(ShortDetails.render, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 71))
>JSX : Symbol(JSX, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 0))
>Element : Symbol(JSX.Element, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 20))
if (this.props.id < 1) {
>this.props.id : Symbol(id, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 51))
>this.props : Symbol(React.Component.props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 46))
>this : Symbol(ShortDetails, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 10, 1))
>props : Symbol(React.Component.props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 46))
>id : Symbol(id, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 51))
return (<div></div>);
>div : Symbol(unknown)
>div : Symbol(unknown)
}
}
}

View File

@ -0,0 +1,59 @@
=== tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx ===
declare module JSX {
>JSX : any
interface Element {
>Element : Element
div: string;
>div : string
}
}
declare namespace React {
>React : typeof React
class Component<P, S> {
>Component : Component<P, S>
>P : P
>S : S
constructor(props?: P, context?: any);
>props : P
>P : P
>context : any
props: P;
>props : P
>P : P
}
}
export class ShortDetails extends React.Component<{ id: number }, {}> {
>ShortDetails : ShortDetails
>React.Component : React.Component<{ id: number; }, {}>
>React : typeof React
>Component : typeof React.Component
>id : number
public render(): JSX.Element {
>render : () => JSX.Element
>JSX : any
>Element : JSX.Element
if (this.props.id < 1) {
>this.props.id < 1 : boolean
>this.props.id : number
>this.props : { id: number; }
>this : this
>props : { id: number; }
>id : number
>1 : 1
return (<div></div>);
>(<div></div>) : any
><div></div> : any
>div : any
>div : any
}
}
}

View File

@ -0,0 +1,5 @@
// @declaration: true
export type Bar<X, Y> = () => [X, Y];
export type Foo<Y> = Bar<any, Y>;
export const y = (x: Foo<string>) => 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
// @jsx: react
declare module JSX {
interface Element {
div: string;
}
}
declare namespace React {
class Component<P, S> {
constructor(props?: P, context?: any);
props: P;
}
}
export class ShortDetails extends React.Component<{ id: number }, {}> {
public render(): JSX.Element {
if (this.props.id < 1) {
return (<div></div>);
}
}
}

View File

@ -36,6 +36,7 @@
//// return [|<any>|] a;
//// }
////}
////const x: Array[|<() => void>|] = [];
test.ranges().forEach((range) => {
verify.matchingBracePositionInCurrentFile(range.start, range.end - 1);