diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java index 91f850b3ec27a6..9405bd75e246ee 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java @@ -1647,7 +1647,9 @@ private static Expression findExpression(String helperHint, String hintPrefix, T static void processLoopElementHint(Match match, IndexView index, Expression expression, BuildProducer incorrectExpressions) { - if (match.isEmpty() || match.type().name().equals(DotNames.INTEGER)) { + if (match.isEmpty() + || match.type().name().equals(DotNames.INTEGER) + || match.type().equals(PrimitiveType.INT)) { return; } Type matchType = null; diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/loop/LoopTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/loop/LoopTest.java index 726ba98f226ddc..ca3ffa7eefe2c6 100644 --- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/loop/LoopTest.java +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/loop/LoopTest.java @@ -8,15 +8,27 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.qute.CheckedTemplate; import io.quarkus.qute.Template; +import io.quarkus.qute.TemplateInstance; import io.quarkus.test.QuarkusUnitTest; public class LoopTest { + static StringAsset template = new StringAsset("{#for i in total}{i}:{/for}"); + @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() - .withApplicationRoot((jar) -> jar - .addAsResource(new StringAsset("{#for i in total}{i}:{/for}"), "templates/loop1.html")); + .withApplicationRoot(root -> root + .addAsResource(template, "templates/loop1.html") + .addAsResource(template, "templates/LoopTest/loopInt.html")); + + @CheckedTemplate + static class Templates { + + static native TemplateInstance loopInt(int total); + + } @Inject Template loop1; @@ -24,6 +36,7 @@ public class LoopTest { @Test public void testIntegerIsIterable() { assertEquals("1:2:3:", loop1.data("total", 3).render()); + assertEquals("1:2:3:", Templates.loopInt(3).render()); } }