Skip to content

defect: Candid formatting is dodgy #4946

Open
@crusso

Description

@crusso
  • no space before :
  • service types in arguments are formatted strangely

see test/mo-idl/ok/named.did.ok

service : {
  /// anon
  anon: (nat, nat) -> (nat); // no space before `:`
  /// escape candid keywords
  escape: ("int": int, "bool": bool, "service": service {  // <- weird break                                                                                
                                                }) -> ("int": int, "bool":
   bool, "service": service { // <- weird break
                    });
  /// function arg/ret
  f: (named: func (x: nat, y: nat) -> (r: nat)) -> (unamed:  // <- weird break
   func (nat, nat) -> (nat));
  /// actor arg/ret
  g: (A:
   service {
     anon: (nat, nat) -> (nat);
     named: (x: nat, y: nat) -> (r: nat);
   }) ->
   (service {
      anon: (x: nat, y: nat) -> (r: nat);
      named: (nat, nat) -> (nat);
    });
  /// named
  named: (x: nat, y: nat) -> (r: nat);
  /// record
  "record": (record {
               x: nat;
               y: nat;
             }) -> (record {r: nat;});
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3low priority, resolve when there is time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions