Skip to content

Pointer.fromFunction's exceptional return const detection doesn't work very well #57115

@liamappelbe

Description

@liamappelbe

A user reported some bugs with Pointer.fromFunction's exceptional return param: dart-lang/native#1724

There are a few different bugs here, but they're all to do with the const detection. The following all erroneously produce a "Exceptional return value must be a constant" error when passed to exceptional return:

  • Negative int literals. These should just work.
  • Simple enums values. These should also just work.
  • An enhanced enum. This should produce a type mismatch error, but is reported as the same constness error, so the user didn't know that they were supposed to pass dc_status_t.DC_STATUS_TIMEOUT.value.
  • The enhanced enum's .value field doesn't work anyway.

Metadata

Metadata

Assignees

Labels

area-native-interopUsed for native interop related issues, including FFI.closed-duplicateClosed in favor of an existing reportlibrary-ffitriage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions