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

fixes attribute scope issues in type #939

Merged
merged 1 commit into from
Jul 8, 2020
Merged

Conversation

nofun97
Copy link
Member

@nofun97 nofun97 commented Jul 8, 2020

Initially attributes in the higher scope replaces attributes that are in lower scope.
This shouldn't happen.

For example:

App:
    !type attr:
        @a = 1
        i <: string:
            @a = 2

The resulted sysl module would replace the a attribute under the
field i with the value 1 which is higher in the scope.

This commit ensures that if attr values in lower scopes can not
be replaced by values in the higher scope.

Checklist:

  • Added related tests
  • Made corresponding changes to the documentation

Initially higher attributes replaces attributes that are in lower scope.
This shouldn't happen.

For example:
```sysl
App:
    !type attr:
        @A = 1
        i <: string:
            @A = 2
```
The resulted sysl module would replace the `a` attribute under the
field `i` with the value 1 which is higher in the scope.

This commit ensures that if attr values in lower scopes can not
be replaced by values in the higher scope.
@nofun97 nofun97 requested a review from cuminandpaprika July 8, 2020 05:47
@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #939 into master will increase coverage by 0.67%.
The diff coverage is 83.83%.

@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
+ Coverage   83.35%   84.03%   +0.67%     
==========================================
  Files          73       74       +1     
  Lines       10609    10302     -307     
==========================================
- Hits         8843     8657     -186     
+ Misses       1432     1335      -97     
+ Partials      334      310      -24     
Impacted Files Coverage Δ
pkg/pbutil/output.go 76.00% <ø> (-0.48%) ⬇️
pkg/parse/listener_impl.go 89.50% <61.53%> (+<0.01%) ⬆️
pkg/importer/importer.go 63.15% <63.15%> (ø)
pkg/mod/gomod.go 73.68% <66.66%> (+1.27%) ⬆️
pkg/parse/parse.go 83.47% <69.56%> (-0.50%) ⬇️
pkg/mod/module.go 66.66% <72.72%> (+0.95%) ⬆️
pkg/importer/formats.go 77.27% <77.27%> (ø)
pkg/importer/openapi.go 81.73% <80.71%> (-7.72%) ⬇️
pkg/importer/swagger.go 81.48% <88.88%> (+1.88%) ⬆️
pkg/importer/xsd.go 91.01% <95.23%> (+0.64%) ⬆️
... and 13 more

Copy link
Contributor

@cuminandpaprika cuminandpaprika left a comment

Choose a reason for hiding this comment

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

LGTM, we might want to document the scope overwriting behaviour, since I had no idea Sysl did that at all?

@nofun97 nofun97 merged commit 5b55656 into anz-bank:master Jul 8, 2020
@nofun97 nofun97 deleted the attr-scope branch July 8, 2020 05:56
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