Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Incorrect simplification with in operator involved #2406

Closed
sb98052 opened this issue Aug 9, 2018 · 1 comment
Closed

Incorrect simplification with in operator involved #2406

sb98052 opened this issue Aug 9, 2018 · 1 comment
Assignees

Comments

@sb98052
Copy link

sb98052 commented Aug 9, 2018

(function () {
  let n = __abstract({x:1}, "o");
  let s;

  if (n!==undefined) {
    s = 'foobar' in n;
  }

  global.s = s;
})();

prepacks to:

(function () {
  var _$0 = this;

  _$0.s = true;
}).call(this);
@sb98052
Copy link
Author

sb98052 commented Aug 9, 2018

This is fine. The way the object n is declared sets the values domain to a singleton with that object.

@sb98052 sb98052 closed this as completed Aug 9, 2018
facebook-github-bot pushed a commit that referenced this issue Sep 4, 2018
… unions (#2513)

Summary:
Release notes: Fixed bugs that could cause generated code to throw

A refactor of my previous attempt to address #2327, which I had to abandon because it was incompatible with the current implementation of certain modeling primitives. Like the previous version, this PR is an intermediate fix that will be refined in a follow up PR. It consists of three changes:

1) It adds a new helper that discharges values from a union after deriving the abstract value in it if needed.

2) It makes conditionally temporal values safe using a helper called `convertToTemporalIfArgsAreTemporal`.

3) It makes the the abstract and concrete members explicit in the interface to Abstract Concrete Unions. Presently, two code sites make the assumption that the abstract member is the first element of `args`, while all others traverse the list to locate it.

Follow ups to come:
1) Update `convertToTemporalIfArgsAreTemporal` to produce a conditional value left to be simplified by the serializer.
2) Enforce the protocol *temporal args should imply temporal results* more generally (#2489).

Fixes #2327 and #2406
Pull Request resolved: #2513

Differential Revision: D9636173

Pulled By: sb98052

fbshipit-source-id: 22d63dfb9d0da4b1f6eba4e2f6f88760f5eb03ca
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant