Skip to content

New vfs baselines follow-up #23878

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 2 commits into from
May 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 1 addition & 21 deletions src/harness/fakes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,27 +289,7 @@ namespace fakes {
}

public getDefaultLibFileName(options: ts.CompilerOptions): string {
// return vpath.resolve(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));

// TODO(rbuckton): This patches the baseline to replace lib.es5.d.ts with lib.d.ts.
// This is only to make the PR for this change easier to read. A follow-up PR will
// revert this change and accept the new baselines.
// See https://github.com/Microsoft/TypeScript/pull/20763#issuecomment-352553264
return vpath.resolve(this.getDefaultLibLocation(), getDefaultLibFileName(options));
function getDefaultLibFileName(options: ts.CompilerOptions) {
switch (options.target) {
case ts.ScriptTarget.ESNext:
case ts.ScriptTarget.ES2017:
return "lib.es2017.d.ts";
case ts.ScriptTarget.ES2016:
return "lib.es2016.d.ts";
case ts.ScriptTarget.ES2015:
return "lib.es2015.d.ts";

default:
return "lib.d.ts";
}
}
return vpath.resolve(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));
}

public getSourceFile(fileName: string, languageVersion: number): ts.SourceFile | undefined {
Expand Down
8 changes: 1 addition & 7 deletions src/harness/projectsRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,7 @@ namespace project {
.map(output => utils.removeTestPathPrefixes(vpath.isAbsolute(output) ? vpath.relative(cwd, output, ignoreCase) : output));

const content = JSON.stringify(resolutionInfo, undefined, " ");

// TODO(rbuckton): This patches the baseline to replace lib.es5.d.ts with lib.d.ts.
// This is only to make the PR for this change easier to read. A follow-up PR will
// revert this change and accept the new baselines.
// See https://github.com/Microsoft/TypeScript/pull/20763#issuecomment-352553264
const patchedContent = content.replace(/lib\.es5\.d\.ts/g, "lib.d.ts");
Harness.Baseline.runBaseline(this.getBaselineFolder(this.compilerResult.moduleKind) + this.testCaseJustName + ".json", () => patchedContent);
Harness.Baseline.runBaseline(this.getBaselineFolder(this.compilerResult.moduleKind) + this.testCaseJustName + ".json", () => content);
}

public verifyDiagnostics() {
Expand Down
21 changes: 1 addition & 20 deletions src/harness/vfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1253,25 +1253,6 @@ namespace vfs {
node: Inode | undefined;
}

// TODO(rbuckton): This patches the baseline to replace lib.d.ts with lib.es5.d.ts.
// This is only to make the PR for this change easier to read. A follow-up PR will
// revert this change and accept the new baselines.
// See https://github.com/Microsoft/TypeScript/pull/20763#issuecomment-352553264
function patchResolver(host: FileSystemResolverHost, resolver: FileSystemResolver): FileSystemResolver {
const libFile = vpath.combine(host.getWorkspaceRoot(), "built/local/lib.d.ts");
const es5File = vpath.combine(host.getWorkspaceRoot(), "built/local/lib.es5.d.ts");
const stringComparer = host.useCaseSensitiveFileNames() ? vpath.compareCaseSensitive : vpath.compareCaseInsensitive;
return {
readdirSync: path => resolver.readdirSync(path),
statSync: path => resolver.statSync(fixPath(path)),
readFileSync: (path) => resolver.readFileSync(fixPath(path))
};

function fixPath(path: string) {
return stringComparer(path, libFile) === 0 ? es5File : path;
}
}

let builtLocalHost: FileSystemResolverHost | undefined;
let builtLocalCI: FileSystem | undefined;
let builtLocalCS: FileSystem | undefined;
Expand All @@ -1286,7 +1267,7 @@ namespace vfs {
const resolver = createResolver(host);
builtLocalCI = new FileSystem(/*ignoreCase*/ true, {
files: {
[builtFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "built/local"), patchResolver(host, resolver)),
[builtFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "built/local"), resolver),
[testLibFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "tests/lib"), resolver),
[srcFolder]: {}
},
Expand Down
9 changes: 0 additions & 9 deletions tests/baselines/reference/ES5For-of1.errors.txt

This file was deleted.

3 changes: 3 additions & 0 deletions tests/baselines/reference/ES5For-of1.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ for (var v of ['a', 'b', 'c']) {
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))

console.log(v);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of1.types
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ for (var v of ['a', 'b', 'c']) {
>'c' : "c"

console.log(v);
>console.log(v) : any
>console.log : any
>console : any
>log : any
>console.log(v) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>v : string
}
10 changes: 0 additions & 10 deletions tests/baselines/reference/ES5For-of22.errors.txt

This file was deleted.

3 changes: 3 additions & 0 deletions tests/baselines/reference/ES5For-of22.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ for (var x of [1, 2, 3]) {
>_a : Symbol(_a, Decl(ES5For-of22.ts, 1, 7))

console.log(x);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8))
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of22.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ for (var x of [1, 2, 3]) {
>0 : 0

console.log(x);
>console.log(x) : any
>console.log : any
>console : any
>log : any
>console.log(x) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>x : number
}
10 changes: 0 additions & 10 deletions tests/baselines/reference/ES5For-of23.errors.txt

