mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Merge pull request #2756 from Microsoft/completionFixes
Completion fixes
This commit is contained in:
commit
fe50957240
@ -9412,7 +9412,10 @@ module ts {
|
||||
}
|
||||
|
||||
if (isArrayLikeType(inputType)) {
|
||||
return getIndexTypeOfType(inputType, IndexKind.Number);
|
||||
let indexType = getIndexTypeOfType(inputType, IndexKind.Number);
|
||||
if (indexType) {
|
||||
return indexType;
|
||||
}
|
||||
}
|
||||
|
||||
error(errorNode, Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType));
|
||||
|
||||
@ -3109,6 +3109,7 @@ module ts {
|
||||
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||
previousToken.parent && previousToken.parent.parent &&
|
||||
(previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
|
||||
@ -3124,7 +3125,8 @@ module ts {
|
||||
case SyntaxKind.DotDotDotToken:
|
||||
return containingNodeKind === SyntaxKind.Parameter ||
|
||||
containingNodeKind === SyntaxKind.Constructor ||
|
||||
(previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
|
||||
(previousToken.parent && previousToken.parent.parent &&
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
|
||||
@ -14,6 +14,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(3
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,1): error TS2461: Type 'any' is not an array type.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
@ -38,7 +39,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(70,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (38 errors) ====
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (39 errors) ====
|
||||
// expected error for all the LHS of assignments
|
||||
var value;
|
||||
|
||||
@ -109,6 +110,8 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7
|
||||
|
||||
// array literals
|
||||
['', ''] = value;
|
||||
~~~~~~~~
|
||||
!!! error TS2461: Type 'any' is not an array type.
|
||||
~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
~~
|
||||
|
||||
6
tests/cases/fourslash/completionAfterDotDotDot.ts
Normal file
6
tests/cases/fourslash/completionAfterDotDotDot.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////.../**/
|
||||
|
||||
goTo.marker();
|
||||
verify.not.completionListIsEmpty();
|
||||
@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var array = [1, 2, 4]
|
||||
////function a4(x, y, z) { }
|
||||
////a4(...<crash>/**/
|
||||
|
||||
|
||||
goTo.marker();
|
||||
verify.not.completionListIsEmpty();
|
||||
Loading…
x
Reference in New Issue
Block a user