jet: Regression: Ranging over slice from Fast Function
I’ve observed a regression caused by https://github.com/CloudyKit/jet/commit/6d666f94dfe73004a23e8e41d7532ac8602c9132 (#112)
Summary
For this template:
{{sorted := SortApples(myApples)}}
{{range i, apple := sorted}}
{{i}}: {{apple.GetFlavor()}}
{{end}}
(Where SortApples
is a fast function aka jet.Func.)
Jet was able to range over the returned slice up until https://github.com/CloudyKit/jet/commit/6d666f94dfe73004a23e8e41d7532ac8602c9132 at which point the template execution would error with: there is no field or method "GetFlavor" in main.Apple
Example Project
https://github.com/tooolbox/jet-example has two branches:
- v2.1.2 (working)
- v2.1.3-6d666f94dfe7 (broken)
I understand we’re now going for a v3 with these commits, so breaking changes might be expected, but this seems like it would hurt fast functions a lot.
cc @sauerbraten
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
Yeah, everything you say makes sense. I’m not sure anymore what our issue was 🤔
I know that a colleague had a problem with comparisons inside a range not working properly before we did #112. I’m not sure anymore why exactly it happened, sadly.
Since we’re changing it back anyway, I don’t think it’s super important to recreate it.