Skip to content

Commit 784f29b

Browse files
committed
merge conflict
2 parents 2576ea1 + 445cf0e commit 784f29b

File tree

105 files changed

+2599
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2599
-137
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"through2": "latest",
7676
"travis-fold": "latest",
7777
"ts-node": "latest",
78-
"tslint": "next",
78+
"tslint": "4.0.0-dev.3",
7979
"typescript": "next"
8080
},
8181
"scripts": {

src/compiler/checker.ts

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4612,8 +4612,8 @@ namespace ts {
46124612
// the modifiers type is T. Otherwise, the modifiers type is {}.
46134613
const declaredType = <MappedType>getTypeFromMappedTypeNode(type.declaration);
46144614
const constraint = getConstraintTypeFromMappedType(declaredType);
4615-
const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
4616-
type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
4615+
const extendedConstraint = constraint && constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
4616+
type.modifiersType = extendedConstraint && extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
46174617
}
46184618
}
46194619
return type.modifiersType;
@@ -6645,7 +6645,7 @@ namespace ts {
66456645
// Starting with the parent of the symbol's declaration, check if the mapper maps any of
66466646
// the type parameters introduced by enclosing declarations. We just pick the first
66476647
// declaration since multiple declarations will all have the same parent anyway.
6648-
let node = symbol.declarations[0].parent;
6648+
let node: Node = symbol.declarations[0];
66496649
while (node) {
66506650
switch (node.kind) {
66516651
case SyntaxKind.FunctionType:
@@ -6665,7 +6665,7 @@ namespace ts {
66656665
case SyntaxKind.ClassExpression:
66666666
case SyntaxKind.InterfaceDeclaration:
66676667
case SyntaxKind.TypeAliasDeclaration:
6668-
const declaration = <DeclarationWithTypeParameters>node;
6668+
const declaration = node as DeclarationWithTypeParameters;
66696669
if (declaration.typeParameters) {
66706670
for (const d of declaration.typeParameters) {
66716671
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
@@ -6680,6 +6680,14 @@ namespace ts {
66806680
}
66816681
}
66826682
break;
6683+
case SyntaxKind.JSDocFunctionType:
6684+
const func = node as JSDocFunctionType;
6685+
for (const p of func.parameters) {
6686+
if (contains(mappedTypes, getTypeOfNode(p))) {
6687+
return true;
6688+
}
6689+
}
6690+
break;
66836691
case SyntaxKind.ModuleDeclaration:
66846692
case SyntaxKind.SourceFile:
66856693
return false;
@@ -7730,8 +7738,11 @@ namespace ts {
77307738
}
77317739
}
77327740
}
7733-
else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(<ObjectType>target))) {
7734-
return Ternary.True;
7741+
else if (relation !== identityRelation) {
7742+
const resolved = resolveStructuredTypeMembers(<ObjectType>target);
7743+
if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & TypeFlags.Any) {
7744+
return Ternary.True;
7745+
}
77357746
}
77367747
return Ternary.False;
77377748
}
@@ -16888,7 +16899,7 @@ namespace ts {
1688816899
if (!local.isReferenced && !local.exportSymbol) {
1688916900
for (const declaration of local.declarations) {
1689016901
if (!isAmbientModule(declaration)) {
16891-
error(declaration.name, Diagnostics._0_is_declared_but_never_used, local.name);
16902+
errorUnusedLocal(declaration.name, local.name);
1689216903
}
1689316904
}
1689416905
}
@@ -21845,8 +21856,19 @@ namespace ts {
2184521856

2184621857
function checkGrammarNumericLiteral(node: NumericLiteral): boolean {
2184721858
// Grammar checking
21848-
if (node.isOctalLiteral && languageVersion >= ScriptTarget.ES5) {
21849-
return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher);
21859+
if (node.isOctalLiteral) {
21860+
let diagnosticMessage: DiagnosticMessage | undefined;
21861+
if (languageVersion >= ScriptTarget.ES5) {
21862+
diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
21863+
}
21864+
else if (isChildOfLiteralType(node)) {
21865+
diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
21866+
}
21867+
if (diagnosticMessage) {
21868+
const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken;
21869+
const literal = `${withMinus ? "-" : ""}0o${node.text}`;
21870+
return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
21871+
}
2185021872
}
2185121873
}
2185221874

src/compiler/diagnosticMessages.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"category": "Error",
228228
"code": 1084
229229
},
230-
"Octal literals are not available when targeting ECMAScript 5 and higher.": {
230+
"Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'.": {
231231
"category": "Error",
232232
"code": 1085
233233
},
@@ -2685,6 +2685,10 @@
26852685
"category": "Message",
26862686
"code": 6080
26872687
},
2688+
"File '{0}' has an unsupported extension, so skipping it.": {
2689+
"category": "Message",
2690+
"code": 6081
2691+
},
26882692
"Only 'amd' and 'system' modules are supported alongside --{0}.": {
26892693
"category": "Error",
26902694
"code": 6082
@@ -2945,6 +2949,10 @@
29452949
"category": "Message",
29462950
"code": 6146
29472951
},
2952+
"Resolution for module '{0}' was found in cache": {
2953+
"category": "Message",
2954+
"code": 6147
2955+
},
29482956
"Variable '{0}' implicitly has an '{1}' type.": {
29492957
"category": "Error",
29502958
"code": 7005
@@ -3234,5 +3242,9 @@
32343242
"Add {0} to existing import declaration from {1}": {
32353243
"category": "Message",
32363244
"code": 90015
3245+
},
3246+
"Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": {
3247+
"category": "Error",
3248+
"code": 8017
32373249
}
32383250
}

0 commit comments

Comments
 (0)