Giter Club home page Giter Club logo

Comments (12)

fredemmott avatar fredemmott commented on August 16, 2024 1

fwiw, if you're able to send a patch for facebook/hhvm#8098, I'll happily cherry pick it to 3.21 :)

from hhast.

fredemmott avatar fredemmott commented on August 16, 2024

Can you double-check what version you have? That doesn't look like v0.5:

from hhast.

bradleyhd avatar bradleyhd commented on August 16, 2024
bradley@slack:~/hhast$ hhvm composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 33 installs, 0 updates, 0 removals
  - Installing fredemmott/hack-error-suppressor (v1.0.1): Loading from cache
  - Installing facebook/definition-finder (v1.6.3): Loading from cache
  - Installing hhvm/hhvm-autoload (v1.5.3): Loading from cache
  - Installing hhvm/hsl (v1.0.0): Loading from cache
  - Installing facebook/hack-codegen (v3.0.0): Loading from cache
  - Installing hhvm/type-assert (v3.1.0): Loading from cache
  - Installing symfony/yaml (v3.3.10): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/recursion-context (2.0.0): Loading from cache
  - Installing sebastian/object-enumerator (2.0.1): Loading from cache
  - Installing sebastian/global-state (1.1.1): Loading from cache
  - Installing sebastian/exporter (2.0.0): Loading from cache
  - Installing sebastian/environment (2.0.0): Loading from cache
  - Installing sebastian/diff (1.4.3): Loading from cache
  - Installing sebastian/comparator (1.2.4): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing phpunit/phpunit-mock-objects (3.4.4): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.2): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-token-stream (1.4.11): Loading from cache
  - Installing phpunit/php-code-coverage (4.0.8): Loading from cache
  - Installing webmozart/assert (1.2.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.3.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (3.2.2): Loading from cache
  - Installing phpspec/prophecy (v1.7.2): Loading from cache
  - Installing myclabs/deep-copy (1.7.0): Loading from cache
  - Installing phpunit/phpunit (5.7.23): Loading from cache
  - Installing 91carriage/phpunit-hhi (5.7.1): Cloning 6864897f02 from cache
  - Installing facebook/fbexpect (v0.3): Loading from cache
symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
phpunit/phpunit suggests installing ext-xdebug (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
91carriage/phpunit-hhi suggests installing 91carriage/dbunit-hhi (HHI files for use with DbUnit)
Generating autoload files
bradley@slack:~/hhast$ hhvm bin/hhast-lint .

Warning: Destructor threw an object exception: exception 'HH\InvariantException' with message 'counter Facebook\HHAST\__Private\LinterCLI destroyed without calling ::end()' in /home/bradley/hhast/src/__Private/PerfCounter.php:51
Stack trace:
#0 /home/bradley/hhast/src/__Private/PerfCounter.php(51): HH\invariant_violation()
#1 /home/bradley/hhast/src/__Private/LinterCLI.php(155): Facebook\HHAST\__Private\PerfCounter->__destruct()
#2 /home/bradley/hhast/bin/hhast-lint(38): Facebook\HHAST\__Private\LinterCLI::mainAsync()
#3 {main} in /home/bradley/hhast/src/__Private/LinterCLI.php on line 155

Fatal error: Uncaught exception 'Exception' with message 'Invalid configuration file: /home/bradley/hhast/hhast-lint.json
  Expected type 'vec<T>', got type 'array'
Type trace:
#0 shape[roots]
' in /home/bradley/hhast/src/__Private/LinterCLIConfig.php:243
Stack trace:
#0 /home/bradley/hhast/src/__Private/LinterCLIConfig.php(97): Facebook\HHAST\__Private\LinterCLIConfig::getConfigFromFile()
#1 /home/bradley/hhast/src/__Private/LinterCLIConfig.php(98): Facebook\HHAST\__Private\LinterCLIConfig::getFromConfigFile$memoize_impl()
#2 /home/bradley/hhast/src/__Private/LinterCLIConfig.php(121): Facebook\HHAST\__Private\LinterCLIConfig::getFromConfigFile()
#3 /home/bradley/hhast/src/__Private/LinterCLIConfig.php(127): Facebook\HHAST\__Private\LinterCLIConfig::getForPathImpl$memoize_impl()
#4 /home/bradley/hhast/src/__Private/LinterCLIConfig.php(109): Facebook\HHAST\__Private\LinterCLIConfig::getForPathImpl()
#5 /home/bradley/hhast/src/__Private/LinterCLI.php(138): Facebook\HHAST\__Private\LinterCLIConfig::getForPath()
#6 /home/bradley/hhast/bin/hhast-lint(38): Facebook\HHAST\__Private\LinterCLI->mainAsync()
#7 {main}

agh yeah I must've done something wrong, thanks. but self-lint (or lint on our repo) still seem to have the vec/array type error

from hhast.

bradleyhd avatar bradleyhd commented on August 16, 2024

Not sure if it matters but the HHVM version is a custom build

HipHop VM 3.21.3 (rel)
Compiler: remotes/origin/3.21.3-slack-0-blahblahblahblah
Repo schema: 90ed4216b98563d0585cf5c87959dc9ff7c2e1a1

from hhast.

fredemmott avatar fredemmott commented on August 16, 2024
  • what's the JSON syntax for your roots? ideally full copy-paste of the file, or at least the 'roots' part
  • what does this get you in hhvm -m debug? =json_decode('{"roots": ["foo", "bar"]}', true, 512, JSON_FB_HACK_ARRAYS)

from hhast.

bradleyhd avatar bradleyhd commented on August 16, 2024
{
  "roots": [ "src/", "codegen/", "tests/" ],
  "builtinLinters": "all",
  "overrides": [
    {
      "patterns": [ "codegen/*" ],
      "disableAllAutoFixes": true
    }
  ]
}

and

hphpd> = json_decode('{"roots": ["foo", "bar"]}', true, 512, JSON_FB_HACK_ARRAYS);
= json_decode('{"roots": ["foo", "bar"]}', true, 512, JSON_FB_HACK_ARRAYS);
Array
(
    [roots] => Array
        (
            [0] => "foo"
            [1] => "bar"
        )

)

but you know what? as I'm typing this I think I remember we swapped out the JSON parser a year and a half or so ago because trailing comma support (😬) or something like that. I'll go check up on what exactly we've done, but if true could that be a part of the problem?

from hhast.

fredemmott avatar fredemmott commented on August 16, 2024
  • it looks like an HHVM bug (in all versions) that we don't support JSON_FB_HACK_ARRAYS if built with USE_JSONC
  • if you're using a custom JSON parser library, you need to add support for JSON_FB_HACK_ARRAYS

from hhast.

fredemmott avatar fredemmott commented on August 16, 2024

As an aside, assuming you're not setting using USE_JSONC, you can get trailing comma support with the standard implementation with the JSON_FB_LOOSE flag:

hphpd> = json_decode('{"roots": ["foo", "bar", ],}', true, 512, JSON_FB_HACK_ARRAYS | JSON_FB_LOOSE);
= json_decode('{"roots": ["foo", "bar", ],}', true, 512, JSON_FB_HACK_ARRAYS | JSON_FB_LOOSE);
Dict
(
    [roots] => Vec
        (
            [0] => "foo"
            [1] => "bar"
        )

)

from hhast.

bradleyhd avatar bradleyhd commented on August 16, 2024

found it: -DUSE_JSONC=ON 😢 . this is really good stuff to know, thank you for all the help!

from hhast.

fredemmott avatar fredemmott commented on August 16, 2024

facebook/hhvm@94f3323

from hhast.

fredemmott avatar fredemmott commented on August 16, 2024

Fix is in 3.21.6: https://hhvm.com/blog/2018/01/30/hhvm-3.24.1.html

from hhast.

bradleyhd avatar bradleyhd commented on August 16, 2024

🙇 can't thank you enough, we're rolling this out now

from hhast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.