Skip to content

[pigeon] Swift generator cast for Object arguments generates warning #117994

Closed
flutter/packages
#3020

Description

@stuartmorgan-g

Making a Pigeon HostApi definition including:

  void setValue(String key, Object value);

generates code including:

  let valueArg = args[1] as! Any

This creates the following warning at compile time:

.../messages.g.swift:73:32: warning: forced cast from 'Any?' to 'Any' only unwraps optionals; did you mean to use '!'?
        let valueArg = args[1] as! Any

We should special-case Object so that it generates let valueArg = args[1]! instead.

Activity

  1. added
    platform-iosiOS applications specifically
    platform-macosBuilding on or for macOS specifically
    packageflutter/packages repository. See also p: labels.
    p: pigeonrelated to pigeon messaging codegen tool
    P2Important issues not at the top of the work list
    on Jan 4, 2023
  2. added a commit that references this issue on Jan 5, 2023
    394dd8d
  3. github-actions commented on Mar 4, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  4. locked as resolved and limited conversation to collaborators on Mar 4, 2023
  5. added a commit that references this issue on Jun 10, 2026
    6c472a4
  6. added a commit that references this issue on Jun 19, 2026
    ad0e065
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyplatform-macosBuilding on or for macOS specifically

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions