This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +72
-16
lines changed
Expand file tree Collapse file tree 4 files changed +72
-16
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2022, 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+ class BadExtends extends Null {}
6+ // ^^^^
7+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
8+ // ^
9+ // [cfe] 'Null' is restricted and can't be extended or implemented.
10+ // [cfe] The superclass, 'Null', has no unnamed constructor that takes no arguments.
11+ // ^
12+ // [cfe] 'Null' is restricted and can't be extended or implemented.
13+
14+ class BadImplements implements Null {}
15+ // ^^^^
16+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
17+ // ^
18+ // [cfe] 'Null' is restricted and can't be extended or implemented.
19+ // ^
20+ // [cfe] 'Null' is restricted and can't be extended or implemented.
21+
22+ class BadMixin extends Object with Null {}
23+ // ^^^^
24+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
25+ // ^
26+ // [cfe] 'Null' is restricted and can't be extended or implemented.
27+ // ^
28+ // [cfe] 'Null' is restricted and can't be extended or implemented.
29+
30+ class BadMixin2 = Object with Null ;
31+ // ^^^^
32+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
33+ // ^
34+ // [cfe] 'Null' is restricted and can't be extended or implemented.
35+ // ^
36+ // [cfe] 'Null' is restricted and can't be extended or implemented.
Original file line number Diff line number Diff line change 77
88import "package:expect/expect.dart" ;
99
10- class BadInherit
11- extends Null // //# 01: compile-time error
12- implements Null // //# 02: compile-time error
13- extends Object with Null // //# 03: compile-time error
14- {}
15-
1610class EqualsNotCalled {
1711 int get hashCode => throw "And don't warn!" ;
1812 bool operator == (Object other) {
@@ -52,8 +46,6 @@ void main() {
5246}
5347
5448void test () {
55- new BadInherit (); // Make sure class is referenced.
56-
5749 void foo (var obj) {
5850 Expect .equals (null , obj);
5951 }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2022, 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+ class BadExtends extends Null {}
6+ // ^^^^
7+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
8+ // ^
9+ // [cfe] 'Null' is restricted and can't be extended or implemented.
10+ // [cfe] The superclass, 'Null', has no unnamed constructor that takes no arguments.
11+ // ^
12+ // [cfe] 'Null' is restricted and can't be extended or implemented.
13+
14+ class BadImplements implements Null {}
15+ // ^^^^
16+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
17+ // ^
18+ // [cfe] 'Null' is restricted and can't be extended or implemented.
19+ // ^
20+ // [cfe] 'Null' is restricted and can't be extended or implemented.
21+
22+ class BadMixin extends Object with Null {}
23+ // ^^^^
24+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
25+ // ^
26+ // [cfe] 'Null' is restricted and can't be extended or implemented.
27+ // ^
28+ // [cfe] 'Null' is restricted and can't be extended or implemented.
29+
30+ class BadMixin2 = Object with Null ;
31+ // ^^^^
32+ // [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_DISALLOWED_TYPE
33+ // ^
34+ // [cfe] 'Null' is restricted and can't be extended or implemented.
35+ // ^
36+ // [cfe] 'Null' is restricted and can't be extended or implemented.
Original file line number Diff line number Diff line change 99
1010import "package:expect/expect.dart" ;
1111
12- class BadInherit
13- extends Null // //# 01: compile-time error
14- implements Null // //# 02: compile-time error
15- extends Object with Null // //# 03: compile-time error
16- {}
17-
1812class EqualsNotCalled {
1913 int get hashCode => throw "And don't warn!" ;
2014 bool operator == (Object other) {
@@ -54,8 +48,6 @@ void main() {
5448}
5549
5650void test () {
57- new BadInherit (); // Make sure class is referenced.
58-
5951 int foo (var obj) {
6052 Expect .equals (null , obj);
6153 }
You can’t perform that action at this time.
0 commit comments