Skip to content

Commit 06b8ce7

Browse files
authored
#2080. Update assertion texts, add mixin syntax test (#2095)
1 parent dcccbc6 commit 06b8ce7

File tree

7 files changed

+57
-26
lines changed

7 files changed

+57
-26
lines changed

Language/Classes/Superinterfaces/no_member_t01.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
/// It is a compile error if the implicit interface of C includes an instance
88
/// member m of type F and C does not declare or inherit a corresponding
99
/// non-abstract instance member m of type F' such that F' <: F.
10-
/// @description Checks that it is a compile error if a class does not declare
1110
///
11+
/// @description Checks that it is a compile error if a class does not declare
1212
/// nor inherit an instance method declared in class' interface.
1313
/// @author msyabro
1414

Language/Classes/Superinterfaces/no_member_t02.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@
44

55
/// @assertion Let C be a concrete class that does not declare its own
66
/// noSuchMethod().
7-
/// It is a compile error if the implicit interface
8-
/// of C includes an instance member m of type F and C does not declare or
9-
/// inherit a corresponding instance member m of type F' such that F' <: F.
7+
/// It is a compile error if the implicit interface of C includes an instance
8+
/// member m of type F and C does not declare or inherit a corresponding
9+
/// instance member m of type F' such that F' <: F.
1010
///
11-
/// @description Checks that there are no warnings if the type F' of
12-
/// declared instance member m is in fact a subtype of F.
11+
/// @description Checks that there are no errors if the type F' of declared
12+
/// instance member m is in fact a subtype of F.
1313
/// @author ilya
1414
1515
abstract class I {
1616
foo(int x);
1717
}
1818

19-
class C implements I {
19+
mixin M {
2020
foo(num x) {}
2121
}
2222

23+
class C1 implements I {
24+
foo(num x) {}
25+
}
26+
27+
class C2 with M {}
28+
2329
main () {
24-
new C();
30+
C1();
31+
C2();
2532
}

Language/Classes/Superinterfaces/no_member_t03.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
/// @assertion Let C be a concrete class that does not declare its own
66
/// noSuchMethod().
7-
/// It is a compile error if the implicit interface
8-
/// of C includes an instance member m of type F and C does not declare or
9-
/// inherit a corresponding instance member m of type F' such that F' <: F.
7+
/// It is a compile error if the implicit interface of C includes an instance
8+
/// member m of type F and C does not declare or inherit a corresponding
9+
/// instance member m of type F' such that F' <: F.
1010
///
11-
/// @description Checks that there are no warnings if the type F' of
12-
/// inherited instance member m is in fact a subtype of F.
11+
/// @description Checks that there are no errors if the type F' of inherited
12+
/// instance member m is in fact a subtype of F.
1313
/// @author ilya
1414
15-
1615
abstract class I {
1716
foo(int x);
1817
}

Language/Classes/Superinterfaces/no_member_t04.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
/// @assertion Let C be a concrete class that does not declare its own
66
/// noSuchMethod().
7-
/// It is a compile error if the implicit interface
8-
/// of C includes an instance member m of type F and C does not declare or
9-
/// inherit a corresponding instance member m of type F' such that F' <: F.
7+
/// It is a compile error if the implicit interface of C includes an instance
8+
/// member m of type F and C does not declare or inherit a corresponding
9+
/// instance member m of type F' such that F' <: F.
1010
///
11-
/// @description Checks that there are no warnings if a class declares
12-
/// its own noSuchMethod() and does not declare nor inherit an instance
13-
/// method declared in class interface.
11+
/// @description Checks that there are no errors if a class declares its own
12+
/// `noSuchMethod()` and does not declare nor inherit an instance method
13+
/// declared in class interface.
1414
/// @author ilya
1515
16-
1716
abstract class I {
1817
foo();
1918
}

Language/Classes/Superinterfaces/no_member_t05.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
/// class.
1414
/// @author [email protected]
1515
16-
1716
class I {
1817
foo() {}
1918
}

Language/Classes/Superinterfaces/no_member_t07.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
/// @assertion Let C be a concrete class that does not declare its own
66
/// noSuchMethod().
7-
/// It is a compile error if the implicit interface
8-
/// of C includes an instance member m of type F and C does not declare or
9-
/// inherit a corresponding instance member m of type F' such that F' <: F.
7+
/// It is a compile error if the implicit interface of C includes an instance
8+
/// member m of type F and C does not declare or inherit a corresponding
9+
/// instance member m of type F' such that F' <: F.
1010
///
1111
/// @description Checks that there are no warnings if a class declares
12-
/// its own noSuchMethod() and does not declare nor inherit an instance
12+
/// its own `noSuchMethod()` and does not declare nor inherit an instance
1313
/// method declared in class interface. Test type alias
1414
/// @author [email protected]
1515
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 S be a class, M be a mixin with required superinterfaces
6+
/// T1, . . . , Tn, combined superinterface MS, implemented interfaces
7+
/// I1, . . . , Ik and members as mixin member declarations, and let N be a name.
8+
/// ...
9+
/// The mixin application of M to S with name N introduces a new class, C,
10+
/// with name N, superclass S, implemented interface I1, . . . , Ik and members
11+
/// as instance members.
12+
///
13+
/// @description Checks that it is not an error if a class mixes in and
14+
/// implements the same mixin class
15+
/// @author [email protected]
16+
17+
mixin class M {
18+
num foo(int i) => i;
19+
}
20+
21+
class C1 with M implements M {}
22+
class C2 = Object with M implements M;
23+
24+
main() {
25+
C1();
26+
C2();
27+
}

0 commit comments

Comments
 (0)