facebook / facebook/hhvm

Typing[4361] An exception occurred while typechecking

Open
#8,714 1 comment 0 reactions 0 assignees View on GitHub
hack
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

**Describe the bug**

An exception occurred while typechecking

**Standalone code, or other way to reproduce the problem**

1. Create `Foo.hack` as :

```hack
namespace App;

interface IFoo {

}

final class Foos {
private vec $foos;
public function __construct(IFoo ...$foos = vec[]) {
$this->foos = vec($foos);
}
}
```

2. Create `Bar.hack` as :

```hack
namespace App;

final class Bar {
private ?Foos $foos = null;
}

```

3. Run `touch .hhconfig`
4. Run `hh_client restart`
5. Run `hh_client`

**Expected behavior**

```console
➜ hh_client
Parsing[1002] A variadic parameter ('...') must not have a default value.
--> Foo.hack
9 | public function __construct(IFoo ...$foos = vec[]) {
| ^^^^^^^^^^^^^^^^^^^^

1 error found.
```

**Actual behavior**

```console
➜ hh_client
Typing[4361] An exception occurred while typechecking this. Please file a bug.
--> Bar.hack
3 | final class Bar {
| ^^^^^^^^^^^^^^^^^

Parsing[1002] A variadic parameter ('...') must not have a default value.
--> Foo.hack
9 | public function __construct(IFoo ...$foos = vec[]) {
| ^^^^^^^^^^^^^^^^^^^^

2 errors found.
```

**Environment**
- Ubuntu 18.04
- apt-get with dl.hhvm.com repository

```console
➜ hh_client --version
hackc-f1be4ccd34a71c94959e53ce98357d79f9a86e04-4.57.0
➜ hhvm --version
HipHop VM 4.57.0 (rel)
Compiler: 1589215700_122020453
Repo schema: d1ae8e21bf3419a65f12a010527485564e719d07

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.