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

Unpacking: do not require storage classes if type is specified. #78

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

tgehr
Copy link
Contributor

@tgehr tgehr commented Sep 24, 2024

As mojo pointed out in discord:

@tg I am just referencing the DIP idea post:

    Types can be declared explicitly, or inferred, independently for each variable:

(int a, (string b, auto c)) = t(1, t("2", 3.0f));


but in my tests:

auto foo() => t(1, 2);
(int a, int b) = foo(); 


test_01.d(21): Error: unpacked variables need at least one storage class, did you mean `auto a`?
test_01.d(21): Error: unpacked variables need at least one storage class, did you mean `auto b`?


This works:

( auto a, auto b) = foo;

This fixes that issue.

@adamdruppe adamdruppe merged commit 427d993 into opendlang:master Sep 24, 2024
3 checks passed
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