Skip to content

[analyzer/ffi] Inline array const lengths #45507

@dcharkes

Description

@dcharkes

The following code is accepted by the dart runtime, but rejected by the analyzer.

const EIGHT = 8;

class Struct8BytesInlineArrayInt extends Struct {
  @Array(EIGHT)
  external Array<Uint8> a0;
}

The ffi_verifier expects an int or int list expression here. Instead, we should evaluate the annotation to a const, so that referenced consts are inlined.

@timsneath thanks for reporting.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.library-ffi

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions