Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate classes leads to compile errors #31

Closed
chrisgraham opened this issue Feb 22, 2010 · 3 comments
Closed

Duplicate classes leads to compile errors #31

chrisgraham opened this issue Feb 22, 2010 · 3 comments

Comments

@chrisgraham
Copy link

If you have duplicate classes, hphp numbers them in the .h files with suffixes like "$$1" and "$$2". However it seems (at least on my build environment - which is latest Kubuntu) that the include commands treat "$$" as "$" and can't find the files.

@scottmac
Copy link
Contributor

Can you provide a test script please.

@carsonmcdonald
Copy link
Contributor

I believe this is the same as issue #23 I opened. I included a test gist and a patch in that issue.

@scottmac
Copy link
Contributor

Yep that has a better test case.

hhvm-bot pushed a commit that referenced this issue Mar 15, 2018
…ble in the typing environment

Summary:
This is a followup to D7179617, which made the wrong assumption that a variable can never be bound to another variable in the typing environment, and as a consequence `Env.expand_type` can never return a `Tvar`.  The following example proved this assumption wrong:
```
<?hh // strict
// Copyright 2004-present Facebook. All Rights Reserved.

class C<T> {
  final public function __construct(
    private T $obj,
  ) {}

  final public function f<Tu>(): void where T = ?Tu {}
}

function test(bool $b, ?int $x): void {
  if ($b) {
    $y = null;
  } else {
    $y = $x;
  }
  hh_show($x);
  hh_show($y);
  $c = new C($y);
  hh_show($c);
  hh_log_level(2);
  $c->f();
  hh_log_level(0);
}
```
It was hitting `assert false` that I put in to preserve completeness of the pattern match:
```
File "hphp/hack/test/typecheck/meh_test.php", line 18, characters 3-13:
  ^(mixed)
File "hphp/hack/test/typecheck/meh_test.php", line 19, characters 3-13:
  ^(^mixed)
File "hphp/hack/test/typecheck/meh_test.php", line 21, characters 3-13:
  C as C<^(^mixed)>
File "hphp/hack/test/typecheck/meh_test.php", line 9, characters 49-51:
  Typing_subtype.sub_type_with_uenv uenv_sub.unwrappedToption=false uenv_super.unwrappedToption=false
    ty_sub: ?#39[unresolved]
    ty_super: #31(#27mixed)
File "hphp/hack/test/typecheck/meh_test.php", line 14, characters 10-13:
  Typing_subtype.sub_type_with_uenv uenv_sub.unwrappedToption=false uenv_super.unwrappedToption=false
    ty_sub: (#27#42mixed)
    ty_super: ?#39mixed
File "", line 0, characters 0--1:
  Typing_subtype.sub_type_with_uenv uenv_sub.unwrappedToption=false uenv_super.unwrappedToption=false
    ty_sub: #27#42mixed
    ty_super: ?#39mixed
Fatal error: exception File "/data/users/manzyuk/fbsource/fbcode/hphp/hack/src/typing/typing_subtype.ml", line 1109, characters 35-41: Assertion failed
```
As can be seen from the debugging info, we are getting a type `^^mixed` (i.e., a variable pointing to a variable pointing to `mixed`).  This is a result of unifying `^mixed` with another type: to unify a variable with a type, we unify the type the variable is bound to with the other type, create a new variable pointing to the unification, and add a binding from the old variable to the new one in the typing environment instead of the substitution map.  This diff changes that.

Reviewed By: andrewjkennedy

Differential Revision: D7287484

fbshipit-source-id: f4b21b0d14d90520d1e5b16d14890a1220d8b004
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants