File tree Expand file tree Collapse file tree 4 files changed +40
-40
lines changed
LanguageFeatures/Inline-classes Expand file tree Collapse file tree 4 files changed +40
-40
lines changed Original file line number Diff line number Diff line change 11
11
/// the two declarations of m are distinct declarations, and DV does not declare
12
12
/// a member named m.
13
13
///
14
- /// @description Checks that it is not an error if an inline class declaration
15
- /// `DV` has two superinterfaces `V1` and `V2` , where both `V1` and `V2` have a
16
- /// member named `m` , and the two declarations of `m` are distinct
17
- /// declarations, but DV does declare a member named `m` .
14
+ /// @description Checks that it is a compile-time error if an inline class
15
+ /// declaration `DV` has two superinterfaces `V1` and `V2` , where both `V1` and
16
+ /// `V2` have a member named `m` , and the two declarations of `m` are distinct
17
+ /// declarations, and DV does not declare a member named `m` . Test the case when
18
+ /// members in `V1` and `V2` have equal signatures
18
19
19
20
20
21
// SharedOptions=--enable-experiment=inline-class
@@ -34,10 +35,11 @@ inline class V2 {
34
35
}
35
36
36
37
inline class V implements V1 , V2 {
38
+ // ^
39
+ // [analyzer] unspecified
40
+ // [cfe] unspecified
37
41
final int id;
38
42
V (this .id);
39
-
40
- num get m => 3.14 ;
41
43
}
42
44
43
45
main () {
Original file line number Diff line number Diff line change 19
19
20
20
// SharedOptions=--enable-experiment=inline-class
21
21
22
- import "../../Utils/expect.dart" ;
23
-
24
22
inline class V1 {
25
23
final int id;
26
24
V1 (this .id);
27
25
28
- int get m => 1 ;
26
+ int m () => 1 ;
29
27
}
30
28
31
29
inline class V2 {
32
30
final int id;
33
31
V2 (this .id);
34
32
35
- num m () => 2 ;
33
+ int m () => 2 ;
36
34
}
37
35
38
36
inline class V implements V1 , V2 {
39
37
final int id;
40
38
V (this .id);
41
39
42
- String get m => "42" ;
40
+ num get m => 3.14 ;
43
41
}
44
42
45
43
main () {
46
- V1 v1 = V (1 );
47
- V2 v2 = V (2 );
48
- V v = V (3 );
49
- Expect .equals (1 , v1.m);
50
- Expect .equals (2 , v2.m ());
51
- Expect .equals ("42" , v.m);
44
+ print (V );
52
45
}
Original file line number Diff line number Diff line change 11
11
/// the two declarations of m are distinct declarations, and DV does not declare
12
12
/// a member named m.
13
13
///
14
- /// @description Checks that it is no an error if an inline class declaration
15
- /// `DV` has two superinterfaces `V1` and `V2` , where both `V1` and `V2` have
16
- /// the same declaration named `m`
14
+ /// @description Checks that it is not an error if an inline class declaration
15
+ /// `DV` has two superinterfaces `V1` and `V2` , where both `V1` and `V2` have a
16
+ /// member named `m` , and the two declarations of `m` are distinct
17
+ /// declarations, but DV does declare a member named `m` .
17
18
18
19
19
20
// SharedOptions=--enable-experiment=inline-class
20
21
21
22
import "../../Utils/expect.dart" ;
22
23
23
- inline class V1 implements V3 {
24
+ inline class V1 {
24
25
final int id;
25
26
V1 (this .id);
27
+
28
+ int get m => 1 ;
26
29
}
27
30
28
- inline class V2 implements V3 {
31
+ inline class V2 {
29
32
final int id;
30
33
V2 (this .id);
31
- }
32
34
33
- inline class V3 {
34
- num foo () => 42 ;
35
+ num m () => 2 ;
35
36
}
36
37
37
38
inline class V implements V1 , V2 {
38
39
final int id;
39
40
V (this .id);
41
+
42
+ String get m => "42" ;
40
43
}
41
44
42
45
main () {
43
- Expect .equals (42 , V (1 ).foo ());
46
+ V1 v1 = V (1 );
47
+ V2 v2 = V (2 );
48
+ V v = V (3 );
49
+ Expect .equals (1 , v1.m);
50
+ Expect .equals (2 , v2.m ());
51
+ Expect .equals ("42" , v.m);
44
52
}
Original file line number Diff line number Diff line change 11
11
/// the two declarations of m are distinct declarations, and DV does not declare
12
12
/// a member named m.
13
13
///
14
- /// @description Checks that it is a compile-time error if an inline class
15
- /// declaration `DV` has two superinterfaces `V1` and `V2` , where both `V1` and
16
- /// `V2` have a member named `m` , and the two declarations of `m` are distinct
17
- /// declarations, and DV does not declare a member named `m` . Test the case when
18
- /// members in `V1` and `V2` have equal signatures
14
+ /// @description Checks that it is no an error if an inline class declaration
15
+ /// `DV` has two superinterfaces `V1` and `V2` , where both `V1` and `V2` have
16
+ /// the same declaration named `m`
19
17
20
18
21
19
// SharedOptions=--enable-experiment=inline-class
22
20
23
- inline class V1 {
21
+ import "../../Utils/expect.dart" ;
22
+
23
+ inline class V1 implements V3 {
24
24
final int id;
25
25
V1 (this .id);
26
-
27
- int m () => 1 ;
28
26
}
29
27
30
- inline class V2 {
28
+ inline class V2 implements V3 {
31
29
final int id;
32
30
V2 (this .id);
31
+ }
33
32
34
- int m () => 2 ;
33
+ inline class V3 {
34
+ num foo () => 42 ;
35
35
}
36
36
37
37
inline class V implements V1 , V2 {
38
- // ^
39
- // [analyzer] unspecified
40
- // [cfe] unspecified
41
38
final int id;
42
39
V (this .id);
43
40
}
44
41
45
42
main () {
46
- print ( V );
43
+ Expect . equals ( 42 , V ( 1 ). foo () );
47
44
}
You can’t perform that action at this time.
0 commit comments