Hhvm: hackfmt not idempotent (ternaries in particular)

Created on 19 Jun 2018  路  6Comments  路  Source: facebook/hhvm

HHVM Version

$ hhvm --version
HipHop VM 3.27.0-0brew (rel)
Compiler: 1529350887_N
Repo schema: 6122058a9b1474afa3b9c7a06f100aa97792abeb

$ hh_client --version
hh-78a76040626d13fb35827fd613bc1fcf222c3f88-3.27.0 Mon Jun 18 12:43:43 2018

Operating System and Version

MacOS Sierra

Standalone code, or other way to reproduce the problem

Run hackfmt on this source file,

<?hh // strict

class :foo {
  protected function render(): XHPChild {
    $frag->appendChild(
      <td>
        {$this->:isDiagramsList
          ? <img src={$set->getThumbnailPath()} />
          : $set->getRawDescription()}
      </td>,
    );
  }
}

Actual result

<?hh // strict

class :foo {
  protected function render(): XHPChild {
    $frag->appendChild(
      <td>
        {$this->:isDiagramsList
          ? <img src={$set->getThumbnailPath()} />

          : $set->getRawDescription()}
      </td>,
    );
  }
}

Notice the newline within the ternary. Run it again, and you get a second one. Then it stabilizes.

Expected result

Idempotence, that running hackfmt repeatedly does not change the result.

hack

Most helpful comment

This specific issue: 74762e0bfbfdf6c1268bf3d6312ade3f8553d95a

General idempotence (with testing) is a stack ending in 43989c61d7b78d81b02096be9849c020fc02a391

All 6 comments

FB references:

  • this issue: T29652799
  • general idempotence: T30658265

Looking at the issue numbers, it seems like this issue has been known for a while. And from that should I infer that it won't be fixed soon?

Is hackfmt used within Facebook? If so, perhaps this isn't a big deal in practice?

Looking at the issue numbers, it seems like this issue has been known for a while. And from that should I infer that it won't be fixed soon?

Sorry, I can't clarify, but that is not the case.

Ishackfmt used within Facebook?

Heavily used

If so, perhaps this isn't a big deal in practice?

We care :)

It looks like this was actually fixed in 3.28? I saw this bug in 3.27 but it doesn't repro anymore in 3.28 for me.

This specific issue: 74762e0bfbfdf6c1268bf3d6312ade3f8553d95a

General idempotence (with testing) is a stack ending in 43989c61d7b78d81b02096be9849c020fc02a391

And yes, those are all in 3.28

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ezzatron picture ezzatron  路  7Comments

caioiglesias picture caioiglesias  路  6Comments

ahmadazimi picture ahmadazimi  路  7Comments

mfurlend picture mfurlend  路  6Comments

Sakretsos picture Sakretsos  路  7Comments