Skip to content

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

Closed
flutter/packages
#3020
@stuartmorgan-g

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.

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-macBuilding 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