-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[analyzer/ffi] Support inline arrays in
Struct
s
This CL does not add inline arrays to `dart:ffi` yet, only to the mock SDK in the analyzer for testing the analyzer. This means we can review and land it separately. Closes: #44747 Bug: #35763 Change-Id: I7df6a61ea4cfa522afd12194dd2f3573eb79b3ef Cq-Include-Trybots: luci.dart.try:analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183684 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
- Loading branch information
Showing
8 changed files
with
270 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
pkg/analyzer/test/src/diagnostics/extra_size_annotation_carray_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2021, 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 'package:analyzer/src/dart/error/ffi_code.dart'; | ||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../dart/resolution/context_collection_resolution.dart'; | ||
|
||
main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(ExtraSizeAnnotationCArray); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class ExtraSizeAnnotationCArray extends PubPackageResolutionTest { | ||
test_one() async { | ||
await assertNoErrorsInCode(r''' | ||
import 'dart:ffi'; | ||
class C extends Struct { | ||
@CArraySize(8) | ||
CArray<Uint8> a0; | ||
} | ||
'''); | ||
} | ||
|
||
test_two() async { | ||
await assertErrorsInCode(r''' | ||
import 'dart:ffi'; | ||
class C extends Struct { | ||
@CArraySize(8) | ||
@CArraySize(8) | ||
CArray<Uint8> a0; | ||
} | ||
''', [ | ||
error(FfiCode.EXTRA_SIZE_ANNOTATION_CARRAY, 64, 14), | ||
]); | ||
} | ||
} |
Oops, something went wrong.