| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Verify semantics of the ?. operator when it appears on the LHS of an | 5 // Verify semantics of the ?. operator when it appears on the LHS of an |
| 6 // assignment. | 6 // assignment. |
| 7 | 7 |
| 8 // SharedOptions=--enable-null-aware-operators | 8 // SharedOptions=--enable-null-aware-operators |
| 9 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // classes. | 80 // classes. |
| 81 Expect.throws(() => C?.staticField = null, noMethod); /// 14: static type warn
ing | 81 Expect.throws(() => C?.staticField = null, noMethod); /// 14: static type warn
ing |
| 82 Expect.throws(() => C?.staticField += null, noMethod); /// 15: static type war
ning | 82 Expect.throws(() => C?.staticField += null, noMethod); /// 15: static type war
ning |
| 83 Expect.throws(() => C?.staticField ??= null, noMethod); /// 16: static type wa
rning | 83 Expect.throws(() => C?.staticField ??= null, noMethod); /// 16: static type wa
rning |
| 84 Expect.throws(() => h.C?.staticField = null, noMethod); /// 17: static type wa
rning | 84 Expect.throws(() => h.C?.staticField = null, noMethod); /// 17: static type wa
rning |
| 85 Expect.throws(() => h.C?.staticField += null, noMethod); /// 18: static type w
arning | 85 Expect.throws(() => h.C?.staticField += null, noMethod); /// 18: static type w
arning |
| 86 Expect.throws(() => h.C?.staticField ??= null, noMethod); /// 19: static type
warning | 86 Expect.throws(() => h.C?.staticField ??= null, noMethod); /// 19: static type
warning |
| 87 | 87 |
| 88 // Nor can it be used to assign to toplevel properties in libraries imported | 88 // Nor can it be used to assign to toplevel properties in libraries imported |
| 89 // via prefix. | 89 // via prefix. |
| 90 Expect.throws(() => h?.topLevelVar = null, noMethod); /// 20: static type warn
ing | 90 h?.topLevelVar = null; /// 20: compile-time error |
| 91 Expect.throws(() => h?.topLevelVar += null, noMethod); /// 21: static type war
ning | 91 h?.topLevelVar += null; /// 21: compile-time error |
| 92 Expect.throws(() => h?.topLevelVar ??= null, noMethod); /// 22: static type wa
rning | 92 h?.topLevelVar ??= null; /// 22: compile-time error |
| 93 } | 93 } |
| OLD | NEW |