Skip to content

Merge release-2.1 into master #12157

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 34 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5e94949
Update LKG
mhegazy Oct 25, 2016
e497d1e
Update version
mhegazy Oct 27, 2016
515542b
Update LKG
mhegazy Oct 27, 2016
1f4d8a1
Skip overloads with too-short function parameters
sandersn Oct 27, 2016
dfa3dd3
Test skip overloads w/too-short function params
sandersn Oct 27, 2016
b4451b1
Minor style improvements
sandersn Oct 27, 2016
4e57f70
Ignore optionality when skipping overloads
sandersn Oct 27, 2016
2c09574
Do not use contextual signatures with too few parameters
sandersn Oct 28, 2016
a163641
isAritySmaller runs later: getNonGenericSignature
sandersn Oct 28, 2016
86138e3
rewrite void-returning statements in constructors that capture result…
vladima Oct 26, 2016
467f252
Update LKG
mhegazy Oct 28, 2016
2869f9c
Fix emit inferred type which is a generic type-alias both fully and p…
Oct 28, 2016
01e06f9
Add tests and baselines
Oct 28, 2016
f2e3439
Skip trying to use alias if there is target type
Oct 29, 2016
f9a317e
Update baselines
Oct 29, 2016
ad9c148
Merge pull request #11931 from Microsoft/release-2.1_fixDeclarationEm…
yuit Oct 31, 2016
182bc77
Add diagnostics to remind adding tsconfig file for certain external p…
zhengbli Nov 1, 2016
73e2328
Flag for not overwrite js files by default without generating errors …
zhengbli Nov 3, 2016
b98089d
Update LKG
mhegazy Nov 3, 2016
0b87210
lockLinter
zhengbli Nov 3, 2016
7d1f0e6
use local registry to check if typings package exist (#12014) (#12032)
vladima Nov 3, 2016
afe36be
Add test for https://github.com/Microsoft/TypeScript/pull/11980 (#12027)
zhengbli Nov 3, 2016
f03e04a
enable sending telemetry events to tsserver client (#12034) (#12051)
vladima Nov 4, 2016
8e8ec9f
Update LKG
mhegazy Nov 4, 2016
da4985e
Reuse subtree transform flags for incrementally parsed nodes (#12088)
rbuckton Nov 8, 2016
796a159
Update LKG
rbuckton Nov 8, 2016
aaf6c1d
Update version
mhegazy Nov 8, 2016
34d41de
Update LKG
mhegazy Nov 8, 2016
afea110
Do not emit "use strict" when targeting es6 or higher or module kind …
Nov 9, 2016
d629bd6
Add tests and baselines
Nov 9, 2016
6ba4b87
Merge pull request #12134 from Microsoft/release-2.1_fix11806_omitUse…
yuit Nov 10, 2016
f7c40d3
[Release 2.1] fix11754 global augmentation (#12133)
yuit Nov 10, 2016
c436bae
Merge branch 'release-2.1' into mergeRelease2.1intoMaster2
mhegazy Nov 10, 2016
4687285
Remove comment
mhegazy Nov 10, 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
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11493,7 +11493,7 @@ namespace ts {
function checkJsxOpeningLikeElement(node: JsxOpeningLikeElement) {
checkGrammarJsxElement(node);
checkJsxPreconditions(node);
// The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
// The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
// And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
const reactRefErr = compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined;
const reactNamespace = getJsxNamespace();
Expand Down
8 changes: 5 additions & 3 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ namespace ts {
return resolveModuleNamesWorker(moduleNames, containingFile);
}

// at this point we know that either
// at this point we know that either
// - file has local declarations for ambient modules
// OR
// - old program state is available
Expand Down Expand Up @@ -670,7 +670,7 @@ namespace ts {
}

const modifiedFilePaths = modifiedSourceFiles.map(f => f.newFile.path);
// try to verify results of module resolution
// try to verify results of module resolution
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
const newSourceFilePath = getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory);
if (resolveModuleNamesWorker) {
Expand Down Expand Up @@ -1447,7 +1447,9 @@ namespace ts {
collectExternalModuleReferences(file);
if (file.imports.length || file.moduleAugmentations.length) {
file.resolvedModules = createMap<ResolvedModuleFull>();
const moduleNames = map(concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral);
// Because global augmentation doesn't have string literal name, we can check for global augmentation as such.
const nonGlobalAugmentation = filter(file.moduleAugmentations, (moduleAugmentation) => moduleAugmentation.kind === SyntaxKind.StringLiteral);
const moduleNames = map(concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral);
const resolutions = resolveModuleNamesReusingOldState(moduleNames, getNormalizedAbsolutePath(file.fileName, currentDirectory), file);
Debug.assert(resolutions.length === moduleNames.length);
for (let i = 0; i < moduleNames.length; i++) {
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/transformers/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ namespace ts {
currentSourceFile = node;

// ensure "use strict" is emitted in all scenarios in alwaysStrict mode
if (compilerOptions.alwaysStrict) {
// There is no need to emit "use strict" in the following cases:
// 1. The file is an external module and target is es2015 or higher
// or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower
if (compilerOptions.alwaysStrict &&
!(isExternalModule(node) && (compilerOptions.target >= ScriptTarget.ES2015 || compilerOptions.module === ModuleKind.ES2015))) {
node = ensureUseStrict(node);
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/typingsInstaller/typingsInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace ts.server.typingsInstaller {
requestId: number;
args: string[];
cwd: string;
onRequestCompleted: RequestCompletedAction
onRequestCompleted: RequestCompletedAction;
};

export abstract class TypingsInstaller {
Expand Down Expand Up @@ -380,7 +380,7 @@ namespace ts.server.typingsInstaller {
compilerOptions: request.compilerOptions,
typings,
unresolvedImports: request.unresolvedImports,
kind: server.ActionSet
kind: ActionSet
};
}

Expand Down
8 changes: 8 additions & 0 deletions tests/baselines/reference/alwaysStrictModule3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//// [alwaysStrictModule3.ts]

// module ES2015
export const a = 1;

//// [alwaysStrictModule3.js]
// module ES2015
export var a = 1;
6 changes: 6 additions & 0 deletions tests/baselines/reference/alwaysStrictModule3.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/alwaysStrictModule3.ts ===

// module ES2015
export const a = 1;
>a : Symbol(a, Decl(alwaysStrictModule3.ts, 2, 12))

7 changes: 7 additions & 0 deletions tests/baselines/reference/alwaysStrictModule3.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/compiler/alwaysStrictModule3.ts ===

// module ES2015
export const a = 1;
>a : 1
>1 : 1

9 changes: 9 additions & 0 deletions tests/baselines/reference/alwaysStrictModule4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//// [alwaysStrictModule4.ts]

// Module commonjs
export const a = 1

//// [alwaysStrictModule4.js]
"use strict";
// Module commonjs
exports.a = 1;
6 changes: 6 additions & 0 deletions tests/baselines/reference/alwaysStrictModule4.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/alwaysStrictModule4.ts ===

// Module commonjs
export const a = 1
>a : Symbol(a, Decl(alwaysStrictModule4.ts, 2, 12))

7 changes: 7 additions & 0 deletions tests/baselines/reference/alwaysStrictModule4.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/compiler/alwaysStrictModule4.ts ===

// Module commonjs
export const a = 1
>a : 1
>1 : 1

8 changes: 8 additions & 0 deletions tests/baselines/reference/alwaysStrictModule5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//// [alwaysStrictModule5.ts]

// Targeting ES6
export const a = 1;

//// [alwaysStrictModule5.js]
// Targeting ES6
export const a = 1;
6 changes: 6 additions & 0 deletions tests/baselines/reference/alwaysStrictModule5.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/alwaysStrictModule5.ts ===

// Targeting ES6
export const a = 1;
>a : Symbol(a, Decl(alwaysStrictModule5.ts, 2, 12))

7 changes: 7 additions & 0 deletions tests/baselines/reference/alwaysStrictModule5.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/compiler/alwaysStrictModule5.ts ===

// Targeting ES6
export const a = 1;
>a : 1
>1 : 1

9 changes: 9 additions & 0 deletions tests/baselines/reference/alwaysStrictModule6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//// [alwaysStrictModule6.ts]

// Targeting ES5
export const a = 1;

//// [alwaysStrictModule6.js]
"use strict";
// Targeting ES5
exports.a = 1;
6 changes: 6 additions & 0 deletions tests/baselines/reference/alwaysStrictModule6.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/alwaysStrictModule6.ts ===

// Targeting ES5
export const a = 1;
>a : Symbol(a, Decl(alwaysStrictModule6.ts, 2, 12))

7 changes: 7 additions & 0 deletions tests/baselines/reference/alwaysStrictModule6.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/compiler/alwaysStrictModule6.ts ===

// Targeting ES5
export const a = 1;
>a : 1
>1 : 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//// [declarationEmitTypeAliasWithTypeParameters2.ts]

export type Bar<X, Y, Z> = () => [X, Y, Z];
export type Baz<M, N> = Bar<M, string, N>;
export type Baa<Y> = Baz<boolean, Y>;
export const y = (x: Baa<number>) => 1

//// [declarationEmitTypeAliasWithTypeParameters2.js]
"use strict";
exports.y = function (x) { return 1; };


//// [declarationEmitTypeAliasWithTypeParameters2.d.ts]
export declare type Bar<X, Y, Z> = () => [X, Y, Z];
export declare type Baz<M, N> = Bar<M, string, N>;
export declare type Baa<Y> = Baz<boolean, Y>;
export declare const y: (x: Bar<boolean, string, number>) => number;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters2.ts ===

export type Bar<X, Y, Z> = () => [X, Y, Z];
>Bar : Symbol(Bar, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 0, 0))
>X : Symbol(X, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 16))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 18))
>Z : Symbol(Z, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 21))
>X : Symbol(X, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 16))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 18))
>Z : Symbol(Z, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 21))

export type Baz<M, N> = Bar<M, string, N>;
>Baz : Symbol(Baz, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 43))
>M : Symbol(M, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 2, 16))
>N : Symbol(N, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 2, 18))
>Bar : Symbol(Bar, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 0, 0))
>M : Symbol(M, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 2, 16))
>N : Symbol(N, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 2, 18))