This file was deleted.

3 changes: 3 additions & 0 deletions tests/baselines/reference/ES5For-of23.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ for (var x of [1, 2, 3]) {
>_a : Symbol(_a, Decl(ES5For-of23.ts, 1, 7))

console.log(x);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(ES5For-of23.ts, 0, 8))
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of23.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ for (var x of [1, 2, 3]) {
>0 : 0

console.log(x);
>console.log(x) : any
>console.log : any
>console : any
>log : any
>console.log(x) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>x : number
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/ES5For-of33.errors.txt

This file was deleted.

3 changes: 3 additions & 0 deletions tests/baselines/reference/ES5For-of33.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ for (var v of ['a', 'b', 'c']) {
>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8))

console.log(v);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8))
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of33.types
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ for (var v of ['a', 'b', 'c']) {
>'c' : "c"

console.log(v);
>console.log(v) : any
>console.log : any
>console : any
>log : any
>console.log(v) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>v : string
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ var r3 = foo3(a); // any
declare function foo5(x: Date): Date;
>foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 21, 22))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

declare function foo5(x: any): any;
>foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37))
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/anyAssignableToEveryType.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var d: boolean = a;

var e: Date = a;
>e : Symbol(e, Decl(anyAssignableToEveryType.ts, 17, 3))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))

var f: any = a;
Expand Down Expand Up @@ -122,7 +122,7 @@ function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
>T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13))
>U : Symbol(U, Decl(anyAssignableToEveryType.ts, 34, 15))
>V : Symbol(V, Decl(anyAssignableToEveryType.ts, 34, 32))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(anyAssignableToEveryType.ts, 34, 49))
>T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13))
>y : Symbol(y, Decl(anyAssignableToEveryType.ts, 34, 54))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface I5 {

[x: string]: Date;
>x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 27, 5))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

foo: any;
>foo : Symbol(I5.foo, Decl(anyAssignableToEveryType2.ts, 27, 22))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>arguments : Symbol(arguments)

result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result.push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 1, 7))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 2, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 2, 12))
}
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/argumentsObjectIterator02_ES6.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
let blah = arguments[Symbol.iterator];
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 1, 7))
>arguments : Symbol(arguments)
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es6.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es6.d.ts, --, --))

let result = [];
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 3, 7))
Expand All @@ -20,9 +20,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 1, 7))

result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result.push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 3, 7))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 4, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 4, 12))
}
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/arrayLiterals2ES6.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];

interface myArray extends Array<Number> { }
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --))

interface myArray2 extends Array<Number|String> { }
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 1 more)
>Array : Symbol(Array, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --))
>String : Symbol(String, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --) ... and 1 more)

var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
Expand Down
14 changes: 1 addition & 13 deletions tests/baselines/reference/arrowFunctionContexts.errors.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(2,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(2,7): error TS2304: Cannot find name 'window'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(18,1): error TS2304: Cannot find name 'window'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(30,9): error TS2322: Type '() => number' is not assignable to type 'E'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(31,16): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(43,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(43,11): error TS2304: Cannot find name 'window'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(59,5): error TS2304: Cannot find name 'window'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(71,13): error TS2322: Type '() => number' is not assignable to type 'E'.
tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(72,20): error TS2332: 'this' cannot be referenced in current location.


==== tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts (10 errors) ====
==== tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts (6 errors) ====
// Arrow function used in with statement
with (window) {
~~~~~~~~~~~~~
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
~~~~~~
!!! error TS2304: Cannot find name 'window'.
var p = () => this;
}

Expand All @@ -33,8 +27,6 @@ tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(72,20): e

// Arrow function as function argument
window.setTimeout(() => null, 100);
~~~~~~
!!! error TS2304: Cannot find name 'window'.

// Arrow function as value in array literal

Expand Down Expand Up @@ -66,8 +58,6 @@ tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(72,20): e
with (window) {
~~~~~~~~~~~~~
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
~~~~~~
!!! error TS2304: Cannot find name 'window'.
var p = () => this;
}

Expand All @@ -84,8 +74,6 @@ tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(72,20): e

// Arrow function as function argument
window.setTimeout(() => null, 100);
~~~~~~
!!! error TS2304: Cannot find name 'window'.

// Arrow function as value in array literal

Expand Down
Loading