Skip to content

Commit c870bef

Browse files
committed
Accept new baselines
1 parent 88961a2 commit c870bef

File tree

4 files changed

+792
-0
lines changed

4 files changed

+792
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
tests/cases/conformance/classes/mixinAccessModifiers.ts(39,4): error TS2546: Property 'p' has conflicting declarations and is inaccessible in type 'Private & Private2'.
2+
tests/cases/conformance/classes/mixinAccessModifiers.ts(43,4): error TS2546: Property 'p' has conflicting declarations and is inaccessible in type 'Private & Protected'.
3+
tests/cases/conformance/classes/mixinAccessModifiers.ts(47,4): error TS2546: Property 'p' has conflicting declarations and is inaccessible in type 'Private & Public'.
4+
tests/cases/conformance/classes/mixinAccessModifiers.ts(51,4): error TS2445: Property 'p' is protected and only accessible within class 'Protected & Protected2' and its subclasses.
5+
tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'.
6+
Type 'C1' is not assignable to type 'Private'.
7+
Property 'p' has conflicting declarations and is inaccessible in type 'C1'.
8+
tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'.
9+
Type 'C2' is not assignable to type 'Private'.
10+
Property 'p' has conflicting declarations and is inaccessible in type 'C2'.
11+
tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'.
12+
Type 'C3' is not assignable to type 'Private'.
13+
Property 'p' has conflicting declarations and is inaccessible in type 'C3'.
14+
tests/cases/conformance/classes/mixinAccessModifiers.ts(85,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses.
15+
tests/cases/conformance/classes/mixinAccessModifiers.ts(90,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses.
16+
tests/cases/conformance/classes/mixinAccessModifiers.ts(98,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses.
17+
tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses.
18+
19+
20+
==== tests/cases/conformance/classes/mixinAccessModifiers.ts (11 errors) ====
21+
22+
type Constructable = new (...args: any[]) => object;
23+
24+
class Private {
25+
constructor (...args: any[]) {}
26+
private p: string;
27+
}
28+
29+
class Private2 {
30+
constructor (...args: any[]) {}
31+
private p: string;
32+
}
33+
34+
class Protected {
35+
constructor (...args: any[]) {}
36+
protected p: string;
37+
protected static s: string;
38+
}
39+
40+
class Protected2 {
41+
constructor (...args: any[]) {}
42+
protected p: string;
43+
protected static s: string;
44+
}
45+
46+
class Public {
47+
constructor (...args: any[]) {}
48+
public p: string;
49+
public static s: string;
50+
}
51+
52+
class Public2 {
53+
constructor (...args: any[]) {}
54+
public p: string;
55+
public static s: string;
56+
}
57+
58+
function f1(x: Private & Private2) {
59+
x.p; // Error, private constituent makes property inaccessible
60+
~
61+
!!! error TS2546: Property 'p' has conflicting declarations and is inaccessible in type 'Private & Private2'.
62+
}
63+
64+
function f2(x: Private & Protected) {
65+
x.p; // Error, private constituent makes property inaccessible
66+
~
67+
!!! error TS2546: Property 'p' has conflicting declarations and is inaccessible in type 'Private & Protected'.
68+
}
69+
70+
function f3(x: Private & Public) {
71+
x.p; // Error, private constituent makes property inaccessible
72+
~
73+
!!! error TS2546: Property 'p' has conflicting declarations and is inaccessible in type 'Private & Public'.
74+
}
75+
76+
function f4(x: Protected & Protected2) {
77+
x.p; // Error, protected when all constituents are protected
78+
~
79+
!!! error TS2445: Property 'p' is protected and only accessible within class 'Protected & Protected2' and its subclasses.
80+
}
81+
82+
function f5(x: Protected & Public) {
83+
x.p; // Ok, public if any constituent is public
84+
}
85+
86+
function f6(x: Public & Public2) {
87+
x.p; // Ok, public if any constituent is public
88+
}
89+
90+
declare function Mix<T, U>(c1: T, c2: U): T & U;
91+
92+
// Can't derive from type with inaccessible properties
93+
94+
class C1 extends Mix(Private, Private2) {}
95+
~~
96+
!!! error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'.
97+
!!! error TS2415: Type 'C1' is not assignable to type 'Private'.
98+
!!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C1'.
99+
class C2 extends Mix(Private, Protected) {}
100+
~~
101+
!!! error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'.
102+
!!! error TS2415: Type 'C2' is not assignable to type 'Private'.
103+
!!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C2'.
104+
class C3 extends Mix(Private, Public) {}
105+
~~
106+
!!! error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'.
107+
!!! error TS2415: Type 'C3' is not assignable to type 'Private'.
108+
!!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C3'.
109+
110+
class C4 extends Mix(Protected, Protected2) {
111+
f(c4: C4, c5: C5, c6: C6) {
112+
c4.p;
113+
c5.p;
114+
c6.p;
115+
}
116+
static g() {
117+
C4.s;
118+
C5.s;
119+
C6.s
120+
}
121+
}
122+
123+
class C5 extends Mix(Protected, Public) {
124+
f(c4: C4, c5: C5, c6: C6) {
125+
c4.p; // Error, not in class deriving from Protected2
126+
~
127+
!!! error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses.
128+
c5.p;
129+
c6.p;
130+
}
131+
static g() {
132+
C4.s; // Error, not in class deriving from Protected2
133+
~
134+
!!! error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses.
135+
C5.s;
136+
C6.s
137+
}
138+
}
139+
140+
class C6 extends Mix(Public, Public2) {
141+
f(c4: C4, c5: C5, c6: C6) {
142+
c4.p; // Error, not in class deriving from Protected2
143+
~
144+
!!! error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses.
145+
c5.p;
146+
c6.p;
147+
}
148+
static g() {
149+
C4.s; // Error, not in class deriving from Protected2
150+
~
151+
!!! error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses.
152+
C5.s;
153+
C6.s
154+
}
155+
}
156+

0 commit comments

Comments
 (0)