Skip to content

Commit

Permalink
2016-08-30 [ci skip] Version: 1.201608300008.1+0485bb6b56b38749b83a23…
Browse files Browse the repository at this point in the history
…626243627a42472d50
  • Loading branch information
basarat committed Aug 30, 2016
1 parent c197d1a commit 941632a
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 37 deletions.
2 changes: 1 addition & 1 deletion TypeScript
Submodule TypeScript updated 20 files
+31 −12 src/compiler/checker.ts
+16 −0 tests/baselines/reference/constructableDecoratorOnClass01.errors.txt
+30 −0 tests/baselines/reference/constructableDecoratorOnClass01.js
+13 −0 tests/baselines/reference/constructableDecoratorOnClass01.symbols
+13 −0 tests/baselines/reference/constructableDecoratorOnClass01.types
+8 −0 tests/baselines/reference/taggedTemplateUntypedTagCall01.js
+8 −0 tests/baselines/reference/taggedTemplateUntypedTagCall01.symbols
+10 −0 tests/baselines/reference/taggedTemplateUntypedTagCall01.types
+9 −0 tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt
+13 −0 tests/baselines/reference/taggedTemplateWithConstructableTag01.js
+7 −0 tests/baselines/reference/taggedTemplateWithConstructableTag01.symbols
+9 −0 tests/baselines/reference/taggedTemplateWithConstructableTag01.types
+12 −0 tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt
+12 −0 tests/baselines/reference/taggedTemplateWithConstructableTag02.js
+16 −0 tests/baselines/reference/taggedTemplateWithConstructableTag02.symbols
+18 −0 tests/baselines/reference/taggedTemplateWithConstructableTag02.types
+8 −0 tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts
+2 −0 tests/cases/conformance/es6/templates/taggedTemplateUntypedTagCall01.ts
+3 −0 tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag01.ts
+6 −0 tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag02.ts
40 changes: 29 additions & 11 deletions bin/ntypescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -27402,16 +27402,10 @@ var ts;
// that the user will not add any.
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
// TS 1.0 spec: 4.12
// If FuncExpr is of type Any, or of an object type that has no call or construct signatures
// but is a subtype of the Function interface, the call is an untyped function call. In an
// untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual
// TS 1.0 Spec: 4.12
// In an untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual
// types are provided for the argument expressions, and the result is always of type Any.
// We exclude union types because we may have a union of function types that happen to have
// no common signatures.
if (isTypeAny(funcType) ||
(isTypeAny(apparentType) && funcType.flags & 16384 /* TypeParameter */) ||
(!callSignatures.length && !constructSignatures.length && !(funcType.flags & 524288 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) {
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {
// The unknownType indicates that an error already occurred (and was reported). No
// need to report another error in this case.
if (funcType !== unknownType && node.typeArguments) {
Expand All @@ -27433,6 +27427,28 @@ var ts;
}
return resolveCall(node, callSignatures, candidatesOutArray);
}
/**
* TS 1.0 spec: 4.12
* If FuncExpr is of type Any, or of an object type that has no call or construct signatures
* but is a subtype of the Function interface, the call is an untyped function call.
*/
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
if (isTypeAny(funcType)) {
return true;
}
if (isTypeAny(apparentFuncType) && funcType.flags & 16384 /* TypeParameter */) {
return true;
}
if (!numCallSignatures && !numConstructSignatures) {
// We exclude union types because we may have a union of function types that happen to have
// no common signatures.
if (funcType.flags & 524288 /* Union */) {
return false;
}
return isTypeAssignableTo(funcType, globalFunctionType);
}
return false;
}
function resolveNewExpression(node, candidatesOutArray) {
if (node.arguments && languageVersion < 1 /* ES5 */) {
var spreadIndex = getSpreadArgumentIndex(node.arguments);
Expand Down Expand Up @@ -27542,7 +27558,8 @@ var ts;
return resolveErrorCall(node);
}
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
if (isTypeAny(tagType) || (!callSignatures.length && !(tagType.flags & 524288 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) {
var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) {
return resolveUntypedCall(node);
}
if (!callSignatures.length) {
Expand Down Expand Up @@ -27579,7 +27596,8 @@ var ts;
return resolveErrorCall(node);
}
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
if (funcType === anyType || (!callSignatures.length && !(funcType.flags & 524288 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) {
var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {
return resolveUntypedCall(node);
}
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
Expand Down
40 changes: 29 additions & 11 deletions bin/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -27402,16 +27402,10 @@ var ts;
// that the user will not add any.
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
// TS 1.0 spec: 4.12
// If FuncExpr is of type Any, or of an object type that has no call or construct signatures
// but is a subtype of the Function interface, the call is an untyped function call. In an
// untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual
// TS 1.0 Spec: 4.12
// In an untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual
// types are provided for the argument expressions, and the result is always of type Any.
// We exclude union types because we may have a union of function types that happen to have
// no common signatures.
if (isTypeAny(funcType) ||
(isTypeAny(apparentType) && funcType.flags & 16384 /* TypeParameter */) ||
(!callSignatures.length && !constructSignatures.length && !(funcType.flags & 524288 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) {
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {
// The unknownType indicates that an error already occurred (and was reported). No
// need to report another error in this case.
if (funcType !== unknownType && node.typeArguments) {
Expand All @@ -27433,6 +27427,28 @@ var ts;
}
return resolveCall(node, callSignatures, candidatesOutArray);
}
/**
* TS 1.0 spec: 4.12
* If FuncExpr is of type Any, or of an object type that has no call or construct signatures
* but is a subtype of the Function interface, the call is an untyped function call.
*/
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
if (isTypeAny(funcType)) {
return true;
}
if (isTypeAny(apparentFuncType) && funcType.flags & 16384 /* TypeParameter */) {
return true;
}
if (!numCallSignatures && !numConstructSignatures) {
// We exclude union types because we may have a union of function types that happen to have
// no common signatures.
if (funcType.flags & 524288 /* Union */) {
return false;
}
return isTypeAssignableTo(funcType, globalFunctionType);
}
return false;
}
function resolveNewExpression(node, candidatesOutArray) {
if (node.arguments && languageVersion < 1 /* ES5 */) {
var spreadIndex = getSpreadArgumentIndex(node.arguments);
Expand Down Expand Up @@ -27542,7 +27558,8 @@ var ts;
return resolveErrorCall(node);
}
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
if (isTypeAny(tagType) || (!callSignatures.length && !(tagType.flags & 524288 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) {
var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) {
return resolveUntypedCall(node);
}
if (!callSignatures.length) {
Expand Down Expand Up @@ -27579,7 +27596,8 @@ var ts;
return resolveErrorCall(node);
}
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
if (funcType === anyType || (!callSignatures.length && !(funcType.flags & 524288 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) {
var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {
return resolveUntypedCall(node);
}
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
Expand Down
2 changes: 1 addition & 1 deletion kicktravis
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2016-08-29 [ci skip] Version: 1.201608290012.1+598ca48c94535156c842ddc13fddd24aac1130fe
2016-08-30 [ci skip] Version: 1.201608300008.1+0485bb6b56b38749b83a23626243627a42472d50
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ntypescript",
"version": "1.201608290012.1+598ca48c94535156c842ddc13fddd24aac1130fe",
"version": "1.201608300008.1+0485bb6b56b38749b83a23626243627a42472d50",
"description": "A nicer version of microsoft/typescript packaged and released for API developers",
"main": "./bin/ntypescript.js",
"bin": {
Expand Down
43 changes: 31 additions & 12 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11960,18 +11960,12 @@ namespace ts {
// Function interface, since they have none by default. This is a bit of a leap of faith
// that the user will not add any.
const callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call);

const constructSignatures = getSignaturesOfType(apparentType, SignatureKind.Construct);
// TS 1.0 spec: 4.12
// If FuncExpr is of type Any, or of an object type that has no call or construct signatures
// but is a subtype of the Function interface, the call is an untyped function call. In an
// untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual

// TS 1.0 Spec: 4.12
// In an untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual
// types are provided for the argument expressions, and the result is always of type Any.
// We exclude union types because we may have a union of function types that happen to have
// no common signatures.
if (isTypeAny(funcType) ||
(isTypeAny(apparentType) && funcType.flags & TypeFlags.TypeParameter) ||
(!callSignatures.length && !constructSignatures.length && !(funcType.flags & TypeFlags.Union) && isTypeAssignableTo(funcType, globalFunctionType))) {
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {
// The unknownType indicates that an error already occurred (and was reported). No
// need to report another error in this case.
if (funcType !== unknownType && node.typeArguments) {
Expand All @@ -11994,6 +11988,29 @@ namespace ts {
return resolveCall(node, callSignatures, candidatesOutArray);
}

/**
* TS 1.0 spec: 4.12
* If FuncExpr is of type Any, or of an object type that has no call or construct signatures
* but is a subtype of the Function interface, the call is an untyped function call.
*/
function isUntypedFunctionCall(funcType: Type, apparentFuncType: Type, numCallSignatures: number, numConstructSignatures: number) {
if (isTypeAny(funcType)) {
return true;
}
if (isTypeAny(apparentFuncType) && funcType.flags & TypeFlags.TypeParameter) {
return true;
}
if (!numCallSignatures && !numConstructSignatures) {
// We exclude union types because we may have a union of function types that happen to have
// no common signatures.
if (funcType.flags & TypeFlags.Union) {
return false;
}
return isTypeAssignableTo(funcType, globalFunctionType);
}
return false;
}

function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature {
if (node.arguments && languageVersion < ScriptTarget.ES5) {
const spreadIndex = getSpreadArgumentIndex(node.arguments);
Expand Down Expand Up @@ -12119,8 +12136,9 @@ namespace ts {
}

const callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call);
const constructSignatures = getSignaturesOfType(apparentType, SignatureKind.Construct);

if (isTypeAny(tagType) || (!callSignatures.length && !(tagType.flags & TypeFlags.Union) && isTypeAssignableTo(tagType, globalFunctionType))) {
if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) {
return resolveUntypedCall(node);
}

Expand Down Expand Up @@ -12165,7 +12183,8 @@ namespace ts {
}

const callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call);
if (funcType === anyType || (!callSignatures.length && !(funcType.flags & TypeFlags.Union) && isTypeAssignableTo(funcType, globalFunctionType))) {
const constructSignatures = getSignaturesOfType(apparentType, SignatureKind.Construct);
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {
return resolveUntypedCall(node);
}

Expand Down

0 comments on commit 941632a

Please sign in to comment.