Skip to content

Commit 4a88fbd

Browse files
committed
new test case
1 parent 16085d5 commit 4a88fbd

5 files changed

+197
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
elaborationForSameRelationshipOnDifferentLocations.ts(18,10): error TS2345: Argument of type 'Snake' is not assignable to parameter of type 'CouponInfo'.
2+
Property 'couponTag' is missing in type 'Snake' but required in type 'CouponInfo'.
3+
elaborationForSameRelationshipOnDifferentLocations.ts(19,5): error TS2741: Property 'couponTag' is missing in type 'Snake' but required in type 'CouponInfo'.
4+
5+
6+
==== elaborationForSameRelationshipOnDifferentLocations.ts (2 errors) ====
7+
// https://github.com/microsoft/TypeScript/issues/3276
8+
9+
class GenericThingamabob<T> {
10+
constructor(private entity: T) {}
11+
add(item: T) { }
12+
}
13+
14+
class CouponInfo {
15+
private couponTag: {};
16+
}
17+
18+
class Snake {
19+
private snakeTag: {};
20+
}
21+
22+
var blah = new GenericThingamabob(new CouponInfo());
23+
24+
blah.add(new Snake());
25+
~~~~~~~~~~~
26+
!!! error TS2345: Argument of type 'Snake' is not assignable to parameter of type 'CouponInfo'.
27+
!!! error TS2345: Property 'couponTag' is missing in type 'Snake' but required in type 'CouponInfo'.
28+
!!! related TS2728 elaborationForSameRelationshipOnDifferentLocations.ts:9:13: 'couponTag' is declared here.
29+
var x: CouponInfo = new Snake();
30+
~
31+
!!! error TS2741: Property 'couponTag' is missing in type 'Snake' but required in type 'CouponInfo'.
32+
!!! related TS2728 elaborationForSameRelationshipOnDifferentLocations.ts:9:13: 'couponTag' is declared here.
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//// [tests/cases/compiler/elaborationForSameRelationshipOnDifferentLocations.ts] ////
2+
3+
//// [elaborationForSameRelationshipOnDifferentLocations.ts]
4+
// https://github.com/microsoft/TypeScript/issues/3276
5+
6+
class GenericThingamabob<T> {
7+
constructor(private entity: T) {}
8+
add(item: T) { }
9+
}
10+
11+
class CouponInfo {
12+
private couponTag: {};
13+
}
14+
15+
class Snake {
16+
private snakeTag: {};
17+
}
18+
19+
var blah = new GenericThingamabob(new CouponInfo());
20+
21+
blah.add(new Snake());
22+
var x: CouponInfo = new Snake();
23+
24+
25+
//// [elaborationForSameRelationshipOnDifferentLocations.js]
26+
// https://github.com/microsoft/TypeScript/issues/3276
27+
var GenericThingamabob = /** @class */ (function () {
28+
function GenericThingamabob(entity) {
29+
this.entity = entity;
30+
}
31+
GenericThingamabob.prototype.add = function (item) { };
32+
return GenericThingamabob;
33+
}());
34+
var CouponInfo = /** @class */ (function () {
35+
function CouponInfo() {
36+
}
37+
return CouponInfo;
38+
}());
39+
var Snake = /** @class */ (function () {
40+
function Snake() {
41+
}
42+
return Snake;
43+
}());
44+
var blah = new GenericThingamabob(new CouponInfo());
45+
blah.add(new Snake());
46+
var x = new Snake();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//// [tests/cases/compiler/elaborationForSameRelationshipOnDifferentLocations.ts] ////
2+
3+
=== elaborationForSameRelationshipOnDifferentLocations.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/3276
5+
6+
class GenericThingamabob<T> {
7+
>GenericThingamabob : Symbol(GenericThingamabob, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 0, 0))
8+
>T : Symbol(T, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 2, 25))
9+
10+
constructor(private entity: T) {}
11+
>entity : Symbol(GenericThingamabob.entity, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 3, 16))
12+
>T : Symbol(T, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 2, 25))
13+
14+
add(item: T) { }
15+
>add : Symbol(GenericThingamabob.add, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 3, 37))
16+
>item : Symbol(item, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 4, 8))
17+
>T : Symbol(T, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 2, 25))
18+
}
19+
20+
class CouponInfo {
21+
>CouponInfo : Symbol(CouponInfo, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 5, 1))
22+
23+
private couponTag: {};
24+
>couponTag : Symbol(CouponInfo.couponTag, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 7, 18))
25+
}
26+
27+
class Snake {
28+
>Snake : Symbol(Snake, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 9, 1))
29+
30+
private snakeTag: {};
31+
>snakeTag : Symbol(Snake.snakeTag, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 11, 13))
32+
}
33+
34+
var blah = new GenericThingamabob(new CouponInfo());
35+
>blah : Symbol(blah, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 15, 3))
36+
>GenericThingamabob : Symbol(GenericThingamabob, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 0, 0))
37+
>CouponInfo : Symbol(CouponInfo, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 5, 1))
38+
39+
blah.add(new Snake());
40+
>blah.add : Symbol(GenericThingamabob.add, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 3, 37))
41+
>blah : Symbol(blah, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 15, 3))
42+
>add : Symbol(GenericThingamabob.add, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 3, 37))
43+
>Snake : Symbol(Snake, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 9, 1))
44+
45+
var x: CouponInfo = new Snake();
46+
>x : Symbol(x, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 18, 3))
47+
>CouponInfo : Symbol(CouponInfo, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 5, 1))
48+
>Snake : Symbol(Snake, Decl(elaborationForSameRelationshipOnDifferentLocations.ts, 9, 1))
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//// [tests/cases/compiler/elaborationForSameRelationshipOnDifferentLocations.ts] ////
2+
3+
=== elaborationForSameRelationshipOnDifferentLocations.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/3276
5+
6+
class GenericThingamabob<T> {
7+
>GenericThingamabob : GenericThingamabob<T>
8+
9+
constructor(private entity: T) {}
10+
>entity : T
11+
12+
add(item: T) { }
13+
>add : (item: T) => void
14+
>item : T
15+
}
16+
17+
class CouponInfo {
18+
>CouponInfo : CouponInfo
19+
20+
private couponTag: {};
21+
>couponTag : {}
22+
}
23+
24+
class Snake {
25+
>Snake : Snake
26+
27+
private snakeTag: {};
28+
>snakeTag : {}
29+
}
30+
31+
var blah = new GenericThingamabob(new CouponInfo());
32+
>blah : GenericThingamabob<CouponInfo>
33+
>new GenericThingamabob(new CouponInfo()) : GenericThingamabob<CouponInfo>
34+
>GenericThingamabob : typeof GenericThingamabob
35+
>new CouponInfo() : CouponInfo
36+
>CouponInfo : typeof CouponInfo
37+
38+
blah.add(new Snake());
39+
>blah.add(new Snake()) : void
40+
>blah.add : (item: CouponInfo) => void
41+
>blah : GenericThingamabob<CouponInfo>
42+
>add : (item: CouponInfo) => void
43+
>new Snake() : Snake
44+
>Snake : typeof Snake
45+
46+
var x: CouponInfo = new Snake();
47+
>x : CouponInfo
48+
>new Snake() : Snake
49+
>Snake : typeof Snake
50+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// https://github.com/microsoft/TypeScript/issues/3276
2+
3+
class GenericThingamabob<T> {
4+
constructor(private entity: T) {}
5+
add(item: T) { }
6+
}
7+
8+
class CouponInfo {
9+
private couponTag: {};
10+
}
11+
12+
class Snake {
13+
private snakeTag: {};
14+
}
15+
16+
var blah = new GenericThingamabob(new CouponInfo());
17+
18+
blah.add(new Snake());
19+
var x: CouponInfo = new Snake();

0 commit comments

Comments
 (0)