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

typeof s === "symbol" yields error 'unexpected predicate "symbol"' #712

Closed
jaredly opened this issue Aug 10, 2015 · 4 comments
Closed

typeof s === "symbol" yields error 'unexpected predicate "symbol"' #712

jaredly opened this issue Aug 10, 2015 · 4 comments
Labels

Comments

@jaredly
Copy link
Contributor

jaredly commented Aug 10, 2015

And it can't be suppressed either.

It totally breaks things, not just a normal error.

@samwgoldman
Copy link
Member

Issue is here. This code isn't actually unreachable, because the string inside the IsP/NotP can be provided by the user in a typeof check. We should output a normal flow error instead of asserting.

@jaredly
Copy link
Contributor Author

jaredly commented Aug 11, 2015

But it shouldn't error. An es6 symbol has typeof "symbol"
On Mon, Aug 10, 2015 at 4:55 PM Sam Goldman [email protected]
wrote:

Issue is here

assert_false (spf "Unexpected predicate %s" (string_of_predicate p))
.
This code isn't actually unreachable, because the string inside the IsP/
NotP can be provided by the user in a typeof check. We should output a
normal flow error instead of asserting.


Reply to this email directly or view it on GitHub
#712 (comment).

@samwgoldman
Copy link
Member

You're right. There are two issues here: 1) we assume code is unreachable when it isn't and 2) we should properly refine symbols.

mroch added a commit that referenced this issue Oct 30, 2015
Summary: `typeof x === "foo"` should show a warning and return false, not assert.

while I was there, I also got rid of `IsP <string>` in favor of a more explicit variant.

See #712

Reviewed By: bhosmer

Differential Revision: D2586915

fb-gh-sync-id: 5761e3202e9849838fef940131f95fb8139cc297
@mroch
Copy link
Contributor

mroch commented Oct 30, 2015

I fixed the exception in d45c099 and filed #1015 to make typeof x === "symbol" actually work. until then, you should be able to suppress the error now.

thanks, this was a bad one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants