From 8beb778e64644fda0e12f2013570cc7bdecd02d0 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Mon, 8 May 2023 15:16:05 +0000 Subject: [PATCH] [analyzer/ffi] Fix spurious FFI errors Closes: https://github.com/dart-lang/sdk/issues/52298 Change-Id: Ibfccd34a877d5786f4720790b5ff88dcc643c9d6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301980 Reviewed-by: Brian Wilkerson Commit-Queue: Daco Harkes --- .../lib/src/generated/ffi_verifier.dart | 1 + tests/ffi/regress_52298_test.dart | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/ffi/regress_52298_test.dart diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart index 1945d8a00c6..58adcc8c045 100644 --- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart +++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart @@ -156,6 +156,7 @@ class FfiVerifier extends RecursiveAstVisitor { } } super.visitClassDeclaration(node); + inCompound = false; } @override diff --git a/tests/ffi/regress_52298_test.dart b/tests/ffi/regress_52298_test.dart new file mode 100644 index 00000000000..cbdc9c66047 --- /dev/null +++ b/tests/ffi/regress_52298_test.dart @@ -0,0 +1,17 @@ +// Copyright (c) 2023, 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. + +import 'dart:ffi'; + +final class Foo extends Struct { + external Pointer field; +} + +mixin Bar { + late final field = 123; +} + +void main() { + print('something'); +}