hhvm / hhast

Mutable AST library for Hack with linting and code migrations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

disable_partially_abstract_typeconsts hhconfig option can not be set

lexidor opened this issue · comments

I am responsible for committing this error in the first place.
This error got past CI because we don't have this option enabled in our .hhconfig.
If this options is maybe going to become the default in some future release, I need to fix this.

Typing[4138] The assigned type of this type constant is inconsistent with its parent [1]
-> This shape type allows unknown fields, and so it may contain fields other than those explicitly declared in its declaration. [2]
-> It is incompatible with a shape that does not allow unknown fields. [3]

src/Linters/ConsistentLineEndingsLinter.hack:18:14
      16 |   extends AutoFixingLineLinter<LineLintError> {
      17 |   // Could become configurable later.
[1,3] 18 |   const type TConfig = shape('line ending' => LineEnding);
      19 | 
      20 |   private function getLineEnding(): LineEnding {

src/Linters/BaseLinter.hack:19:38
      17 | abstract class BaseLinter {
      18 |   <<__Reifiable>>
[2]   19 |   const type TConfig as shape(...) = shape(...);
      20 | 
      21 |   abstract public function getLintErrorsAsync(): Awaitable<vec<LintError>>;

It looks like it was added in 2019 and not touched since then, so I wouldn't expect it to change any time soon. I don't think it's necessary to preemptively fix HHAST or other projects, we can always do that if/when someone wants to change the default.

commented

That said, if you want to enable this option in some of your projects but the HHAST dependency is preventing you, I certainly wouldn't be opposed to fixing it here.

That said, if you want to enable this option in some of your projects but the HHAST dependency is preventing you, I certainly wouldn't be opposed to fixing it here.

If I knew what this setting did, I could make an informed decision. I don't understand the error it creates either. If others want to turn this feature on, please comment below.

It seems like this area is being explored again.
facebook/hhvm@e72c9ef

Thanks for publishing the HIP. I have given it a read, but I couldn't take it all in at once. I'll read this again tomorrow. (With a hh_client, hhvm, and pen and paper in hand 😄.)

This issue has been resolved. The type constant does not have a default value anymore.