stencilproject / Stencil

Stencil is a simple and powerful template language for Swift.
https://stencil.fuller.li
BSD 2-Clause "Simplified" License
2.34k stars 223 forks source link

Fix creating float from int #181

Closed ilyapuchka closed 6 years ago

ilyapuchka commented 6 years ago

Currently all number literals are implicitly converted to Float, which can lead to unexpected output, i.e. "{{ value|default:0 }}" will output 0.0 where 0 is more likely expected. This fix first checks if literal is an Int and then returns it, otherwise it returns Float.