Skip to content

[swift] mutating function for bool field has Byte argument, but not Bool #7372

@mr-swifter

Description

@mr-swifter

I have a simple table

table Event
{
    handled:bool=null;
}

when I compile with flatc protocol.fbs --swift --gen-mutable

  public var handled: Bool? { let o = _accessor.offset(VTOFFSET.handled.v); return o == 0 ? nil : 0 != _accessor.readBuffer(of: Byte.self, at: o) }
  @discardableResult public func mutate(handled: Byte) -> Bool {let o = _accessor.offset(VTOFFSET.handled.v);  return _accessor.mutate(handled, index: o) }

It's strange mutating function argument type is Byte, but not a Bool. Is there any special reason for this?

I manually modified autogenerated code and changed Byte to Bool and see no issue (at least it is not visible)

If it's an issue I would happy to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions