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

Clarify that an extension type _can_ have instance variables which are external #3303

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Aug 23, 2023

The current rule about instance variable declarations in an extension type declaration is that every instance variable declaration is a compile-time error (we only allow the implicitly induced instance variable which is caused by the parameter declaration in the primary constructor which is now syntactically the <representationDeclaration>, because we don't yet have primary constructors).

However, it is not an error to declare an external getter and/or setter, and an external instance variable declaration is just a convenient notation for exactly that.

This PR just clarifies that an external instance variable is not an error.

Fixes #3301.

@eernstg
Copy link
Member Author

eernstg commented Aug 23, 2023

Thanks!

@eernstg eernstg merged commit af82971 into main Aug 23, 2023
3 checks passed
@eernstg eernstg deleted the specify_external_ok_in_extension_type_aug23 branch August 23, 2023 18:08
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.

[extension-types] Specify that it is not an error to declare an external variable
3 participants