Skip to content

Commit 672e21d

Browse files
authored
#1400. File renaming commit (#2075)
1 parent 86b636f commit 672e21d

8 files changed

+111
-162
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// @assertion Let DV be an inline class declaration named Inline with type
6+
/// parameters X1 extends B1, .. Xs extends Bs. Assume that DV declares a final
7+
/// instance variable with name id and type R.
8+
///
9+
/// We say that the declared representation type of Inline is R, and the
10+
/// instantiated representation type corresponding to Inline<T1,.. Ts> is
11+
/// [T1/X1, .. Ts/Xs]R.
12+
/// ...
13+
/// In the body of a member of an inline class declaration DV named Inline and
14+
/// declaring the type parameters X1, .. Xs, the static type of this is
15+
/// Inline<X1 .. Xs>. The static type of the representation name is the
16+
/// representation type.
17+
///
18+
/// @description Checks that static type of `this` in an inline class
19+
/// `Inline<X1 .. Xs>` is `Inline<X1 .. Xs>`
20+
/// @author [email protected]
21+
22+
// SharedOptions=--enable-experiment=inline-class
23+
24+
import "../../Utils/static_type_helper.dart";
25+
26+
inline class V1 {
27+
final int id;
28+
V1(this.id);
29+
30+
test() {
31+
this.expectStaticType<Exactly<V1>>();
32+
}
33+
}
34+
35+
inline class V2<T1, T2 extends num> {
36+
final int id;
37+
V2(this.id);
38+
39+
test() {
40+
this.expectStaticType<Exactly<V2<T1, T2>>>();
41+
}
42+
}
43+
44+
main() {
45+
V1(42).test();
46+
V2(42).test();
47+
V2<String, num>(42).test();
48+
V2<int, int>(42).test();
49+
}

LanguageFeatures/Inline-classes/static_analysis_inline_class_A13_t01.dart

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,33 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// @assertion Let DV be an inline class declaration named Inline with type
6-
/// parameters X1 extends B1, .. Xs extends Bs. Assume that DV declares a final
7-
/// instance variable with name id and type R.
8-
///
9-
/// We say that the declared representation type of Inline is R, and the
10-
/// instantiated representation type corresponding to Inline<T1,.. Ts> is
11-
/// [T1/X1, .. Ts/Xs]R.
12-
/// ...
13-
/// In the body of a member of an inline class declaration DV named Inline and
14-
/// declaring the type parameters X1, .. Xs, the static type of this is
15-
/// Inline<X1 .. Xs>. The static type of the representation name is the
5+
/// @assertion The inline erasure of an inline type V is obtained by recursively
6+
/// replacing every subterm of V which is an inline type by the corresponding
167
/// representation type.
178
///
18-
/// @description Checks that static type of `this` in an inline class
19-
/// `Inline<X1 .. Xs>` is `Inline<X1 .. Xs>`
9+
/// Let X1 extends B1, .. Xs extends Bs be a declaration of the type parameters
10+
/// of a generic entity (it could be a generic class, inline or not, or mixin,
11+
/// or typedef, or function). Let BBj be the inline erasure of Bj, for j in
12+
/// 1 .. s. It is a compile-time error if X1 extends BB1, .. Xs extends BBs has
13+
/// any compile-time errors.
14+
///
15+
/// @description Checks that if `BBj` is the inline erasure of `Bj`, for `j` in
16+
/// `1 .. s`, then it is a compile-time error if
17+
/// `X1 extends BB1, .. Xs extends BBs` has any compile-time errors.
2018
/// @author [email protected]
2119
2220
// SharedOptions=--enable-experiment=inline-class
2321

24-
import "../../Utils/static_type_helper.dart";
25-
26-
inline class V1 {
27-
final int id;
28-
V1(this.id);
29-
30-
test() {
31-
this.expectStaticType<Exactly<V1>>();
32-
}
22+
inline class V<T> {
23+
final T id;
24+
V(this.id);
3325
}
3426

35-
inline class V2<T1, T2 extends num> {
36-
final int id;
37-
V2(this.id);
38-
39-
test() {
40-
this.expectStaticType<Exactly<V2<T1, T2>>>();
41-
}
42-
}
27+
void foo<X extends V<Y>, Y extends X>() {} // foo<X extends Y, Y extends X>()
28+
// ^^^^
29+
// [analyzer] unspecified
30+
// [cfe] unspecified
4331

4432
main() {
45-
V1(42).test();
46-
V2(42).test();
47-
V2<String, num>(42).test();
48-
V2<int, int>(42).test();
33+
print(foo);
4934
}

LanguageFeatures/Inline-classes/static_analysis_inline_class_A14_t01.dart

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,35 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// @assertion Let DV be an inline class declaration named V with representation
6-
/// type R. Assuming that all types have been fully alias expanded, we say that
7-
/// DV has a representation dependency on an inline class declaration DV2 if R
8-
/// contains an identifier id (possibly qualified) that resolves to DV2, or id
9-
/// resolves to an inline class declaration DV3 and DV3 has a representation
10-
/// dependency on DV2.
5+
/// @assertion A compile-time error occurs if an inline class constructor
6+
/// includes a superinitializer
117
///
12-
/// It is a compile-time error if an inline class declaration has a
13-
/// representation dependency on itself.
14-
///
15-
/// @description Checks that it is a compile-time error if an inline class has a
16-
/// dependency on itself.
8+
/// @description Checks that a compile-time error occurs if an inline class
9+
/// constructor includes a superinitializer
1710
/// @author [email protected]
1811
1912
// SharedOptions=--enable-experiment=inline-class
2013

21-
inline class V1 implements V2 {
22-
// ^^
23-
// [analyzer] unspecified
24-
// [cfe] unspecified
14+
inline class V1 {
2515
final int id;
26-
V1(this.id);
16+
V1([this.id = 0]);
17+
V1.x(this.id);
2718
}
2819

29-
inline class V2 implements V3 {
30-
// ^^
20+
inline class V2 implements V1 {
21+
final int id = 0;
22+
V2() : super();
23+
// ^^^^^
3124
// [analyzer] unspecified
3225
// [cfe] unspecified
33-
final int id;
34-
V2(this.id);
35-
}
36-
37-
typedef V1Alias = V1;
3826

39-
inline class V3 implements V1Alias {
40-
// ^^
27+
V2.x(int i) : super.x(i);
28+
// ^^^^^^^
4129
// [analyzer] unspecified
4230
// [cfe] unspecified
43-
final int id;
44-
V3(this.id);
4531
}
4632

4733
main() {
48-
print(V1);
49-
print(V2);
50-
print(V3);
34+
V1(42);
35+
V2();
5136
}

LanguageFeatures/Inline-classes/static_analysis_inline_class_A15_t01.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// @assertion The inline erasure of an inline type V is obtained by recursively
6-
/// replacing every subterm of V which is an inline type by the corresponding
7-
/// representation type.
5+
/// @assertion A compile-time error occurs if an inline class constructor
6+
/// declares a super parameter
87
///
9-
/// Let X1 extends B1, .. Xs extends Bs be a declaration of the type parameters
10-
/// of a generic entity (it could be a generic class, inline or not, or mixin,
11-
/// or typedef, or function). Let BBj be the inline erasure of Bj, for j in
12-
/// 1 .. s. It is a compile-time error if X1 extends BB1, .. Xs extends BBs has
13-
/// any compile-time errors.
14-
///
15-
/// @description Checks that if `BBj` is the inline erasure of `Bj`, for `j` in
16-
/// `1 .. s`, then it is a compile-time error if
17-
/// `X1 extends BB1, .. Xs extends BBs` has any compile-time errors.
8+
/// @description Checks that a compile-time error occurs if an inline class
9+
/// constructor declares a super parameter
1810
/// @author [email protected]
1911
2012
// SharedOptions=--enable-experiment=inline-class
2113

22-
inline class V<T> {
23-
final T id;
24-
V(this.id);
14+
inline class V1 {
15+
final int id;
16+
V1(this.id, [Object? _]);
2517
}
2618

27-
void foo<X extends V<Y>, Y extends X>() {} // foo<X extends Y, Y extends X>()
28-
// ^^^^
19+
inline class V2 implements V1 {
20+
final int id;
21+
V2(this.id, super.id);
22+
// ^^^^^
2923
// [analyzer] unspecified
3024
// [cfe] unspecified
3125

26+
V2.n(super.id);
27+
// ^^^^^
28+
// [analyzer] unspecified
29+
// [cfe] unspecified
30+
}
31+
3232
main() {
33-
print(foo);
33+
V2(42, 0);
3434
}

LanguageFeatures/Inline-classes/static_analysis_inline_class_A16_t01.dart

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,23 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// @assertion A compile-time error occurs if an inline class constructor
6-
/// includes a superinitializer
5+
/// @assertion An inline type V used as an expression (a type literal) is
6+
/// allowed and has static type Type.
77
///
8-
/// @description Checks that a compile-time error occurs if an inline class
9-
/// constructor includes a superinitializer
8+
/// @description Checks that an inline type `V` can be used as an expression (a
9+
/// type literal) is and has static type `Type`.
1010
/// @author [email protected]
1111
1212
// SharedOptions=--enable-experiment=inline-class
1313

14-
inline class V1 {
15-
final int id;
16-
V1([this.id = 0]);
17-
V1.x(this.id);
18-
}
14+
import "../../Utils/static_type_helper.dart";
1915

20-
inline class V2 implements V1 {
21-
final int id = 0;
22-
V2() : super();
23-
// ^^^^^
24-
// [analyzer] unspecified
25-
// [cfe] unspecified
26-
27-
V2.x(int i) : super.x(i);
28-
// ^^^^^^^
29-
// [analyzer] unspecified
30-
// [cfe] unspecified
16+
inline class V {
17+
final int id;
18+
V(this.id);
3119
}
3220

3321
main() {
34-
V1(42);
35-
V2();
22+
var t = V;
23+
t.expectStaticType<Exactly<Type>>();
3624
}

LanguageFeatures/Inline-classes/static_analysis_inline_class_A17_t01.dart

Lines changed: 0 additions & 34 deletions
This file was deleted.

LanguageFeatures/Inline-classes/static_analysis_inline_class_A18_t01.dart

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)