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

feat(compiler): Allow omitting field name in struct creation [LNG-261] #943

Merged
merged 11 commits into from
Oct 25, 2023

Conversation

InversionSpaces
Copy link
Contributor

@InversionSpaces InversionSpaces commented Oct 24, 2023

Description

Allow omitting field name in ability or data construction if it is the same as the passed variable for convenience:

field = 42
st = Struct(field) -- same as Struct(field = field)

Also the same for .copy method.

Implementation Details

  • Rewrite parsing to accept short arguments in .copy and constructors
  • Process parsing results on semantics stage accordingly

Checklist

  • Corresponding issue has been created and linked in PR title.
  • Proposed changes are covered by tests.
  • Documentation has been updated to reflect the changes (if applicable).
  • I have self-reviewed my code and ensured its quality.
  • I have added/updated necessary comments to aid understanding.

Reviewer Checklist

  • Tests have been reviewed and are sufficient to validate the changes.
  • Documentation has been reviewed and is up to date.
  • Any questions or concerns have been addressed.

@linear
Copy link

linear bot commented Oct 24, 2023

LNG-261 Allow omitting field name in struct creation

data Struct:
  integer: i8
  str: string

func main():
  str = "string"
  i = 42
  st = Struct(str, integer = i) -- not `str = str`

Also would be beneficial for abilities.

@InversionSpaces InversionSpaces added the e2e Run e2e workflow label Oct 24, 2023
@InversionSpaces
Copy link
Contributor Author

Task for docs: LNG-264

@InversionSpaces InversionSpaces marked this pull request as ready for review October 24, 2023 15:54
@InversionSpaces InversionSpaces enabled auto-merge (squash) October 24, 2023 15:54
@DieMyst DieMyst disabled auto-merge October 25, 2023 08:41
@DieMyst DieMyst enabled auto-merge (squash) October 25, 2023 08:44
@DieMyst DieMyst merged commit fcdb5b0 into main Oct 25, 2023
10 checks passed
@DieMyst DieMyst deleted the feat/omit-fields-LNG-261 branch October 25, 2023 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants