Skip to content

Commit 9080611

Browse files
authored
[ios]fix unused variable clang tidy warning (flutter#56637)
Spot another clang-tidy linter failure from: flutter/engine#56631 In release mode, if we remove NSAssert, then weakFlutterEngine is not used at all. This should have been an XCTAssert rather than NSAssert in the first place. ``` � Failures for clang-tidy on /Volumes/Work/s/w/ir/cache/builder/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm: /Volumes/Work/s/w/ir/cache/builder/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm:239:5: error: Value stored to 'weakFlutterEngine' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors] 239 | weakFlutterEngine = flutterEngine; | ^ ~~~~~~~~~~~~~ /Volumes/Work/s/w/ir/cache/builder/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm:239:5: note: Value stored to 'weakFlutterEngine' is never read 239 | weakFlutterEngine = flutterEngine; | ^ ~~~~~~~~~~~~~ Suppressed 9240 warnings (9111 in non-user code, 129 NOLINT). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. ``` *List which issues are fixed by this PR. You must list at least one issue.* flutter#157837 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent ca683bb commit 9080611

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ - (void)testNoDanglingEnginePointer {
237237
@autoreleasepool {
238238
FlutterEngine* flutterEngine = OCMClassMock([FlutterEngine class]);
239239
weakFlutterEngine = flutterEngine;
240-
NSAssert(weakFlutterEngine, @"flutter engine must not be nil");
240+
XCTAssertNotNil(weakFlutterEngine, @"flutter engine must not be nil");
241241
FlutterTextInputPlugin* flutterTextInputPlugin = [[FlutterTextInputPlugin alloc]
242242
initWithDelegate:(id<FlutterTextInputDelegate>)flutterEngine];
243243
weakFlutterTextInputPlugin = flutterTextInputPlugin;
@@ -254,8 +254,8 @@ - (void)testNoDanglingEnginePointer {
254254
currentView = flutterTextInputPlugin.activeView;
255255
}
256256

257-
NSAssert(!weakFlutterEngine, @"flutter engine must be nil");
258-
NSAssert(currentView, @"current view must not be nil");
257+
XCTAssertNil(weakFlutterEngine, @"flutter engine must be nil");
258+
XCTAssertNotNil(currentView, @"current view must not be nil");
259259

260260
XCTAssertNil(weakFlutterTextInputPlugin);
261261
// Verify that the view can no longer access the deallocated engine/text input plugin

0 commit comments

Comments
 (0)