Update baselines and clean up tests

This commit is contained in:
Nathan Shively-Sanders 2016-08-30 10:25:07 -07:00
parent 02e5a31b40
commit 5872fdbf25
8 changed files with 173 additions and 77 deletions

View file

@ -1,3 +1,4 @@
tests/cases/compiler/convertKeywordsYes.ts(175,5): error TS2322: Type 'number' is not assignable to type 'Function'.
tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1213: Identifier expected. 'implements' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1213: Identifier expected. 'interface' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
@ -9,7 +10,7 @@ tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1213: Identifier exp
tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
==== tests/cases/compiler/convertKeywordsYes.ts (9 errors) ====
==== tests/cases/compiler/convertKeywordsYes.ts (10 errors) ====
// reserved ES5 future in strict mode
var constructor = 0;
@ -185,6 +186,8 @@ tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier exp
class bigClass {
public "constructor" = 0;
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'Function'.
public any = 0;
public boolean = 0;
public implements = 0;

View file

@ -2,18 +2,10 @@ tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextu
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(28,9): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(32,9): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(35,9): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(59,7): error TS2420: Class 'Multiple' incorrectly implements interface 'A'.
Types of property 'r' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(59,7): error TS2420: Class 'Multiple' incorrectly implements interface 'B'.
Types of property 'r' are incompatible.
Type 'number' is not assignable to type 'boolean'.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(60,5): error TS7008: Member 'p' implicitly has an 'any' type.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(61,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(70,12): error TS2339: Property 'length' does not exist on type 'number'.
tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(54,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
==== tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts (9 errors) ====
==== tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts (5 errors) ====
interface Event {
time: number;
}
@ -66,45 +58,20 @@ tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextu
}
interface A {
p: string;
q(n: string): void;
r: string;
s: string;
}
interface B {
p: number;
q(n: number): void;
r: boolean;
s: string;
}
class C {
r: number;
}
class Multiple extends C implements A, B {
~~~~~~~~
!!! error TS2420: Class 'Multiple' incorrectly implements interface 'A'.
!!! error TS2420: Types of property 'r' are incompatible.
!!! error TS2420: Type 'number' is not assignable to type 'string'.
~~~~~~~~
!!! error TS2420: Class 'Multiple' incorrectly implements interface 'B'.
!!! error TS2420: Types of property 'r' are incompatible.
!!! error TS2420: Type 'number' is not assignable to type 'boolean'.
p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist
~~~~~~~~~~~~~~
!!! error TS7008: Member 'p' implicitly has an 'any' type.
q(n) { // error, n is implicitly any because A.q and B.q exist
~
!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
n.length;
n.toFixed;
n.length; // and the unioned type has no signature
n.toFixed; // (even though the constituent types each do)
}
r = null; // OK, C.r wins over A.r and B.r
s = null; // OK, A.s and B.s match
}
let multiple = new Multiple();
multiple.r.toFixed; // OK, C.r wins so Multiple.r: number
multiple.r.length; // error, Multiple.r: number
~~~~~~
!!! error TS2339: Property 'length' does not exist on type 'number'.
multiple.s.length; // OK, A.s and B.s match.

View file

@ -43,33 +43,20 @@ class Alarm extends Watcher implements Listener, Ringer, StringLiteral {
}
interface A {
p: string;
q(n: string): void;
r: string;
s: string;
}
interface B {
p: number;
q(n: number): void;
r: boolean;
s: string;
}
class C {
r: number;
}
class Multiple extends C implements A, B {
p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist
q(n) { // error, n is implicitly any because A.q and B.q exist
n.length;
n.toFixed;
n.length; // and the unioned type has no signature
n.toFixed; // (even though the constituent types each do)
}
r = null; // OK, C.r wins over A.r and B.r
s = null; // OK, A.s and B.s match
}
let multiple = new Multiple();
multiple.r.toFixed; // OK, C.r wins so Multiple.r: number
multiple.r.length; // error, Multiple.r: number
multiple.s.length; // OK, A.s and B.s match.
//// [implementedPropertyContextualTyping1.js]
@ -118,17 +105,10 @@ var Multiple = (function (_super) {
__extends(Multiple, _super);
function Multiple() {
_super.apply(this, arguments);
this.p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist
this.r = null; // OK, C.r wins over A.r and B.r
this.s = null; // OK, A.s and B.s match
}
Multiple.prototype.q = function (n) {
n.length;
n.toFixed;
n.length; // and the unioned type has no signature
n.toFixed; // (even though the constituent types each do)
};
return Multiple;
}(C));
var multiple = new Multiple();
multiple.r.toFixed; // OK, C.r wins so Multiple.r: number
multiple.r.length; // error, Multiple.r: number
multiple.s.length; // OK, A.s and B.s match.

View file

@ -0,0 +1,42 @@
//// [implementedPropertyContextualTyping3.ts]
interface A {
p: string;
r: string;
s: string;
}
interface B {
p: number;
r: boolean;
s: string;
}
class C {
r: number;
}
class Multiple extends C implements A, B {
p = undefined; // ok, Multiple.p: string & number
r = null; // OK, r: string & boolean & number
s = null; // OK, s: string
}
//// [implementedPropertyContextualTyping3.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var C = (function () {
function C() {
}
return C;
}());
var Multiple = (function (_super) {
__extends(Multiple, _super);
function Multiple() {
_super.apply(this, arguments);
this.p = undefined; // ok, Multiple.p: string & number
this.r = null; // OK, r: string & boolean & number
this.s = null; // OK, s: string
}
return Multiple;
}(C));

View file

@ -0,0 +1,48 @@
=== tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping3.ts ===
interface A {
>A : Symbol(A, Decl(implementedPropertyContextualTyping3.ts, 0, 0))
p: string;
>p : Symbol(A.p, Decl(implementedPropertyContextualTyping3.ts, 0, 13))
r: string;
>r : Symbol(A.r, Decl(implementedPropertyContextualTyping3.ts, 1, 14))
s: string;
>s : Symbol(A.s, Decl(implementedPropertyContextualTyping3.ts, 2, 14))
}
interface B {
>B : Symbol(B, Decl(implementedPropertyContextualTyping3.ts, 4, 1))
p: number;
>p : Symbol(B.p, Decl(implementedPropertyContextualTyping3.ts, 5, 13))
r: boolean;
>r : Symbol(B.r, Decl(implementedPropertyContextualTyping3.ts, 6, 14))
s: string;
>s : Symbol(B.s, Decl(implementedPropertyContextualTyping3.ts, 7, 15))
}
class C {
>C : Symbol(C, Decl(implementedPropertyContextualTyping3.ts, 9, 1))
r: number;
>r : Symbol(C.r, Decl(implementedPropertyContextualTyping3.ts, 10, 9))
}
class Multiple extends C implements A, B {
>Multiple : Symbol(Multiple, Decl(implementedPropertyContextualTyping3.ts, 12, 1))
>C : Symbol(C, Decl(implementedPropertyContextualTyping3.ts, 9, 1))
>A : Symbol(A, Decl(implementedPropertyContextualTyping3.ts, 0, 0))
>B : Symbol(B, Decl(implementedPropertyContextualTyping3.ts, 4, 1))
p = undefined; // ok, Multiple.p: string & number
>p : Symbol(Multiple.p, Decl(implementedPropertyContextualTyping3.ts, 13, 42))
>undefined : Symbol(undefined)
r = null; // OK, r: string & boolean & number
>r : Symbol(Multiple.r, Decl(implementedPropertyContextualTyping3.ts, 14, 18))
s = null; // OK, s: string
>s : Symbol(Multiple.s, Decl(implementedPropertyContextualTyping3.ts, 15, 13))
}

View file

@ -0,0 +1,50 @@
=== tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping3.ts ===
interface A {
>A : A
p: string;
>p : string
r: string;
>r : string
s: string;
>s : string
}
interface B {
>B : B
p: number;
>p : number
r: boolean;
>r : boolean
s: string;
>s : string
}
class C {
>C : C
r: number;
>r : number
}
class Multiple extends C implements A, B {
>Multiple : Multiple
>C : C
>A : A
>B : B
p = undefined; // ok, Multiple.p: string & number
>p : string & number
>undefined : undefined
r = null; // OK, r: string & boolean & number
>r : number & string & boolean
>null : null
s = null; // OK, s: string
>s : string
>null : null
}

View file

@ -43,30 +43,17 @@ class Alarm extends Watcher implements Listener, Ringer, StringLiteral {
}
interface A {
p: string;
q(n: string): void;
r: string;
s: string;
}
interface B {
p: number;
q(n: number): void;
r: boolean;
s: string;
}
class C {
r: number;
}
class Multiple extends C implements A, B {
p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist
q(n) { // error, n is implicitly any because A.q and B.q exist
n.length;
n.toFixed;
n.length; // and the unioned type has no signature
n.toFixed; // (even though the constituent types each do)
}
r = null; // OK, C.r wins over A.r and B.r
s = null; // OK, A.s and B.s match
}
let multiple = new Multiple();
multiple.r.toFixed; // OK, C.r wins so Multiple.r: number
multiple.r.length; // error, Multiple.r: number
multiple.s.length; // OK, A.s and B.s match.

View file

@ -0,0 +1,19 @@
// @noImplicitAny: true
interface A {
p: string;
r: string;
s: string;
}
interface B {
p: number;
r: boolean;
s: string;
}
class C {
r: number;
}
class Multiple extends C implements A, B {
p = undefined; // ok, Multiple.p: string & number
r = null; // OK, r: string & boolean & number
s = null; // OK, s: string
}