[Typechecker] Missing typechecker error when redeclared properties in traits with stricter accessibility modifiers
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
### HHVM Version
```
HipHop VM 4.38.0-dev (rel)
Compiler: 1577504418_723705903
Repo schema: c0008085502abfa268d64b7193673709d52f0a0c
hackc-cc9cfe59f273bf16e25b5f524e7c7f044851ec5d-4.38.0-dev
```
### Operating System and Version
`Ubuntu 18.04`
### Standalone code, or other way to reproduce the problem
```HACK
class SailPrivateUseProtected {
use RedeclareSailProtected;
private null $sail; // << Typing[4113] This member visibility is: private
}
class SailPrivateUsePublic {
use RedeclareSailPublic;
private null $sail; // << Typing[4113] This member visibility is: private
}
class SailProtectedUsePrivate {
use RedeclareSailPrivate;
protected null $sail; // << Only fails at runtime
}
class SailProtectedUsePublic {
use RedeclareSailPublic;
protected null $sail; // << Typing[4113] This member visibility is: protected
}
class SailPublicUsePrivate {
use RedeclareSailPrivate;
public null $sail; // << Only fails at runtime
}
class SailPublicUsePublic {
use RedeclareSailProtected;
public null $sail; // << Only fails at runtime
}
trait RedeclareSailPrivate {
private null $sail;
}
trait RedeclareSailProtected {
protected null $sail;
}
trait RedeclareSailPublic {
public null $sail;
}
```
### Actual result
```
Typing[4113] This member visibility is: private
--> file.hack
3 | private null $sail; // << Typing[4113] This member visibility is: private
| ^^^^
32 | protected null $sail;
| ^^^^ protected was expected
Typing[4113] This member visibility is: private
--> file.hack
7 | private null $sail; // << Typing[4113] This member visibility is: private
| ^^^^
35 | public null $sail;
| ^^^^ public was expected
Typing[4113] This member visibility is: protected
--> file.hack
16 | protected null $sail; // << Typing[4113] This member visibility is: protected
| ^^^^
35 | public null $sail;
| ^^^^ public was expected
3 errors found.
```
### Expected result
All of these cases should generate an error, since they all fail at runtime with an error like:
```
Fatal error: Uncaught Error: trait declaration of property 'sail' is incompatible with previous declaration in file.hack:line
```
Contributor guide
Assessment
This issue has not been assessed yet.