Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2020-10-09 15:25:23 -07:00
parent 8ba6f5f29d
commit b31be85169
4 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,21 @@
tests/cases/compiler/propertyElementAccessOnVoidNoImplicitAnyFalse01.ts(7,12): error TS2339: Property 'world' does not exist on type 'void'.
tests/cases/compiler/propertyElementAccessOnVoidNoImplicitAnyFalse01.ts(11,24): error TS2339: Property 'world' does not exist on type 'void'.
==== tests/cases/compiler/propertyElementAccessOnVoidNoImplicitAnyFalse01.ts (2 errors) ====
let result = [1, 2, 3, 4].forEach(x => {
console.log(x);
});
if (Math.random()) {
result["hello"] = "foo";
result.world = "foo";
~~~~~
!!! error TS2339: Property 'world' does not exist on type 'void'.
}
else {
console.log(result["hello"]);
console.log(result.world);
~~~~~
!!! error TS2339: Property 'world' does not exist on type 'void'.
}

View File

@ -0,0 +1,26 @@
//// [propertyElementAccessOnVoidNoImplicitAnyFalse01.ts]
let result = [1, 2, 3, 4].forEach(x => {
console.log(x);
});
if (Math.random()) {
result["hello"] = "foo";
result.world = "foo";
}
else {
console.log(result["hello"]);
console.log(result.world);
}
//// [propertyElementAccessOnVoidNoImplicitAnyFalse01.js]
var result = [1, 2, 3, 4].forEach(function (x) {
console.log(x);
});
if (Math.random()) {
result["hello"] = "foo";
result.world = "foo";
}
else {
console.log(result["hello"]);
console.log(result.world);
}

View File

@ -0,0 +1,39 @@
=== tests/cases/compiler/propertyElementAccessOnVoidNoImplicitAnyFalse01.ts ===
let result = [1, 2, 3, 4].forEach(x => {
>result : Symbol(result, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 3))
>[1, 2, 3, 4].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 34))
console.log(x);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 34))
});
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
result["hello"] = "foo";
>result : Symbol(result, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 3))
result.world = "foo";
>result : Symbol(result, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 3))
}
else {
console.log(result["hello"]);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>result : Symbol(result, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 3))
console.log(result.world);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>result : Symbol(result, Decl(propertyElementAccessOnVoidNoImplicitAnyFalse01.ts, 0, 3))
}

View File

@ -0,0 +1,62 @@
=== tests/cases/compiler/propertyElementAccessOnVoidNoImplicitAnyFalse01.ts ===
let result = [1, 2, 3, 4].forEach(x => {
>result : void
>[1, 2, 3, 4].forEach(x => { console.log(x);}) : void
>[1, 2, 3, 4].forEach : (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void
>[1, 2, 3, 4] : number[]
>1 : 1
>2 : 2
>3 : 3
>4 : 4
>forEach : (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void
>x => { console.log(x);} : (x: number) => void
>x : number
console.log(x);
>console.log(x) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>x : number
});
if (Math.random()) {
>Math.random() : number
>Math.random : () => number
>Math : Math
>random : () => number
result["hello"] = "foo";
>result["hello"] = "foo" : "foo"
>result["hello"] : any
>result : void
>"hello" : "hello"
>"foo" : "foo"
result.world = "foo";
>result.world = "foo" : "foo"
>result.world : any
>result : void
>world : any
>"foo" : "foo"
}
else {
console.log(result["hello"]);
>console.log(result["hello"]) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>result["hello"] : any
>result : void
>"hello" : "hello"
console.log(result.world);
>console.log(result.world) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>result.world : any
>result : void
>world : any
}