| // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| /// @assertion An instance field is promotable if all the following conditions |
| /// hold: |
| /// - It refers to a field (not a getter) |
| /// - The field is private |
| /// - The field is final |
| /// - There is no getter with the same name elsewhere in the library |
| /// - There is no non-final field with the same name elsewhere in the library |
| /// - There is no implicit noSuchMethod forwarder with the same name elsewhere |
| /// in the library. |
| /// |
| /// @description Checks that if there are other concrete instance getters with |
| /// the same name in the same library and they are not a final fields then the |
| /// field is not promotable. Test when the variable with the same name is not |
| /// final in some class in the same library |
| /// @author sgrekhov22@gmail.com |
| |
| library promotion_A03_t04_lib; |
| |
| class C { |
| int? _x = 43; |
| |
| void testC() { |
| print(_x); |
| } |
| } |