JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Treat constraint builder as mutable reference #387

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 1 year ago

Relevant issues

Resolves #385 Resolves #375

Summary

Simplify logic by treating constraint builder as a mutable argument, without cloning it ever. Also make sure to not unnecessarily copy over Environment, preventing cross-contamination.

As a happy bonus, this refactor also fixed #375 .

JSAbrahams commented 1 year ago

Lets see if we can't uncommon some tests to see if we have unknowingly solved old bugs by simplifying logic.

codecov[bot] commented 1 year ago

Codecov Report

Merging #387 (575fa93) into develop (dfe3b63) will increase coverage by 0.02%. The diff coverage is 93.07%.

@@             Coverage Diff             @@
##           develop     #387      +/-   ##
===========================================
+ Coverage    87.07%   87.09%   +0.02%     
===========================================
  Files          109      109              
  Lines        12008    12005       -3     
===========================================
  Hits         10456    10456              
+ Misses        1552     1549       -3     
Impacted Files Coverage Δ
src/check/constrain/constraint/builder.rs 90.38% <0.00%> (-7.70%) :arrow_down:
src/check/constrain/generate/class.rs 89.13% <83.33%> (+1.63%) :arrow_up:
src/check/constrain/generate/operation.rs 91.66% <86.95%> (-0.12%) :arrow_down:
src/check/constrain/generate/statement.rs 84.09% <87.50%> (+1.86%) :arrow_up:
src/check/constrain/generate/control_flow.rs 92.38% <94.44%> (+0.87%) :arrow_up:
src/check/constrain/generate/call.rs 87.89% <94.87%> (-0.45%) :arrow_down:
src/check/constrain/generate/definition.rs 90.44% <94.87%> (-0.30%) :arrow_down:
src/check/constrain/generate/collection.rs 87.87% <100.00%> (ø)
src/check/constrain/generate/env.rs 92.70% <100.00%> (-0.30%) :arrow_down:
src/check/constrain/generate/expression.rs 94.44% <100.00%> (+0.15%) :arrow_up:
... and 10 more