OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, 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 // Verify that the ?. operator cannot be used with "super". |
| 6 |
| 7 // SharedOptions=--enable-null-aware-operators |
| 8 |
| 9 class B { |
| 10 B(); |
| 11 B.namedConstructor(); |
| 12 var field = 1; |
| 13 method() => 1; |
| 14 } |
| 15 |
| 16 class C extends B { |
| 17 C() |
| 18 : super?.namedConstructor() /// 01: compile-time error |
| 19 ; |
| 20 |
| 21 test() { |
| 22 super?.field = 1; /// 02: compile-time error |
| 23 super?.field += 1; /// 03: compile-time error |
| 24 super?.field ??= 1; /// 04: compile-time error |
| 25 super?.field; /// 05: compile-time error |
| 26 1 * super?.field; /// 06: compile-time error |
| 27 -super?.field; /// 07: compile-time error |
| 28 ~super?.field; /// 08: compile-time error |
| 29 !super?.field; /// 09: compile-time error |
| 30 --super?.field; /// 10: compile-time error |
| 31 ++super?.field; /// 11: compile-time error |
| 32 super?.method(); /// 12: compile-time error |
| 33 1 * super?.method(); /// 13: compile-time error |
| 34 -super?.method(); /// 14: compile-time error |
| 35 ~super?.method(); /// 15: compile-time error |
| 36 !super?.method(); /// 16: compile-time error |
| 37 --super?.method(); /// 17: compile-time error |
| 38 ++super?.method(); /// 18: compile-time error |
| 39 } |
| 40 } |
| 41 |
| 42 main() { |
| 43 new C().test(); |
| 44 } |
OLD | NEW |