-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement tracked
members
#21761
base: main
Are you sure you want to change the base?
Implement tracked
members
#21761
Conversation
…behind a flag, reemove debugs and add some more tests
Move tracked inference logic to `inferredResultType`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR needs an update to the spec. I believe we should update docs/_docs/reference/experimenta/modularity.md
and also docs/_docs/internals/syntax.md
. With a spec we can better evaluate whether the implementation is correct.
internals/syntax.md
describes the syntax supported by the parser, including all language imports.
5ed44d1
to
8208d46
Compare
closes #21754
Allow for the
tracked
modifier to be used forval
members of classes and traits.tracked
members and members inheriting fromtracked
force the type of the member (or it's overriding member) to be as exact aspossible. More precisely, it will will assign the
tracked
member the infered type of the rhs. For instance, consider the following definition:Here, the
tracked
modifier ensures that the type ofa
inN
is22
and notInt
. But the type ofb
isN
isInt
since it's explicitly declared asInt
.tracked
members can also be immediately initialized, as in the case ofc
.