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

Fix various issues with object literals #1235

Merged
merged 5 commits into from
Apr 26, 2020
Merged

Fix various issues with object literals #1235

merged 5 commits into from
Apr 26, 2020

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Apr 21, 2020

This is a follow-up to #1229 that fixes various issues unrelated to that PR. In particular, classes instantiated from object literals cannot declare a constructor anymore since all kinds of stuff can go wrong with custom logic, with the most prominent one being that we don't know what fields the constructor sets (yet, there's PR for that), in the worst case overwriting those fields with nulls again. The upside is that we can rely on generated constructors for the time being, so field initializers of omitted fields can be applied, fixing the commented out test.

@dcodeIO dcodeIO merged commit e257567 into master Apr 26, 2020
@MaxGraey
Copy link
Member

Is it fix this #258 issue?

@dcodeIO
Copy link
Member Author

dcodeIO commented Apr 26, 2020

Unfortunately not. Instead if completely refuses to compile something from an object literal that has a declared constructor.

@dcodeIO
Copy link
Member Author

dcodeIO commented Apr 26, 2020

Appears that to tackle this issue we'll need #1155 so we can reenable support for constructors (see the issue mentioned in the opening comment), and then require constructor parameters to be implicitly declared fields (constructor(public someThing: i32) { ... }) to ensure parameter and field names never conflict.

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

Successfully merging this pull request may close these issues.

2 participants