Skip to content
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 67 additions & 53 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var myCars3 = new Array({});
>{} : {}

var myCars4: Array; // error
>myCars4 : any
>myCars4 : {}[]
>Array : T[]

var myCars5: Array<any>[];
Expand All @@ -24,9 +24,9 @@ myCars = myCars3;
>myCars3 : {}[]

myCars = myCars4;
>myCars = myCars4 : any
>myCars = myCars4 : {}[]
>myCars : any[]
>myCars4 : any
>myCars4 : {}[]

myCars = myCars5;
>myCars = myCars5 : any[][]
Expand All @@ -39,9 +39,9 @@ myCars3 = myCars;
>myCars : any[]

myCars3 = myCars4;
>myCars3 = myCars4 : any
>myCars3 = myCars4 : {}[]
>myCars3 : {}[]
>myCars4 : any
>myCars4 : {}[]

myCars3 = myCars5;
>myCars3 = myCars5 : any[][]
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayReferenceWithoutTypeArgs.types
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class X {
>X : X

public f(a: Array) { }
>f : (a: any) => void
>a : any
>f : (a: {}[]) => void
>a : {}[]
>Array : T[]
}
2 changes: 1 addition & 1 deletion tests/baselines/reference/emptyGenericParamList.types
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class I<T> {}
>T : T

var x: I<>;
>x : any
>x : I<{}>
>I : I<T>

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import a = require('./externalModuleExportingGenericClass_file0');
>a : typeof a

var v: a; // this should report error
>v : any
>v : a<{}>
>a : a<T>

var v2: any = (new a()).foo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var myCars3 = new Array({});
>{} : {}

var myCars4: Array; // error
>myCars4 : any
>myCars4 : {}[]
>Array : T[]

var myCars5: Array<any>[];
Expand All @@ -34,9 +34,9 @@ myCars = myCars3;
>myCars3 : {}[]

myCars = myCars4;
>myCars = myCars4 : any
>myCars = myCars4 : {}[]
>myCars : any[]
>myCars4 : any
>myCars4 : {}[]

myCars = myCars5;
>myCars = myCars5 : any[][]
Expand All @@ -54,9 +54,9 @@ myCars2 = myCars3;
>myCars3 : {}[]

myCars2 = myCars4;
>myCars2 = myCars4 : any
>myCars2 = myCars4 : {}[]
>myCars2 : any
>myCars4 : any
>myCars4 : {}[]

myCars2 = myCars5;
>myCars2 = myCars5 : any[][]
Expand All @@ -74,9 +74,9 @@ myCars3 = myCars2;
>myCars2 : any

myCars3 = myCars4;
>myCars3 = myCars4 : any
>myCars3 = myCars4 : {}[]
>myCars3 : {}[]
>myCars4 : any
>myCars4 : {}[]

myCars3 = myCars5;
>myCars3 = myCars5 : any[][]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class Bar {
>Bar : Bar

public getBar(foo: IFoo[]) {
>getBar : (foo: any[]) => void
>foo : any[]
>getBar : (foo: IFoo<{}>[]) => void
>foo : IFoo<{}>[]
>IFoo : IFoo<T>
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/genericCloduleInModule2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ var b: A.B;
>B : Symbol(A.B, Decl(genericCloduleInModule2.ts, 0, 10), Decl(genericCloduleInModule2.ts, 7, 10))

b.foo();
>b.foo : Symbol(A.B.foo, Decl(genericCloduleInModule2.ts, 1, 23))
>b : Symbol(b, Decl(genericCloduleInModule2.ts, 13, 3))
>foo : Symbol(A.B.foo, Decl(genericCloduleInModule2.ts, 1, 23))

10 changes: 5 additions & 5 deletions tests/baselines/reference/genericCloduleInModule2.types
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ module A {
}

var b: A.B;
>b : any
>b : A.B<{}>
>A : any
>B : A.B<T>

b.foo();
>b.foo() : any
>b.foo : any
>b : any
>foo : any
>b.foo() : void
>b.foo : () => void
>b : A.B<{}>
>foo : () => void

6 changes: 3 additions & 3 deletions tests/baselines/reference/genericDefaultsErrors.types
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ interface i09<T, U, V = number> { }
>V : V

type i09t00 = i09; // error
>i09t00 : any
>i09t00 : i09<{}, {}, number>
>i09 : i09<T, U, V>

type i09t01 = i09<1>; // error
>i09t01 : any
>i09t01 : i09<1, {}, number>
>i09 : i09<T, U, V>

type i09t02 = i09<1, 2>; // ok
Expand All @@ -133,7 +133,7 @@ type i09t03 = i09<1, 2, 3>; // ok
>i09 : i09<T, U, V>

type i09t04 = i09<1, 2, 3, 4>; // error
>i09t04 : any
>i09t04 : i09<1, 2, 3>
>i09 : i09<T, U, V>

interface i10 { x: T; } // error
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/genericGetter2.types
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class C<T> {
>T : T

get x(): A {
>x : any
>x : A<{}>
>A : A<T>

return this.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class C<T> { }
>T : T

var i: I;
>i : any
>i : I<{}>
>I : I<T>

var c: C<I>;
>c : C<any>
>c : C<I<{}>>
>C : C<T>
>I : I<T>

Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ foo((arg: Foo) => { return arg.x; });
>foo : Symbol(foo, Decl(genericLambaArgWithoutTypeArguments.ts, 2, 1))
>arg : Symbol(arg, Decl(genericLambaArgWithoutTypeArguments.ts, 6, 5))
>Foo : Symbol(Foo, Decl(genericLambaArgWithoutTypeArguments.ts, 0, 0))
>arg.x : Symbol(Foo.x, Decl(genericLambaArgWithoutTypeArguments.ts, 0, 18))
>arg : Symbol(arg, Decl(genericLambaArgWithoutTypeArguments.ts, 6, 5))
>x : Symbol(Foo.x, Decl(genericLambaArgWithoutTypeArguments.ts, 0, 18))

Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ function foo(a) {
foo((arg: Foo) => { return arg.x; });
>foo((arg: Foo) => { return arg.x; }) : any
>foo : (a: any) => any
>(arg: Foo) => { return arg.x; } : (arg: any) => any
>arg : any
>(arg: Foo) => { return arg.x; } : (arg: Foo<{}>) => {}
>arg : Foo<{}>
>Foo : Foo<T>
>arg.x : any
>arg : any
>x : any
>arg.x : {}
>arg : Foo<{}>
>x : {}

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export declare module TypeScript {
>A : A
>B : B
>C : C
>PullTypeSymbol : typeof PullTypeSymbol
>PullTypeSymbol : PullTypeSymbol<{}, {}, {}>
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(3,66): error TS2314: Generic type 'MemberName<A, B, C>' requires 3 type argument(s).
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(3,66): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(10,22): error TS2314: Generic type 'PullTypeSymbol<A, B, C>' requires 3 type argument(s).
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(12,48): error TS2314: Generic type 'PullSymbol<A, B, C>' requires 3 type argument(s).
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(13,31): error TS2314: Generic type 'PullTypeSymbol<A, B, C>' requires 3 type argument(s).
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(14,46): error TS2314: Generic type 'PullSymbol<A, B, C>' requires 3 type argument(s).
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(18,53): error TS2314: Generic type 'PullSymbol<A, B, C>' requires 3 type argument(s).
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(19,22): error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol<A, B, C>'.
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(21,36): error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol<{}, {}, {}>'.
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(21,67): error TS2339: Property 'isNamedTypeSymbol' does not exist on type 'PullTypeSymbol<{}, {}, {}>'.
tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(23,35): error TS2339: Property 'getMemberTypeNameEx' does not exist on type 'PullTypeSymbol<{}, {}, {}>'.


==== tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts (7 errors) ====
==== tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts (11 errors) ====
module TypeScript {
export class MemberName <A,B,C>{
static create<A,B,C>(arg1: any, arg2?: any, arg3?: any): MemberName {
~~~~~~~~~~
!!! error TS2314: Generic type 'MemberName<A, B, C>' requires 3 type argument(s).
~~~~~~~~~~
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
}
}
}
Expand Down Expand Up @@ -43,8 +49,14 @@ tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(19,22): error
!!! error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol<A, B, C>'.
var elementMemberName = this._elementType ?
(this._elementType.isArray() || this._elementType.isNamedTypeSymbol() ?
~~~~~~~
!!! error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol<{}, {}, {}>'.
~~~~~~~~~~~~~~~~~
!!! error TS2339: Property 'isNamedTypeSymbol' does not exist on type 'PullTypeSymbol<{}, {}, {}>'.
this._elementType.getScopedNameEx(scopeSymbol, false, getPrettyTypeName, getTypeParamMarkerInfo) :
this._elementType.getMemberTypeNameEx(false, scopeSymbol, getPrettyTypeName)) : 1
~~~~~~~~~~~~~~~~~~~
!!! error TS2339: Property 'getMemberTypeNameEx' does not exist on type 'PullTypeSymbol<{}, {}, {}>'.
return MemberName.create(elementMemberName, "", "[]");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ module TypeScript {
>_elementType : Symbol(PullTypeSymbol._elementType, Decl(genericRecursiveImplicitConstructorErrors3.ts, 11, 59))

this._elementType.getScopedNameEx(scopeSymbol, false, getPrettyTypeName, getTypeParamMarkerInfo) :
>this._elementType.getScopedNameEx : Symbol(PullTypeSymbol.getScopedNameEx, Decl(genericRecursiveImplicitConstructorErrors3.ts, 16, 9))
>this._elementType : Symbol(PullTypeSymbol._elementType, Decl(genericRecursiveImplicitConstructorErrors3.ts, 11, 59))
>this : Symbol(PullTypeSymbol, Decl(genericRecursiveImplicitConstructorErrors3.ts, 10, 5))
>_elementType : Symbol(PullTypeSymbol._elementType, Decl(genericRecursiveImplicitConstructorErrors3.ts, 11, 59))
>getScopedNameEx : Symbol(PullTypeSymbol.getScopedNameEx, Decl(genericRecursiveImplicitConstructorErrors3.ts, 16, 9))
>scopeSymbol : Symbol(scopeSymbol, Decl(genericRecursiveImplicitConstructorErrors3.ts, 17, 38))
>getPrettyTypeName : Symbol(getPrettyTypeName, Decl(genericRecursiveImplicitConstructorErrors3.ts, 17, 94))
>getTypeParamMarkerInfo : Symbol(getTypeParamMarkerInfo, Decl(genericRecursiveImplicitConstructorErrors3.ts, 17, 123))
Expand Down
Loading