export type Baa<Y> = Baz<boolean, Y>;
>Baa : Symbol(Baa, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 2, 42))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 3, 16))
>Baz : Symbol(Baz, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 1, 43))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 3, 16))

export const y = (x: Baa<number>) => 1
>y : Symbol(y, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 4, 12))
>x : Symbol(x, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 4, 18))
>Baa : Symbol(Baa, Decl(declarationEmitTypeAliasWithTypeParameters2.ts, 2, 42))

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters2.ts ===

export type Bar<X, Y, Z> = () => [X, Y, Z];
>Bar : Bar<X, Y, Z>
>X : X
>Y : Y
>Z : Z
>X : X
>Y : Y
>Z : Z

export type Baz<M, N> = Bar<M, string, N>;
>Baz : Bar<M, string, N>
>M : M
>N : N
>Bar : Bar<X, Y, Z>
>M : M
>N : N

export type Baa<Y> = Baz<boolean, Y>;
>Baa : Bar<boolean, string, Y>
>Y : Y
>Baz : Bar<M, string, N>
>Y : Y

export const y = (x: Baa<number>) => 1
>y : (x: Bar<boolean, string, number>) => number
>(x: Baa<number>) => 1 : (x: Bar<boolean, string, number>) => number
>x : Bar<boolean, string, number>
>Baa : Bar<boolean, string, Y>
>1 : 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//// [declarationEmitTypeAliasWithTypeParameters3.ts]

