Skip to content

Use type Bar\{Bar} treated differently to use type Bar\Bar #9335

Open
@muglug

Description

Describe the bug
We see an unexpected error in the code below. Replacing use type Bar\{Bar}; with use type Bar\Bar; is a workaround for this issue.

Standalone code, or other way to reproduce the problem

namespace Foo;
  
use namespace Bar;
use type Bar\{Bar};

final class FooBar extends Bar {
   const Bar\my_type CONFIG = shape('a' => 'b');
}

namespace Bar;

abstract class Bar {
  const my_type CONFIG = shape('a' => 'b');
}

type my_type = shape('a' => string);

Steps to reproduce the behavior:
Run hh_client on the above

Expected behavior

No errors

Actual behavior

File "/root/foo.hack", line 6, characters 28-30:
Some members in class `Foo\FooBar` are incompatible with those declared in type `Bar\Bar` (Typing[4348])
  File "/root/foo.hack", line 13, characters 9-15:
  Expected `shape('a' => string)`
  File "/root/foo.hack", line 7, characters 10-20:
  But got `Bar\Bar\my_type`

Environment
Docker nightly

HipHop VM 6.33.0-dev (rel) (non-lowptr)
Compiler: 1676345911_402707174
Repo schema: 960a4d092e2e8175b8f0a3b2caecffb7c980c672

Additional context

Narrowed down to this breaking diff: e71e870...21598ba

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions