anz-bank / sysl

Sysl (pronounced "sizzle") is a system specification language
https://sysl.io
Apache License 2.0
122 stars 42 forks source link

fixes attribute scope issues in type #939

Closed nofun97 closed 4 years ago

nofun97 commented 4 years ago

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:

codecov[bot] commented 4 years ago

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%) :arrow_down:
pkg/parse/listener_impl.go 89.50% <61.53%> (+<0.01%) :arrow_up:
pkg/importer/importer.go 63.15% <63.15%> (ø)
pkg/mod/gomod.go 73.68% <66.66%> (+1.27%) :arrow_up:
pkg/parse/parse.go 83.47% <69.56%> (-0.50%) :arrow_down:
pkg/mod/module.go 66.66% <72.72%> (+0.95%) :arrow_up:
pkg/importer/formats.go 77.27% <77.27%> (ø)
pkg/importer/openapi.go 81.73% <80.71%> (-7.72%) :arrow_down:
pkg/importer/swagger.go 81.48% <88.88%> (+1.88%) :arrow_up:
pkg/importer/xsd.go 91.01% <95.23%> (+0.64%) :arrow_up:
... and 13 more