mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-16 01:41:17 -06:00
Merge branch 'master' into release-2.0
This commit is contained in:
commit
78f259340a
@ -46785,6 +46785,7 @@ var ts;
|
||||
if (objectLikeContainer.kind === 171) {
|
||||
isNewIdentifierLocation = true;
|
||||
typeForObject = typeChecker.getContextualType(objectLikeContainer);
|
||||
typeForObject = typeForObject && typeForObject.getNonNullableType();
|
||||
existingMembers = objectLikeContainer.properties;
|
||||
}
|
||||
else if (objectLikeContainer.kind === 167) {
|
||||
|
||||
@ -46785,6 +46785,7 @@ var ts;
|
||||
if (objectLikeContainer.kind === 171) {
|
||||
isNewIdentifierLocation = true;
|
||||
typeForObject = typeChecker.getContextualType(objectLikeContainer);
|
||||
typeForObject = typeForObject && typeForObject.getNonNullableType();
|
||||
existingMembers = objectLikeContainer.properties;
|
||||
}
|
||||
else if (objectLikeContainer.kind === 167) {
|
||||
|
||||
@ -41058,6 +41058,21 @@ var ts;
|
||||
emitSignatureParameters(ctor);
|
||||
}
|
||||
else {
|
||||
// The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation:
|
||||
// If constructor is empty, then
|
||||
// If ClassHeritag_eopt is present and protoParent is not null, then
|
||||
// Let constructor be the result of parsing the source text
|
||||
// constructor(...args) { super (...args);}
|
||||
// using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
|
||||
// Else,
|
||||
// Let constructor be the result of parsing the source text
|
||||
// constructor( ){ }
|
||||
// using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
|
||||
//
|
||||
// While we could emit the '...args' rest parameter, certain later tools in the pipeline might
|
||||
// downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.
|
||||
// Instead, we'll avoid using a rest parameter and spread into the super call as
|
||||
// 'super(...arguments)' instead of 'super(...args)', as you can see below.
|
||||
write("()");
|
||||
}
|
||||
}
|
||||
@ -41092,6 +41107,7 @@ var ts;
|
||||
write("_super.apply(this, arguments);");
|
||||
}
|
||||
else {
|
||||
// See comment above on using '...arguments' instead of '...args'.
|
||||
write("super(...arguments);");
|
||||
}
|
||||
emitEnd(baseTypeElement);
|
||||
@ -55629,7 +55645,10 @@ var ts;
|
||||
// We are completing on contextual types, but may also include properties
|
||||
// other than those within the declared type.
|
||||
isNewIdentifierLocation = true;
|
||||
// If the object literal is being assigned to something of type 'null | { hello: string }',
|
||||
// it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible.
|
||||
typeForObject = typeChecker.getContextualType(objectLikeContainer);
|
||||
typeForObject = typeForObject && typeForObject.getNonNullableType();
|
||||
existingMembers = objectLikeContainer.properties;
|
||||
}
|
||||
else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) {
|
||||
@ -55640,7 +55659,7 @@ var ts;
|
||||
// We don't want to complete using the type acquired by the shape
|
||||
// of the binding pattern; we are only interested in types acquired
|
||||
// through type declaration or inference.
|
||||
// Also proceed if rootDeclaration is parameter and if its containing function expression\arrow function is contextually typed -
|
||||
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
|
||||
// type of parameter will flow in from the contextual type of the function
|
||||
var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
|
||||
if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) {
|
||||
|
||||
@ -41058,6 +41058,21 @@ var ts;
|
||||
emitSignatureParameters(ctor);
|
||||
}
|
||||
else {
|
||||
// The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation:
|
||||
// If constructor is empty, then
|
||||
// If ClassHeritag_eopt is present and protoParent is not null, then
|
||||
// Let constructor be the result of parsing the source text
|
||||
// constructor(...args) { super (...args);}
|
||||
// using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
|
||||
// Else,
|
||||
// Let constructor be the result of parsing the source text
|
||||
// constructor( ){ }
|
||||
// using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
|
||||
//
|
||||
// While we could emit the '...args' rest parameter, certain later tools in the pipeline might
|
||||
// downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.
|
||||
// Instead, we'll avoid using a rest parameter and spread into the super call as
|
||||
// 'super(...arguments)' instead of 'super(...args)', as you can see below.
|
||||
write("()");
|
||||
}
|
||||
}
|
||||
@ -41092,6 +41107,7 @@ var ts;
|
||||
write("_super.apply(this, arguments);");
|
||||
}
|
||||
else {
|
||||
// See comment above on using '...arguments' instead of '...args'.
|
||||
write("super(...arguments);");
|
||||
}
|
||||
emitEnd(baseTypeElement);
|
||||
@ -55629,7 +55645,10 @@ var ts;
|
||||
// We are completing on contextual types, but may also include properties
|
||||
// other than those within the declared type.
|
||||
isNewIdentifierLocation = true;
|
||||
// If the object literal is being assigned to something of type 'null | { hello: string }',
|
||||
// it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible.
|
||||
typeForObject = typeChecker.getContextualType(objectLikeContainer);
|
||||
typeForObject = typeForObject && typeForObject.getNonNullableType();
|
||||
existingMembers = objectLikeContainer.properties;
|
||||
}
|
||||
else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) {
|
||||
@ -55640,7 +55659,7 @@ var ts;
|
||||
// We don't want to complete using the type acquired by the shape
|
||||
// of the binding pattern; we are only interested in types acquired
|
||||
// through type declaration or inference.
|
||||
// Also proceed if rootDeclaration is parameter and if its containing function expression\arrow function is contextually typed -
|
||||
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
|
||||
// type of parameter will flow in from the contextual type of the function
|
||||
var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
|
||||
if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/// <reference path="../src/harness/external/node.d.ts" />
|
||||
/// <reference types="node"/>
|
||||
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
|
||||
@ -5311,6 +5311,21 @@ const _super = (function (geti, seti) {
|
||||
emitSignatureParameters(ctor);
|
||||
}
|
||||
else {
|
||||
// The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation:
|
||||
// If constructor is empty, then
|
||||
// If ClassHeritag_eopt is present and protoParent is not null, then
|
||||
// Let constructor be the result of parsing the source text
|
||||
// constructor(...args) { super (...args);}
|
||||
// using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
|
||||
// Else,
|
||||
// Let constructor be the result of parsing the source text
|
||||
// constructor( ){ }
|
||||
// using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
|
||||
//
|
||||
// While we could emit the '...args' rest parameter, certain later tools in the pipeline might
|
||||
// downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.
|
||||
// Instead, we'll avoid using a rest parameter and spread into the super call as
|
||||
// 'super(...arguments)' instead of 'super(...args)', as you can see below.
|
||||
write("()");
|
||||
}
|
||||
}
|
||||
@ -5349,6 +5364,7 @@ const _super = (function (geti, seti) {
|
||||
write("_super.apply(this, arguments);");
|
||||
}
|
||||
else {
|
||||
// See comment above on using '...arguments' instead of '...args'.
|
||||
write("super(...arguments);");
|
||||
}
|
||||
emitEnd(baseTypeElement);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
|
||||
export const version = "2.0.2";
|
||||
|
||||
const emptyArray: any[] = [];
|
||||
|
||||
@ -198,7 +198,8 @@ namespace RWC {
|
||||
}
|
||||
// Do not include the library in the baselines to avoid noise
|
||||
const baselineFiles = inputFiles.concat(otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName));
|
||||
return Harness.Compiler.getErrorBaseline(baselineFiles, compilerResult.errors);
|
||||
const errors = compilerResult.errors.filter(e => !Harness.isDefaultLibraryFile(e.file.fileName));
|
||||
return Harness.Compiler.getErrorBaseline(baselineFiles, errors);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
|
||||
@ -3789,7 +3789,11 @@ namespace ts {
|
||||
// other than those within the declared type.
|
||||
isNewIdentifierLocation = true;
|
||||
|
||||
// If the object literal is being assigned to something of type 'null | { hello: string }',
|
||||
// it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible.
|
||||
typeForObject = typeChecker.getContextualType(<ObjectLiteralExpression>objectLikeContainer);
|
||||
typeForObject = typeForObject && typeForObject.getNonNullableType();
|
||||
|
||||
existingMembers = (<ObjectLiteralExpression>objectLikeContainer).properties;
|
||||
}
|
||||
else if (objectLikeContainer.kind === SyntaxKind.ObjectBindingPattern) {
|
||||
@ -3801,7 +3805,7 @@ namespace ts {
|
||||
// We don't want to complete using the type acquired by the shape
|
||||
// of the binding pattern; we are only interested in types acquired
|
||||
// through type declaration or inference.
|
||||
// Also proceed if rootDeclaration is parameter and if its containing function expression\arrow function is contextually typed -
|
||||
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
|
||||
// type of parameter will flow in from the contextual type of the function
|
||||
let canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
|
||||
if (!canGetType && rootDeclaration.kind === SyntaxKind.Parameter) {
|
||||
|
||||
28
tests/cases/fourslash/completionListInObjectLiteral4.ts
Normal file
28
tests/cases/fourslash/completionListInObjectLiteral4.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @strictNullChecks: true
|
||||
////interface Thing {
|
||||
//// hello: number;
|
||||
//// world: string;
|
||||
////}
|
||||
////
|
||||
////declare function funcA(x : Thing): void;
|
||||
////declare function funcB(x?: Thing): void;
|
||||
////declare function funcC(x : Thing | null): void;
|
||||
////declare function funcD(x : Thing | undefined): void;
|
||||
////declare function funcE(x : Thing | null | undefined): void;
|
||||
////declare function funcF(x?: Thing | null | undefined): void;
|
||||
////
|
||||
////funcA({ /*A*/ });
|
||||
////funcB({ /*B*/ });
|
||||
////funcC({ /*C*/ });
|
||||
////funcD({ /*D*/ });
|
||||
////funcE({ /*E*/ });
|
||||
////funcF({ /*F*/ });
|
||||
|
||||
|
||||
for (const marker of test.markers()) {
|
||||
goTo.position(marker.position);
|
||||
verify.completionListContains("hello");
|
||||
verify.completionListContains("world");
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user