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

fixed misc. scope issues #1834

Merged
merged 1 commit into from
Mar 12, 2021
Merged

fixed misc. scope issues #1834

merged 1 commit into from
Mar 12, 2021

Conversation

majastrz
Copy link
Member

@majastrz majastrz commented Mar 12, 2021

Fixed various issues with scopes and loop interactions with scopes. This fixes #1791 and #1823.

@majastrz majastrz force-pushed the majastrz/loopy-scopes branch from 7754ca5 to 08465b1 Compare March 12, 2021 06:38
return new ScopeData { RequestedScope = ResourceScope.Resource, ResourceScopeSymbol = targetResourceSymbol };
return new ScopeData { RequestedScope = ResourceScope.Resource, ResourceScopeSymbol = targetResourceSymbol, IndexExpression = indexExpression };

case { } when scopeSymbol is ModuleSymbol targetModuleSymbol:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearly my comment "type validation should have already caught this" was not accurate 😄

Maybe we should just always log an error if we don't match what we expect, even if it results in multiple error messages?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking something like:

if (scopeType is IScopeReference scopeReference)
{
    logInvalidScopeFunc(scopeProperty.Value, scopeReference.Scope, supportedScopes);
    return null;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm torn on this. In many other places, we tend to avoid adding too many errors inline with Anders' suggestion to avoid errors caused by other errors. On the other hand, this would prevent validation bugs in the future or at least reduce the chance.

@majastrz majastrz merged commit dd228db into main Mar 12, 2021
@majastrz majastrz deleted the majastrz/loopy-scopes branch March 12, 2021 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants