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 1111/// the two declarations of m are distinct declarations, and DV does not declare
1212/// a member named m.
1313///
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
1819/// @author sgrekhov22@gmail.com
1920
2021// SharedOptions=--enable-experiment=inline-class
@@ -34,10 +35,11 @@ inline class V2 {
3435}
3536
3637inline class V implements V1 , V2 {
38+ // ^
39+ // [analyzer] unspecified
40+ // [cfe] unspecified
3741 final int id;
3842 V (this .id);
39-
40- num get m => 3.14 ;
4143}
4244
4345main () {
Original file line number Diff line number Diff line change 1919
2020// SharedOptions=--enable-experiment=inline-class
2121
22- import "../../Utils/expect.dart" ;
23-
2422inline class V1 {
2523 final int id;
2624 V1 (this .id);
2725
28- int get m => 1 ;
26+ int m () => 1 ;
2927}
3028
3129inline class V2 {
3230 final int id;
3331 V2 (this .id);
3432
35- num m () => 2 ;
33+ int m () => 2 ;
3634}
3735
3836inline class V implements V1 , V2 {
3937 final int id;
4038 V (this .id);
4139
42- String get m => "42" ;
40+ num get m => 3.14 ;
4341}
4442
4543main () {
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 );
5245}
Original file line number Diff line number Diff line change 1111/// the two declarations of m are distinct declarations, and DV does not declare
1212/// a member named m.
1313///
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` .
1718/// @author sgrekhov22@gmail.com
1819
1920// SharedOptions=--enable-experiment=inline-class
2021
2122import "../../Utils/expect.dart" ;
2223
23- inline class V1 implements V3 {
24+ inline class V1 {
2425 final int id;
2526 V1 (this .id);
27+
28+ int get m => 1 ;
2629}
2730
28- inline class V2 implements V3 {
31+ inline class V2 {
2932 final int id;
3033 V2 (this .id);
31- }
3234
33- inline class V3 {
34- num foo () => 42 ;
35+ num m () => 2 ;
3536}
3637
3738inline class V implements V1 , V2 {
3839 final int id;
3940 V (this .id);
41+
42+ String get m => "42" ;
4043}
4144
4245main () {
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);
4452}
Original file line number Diff line number Diff line change 1111/// the two declarations of m are distinct declarations, and DV does not declare
1212/// a member named m.
1313///
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`
1917/// @author sgrekhov22@gmail.com
2018
2119// SharedOptions=--enable-experiment=inline-class
2220
23- inline class V1 {
21+ import "../../Utils/expect.dart" ;
22+
23+ inline class V1 implements V3 {
2424 final int id;
2525 V1 (this .id);
26-
27- int m () => 1 ;
2826}
2927
30- inline class V2 {
28+ inline class V2 implements V3 {
3129 final int id;
3230 V2 (this .id);
31+ }
3332
34- int m () => 2 ;
33+ inline class V3 {
34+ num foo () => 42 ;
3535}
3636
3737inline class V implements V1 , V2 {
38- // ^
39- // [analyzer] unspecified
40- // [cfe] unspecified
4138 final int id;
4239 V (this .id);
4340}
4441
4542main () {
46- print ( V );
43+ Expect . equals ( 42 , V ( 1 ). foo () );
4744}
You can’t perform that action at this time.
0 commit comments