Skip to content

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.

3 participants