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

Symbols cannot be defined as a property #732

Closed
jasonwilliams opened this issue Sep 28, 2020 · 2 comments · Fixed by #770
Closed

Symbols cannot be defined as a property #732

jasonwilliams opened this issue Sep 28, 2020 · 2 comments · Fixed by #770
Assignees
Labels
bug Something isn't working E-Easy Easy good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com

Comments

@jasonwilliams
Copy link
Member

var obj = {};
var s = Symbol('1');
Object.defineProperty(obj, s);

Outputs: Uncaught "TypeError": "can't convert symbol to string"

The problem starts here:
https://github.com/boa-dev/boa/blob/master/boa/src/builtins/object/mod.rs#L101 we try to coarce the key into a string type. We shouldn't need to do this as Property's already support Symbols as keys. We should pass the argument straight through to PropertyKey::from() and let it sort it out.

PropertyKey is defined here:
https://github.com/boa-dev/boa/blob/master/boa/src/property/mod.rs#L290-L294

Contributing: https://github.com/boa-dev/boa/blob/master/CONTRIBUTING.md
Debugging: https://github.com/boa-dev/boa/blob/master/docs/debugging.md

@jasonwilliams jasonwilliams added bug Something isn't working good first issue Good for newcomers E-Easy Easy Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com labels Sep 28, 2020
@georgeroman
Copy link
Contributor

I can take this one.

@jasonwilliams
Copy link
Member Author

Thanks @georgeroman assigned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working E-Easy Easy good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants