Skip to content

[Transforms] Merging Master to Transforms on 06/21 #9294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 125 commits into from
Jul 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
f9ae3e4
Initial support for globs in tsconfig.json
rbuckton Dec 3, 2015
30575db
Added caching, more tests
rbuckton Dec 7, 2015
5de2fcc
Merge branch 'master' into glob2
rbuckton Dec 7, 2015
def3ba1
Added stubs to ChakraHost interface for readDirectoryNames/readFileNames
rbuckton Dec 7, 2015
c3c3bca
Fixed typos in comments
rbuckton Dec 8, 2015
bf9af46
Changed name of 'reduce' method added to FileSet
rbuckton Dec 8, 2015
d857250
Heavily revised implementation that relies on an updated 'readDirecto…
rbuckton Dec 14, 2015
247657f
Merge branch 'master' into glob2
rbuckton Dec 15, 2015
94a5327
more tests
rbuckton Dec 16, 2015
6f85fe9
Minor update to shims.ts for forthcoming VS support for globs.
rbuckton Dec 16, 2015
d23df34
Detailed comments for regular expressions and renamed some files.
rbuckton Dec 16, 2015
c224917
Comment cleanup
rbuckton Jan 4, 2016
cde12ef
Merge branch 'master' into glob2
rbuckton Jan 4, 2016
c1205eb
Fixed new linter warnings
rbuckton Jan 5, 2016
4d3cff1
Add upper limit for the program size, fix readDirectory for the symli…
zhengbli Mar 11, 2016
b155fa8
Add comments
zhengbli Mar 12, 2016
a3aa000
CR feedback / Change upper limit / Add disableSizeLimit compiler option
zhengbli Mar 14, 2016
a6a466c
online and offline CR feedback
zhengbli Mar 15, 2016
d4eb3b8
Don't count current opened client file if it's TS file
zhengbli Mar 15, 2016
a839d93
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
zhengbli Mar 17, 2016
225e3b4
Speed up file searching
zhengbli Mar 17, 2016
c8e0b00
Make language service optional for a project
zhengbli Mar 17, 2016
d7e1d34
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
zhengbli Mar 18, 2016
cb46f16
Fix failed tests
zhengbli Mar 18, 2016
74e3d7b
Fix project updateing issue after editing config file
zhengbli Mar 18, 2016
1b76294
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
zhengbli Mar 24, 2016
5c9ce9e
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
zhengbli Mar 28, 2016
084b94c
Merge branch 'master' into glob2
riknoll May 26, 2016
db85643
Fixing linter and test errors
riknoll May 26, 2016
c340c88
Bringing back excludes error and fixing faulty test
riknoll May 26, 2016
50f0033
Merge branch 'master' into glob2_merged
riknoll May 26, 2016
aa5c51c
Fixing lint errors
riknoll May 26, 2016
0415b95
Passing regular expressions to native hosts
riknoll May 31, 2016
94d44ad
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
zhengbli Jun 9, 2016
d387050
Fix merging issues and multiple project scenario
zhengbli Jun 9, 2016
4383f1a
Refactoring
zhengbli Jun 9, 2016
e41b10b
add test and spit commandLineParser changes to another PR
zhengbli Jun 10, 2016
1e7790d
Fix #8523
zhengbli Jun 10, 2016
85ac67f
check the declaration and use order if both are not in module file
zhengbli Jun 10, 2016
4a8f94a
Type guards using discriminant properties of string literal types
ahejlsberg Jun 10, 2016
e86f183
Fix #9098: report missing function impelementation errors for merged …
mhegazy Jun 11, 2016
ce15646
Narrow type in case/default sections in switch on discriminant property
ahejlsberg Jun 13, 2016
c90b0fe
No implicit returns following exhaustive switch statements
ahejlsberg Jun 13, 2016
00376f4
Narrow non-union types to ensure consistent results
ahejlsberg Jun 14, 2016
5ff7c29
Add tests
ahejlsberg Jun 14, 2016
5ea469a
No Need to store dot token when parsing property access expression
sheetalkamat Jun 14, 2016
5a90c67
Added tests.
DanielRosenwasser Jun 14, 2016
0a1c4c6
Accepted baselines.
DanielRosenwasser Jun 14, 2016
30b3871
Merge branch 'master' into removeDotToken
sheetalkamat Jun 14, 2016
c9bab05
Check tuple types when getting the type node's type.
DanielRosenwasser Jun 14, 2016
a3635cc
Merge branch 'master' into typeGuardDiscriminants
ahejlsberg Jun 14, 2016
82b385f
Accepted baselines.
DanielRosenwasser Jun 14, 2016
784a765
Fix #9173: clear out lib and types before creating a program in trans…
mhegazy Jun 15, 2016
38c89af
Merge pull request #9174 from Microsoft/Fix9173
mhegazy Jun 15, 2016
14c2bcf
Added tests.
DanielRosenwasser Jun 15, 2016
f786c5c
Accepted baselines.
DanielRosenwasser Jun 15, 2016
52a96ac
Always check type assertion types.
DanielRosenwasser Jun 15, 2016
da3333e
Clear out unused compiler options when transpiling
mhegazy Jun 15, 2016
74a784c
Accepted baselines.
DanielRosenwasser Jun 15, 2016
386fa3e
improve error message for extending interface
HerringtonDarkholme Jun 15, 2016
85434c5
accept baselines
HerringtonDarkholme Jun 15, 2016
8a025fc
Use helper functions to simplify range tests
Jun 15, 2016
6366a6d
Remove String, Number, and Boolean from TypeFlags.Falsy
ahejlsberg Jun 15, 2016
28b241e
Add regression test
ahejlsberg Jun 15, 2016
c9e5bcb
Accept new baselines
ahejlsberg Jun 15, 2016
dd0411a
Allow property declarations in .js files
Jun 15, 2016
9b6472a
Remove old test
Jun 15, 2016
e2376a7
Merge pull request #9185 from Microsoft/simplify_range_tests
Jun 15, 2016
a3a0c98
Merge pull request #9188 from Microsoft/relaxLogicalAnd
ahejlsberg Jun 15, 2016
95ddfc7
Do not use Object.assing in test
mhegazy Jun 15, 2016
97be083
Merge pull request #9100 from Microsoft/Fix9098
mhegazy Jun 15, 2016
a1e0504
Merge pull request #9189 from Microsoft/js_property_declaration
Jun 15, 2016
ce45ee7
Fix comment
mhegazy Jun 15, 2016
9a2cf11
Merge pull request #9170 from Microsoft/emptyTupleAssertions
DanielRosenwasser Jun 15, 2016
8c38cbf
Merge pull request #9073 from zhengbli/i8523
zhengbli Jun 15, 2016
7bb739f
Merge pull request #9083 from zhengbli/i6853
zhengbli Jun 15, 2016
3354436
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
zhengbli Jun 15, 2016
550d912
Refactor code to make if statements cheaper
zhengbli Jun 15, 2016
95ae809
Merge pull request #7486 from zhengbli/fixLargeProjectTry2
zhengbli Jun 16, 2016
478d763
ignore casing when converting a source file path to relative path
zhengbli Jun 16, 2016
f96a7f0
Merge pull request #9166 from Microsoft/removeDotToken
sheetalkamat Jun 16, 2016
c721b5f
add tests & add branches for module interface
HerringtonDarkholme Jun 16, 2016
0e6f8eb
Using baselines for transpile unittests (#9195)
yuit Jun 16, 2016
38962ee
use resolveEntityName to find interface
HerringtonDarkholme Jun 17, 2016
877977a
add new tests for extends interface
HerringtonDarkholme Jun 17, 2016
2a9636b
address code style
HerringtonDarkholme Jun 17, 2016
166bc49
Refactor navigation bar
Jun 16, 2016
48a340f
routine dom update
zhengbli Jun 17, 2016
c7dec0e
Merge pull request #9163 from Microsoft/typeGuardDiscriminants
ahejlsberg Jun 17, 2016
abe7c19
Merge pull request #9237 from zhengbli/updateDomJune17
zhengbli Jun 17, 2016
11bb6c0
Merge branch 'master' into Fix9173-2
mhegazy Jun 17, 2016
2b4378d
Merge pull request #9180 from HerringtonDarkholme/interface
mhegazy Jun 17, 2016
08ca1c0
Merge branch 'master' into glob2_merged
riknoll Jun 17, 2016
86cde9e
Updating readDirectory for tsserverProjectSystem unit tests
riknoll Jun 17, 2016
e9226af
Array#map -> ts.map.
DanielRosenwasser Jun 18, 2016
95072aa
Responding to PR feedback
riknoll Jun 18, 2016
f817ffa
Merge branch 'master' into glob2_merged
riknoll Jun 18, 2016
3fe546b
Merge pull request #9240 from Microsoft/mapBeDamned
DanielRosenwasser Jun 18, 2016
f568ad0
Add conditional index signature for Canvas2DContextAttributes (https:…
mhegazy Jun 18, 2016
dfed762
Add libcheck tests
mhegazy Jun 18, 2016
634818c
Add missing worker types
zhengbli Jun 19, 2016
ba78d1e
Merge pull request #9250 from zhengbli/fix9244
zhengbli Jun 19, 2016
2ea7a1d
Merge branch 'master' into AddLibCheckTests
mhegazy Jun 20, 2016
5697d21
Accept webworker baselines
mhegazy Jun 20, 2016
c0eb472
Classify `this` in parameter position as a keyword
Jun 20, 2016
f3bdfb0
Merge pull request #9249 from Microsoft/AddLibCheckTests
mhegazy Jun 20, 2016
8b5616d
Merge pull request #9176 from Microsoft/Fix9173-2
mhegazy Jun 20, 2016
420b920
Merge pull request #9271 from Microsoft/classify_this
Jun 20, 2016
f73ed59
Adding more matchFiles test cases
riknoll Jun 20, 2016
95cfaaf
Use implicit boolean casts; it doesn't hurt performance
Jun 20, 2016
d9bd31f
Use getCanonicalFileName
zhengbli Jun 20, 2016
4d5d152
Merge pull request #9220 from Microsoft/navbar_refactor_3000
Jun 20, 2016
7b3abc6
Merge pull request #9213 from zhengbli/fixRealPath
zhengbli Jun 20, 2016
b49acd5
Merge branch 'master' into glob2_merged
riknoll Jun 20, 2016
6d99b2f
Merge pull request #8841 from Microsoft/glob2_merged
riknoll Jun 20, 2016
8e489cb
export interface used by other exported functions
basarat Jun 21, 2016
cb9246f
Merge pull request #9286 from basarat/patch-2
DanielRosenwasser Jun 21, 2016
0981573
Merge branch 'master' into transforms
Jun 21, 2016
cdb490b
Fix from merging with master
Jun 21, 2016
595d2a1
Update tests and baselines from merging with master
Jun 21, 2016
3040f2d
Remove using dotToken as it is no longer needed
Jun 28, 2016
9abe0f8
Update baselines from removing dotToken
Jun 28, 2016
f42aa69
Address PR: Add NodeEmitFlags to no indent when emit
Jun 30, 2016
34704cd
Address PR; and refactor setting NodeEmitFlags for createMemberAccess…
Jul 1, 2016
26d0923
Update baselines
Jul 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ var languageServiceLibrarySources = [

var harnessCoreSources = [
"harness.ts",
"virtualFileSystem.ts",
"sourceMapRecorder.ts",
"harnessLanguageService.ts",
"fourslash.ts",
Expand Down Expand Up @@ -179,7 +180,8 @@ var harnessSources = harnessCoreSources.concat([
"commandLineParsing.ts",
"convertCompilerOptionsFromJson.ts",
"convertTypingOptionsFromJson.ts",
"tsserverProjectSystem.ts"
"tsserverProjectSystem.ts",
"matchFiles.ts"
].map(function (f) {
return path.join(unittestsDirectory, f);
})).concat([
Expand Down
138 changes: 90 additions & 48 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,20 +599,14 @@ namespace ts {
}
}

function isNarrowableReference(expr: Expression): boolean {
return expr.kind === SyntaxKind.Identifier ||
expr.kind === SyntaxKind.ThisKeyword ||
expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
}

function isNarrowingExpression(expr: Expression): boolean {
switch (expr.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.ThisKeyword:
case SyntaxKind.PropertyAccessExpression:
return isNarrowableReference(expr);
case SyntaxKind.CallExpression:
return true;
return hasNarrowableArgument(<CallExpression>expr);
case SyntaxKind.ParenthesizedExpression:
return isNarrowingExpression((<ParenthesizedExpression>expr).expression);
case SyntaxKind.BinaryExpression:
Expand All @@ -623,6 +617,39 @@ namespace ts {
return false;
}

function isNarrowableReference(expr: Expression): boolean {
return expr.kind === SyntaxKind.Identifier ||
expr.kind === SyntaxKind.ThisKeyword ||
expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
}

function hasNarrowableArgument(expr: CallExpression) {
if (expr.arguments) {
for (const argument of expr.arguments) {
if (isNarrowableReference(argument)) {
return true;
}
}
}
if (expr.expression.kind === SyntaxKind.PropertyAccessExpression &&
isNarrowableReference((<PropertyAccessExpression>expr.expression).expression)) {
return true;
}
return false;
}

function isNarrowingNullCheckOperands(expr1: Expression, expr2: Expression) {
return (expr1.kind === SyntaxKind.NullKeyword || expr1.kind === SyntaxKind.Identifier && (<Identifier>expr1).text === "undefined") && isNarrowableOperand(expr2);
}

function isNarrowingTypeofOperands(expr1: Expression, expr2: Expression) {
return expr1.kind === SyntaxKind.TypeOfExpression && isNarrowableOperand((<TypeOfExpression>expr1).expression) && expr2.kind === SyntaxKind.StringLiteral;
}

function isNarrowingDiscriminant(expr: Expression) {
return expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
}

function isNarrowingBinaryExpression(expr: BinaryExpression) {
switch (expr.operatorToken.kind) {
case SyntaxKind.EqualsToken:
Expand All @@ -631,34 +658,35 @@ namespace ts {
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
if ((isNarrowingExpression(expr.left) && (expr.right.kind === SyntaxKind.NullKeyword || expr.right.kind === SyntaxKind.Identifier)) ||
(isNarrowingExpression(expr.right) && (expr.left.kind === SyntaxKind.NullKeyword || expr.left.kind === SyntaxKind.Identifier))) {
return true;
}
if (isTypeOfNarrowingBinaryExpression(expr)) {
return true;
}
return false;
return isNarrowingNullCheckOperands(expr.right, expr.left) || isNarrowingNullCheckOperands(expr.left, expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) ||
isNarrowingDiscriminant(expr.left) || isNarrowingDiscriminant(expr.right);
case SyntaxKind.InstanceOfKeyword:
return isNarrowingExpression(expr.left);
return isNarrowableOperand(expr.left);
case SyntaxKind.CommaToken:
return isNarrowingExpression(expr.right);
}
return false;
}

function isTypeOfNarrowingBinaryExpression(expr: BinaryExpression) {
let typeOf: Expression;
if (expr.left.kind === SyntaxKind.StringLiteral) {
typeOf = expr.right;
}
else if (expr.right.kind === SyntaxKind.StringLiteral) {
typeOf = expr.left;
}
else {
typeOf = undefined;
function isNarrowableOperand(expr: Expression): boolean {
switch (expr.kind) {
case SyntaxKind.ParenthesizedExpression:
return isNarrowableOperand((<ParenthesizedExpression>expr).expression);
case SyntaxKind.BinaryExpression:
switch ((<BinaryExpression>expr).operatorToken.kind) {
case SyntaxKind.EqualsToken:
return isNarrowableOperand((<BinaryExpression>expr).left);
case SyntaxKind.CommaToken:
return isNarrowableOperand((<BinaryExpression>expr).right);
}
}
return typeOf && typeOf.kind === SyntaxKind.TypeOfExpression && isNarrowingExpression((<TypeOfExpression>typeOf).expression);
return isNarrowableReference(expr);
}

function isNarrowingSwitchStatement(switchStatement: SwitchStatement) {
const expr = switchStatement.expression;
return expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
}

function createBranchLabel(): FlowLabel {
Expand Down Expand Up @@ -704,8 +732,22 @@ namespace ts {
setFlowNodeReferenced(antecedent);
return <FlowCondition>{
flags,
antecedent,
expression,
antecedent
};
}

function createFlowSwitchClause(antecedent: FlowNode, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): FlowNode {
if (!isNarrowingSwitchStatement(switchStatement)) {
return antecedent;
}
setFlowNodeReferenced(antecedent);
return <FlowSwitchClause>{
flags: FlowFlags.SwitchClause,
switchStatement,
clauseStart,
clauseEnd,
antecedent
};
}

Expand Down Expand Up @@ -934,9 +976,12 @@ namespace ts {
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
const hasNonEmptyDefault = forEach(node.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause && c.statements.length);
if (!hasNonEmptyDefault) {
addAntecedent(postSwitchLabel, preSwitchCaseFlow);
const hasDefault = forEach(node.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause);
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
if (!hasDefault) {
addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));
}
currentBreakTarget = saveBreakTarget;
preSwitchCaseFlow = savePreSwitchCaseFlow;
Expand All @@ -945,25 +990,22 @@ namespace ts {

function bindCaseBlock(node: CaseBlock): void {
const clauses = node.clauses;
let fallthroughFlow = unreachableFlow;
for (let i = 0; i < clauses.length; i++) {
const clauseStart = i;
while (!clauses[i].statements.length && i + 1 < clauses.length) {
bind(clauses[i]);
i++;
}
const preCaseLabel = createBranchLabel();
addAntecedent(preCaseLabel, createFlowSwitchClause(preSwitchCaseFlow, <SwitchStatement>node.parent, clauseStart, i + 1));
addAntecedent(preCaseLabel, fallthroughFlow);
currentFlow = finishFlowLabel(preCaseLabel);
const clause = clauses[i];
if (clause.statements.length) {
if (currentFlow.flags & FlowFlags.Unreachable) {
currentFlow = preSwitchCaseFlow;
}
else {
const preCaseLabel = createBranchLabel();
addAntecedent(preCaseLabel, preSwitchCaseFlow);
addAntecedent(preCaseLabel, currentFlow);
currentFlow = finishFlowLabel(preCaseLabel);
}
bind(clause);
if (!(currentFlow.flags & FlowFlags.Unreachable) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
errorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch);
}
}
else {
bind(clause);
bind(clause);
fallthroughFlow = currentFlow;
if (!(currentFlow.flags & FlowFlags.Unreachable) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
errorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch);
}
}
}
Expand Down
Loading