hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
373 stars 66 forks source link

Expect correct type from a conditional with nulls #116

Closed jbardin closed 5 years ago

jbardin commented 5 years ago

The type unification done when evaluating a conditional normally needs to return a DynamicPseudoType when either condition is dynamic. However, a null dynamic value represents a known value of the desired type rather than an unknown type, and we can be certain that it is convertible to the desired type during the final evaluation. Rather than unifying types against nulls, directly assign the needed conversion when evaluating the conditional.

codecov-io commented 5 years ago

Codecov Report

Merging #116 into master will increase coverage by 0.21%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #116      +/-   ##
==========================================
+ Coverage   68.76%   68.98%   +0.21%     
==========================================
  Files          98       98              
  Lines       10313    10323      +10     
==========================================
+ Hits         7092     7121      +29     
+ Misses       2895     2873      -22     
- Partials      326      329       +3
Impacted Files Coverage Δ
hcl/hclsyntax/expression.go 62.63% <100%> (+1.14%) :arrow_up:
hcl/hclsyntax/parser.go 67.33% <0%> (+0.96%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0b64543...d0f9032. Read the comment docs.