type Foo<T> = {
foo<U>(): Foo<U>
};
function bar() {
return {} as Foo<number>;
}


//// [declarationEmitTypeAliasWithTypeParameters3.js]
function bar() {
return {};
}


//// [declarationEmitTypeAliasWithTypeParameters3.d.ts]
declare type Foo<T> = {
foo<U>(): Foo<U>;
};
declare function bar(): Foo<number>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters3.ts ===

type Foo<T> = {
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 0, 0))
>T : Symbol(T, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 1, 9))

foo<U>(): Foo<U>
>foo : Symbol(foo, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 1, 15))
>U : Symbol(U, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 2, 8))
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 0, 0))
>U : Symbol(U, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 2, 8))

};
function bar() {
>bar : Symbol(bar, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 3, 2))

return {} as Foo<number>;
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters3.ts, 0, 0))
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters3.ts ===

type Foo<T> = {
>Foo : Foo<T>
>T : T

foo<U>(): Foo<U>
>foo : <U>() => Foo<U>
>U : U
>Foo : Foo<T>
>U : U

};
function bar() {
>bar : () => Foo<number>

return {} as Foo<number>;
>{} as Foo<number> : Foo<number>
>{} : {}
>Foo : Foo<T>
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//// [declarationEmitTypeAliasWithTypeParameters4.ts]

type Foo<T, Y> = {
foo<U, J>(): Foo<U, J>
};
type SubFoo<R> = Foo<string, R>;

function foo() {
return {} as SubFoo<number>;
}


//// [declarationEmitTypeAliasWithTypeParameters4.js]
function foo() {
return {};
}


//// [declarationEmitTypeAliasWithTypeParameters4.d.ts]
declare type Foo<T, Y> = {
foo<U, J>(): Foo<U, J>;
};
declare type SubFoo<R> = Foo<string, R>;
declare function foo(): Foo<string, number>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters4.ts ===

type Foo<T, Y> = {
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 0, 0))
>T : Symbol(T, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 1, 9))
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 1, 11))

foo<U, J>(): Foo<U, J>
>foo : Symbol(foo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 1, 18))
>U : Symbol(U, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 2, 8))
>J : Symbol(J, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 2, 10))
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 0, 0))
>U : Symbol(U, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 2, 8))
>J : Symbol(J, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 2, 10))

};
type SubFoo<R> = Foo<string, R>;
>SubFoo : Symbol(SubFoo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 3, 2))
>R : Symbol(R, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 4, 12))
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 0, 0))
>R : Symbol(R, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 4, 12))

function foo() {
>foo : Symbol(foo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 4, 32))

return {} as SubFoo<number>;
>SubFoo : Symbol(SubFoo, Decl(declarationEmitTypeAliasWithTypeParameters4.ts, 3, 2))
}

Loading